drm/nouveau/ce: make use of nvkm_subdev.inst
authorBen Skeggs <bskeggs@redhat.com>
Wed, 3 Feb 2021 22:29:43 +0000 (08:29 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 11 Feb 2021 01:49:56 +0000 (11:49 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c
drivers/gpu/drm/nouveau/nvkm/engine/ce/gk104.c
drivers/gpu/drm/nouveau/nvkm/engine/ce/gp100.c
drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c

index 847b787dbc31a09548b36834c4b2c5f18d77c441..b9cc3956598570fe89db1c416ed06ec1cfb98c6e 100644 (file)
@@ -29,9 +29,7 @@
 static void
 gf100_ce_init(struct nvkm_falcon *ce)
 {
-       struct nvkm_device *device = ce->engine.subdev.device;
-       const int index = ce->engine.subdev.index - NVKM_ENGINE_CE0;
-       nvkm_wr32(device, ce->addr + 0x084, index);
+       nvkm_wr32(ce->engine.subdev.device, ce->addr + 0x084, ce->engine.subdev.inst);
 }
 
 static const struct nvkm_falcon_func
index 55075f3d80ccafaaf19a8b036043d4c5a6a2009d..27f29eb0494da1212add0523ef51128ce8a5e0a3 100644 (file)
@@ -58,9 +58,9 @@ gk104_ce_intr_launcherr(struct nvkm_engine *ce, const u32 base)
 void
 gk104_ce_intr(struct nvkm_engine *ce)
 {
-       const u32 base = (ce->subdev.index - NVKM_ENGINE_CE0) * 0x1000;
        struct nvkm_subdev *subdev = &ce->subdev;
        struct nvkm_device *device = subdev->device;
+       const u32 base = subdev->inst * 0x1000;
        u32 mask = nvkm_rd32(device, 0x104904 + base);
        u32 intr = nvkm_rd32(device, 0x104908 + base) & mask;
        if (intr & 0x00000001) {
index 24130198fa62dfba76d57e37ffaff7c772ee9643..a4f08a4472c900a942ec59722020ee4c8421e2a7 100644 (file)
@@ -59,9 +59,9 @@ gp100_ce_intr_launcherr(struct nvkm_engine *ce, const u32 base)
 void
 gp100_ce_intr(struct nvkm_engine *ce)
 {
-       const u32 base = (ce->subdev.index - NVKM_ENGINE_CE0) * 0x80;
        struct nvkm_subdev *subdev = &ce->subdev;
        struct nvkm_device *device = subdev->device;
+       const u32 base = subdev->inst * 0x80;
        u32 mask = nvkm_rd32(device, 0x10440c + base);
        u32 intr = nvkm_rd32(device, 0x104410 + base) & mask;
        if (intr & 0x00000001) { //XXX: guess
index 20df04ba7f09ca36b5f17b7d41461023858fdc21..704df0f2d1f16c39fc5cbe897b80ffdc76fe3461 100644 (file)
@@ -44,7 +44,7 @@ gt215_ce_intr(struct nvkm_falcon *ce, struct nvkm_fifo_chan *chan)
 {
        struct nvkm_subdev *subdev = &ce->engine.subdev;
        struct nvkm_device *device = subdev->device;
-       const u32 base = (subdev->index - NVKM_ENGINE_CE0) * 0x1000;
+       const u32 base = subdev->inst * 0x1000;
        u32 ssta = nvkm_rd32(device, 0x104040 + base) & 0x0000ffff;
        u32 addr = nvkm_rd32(device, 0x104040 + base) >> 16;
        u32 mthd = (addr & 0x07ff) << 2;