]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/nouveau/mc: use split type+inst when handling dev_top interrupts
authorBen Skeggs <bskeggs@redhat.com>
Sat, 6 Feb 2021 00:54:34 +0000 (10:54 +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/top.h
drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/top/base.c

index efab50f75ee2216d29d75512599ba79e359cc3fc..74314d255a52e69640723f21e568be0607423504 100644 (file)
@@ -24,7 +24,6 @@ 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_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);
index 92a6d23c6ae647de74fff49317eadae533c134e3..21c4af3f81d5fc7a4fe3a2c4512b3d57e5bc8cc2 100644 (file)
@@ -78,22 +78,29 @@ void
 nvkm_mc_intr(struct nvkm_device *device, bool *handled)
 {
        struct nvkm_mc *mc = device->mc;
+       struct nvkm_top *top = device->top;
+       struct nvkm_top_device *tdev;
        struct nvkm_subdev *subdev;
        const struct nvkm_mc_map *map;
        u32 stat, intr;
-       u64 subdevs;
 
        if (unlikely(!mc))
                return;
 
-       intr = nvkm_mc_intr_stat(mc);
-       stat = nvkm_top_intr(device, intr, &subdevs);
-       while (subdevs) {
-               enum nvkm_devidx subidx = __ffs64(subdevs);
-               subdev = nvkm_device_subdev(device, subidx, 0);
-               if (subdev)
-                       nvkm_subdev_intr(subdev);
-               subdevs &= ~BIT_ULL(subidx);
+       stat = intr = nvkm_mc_intr_stat(mc);
+
+       if (top) {
+               list_for_each_entry(tdev, &top->device, head) {
+                       if (tdev->intr >= 0 && (stat & BIT(tdev->intr))) {
+                               subdev = nvkm_device_subdev(device, tdev->type, tdev->inst);
+                               if (subdev) {
+                                       nvkm_subdev_intr(subdev);
+                                       stat &= ~BIT(tdev->intr);
+                                       if (!stat)
+                                               break;
+                               }
+                       }
+               }
        }
 
        for (map = mc->func->intr; map->stat; map++) {
index 3c80a41f3ff6c00eaa20a7ea45bb998b2cccfeba..1eda904367b8dabf56bc642b016ac1757411dc59 100644 (file)
@@ -90,29 +90,6 @@ nvkm_top_intr_mask(struct nvkm_device *device, enum nvkm_subdev_type type, int i
        return 0;
 }
 
-u32
-nvkm_top_intr(struct nvkm_device *device, u32 intr, u64 *psubdevs)
-{
-       struct nvkm_top *top = device->top;
-       struct nvkm_top_device *info;
-       u64 subdevs = 0;
-       u32 handled = 0;
-
-       if (top) {
-               list_for_each_entry(info, &top->device, head) {
-                       if (info->index != NVKM_SUBDEV_NR && info->intr >= 0) {
-                               if (intr & BIT(info->intr)) {
-                                       subdevs |= BIT_ULL(info->index);
-                                       handled |= BIT(info->intr);
-                               }
-                       }
-               }
-       }
-
-       *psubdevs = subdevs;
-       return intr & ~handled;
-}
-
 int
 nvkm_top_fault_id(struct nvkm_device *device, enum nvkm_devidx devidx)
 {