drm/nouveau/mc: use split type+inst in interrupt masking API
authorBen Skeggs <bskeggs@redhat.com>
Sat, 6 Feb 2021 00:47:48 +0000 (10:47 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 11 Feb 2021 01:49:54 +0000 (11:49 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/subdev/mc.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/top.h
drivers/gpu/drm/nouveau/nvkm/subdev/acr/gm200.c
drivers/gpu/drm/nouveau/nvkm/subdev/fault/gp100.c
drivers/gpu/drm/nouveau/nvkm/subdev/fault/tu102.c
drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/top/base.c

index 88970a7..cb86a56 100644 (file)
@@ -15,7 +15,7 @@ void nvkm_mc_reset(struct nvkm_device *, enum nvkm_subdev_type, int);
 void nvkm_mc_intr(struct nvkm_device *, bool *handled);
 void nvkm_mc_intr_unarm(struct nvkm_device *);
 void nvkm_mc_intr_rearm(struct nvkm_device *);
-void nvkm_mc_intr_mask(struct nvkm_device *, enum nvkm_devidx, bool enable);
+void nvkm_mc_intr_mask(struct nvkm_device *, enum nvkm_subdev_type, int, bool enable);
 void nvkm_mc_unk260(struct nvkm_device *, u32 data);
 
 int nv04_mc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_mc **);
index f94cb24..efab50f 100644 (file)
@@ -25,7 +25,7 @@ struct nvkm_top_device {
 u32 nvkm_top_addr(struct nvkm_device *, enum nvkm_devidx);
 u32 nvkm_top_reset(struct nvkm_device *, enum nvkm_subdev_type, int);
 u32 nvkm_top_intr(struct nvkm_device *, u32 intr, u64 *subdevs);
-u32 nvkm_top_intr_mask(struct nvkm_device *, enum nvkm_devidx);
+u32 nvkm_top_intr_mask(struct nvkm_device *, enum nvkm_subdev_type, int);
 int nvkm_top_fault_id(struct nvkm_device *, enum nvkm_devidx);
 enum nvkm_devidx nvkm_top_fault(struct nvkm_device *, int fault);
 enum nvkm_devidx nvkm_top_engine(struct nvkm_device *, int, int *runl, int *engn);
index 8bff384..cdb1ead 100644 (file)
@@ -262,7 +262,7 @@ gm200_acr_hsfw_boot(struct nvkm_acr *acr, struct nvkm_acr_hsf *hsf,
        hsf->func->bld(acr, hsf);
 
        /* Boot the falcon. */
-       nvkm_mc_intr_mask(device, falcon->owner->index, false);
+       nvkm_mc_intr_mask(device, falcon->owner->type, falcon->owner->inst, false);
 
        nvkm_falcon_wr32(falcon, 0x040, 0xdeada5a5);
        nvkm_falcon_set_start_addr(falcon, hsf->imem_tag << 8);
@@ -279,7 +279,7 @@ gm200_acr_hsfw_boot(struct nvkm_acr *acr, struct nvkm_acr_hsf *hsf,
                return -EIO;
 
        nvkm_falcon_clear_interrupt(falcon, intr_clear);
-       nvkm_mc_intr_mask(device, falcon->owner->index, true);
+       nvkm_mc_intr_mask(device, falcon->owner->type, falcon->owner->inst, true);
        return ret;
 }
 
index 20e2717..6af7959 100644 (file)
@@ -30,7 +30,7 @@ void
 gp100_fault_buffer_intr(struct nvkm_fault_buffer *buffer, bool enable)
 {
        struct nvkm_device *device = buffer->fault->subdev.device;
-       nvkm_mc_intr_mask(device, NVKM_SUBDEV_FAULT, enable);
+       nvkm_mc_intr_mask(device, NVKM_SUBDEV_FAULT, 0, enable);
 }
 
 void
index 437cf32..91eb672 100644 (file)
@@ -37,7 +37,7 @@ tu102_fault_buffer_intr(struct nvkm_fault_buffer *buffer, bool enable)
         */
        struct nvkm_device *device = buffer->fault->subdev.device;
 
-       nvkm_mc_intr_mask(device, NVKM_SUBDEV_FAULT, enable);
+       nvkm_mc_intr_mask(device, NVKM_SUBDEV_FAULT, 0, enable);
 }
 
 static void
index 7bd92d0..92a6d23 100644 (file)
@@ -35,14 +35,14 @@ nvkm_mc_unk260(struct nvkm_device *device, u32 data)
 }
 
 void
-nvkm_mc_intr_mask(struct nvkm_device *device, enum nvkm_devidx devidx, bool en)
+nvkm_mc_intr_mask(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, bool en)
 {
        struct nvkm_mc *mc = device->mc;
        const struct nvkm_mc_map *map;
        if (likely(mc) && mc->func->intr_mask) {
-               u32 mask = nvkm_top_intr_mask(device, devidx);
+               u32 mask = nvkm_top_intr_mask(device, type, inst);
                for (map = mc->func->intr; !mask && map->stat; map++) {
-                       if (map->type + map->inst == devidx)
+                       if (map->type == type && map->inst == inst)
                                mask = map->stat;
                }
                mc->func->intr_mask(mc, mask, en ? mask : 0);
index 1e556e8..3c80a41 100644 (file)
@@ -75,14 +75,14 @@ nvkm_top_reset(struct nvkm_device *device, enum nvkm_subdev_type type, int inst)
 }
 
 u32
-nvkm_top_intr_mask(struct nvkm_device *device, enum nvkm_devidx devidx)
+nvkm_top_intr_mask(struct nvkm_device *device, enum nvkm_subdev_type type, int inst)
 {
        struct nvkm_top *top = device->top;
        struct nvkm_top_device *info;
 
        if (top) {
                list_for_each_entry(info, &top->device, head) {
-                       if (info->index == devidx && info->intr >= 0)
+                       if (info->type == type && info->inst == inst && info->intr >= 0)
                                return BIT(info->intr);
                }
        }