All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] drm/etnaviv: update hardware headers from rnndb
@ 2019-09-13  5:50 ` Christian Gmeiner
  0 siblings, 0 replies; 6+ messages in thread
From: Christian Gmeiner @ 2019-09-13  5:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Christian Gmeiner, Lucas Stach, Russell King, David Airlie,
	Daniel Vetter, etnaviv, dri-devel

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.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
 drivers/gpu/drm/etnaviv/state_hi.xml.h | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/state_hi.xml.h b/drivers/gpu/drm/etnaviv/state_hi.xml.h
index 41d8da2b6f4f..0f93dbbbaaeb 100644
--- a/drivers/gpu/drm/etnaviv/state_hi.xml.h
+++ b/drivers/gpu/drm/etnaviv/state_hi.xml.h
@@ -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 <laanwj@gmail.com>
 - Christian Gmeiner <christian.gmeiner@gmail.com>
 - Lucas Stach <l.stach@pengutronix.de>
@@ -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
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] drm/etnaviv: update hardware headers from rnndb
@ 2019-09-13  5:50 ` Christian Gmeiner
  0 siblings, 0 replies; 6+ messages in thread
From: Christian Gmeiner @ 2019-09-13  5:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: David Airlie, etnaviv, dri-devel, Russell King

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.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
 drivers/gpu/drm/etnaviv/state_hi.xml.h | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/state_hi.xml.h b/drivers/gpu/drm/etnaviv/state_hi.xml.h
index 41d8da2b6f4f..0f93dbbbaaeb 100644
--- a/drivers/gpu/drm/etnaviv/state_hi.xml.h
+++ b/drivers/gpu/drm/etnaviv/state_hi.xml.h
@@ -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 <laanwj@gmail.com>
 - Christian Gmeiner <christian.gmeiner@gmail.com>
 - Lucas Stach <l.stach@pengutronix.de>
@@ -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
-- 
2.21.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] drm/etnaviv: print MMU exception cause
  2019-09-13  5:50 ` Christian Gmeiner
@ 2019-09-13  5:50   ` Christian Gmeiner
  -1 siblings, 0 replies; 6+ messages in thread
From: Christian Gmeiner @ 2019-09-13  5:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Christian Gmeiner, Lucas Stach, Russell King, David Airlie,
	Daniel Vetter, etnaviv, dri-devel

Might be useful when debugging MMU exceptions.

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

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

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index d47d1a8e0219..b8cd85153fe0 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -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
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] drm/etnaviv: print MMU exception cause
@ 2019-09-13  5:50   ` Christian Gmeiner
  0 siblings, 0 replies; 6+ messages in thread
From: Christian Gmeiner @ 2019-09-13  5:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: David Airlie, etnaviv, dri-devel, Russell King

Might be useful when debugging MMU exceptions.

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

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

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index d47d1a8e0219..b8cd85153fe0 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -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
-- 
2.21.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] drm/etnaviv: print MMU exception cause
  2019-09-13  5:50   ` Christian Gmeiner
  (?)
@ 2019-09-13  8:53   ` Lucas Stach
  -1 siblings, 0 replies; 6+ messages in thread
From: Lucas Stach @ 2019-09-13  8:53 UTC (permalink / raw)
  To: Christian Gmeiner, linux-kernel
  Cc: David Airlie, etnaviv, dri-devel, Daniel Vetter, Russell King

On Fr, 2019-09-13 at 07:50 +0200, Christian Gmeiner wrote:
> 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.

> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> index d47d1a8e0219..b8cd85153fe0 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> @@ -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];

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

> +
> +		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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] drm/etnaviv: print MMU exception cause
  2022-12-01 17:43 [PATCH v2 1/2] drm/etnaviv: update hardware headers from rnndb Lucas Stach
@ 2022-12-01 17:43 ` Lucas Stach
  0 siblings, 0 replies; 6+ messages in thread
From: Lucas Stach @ 2022-12-01 17:43 UTC (permalink / raw)
  To: etnaviv; +Cc: patchwork-lst, kernel, dri-devel, Russell King

From: Christian Gmeiner <christian.gmeiner@gmail.com>

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 <christian.gmeiner@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 37018bc55810..f79203b774d9 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -1426,6 +1426,15 @@ static void sync_point_worker(struct work_struct *work)
 
 static void dump_mmu_fault(struct etnaviv_gpu *gpu)
 {
+	static const char *fault_reasons[] = {
+		"slave not present",
+		"page not present",
+		"write violation",
+		"out of bounds",
+		"read security violation",
+		"write security violation",
+	};
+
 	u32 status_reg, status;
 	int i;
 
@@ -1438,18 +1447,25 @@ static void dump_mmu_fault(struct etnaviv_gpu *gpu)
 	dev_err_ratelimited(gpu->dev, "MMU fault status 0x%08x\n", status);
 
 	for (i = 0; i < 4; i++) {
+		const char *reason = "unknown";
 		u32 address_reg;
+		u32 mmu_status;
 
-		if (!(status & (VIVS_MMUv2_STATUS_EXCEPTION0__MASK << (i * 4))))
+		mmu_status = (status >> (i * 4)) & VIVS_MMUv2_STATUS_EXCEPTION0__MASK;
+		if (!mmu_status)
 			continue;
 
+		if ((mmu_status - 1) < ARRAY_SIZE(fault_reasons))
+			reason = fault_reasons[mmu_status - 1];
+
 		if (gpu->sec_mode == ETNA_SEC_NONE)
 			address_reg = VIVS_MMUv2_EXCEPTION_ADDR(i);
 		else
 			address_reg = VIVS_MMUv2_SEC_EXCEPTION_ADDR;
 
-		dev_err_ratelimited(gpu->dev, "MMU %d fault addr 0x%08x\n", i,
-				    gpu_read(gpu, address_reg));
+		dev_err_ratelimited(gpu->dev,
+				    "MMU %d fault (%s) addr 0x%08x\n",
+				    i, reason, gpu_read(gpu, address_reg));
 	}
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-12-01 17:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-13  5:50 [PATCH v2 1/2] drm/etnaviv: update hardware headers from rnndb Christian Gmeiner
2019-09-13  5:50 ` Christian Gmeiner
2019-09-13  5:50 ` [PATCH v2 2/2] drm/etnaviv: print MMU exception cause Christian Gmeiner
2019-09-13  5:50   ` Christian Gmeiner
2019-09-13  8:53   ` Lucas Stach
2022-12-01 17:43 [PATCH v2 1/2] drm/etnaviv: update hardware headers from rnndb Lucas Stach
2022-12-01 17:43 ` [PATCH v2 2/2] drm/etnaviv: print MMU exception cause Lucas Stach

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.