Skip to contentSkip to conversation

drm/etnaviv: update hardware headers from rnndb

PATCH In review Christian Gmeiner 2 participants 3 messages Sep 13, 2019

Subsystems (2)
lore
Share & tools
lore

Christian Gmeiner

author reviewer
#0 lore raw

PATCH v2 1/2 drm/etnaviv: update hardware headers from rnndb

Update the state HI header from rnndb commit a04283591a8a (rnndb: update MMU exception causes).

Changes in V2:
- Only update state_hi.xml as suggested by Lucas Stach.

---
 drivers/gpu/drm/etnaviv/state_hi.xml.h | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/gpu/drm/etnaviv/state_hi.xml.h +14 -11
index 41d8da2b6f4f..0f93dbbbaaeb 100644
@@ -8,17 +8,17 @@ This file was generated by the rules-ng-ng headergen tool in this git repository
 git clone git://0x04.net/rules-ng-ng
 
 The rules-ng-ng source files this header was generated from are:
-- state.xml     (  26087 bytes, from 2017-12-18 16:51:59)
-- common.xml    (  35468 bytes, from 2018-01-22 13:48:54)
-- common_3d.xml (  14615 bytes, from 2017-12-18 16:51:59)
-- state_hi.xml  (  30232 bytes, from 2018-02-15 15:48:01)
-- copyright.xml (   1597 bytes, from 2016-12-08 16:37:56)
-- state_2d.xml  (  51552 bytes, from 2016-12-08 16:37:56)
-- state_3d.xml  (  79992 bytes, from 2017-12-18 16:51:59)
-- state_blt.xml (  13405 bytes, from 2017-12-18 16:51:59)
-- state_vg.xml  (   5975 bytes, from 2016-12-08 16:37:56)
-
-Copyright (C) 2012-2018 by the following authors:
+- state.xml     (  26666 bytes, from 2019-08-13 11:26:49)
+- common.xml    (  35468 bytes, from 2018-02-10 13:09:26)
+- common_3d.xml (  14322 bytes, from 2019-08-20 20:31:50)
+- state_hi.xml  (  30396 bytes, from 2019-08-20 20:34:03)
+- copyright.xml (   1597 bytes, from 2018-02-10 13:09:26)
+- state_2d.xml  (  51552 bytes, from 2018-02-10 13:09:26)
+- state_3d.xml  (  83505 bytes, from 2019-09-06 09:32:54)
+- state_blt.xml (  14252 bytes, from 2019-08-13 20:00:42)
+- state_vg.xml  (   5975 bytes, from 2018-02-10 13:09:26)
+
+Copyright (C) 2012-2019 by the following authors:
 - Wladimir J. van der Laan <[email protected]>
 - Christian Gmeiner <[email protected]>
 - Lucas Stach <[email protected]>
@@ -48,6 +48,9 @@ DEALINGS IN THE SOFTWARE.
 #define MMU_EXCEPTION_SLAVE_NOT_PRESENT				0x00000001
 #define MMU_EXCEPTION_PAGE_NOT_PRESENT				0x00000002
 #define MMU_EXCEPTION_WRITE_VIOLATION				0x00000003
+#define MMU_EXCEPTION_OUT_OF_BOUND				0x00000004
+#define MMU_EXCEPTION_READ_SECURITY_VIOLATION			0x00000005
+#define MMU_EXCEPTION_WRITE_SECURITY_VIOLATION			0x00000006
 #define VIVS_HI							0x00000000
 
 #define VIVS_HI_CLOCK_CONTROL					0x00000000
Signature · 6 lines
2.21.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author reviewer
#1 lore raw

PATCH v2 2/2 drm/etnaviv: print MMU exception cause

Might be useful when debugging MMU exceptions.

Changes in V2:
- Use a static array of string for error message as suggested by Lucas Stach.

---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +15 -0
index d47d1a8e0219..b8cd85153fe0 100644
@@ -1351,6 +1351,15 @@ static void sync_point_worker(struct work_struct *work)
 
 static void dump_mmu_fault(struct etnaviv_gpu *gpu)
 {
+	static const char *errors[] = {
+		"slave not present",
+		"page not present",
+		"write violation",
+		"out of bound",
+		"read security violation",
+		"write security violation",
+	};
+
 	u32 status_reg, status;
 	int i;
 
@@ -1364,10 +1373,16 @@ static void dump_mmu_fault(struct etnaviv_gpu *gpu)
 
 	for (i = 0; i < 4; i++) {
 		u32 address_reg;
+		const char *error = "unknown state";
 
 		if (!(status & (VIVS_MMUv2_STATUS_EXCEPTION0__MASK << (i * 4))))
 			continue;
 
+		if (status < ARRAY_SIZE(errors))
+			error = errors[status];
+
+		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
Signature · 6 lines
2.21.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer
#2 lore raw

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

Quoted 5 lines · Christian Gmeiner

Might be useful when debugging MMU exceptions.

Changes in V2:
- Use a static array of string for error message as suggested by Lucas Stach.

Please move those changelogs below the 3 dashes, so they don't end up in the commit message. They don't really add any value to the persistent kernel history.

Quoted 26 lines
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +9 -0
index d47d1a8e0219..b8cd85153fe0 100644
@@ -1351,6 +1351,15 @@ static void sync_point_worker(struct work_struct *work)
 
 static void dump_mmu_fault(struct etnaviv_gpu *gpu)
 {
+	static const char *errors[] = {
+		"slave not present",
+		"page not present",
+		"write violation",
+		"out of bound",
+		"read security violation",
+		"write security violation",
+	};
+
 	u32 status_reg, status;
 	int i;
 

drivers/gpu/drm/etnaviv/etnaviv_gpu.c static void dump_mmu_fault(struct etnaviv_gpu *gpu) · line 1382

Quoted 10 lines
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +3 -0
@@ -1364,10 +1373,16 @@ static void dump_mmu_fault(struct etnaviv_gpu *gpu)
 
 	for (i = 0; i < 4; i++) {
 		u32 address_reg;
+		const char *error = "unknown state";
 
 		if (!(status & (VIVS_MMUv2_STATUS_EXCEPTION0__MASK << (i * 4))))
 			continue;
 
+		if (status < ARRAY_SIZE(errors))
+			error = errors[status];

Huh? This won't work. The status register is a bitfield, not an integer so you need to map the bit position to the array index via ffs() or something like that.

Regards,
Lucas

Quoted 6 lines
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +3 -0
+
+		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