]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/nouveau/bar/tu102-: prepare for GSP-RM
authorBen Skeggs <bskeggs@redhat.com>
Mon, 18 Sep 2023 20:21:11 +0000 (06:21 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 31 Oct 2023 05:08:10 +0000 (15:08 +1000)
- (temporarily) disable if GSP-RM detected, will be added later
- move BAR2 teardown from dtor(), it doesn't belong there

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230918202149.4343-7-skeggsb@gmail.com
drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/bar/tu102.c

index d017a1b5e5dd55f23ce0ef7d752727b07ac86ab1..91bc53be97ffc228c243e675c039b8c53bdb8aab 100644 (file)
@@ -93,8 +93,16 @@ static int
 nvkm_bar_fini(struct nvkm_subdev *subdev, bool suspend)
 {
        struct nvkm_bar *bar = nvkm_bar(subdev);
+
+       if (!subdev->use.enabled)
+               return 0;
+
        if (bar->func->bar1.fini)
                bar->func->bar1.fini(bar);
+
+       if (!suspend) /* Handled by instmem. */
+               nvkm_bar_bar2_fini(subdev->device);
+
        return 0;
 }
 
@@ -120,7 +128,7 @@ static void *
 nvkm_bar_dtor(struct nvkm_subdev *subdev)
 {
        struct nvkm_bar *bar = nvkm_bar(subdev);
-       nvkm_bar_bar2_fini(subdev->device);
+
        return bar->func->dtor(bar);
 }
 
index c25ab407b85d9182ff26ba361ac23dadde8b87a0..8041bb632835116b36afec6ded1120362370a784 100644 (file)
@@ -22,6 +22,7 @@
 #include "gf100.h"
 
 #include <core/memory.h>
+#include <subdev/gsp.h>
 #include <subdev/timer.h>
 
 static void
@@ -95,5 +96,8 @@ int
 tu102_bar_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
              struct nvkm_bar **pbar)
 {
+       if (nvkm_gsp_rm(device->gsp))
+               return -ENODEV;
+
        return gf100_bar_new_(&tu102_bar, device, type, inst, pbar);
 }