]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/v3d: fix client obtained from axi_ids on V3D 4.1
authorJose Maria Casanova Crespo <jmcasanova@igalia.com>
Fri, 25 Apr 2025 12:25:07 +0000 (14:25 +0200)
committerMaíra Canal <mcanal@igalia.com>
Sun, 27 Apr 2025 17:38:02 +0000 (14:38 -0300)
In the case of MMU errors caused by the TFU unit, the
client that causes the MMU error is expected to be reported.
But in the case of MMU TFU errors, a non existing client was
being reported. This happened because the client calculation
was taking into account more than the bits 0-7 from the
axi_id that were representing the client.

[   27.845132] v3d fec00000.v3d: MMU error from client ? (13) at 0x3bb1000, pte invalid

Masking the bits and using the correct axi_id ranges fixes the
calculation to report the real guilty client on V3D 4.1 and 4.2.

Make the MMU error print axi_id with hexadecimal as used in the
ranges.

Fixes: 38c2c7917adc ("drm/v3d: Fix and extend MMU error handling.")
Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Reviewed-by: Maíra Canal <mcanal@igalia.com>
Link: https://lore.kernel.org/r/20250425122522.18425-1-jmcasanova@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
drivers/gpu/drm/v3d/v3d_irq.c

index 29f63f572d35b7217e346f82b9afb0957a42bd39..d6ce1324905df9d5eb104d03cab50622f65e6131 100644 (file)
@@ -186,27 +186,38 @@ v3d_hub_irq(int irq, void *arg)
                u32 axi_id = V3D_READ(V3D_MMU_VIO_ID);
                u64 vio_addr = ((u64)V3D_READ(V3D_MMU_VIO_ADDR) <<
                                (v3d->va_width - 32));
-               static const char *const v3d41_axi_ids[] = {
-                       "L2T",
-                       "PTB",
-                       "PSE",
-                       "TLB",
-                       "CLE",
-                       "TFU",
-                       "MMU",
-                       "GMP",
+               static const struct {
+                       u32 begin;
+                       u32 end;
+                       const char *client;
+               } v3d41_axi_ids[] = {
+                       {0x00, 0x20, "L2T"},
+                       {0x20, 0x21, "PTB"},
+                       {0x40, 0x41, "PSE"},
+                       {0x60, 0x80, "TLB"},
+                       {0x80, 0x88, "CLE"},
+                       {0xA0, 0xA1, "TFU"},
+                       {0xC0, 0xE0, "MMU"},
+                       {0xE0, 0xE1, "GMP"},
                };
                const char *client = "?";
 
                V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL));
 
                if (v3d->ver >= V3D_GEN_41) {
-                       axi_id = axi_id >> 5;
-                       if (axi_id < ARRAY_SIZE(v3d41_axi_ids))
-                               client = v3d41_axi_ids[axi_id];
+                       size_t i;
+
+                       axi_id = axi_id & 0xFF;
+                       for (i = 0; i < ARRAY_SIZE(v3d41_axi_ids); i++) {
+                               if (axi_id >= v3d41_axi_ids[i].begin &&
+                                   axi_id < v3d41_axi_ids[i].end) {
+                                       client = v3d41_axi_ids[i].client;
+                                       break;
+                               }
+                       }
                }
 
-               dev_err(v3d->drm.dev, "MMU error from client %s (%d) at 0x%llx%s%s%s\n",
+               dev_err(v3d->drm.dev, "MMU error from client %s (0x%x) at 0x%llx%s%s%s\n",
                        client, axi_id, (long long)vio_addr,
                        ((intsts & V3D_HUB_INT_MMU_WRV) ?
                         ", write violation" : ""),