[PATCH 2/2] drm/etnaviv: print MMU exception cause

Christian Gmeiner christian.gmeiner at gmail.com
Fri Sep 6 10:03:08 UTC 2019


Might be useful when debugging MMU exceptions.

Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index d47d1a8e0219..aa878dd05860 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -1364,10 +1364,36 @@ static void dump_mmu_fault(struct etnaviv_gpu *gpu)
 
 	for (i = 0; i < 4; i++) {
 		u32 address_reg;
+		const char *error;
 
 		if (!(status & (VIVS_MMUv2_STATUS_EXCEPTION0__MASK << (i * 4))))
 			continue;
 
+		switch (status) {
+		case MMU_EXCEPTION_SLAVE_NOT_PRESENT:
+			error = "slave not present";
+			break;
+		case MMU_EXCEPTION_PAGE_NOT_PRESENT:
+			error = "page not present";
+			break;
+		case MMU_EXCEPTION_WRITE_VIOLATION:
+			error = "write violation";
+			break;
+		case MMU_EXCEPTION_OUT_OF_BOUND:
+			error = "out of bound";
+			break;
+		case MMU_EXCEPTION_READ_SECURITY_VIOLATION:
+			error = "read security violation";
+			break;
+		case MMU_EXCEPTION_WRITE_SECURITY_VIOLATION:
+			error = "write security violation";
+			break;
+		default:
+			error = "unknown state";
+			break;
+		}
+		dev_err_ratelimited(gpu->dev, "MMU %d %s\n", i, error);
+
 		if (gpu->sec_mode == ETNA_SEC_NONE)
 			address_reg = VIVS_MMUv2_EXCEPTION_ADDR(i);
 		else
-- 
2.21.0



More information about the dri-devel mailing list