drm/nouveau/fault/gv100: fix fault buffer initialisation
authorBen Skeggs <bskeggs@redhat.com>
Wed, 13 Jun 2018 05:33:16 +0000 (15:33 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 16 Jul 2018 08:06:28 +0000 (18:06 +1000)
Not sure how this happened, it worked last time I tested it!

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/fault/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/fault/gv100.c
drivers/gpu/drm/nouveau/nvkm/subdev/fault/priv.h

index 007bf4af33b9935979c481af36449be504faf26a..16ad91c91a7beca11a8febfbb91a54f3b34ac008 100644 (file)
@@ -133,8 +133,14 @@ nvkm_fault_oneinit(struct nvkm_subdev *subdev)
                }
        }
 
-       return nvkm_event_init(&nvkm_fault_ntfy, 1, fault->buffer_nr,
-                              &fault->event);
+       ret = nvkm_event_init(&nvkm_fault_ntfy, 1, fault->buffer_nr,
+                             &fault->event);
+       if (ret)
+               return ret;
+
+       if (fault->func->oneinit)
+               ret = fault->func->oneinit(fault);
+       return ret;
 }
 
 static void *
index 73c7728b5969670a2ef5a79f71a6540403a2383a..3cd610d7deb5268f1e73fcebbd4e49aa50519cfc 100644 (file)
@@ -176,8 +176,17 @@ gv100_fault_init(struct nvkm_fault *fault)
        nvkm_notify_get(&fault->nrpfb);
 }
 
+static int
+gv100_fault_oneinit(struct nvkm_fault *fault)
+{
+       return nvkm_notify_init(&fault->buffer[0]->object, &fault->event,
+                               gv100_fault_ntfy_nrpfb, false, NULL, 0, 0,
+                               &fault->nrpfb);
+}
+
 static const struct nvkm_fault_func
 gv100_fault = {
+       .oneinit = gv100_fault_oneinit,
        .init = gv100_fault_init,
        .fini = gv100_fault_fini,
        .intr = gv100_fault_intr,
@@ -192,15 +201,5 @@ int
 gv100_fault_new(struct nvkm_device *device, int index,
                struct nvkm_fault **pfault)
 {
-       struct nvkm_fault *fault;
-       int ret;
-
-       ret = nvkm_fault_new_(&gv100_fault, device, index, &fault);
-       *pfault = fault;
-       if (ret)
-               return ret;
-
-       return nvkm_notify_init(&fault->buffer[0]->object, &fault->event,
-                               gv100_fault_ntfy_nrpfb, false, NULL, 0, 0,
-                               &fault->nrpfb);
+       return nvkm_fault_new_(&gv100_fault, device, index, pfault);
 }
index 44843ecf12b07ca5df7b43442ccfd1038dfbd0fe..e4d2f5234fd19be82125e7266bf89e3db1e4f563 100644 (file)
@@ -20,6 +20,7 @@ int nvkm_fault_new_(const struct nvkm_fault_func *, struct nvkm_device *,
                    int index, struct nvkm_fault **);
 
 struct nvkm_fault_func {
+       int (*oneinit)(struct nvkm_fault *);
        void (*init)(struct nvkm_fault *);
        void (*fini)(struct nvkm_fault *);
        void (*intr)(struct nvkm_fault *);