linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] drm/etnaviv: update hardware headers from rnndb
@ 2019-09-13  5:50 Christian Gmeiner
  2019-09-13  5:50 ` [PATCH v2 2/2] drm/etnaviv: print MMU exception cause Christian Gmeiner
  0 siblings, 1 reply; 3+ 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] 3+ messages in thread

* [PATCH v2 2/2] drm/etnaviv: print MMU exception cause
  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  8:53   ` Lucas Stach
  0 siblings, 1 reply; 3+ 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] 3+ messages in thread

* Re: [PATCH v2 2/2] drm/etnaviv: print MMU exception cause
  2019-09-13  5:50 ` [PATCH v2 2/2] drm/etnaviv: print MMU exception cause Christian Gmeiner
@ 2019-09-13  8:53   ` Lucas Stach
  0 siblings, 0 replies; 3+ 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] 3+ messages in thread

end of thread, other threads:[~2019-09-13  8:53 UTC | newest]

Thread overview: 3+ 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 ` [PATCH v2 2/2] drm/etnaviv: print MMU exception cause Christian Gmeiner
2019-09-13  8:53   ` Lucas Stach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).