Skip to content

Commit b4bc0e7

Browse files
austriancoderlynxeye-dev
authored andcommitted
drm/etnaviv: print MMU exception cause
The MMU tells us the fault status. While the raw register value is already printed, it's a bit more user friendly to translate the fault reasons into human readable format. Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Philipp Zabel <[email protected]> Signed-off-by: Lucas Stach <[email protected]>
1 parent 50f79da commit b4bc0e7

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

drivers/gpu/drm/etnaviv/etnaviv_gpu.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,15 @@ static void sync_point_worker(struct work_struct *work)
14541454

14551455
static void dump_mmu_fault(struct etnaviv_gpu *gpu)
14561456
{
1457+
static const char *fault_reasons[] = {
1458+
"slave not present",
1459+
"page not present",
1460+
"write violation",
1461+
"out of bounds",
1462+
"read security violation",
1463+
"write security violation",
1464+
};
1465+
14571466
u32 status_reg, status;
14581467
int i;
14591468

@@ -1466,18 +1475,25 @@ static void dump_mmu_fault(struct etnaviv_gpu *gpu)
14661475
dev_err_ratelimited(gpu->dev, "MMU fault status 0x%08x\n", status);
14671476

14681477
for (i = 0; i < 4; i++) {
1478+
const char *reason = "unknown";
14691479
u32 address_reg;
1480+
u32 mmu_status;
14701481

1471-
if (!(status & (VIVS_MMUv2_STATUS_EXCEPTION0__MASK << (i * 4))))
1482+
mmu_status = (status >> (i * 4)) & VIVS_MMUv2_STATUS_EXCEPTION0__MASK;
1483+
if (!mmu_status)
14721484
continue;
14731485

1486+
if ((mmu_status - 1) < ARRAY_SIZE(fault_reasons))
1487+
reason = fault_reasons[mmu_status - 1];
1488+
14741489
if (gpu->sec_mode == ETNA_SEC_NONE)
14751490
address_reg = VIVS_MMUv2_EXCEPTION_ADDR(i);
14761491
else
14771492
address_reg = VIVS_MMUv2_SEC_EXCEPTION_ADDR;
14781493

1479-
dev_err_ratelimited(gpu->dev, "MMU %d fault addr 0x%08x\n", i,
1480-
gpu_read(gpu, address_reg));
1494+
dev_err_ratelimited(gpu->dev,
1495+
"MMU %d fault (%s) addr 0x%08x\n",
1496+
i, reason, gpu_read(gpu, address_reg));
14811497
}
14821498
}
14831499

0 commit comments

Comments
 (0)