drm/nouveau/mc: lookup subdev interrupt handlers with split type+inst
authorBen Skeggs <bskeggs@redhat.com>
Thu, 4 Feb 2021 07:59:28 +0000 (17:59 +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/nvkm/subdev/mc/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/mc/gf100.c
drivers/gpu/drm/nouveau/nvkm/subdev/mc/gk104.c
drivers/gpu/drm/nouveau/nvkm/subdev/mc/gt215.c
drivers/gpu/drm/nouveau/nvkm/subdev/mc/priv.h

index a1fcb81..a9e7d09 100644 (file)
@@ -42,7 +42,7 @@ nvkm_mc_intr_mask(struct nvkm_device *device, enum nvkm_devidx devidx, bool en)
        if (likely(mc) && mc->func->intr_mask) {
                u32 mask = nvkm_top_intr_mask(device, devidx);
                for (map = mc->func->intr; !mask && map->stat; map++) {
-                       if (map->unit == devidx)
+                       if (map->type + map->inst == devidx)
                                mask = map->stat;
                }
                mc->func->intr_mask(mc, mask, en ? mask : 0);
@@ -98,7 +98,7 @@ nvkm_mc_intr(struct nvkm_device *device, bool *handled)
 
        for (map = mc->func->intr; map->stat; map++) {
                if (intr & map->stat) {
-                       subdev = nvkm_device_subdev(device, map->unit, 0);
+                       subdev = nvkm_device_subdev(device, map->type, map->inst);
                        if (subdev)
                                nvkm_subdev_intr(subdev);
                        stat &= ~map->stat;
@@ -121,7 +121,7 @@ nvkm_mc_reset_mask(struct nvkm_device *device, bool isauto,
                if (!(pmc_enable = nvkm_top_reset(device, devidx))) {
                        for (map = mc->func->reset; map && map->stat; map++) {
                                if (!isauto || !map->noauto) {
-                                       if (map->unit == devidx) {
+                                       if (map->type + map->inst == devidx) {
                                                pmc_enable = map->stat;
                                                break;
                                        }
index 7e7b163..9e27356 100644 (file)
@@ -27,11 +27,11 @@ static const struct nvkm_mc_map
 gf100_mc_reset[] = {
        { 0x00020000, NVKM_ENGINE_MSPDEC },
        { 0x00008000, NVKM_ENGINE_MSVLD },
-       { 0x00002000, NVKM_SUBDEV_PMU, true },
+       { 0x00002000, NVKM_SUBDEV_PMU, 0, true },
        { 0x00001000, NVKM_ENGINE_GR },
        { 0x00000100, NVKM_ENGINE_FIFO },
-       { 0x00000080, NVKM_ENGINE_CE1 },
-       { 0x00000040, NVKM_ENGINE_CE0 },
+       { 0x00000080, NVKM_ENGINE_CE1 },
+       { 0x00000040, NVKM_ENGINE_CE0 },
        { 0x00000002, NVKM_ENGINE_MSPPP },
        {}
 };
@@ -43,8 +43,8 @@ gf100_mc_intr[] = {
        { 0x00008000, NVKM_ENGINE_MSVLD },
        { 0x00001000, NVKM_ENGINE_GR },
        { 0x00000100, NVKM_ENGINE_FIFO },
-       { 0x00000040, NVKM_ENGINE_CE1 },
-       { 0x00000020, NVKM_ENGINE_CE0 },
+       { 0x00000040, NVKM_ENGINE_CE1 },
+       { 0x00000020, NVKM_ENGINE_CE0 },
        { 0x00000001, NVKM_ENGINE_MSPPP },
        { 0x40000000, NVKM_SUBDEV_IBUS },
        { 0x10000000, NVKM_SUBDEV_BUS },
index 69634fd..afe0d1d 100644 (file)
@@ -26,7 +26,7 @@
 const struct nvkm_mc_map
 gk104_mc_reset[] = {
        { 0x00000100, NVKM_ENGINE_FIFO },
-       { 0x00002000, NVKM_SUBDEV_PMU, true },
+       { 0x00002000, NVKM_SUBDEV_PMU, 0, true },
        {}
 };
 
index 6c40aa4..1b4d435 100644 (file)
@@ -27,7 +27,7 @@ static const struct nvkm_mc_map
 gt215_mc_reset[] = {
        { 0x04008000, NVKM_ENGINE_MSVLD },
        { 0x01020000, NVKM_ENGINE_MSPDEC },
-       { 0x00802000, NVKM_ENGINE_CE0 },
+       { 0x00802000, NVKM_ENGINE_CE0 },
        { 0x00400002, NVKM_ENGINE_MSPPP },
        { 0x00201000, NVKM_ENGINE_GR },
        { 0x00000100, NVKM_ENGINE_FIFO },
@@ -37,7 +37,7 @@ gt215_mc_reset[] = {
 static const struct nvkm_mc_map
 gt215_mc_intr[] = {
        { 0x04000000, NVKM_ENGINE_DISP },
-       { 0x00400000, NVKM_ENGINE_CE0 },
+       { 0x00400000, NVKM_ENGINE_CE0 },
        { 0x00020000, NVKM_ENGINE_MSPDEC },
        { 0x00008000, NVKM_ENGINE_MSVLD },
        { 0x00001000, NVKM_ENGINE_GR },
index 6118aa2..c8bcabb 100644 (file)
@@ -11,7 +11,8 @@ int nvkm_mc_new_(const struct nvkm_mc_func *, struct nvkm_device *, enum nvkm_su
 
 struct nvkm_mc_map {
        u32 stat;
-       u32 unit;
+       enum nvkm_subdev_type type;
+       int inst;
        bool noauto;
 };