drm/nouveau/fifo: perform reset from preinit
authorBen Skeggs <bskeggs@redhat.com>
Tue, 31 Oct 2017 17:56:19 +0000 (03:56 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 2 Nov 2017 03:32:17 +0000 (13:32 +1000)
RM appears to do this really early in its initialisation, before DEVINIT.

We currently do this before BAR2 initialisation for some reason.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/core/engine.h
drivers/gpu/drm/nouveau/nvkm/core/engine.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c

index d4cd2fbfde885eb0797b95bf9b725c470bde8094..7730499bfd958aed0e993f0a0e0c9fcdab639566 100644 (file)
@@ -15,6 +15,7 @@ struct nvkm_engine {
 
 struct nvkm_engine_func {
        void *(*dtor)(struct nvkm_engine *);
+       void (*preinit)(struct nvkm_engine *);
        int (*oneinit)(struct nvkm_engine *);
        int (*init)(struct nvkm_engine *);
        int (*fini)(struct nvkm_engine *, bool suspend);
index b6c916954a1076aca6d5fcf5b31f0a83b2540ec5..657231c3c098a667eecddac29146ced58feea7c7 100644 (file)
@@ -126,6 +126,15 @@ nvkm_engine_init(struct nvkm_subdev *subdev)
        return ret;
 }
 
+static int
+nvkm_engine_preinit(struct nvkm_subdev *subdev)
+{
+       struct nvkm_engine *engine = nvkm_engine(subdev);
+       if (engine->func->preinit)
+               engine->func->preinit(engine);
+       return 0;
+}
+
 static void *
 nvkm_engine_dtor(struct nvkm_subdev *subdev)
 {
@@ -138,6 +147,7 @@ nvkm_engine_dtor(struct nvkm_subdev *subdev)
 static const struct nvkm_subdev_func
 nvkm_engine_func = {
        .dtor = nvkm_engine_dtor,
+       .preinit = nvkm_engine_preinit,
        .init = nvkm_engine_init,
        .fini = nvkm_engine_fini,
        .intr = nvkm_engine_intr,
index 660ca7aa95ea397fc7b8770ed584c76a7c7d71d5..64f6b7654a08dc6f525c87f049ebcc7a991136ed 100644 (file)
@@ -27,6 +27,7 @@
 #include <core/client.h>
 #include <core/gpuobj.h>
 #include <core/notify.h>
+#include <subdev/mc.h>
 
 #include <nvif/event.h>
 #include <nvif/unpack.h>
@@ -278,6 +279,12 @@ nvkm_fifo_oneinit(struct nvkm_engine *engine)
        return 0;
 }
 
+static void
+nvkm_fifo_preinit(struct nvkm_engine *engine)
+{
+       nvkm_mc_reset(engine->subdev.device, NVKM_ENGINE_FIFO);
+}
+
 static int
 nvkm_fifo_init(struct nvkm_engine *engine)
 {
@@ -302,6 +309,7 @@ nvkm_fifo_dtor(struct nvkm_engine *engine)
 static const struct nvkm_engine_func
 nvkm_fifo = {
        .dtor = nvkm_fifo_dtor,
+       .preinit = nvkm_fifo_preinit,
        .oneinit = nvkm_fifo_oneinit,
        .init = nvkm_fifo_init,
        .fini = nvkm_fifo_fini,