mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/2] drm/v3d: fix client obtained from axi_ids on V3D 4.1
@ 2025-04-25 12:25 Jose Maria Casanova Crespo
  2025-04-25 12:25 ` [PATCH v2 2/2] drm/v3d: client ranges from axi_ids are different with V3D 7.1 Jose Maria Casanova Crespo
  2025-04-27 18:16 ` [PATCH v2 1/2] drm/v3d: fix client obtained from axi_ids on V3D 4.1 Maíra Canal
  0 siblings, 2 replies; 3+ messages in thread
From: Jose Maria Casanova Crespo @ 2025-04-25 12:25 UTC (permalink / raw)
  To: Melissa Wen, Maíra Canal, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter,
	Paul Kocialkowski
  Cc: Jose Maria Casanova Crespo, dri-devel, linux-kernel, kernel-dev

In the case of MMU errors caused by the TFU unit, the
client that causes the MMU error is expected to be reported.
But in the case of MMU TFU errors, a non existing client was
being reported. This happened because the client calculation
was taking into account more than the bits 0-7 from the
axi_id that were representing the client.

[   27.845132] v3d fec00000.v3d: MMU error from client ? (13) at 0x3bb1000, pte invalid

Masking the bits and using the correct exi_id ranges fixes the
calculation to report the real guilty client on V3D 4.1 and 4.2.

Make the MMU error print axi_id with hexadecimal as used in the
ranges.

Fixes: 38c2c7917adc ("drm/v3d: Fix and extend MMU error handling.")
Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
---
 drivers/gpu/drm/v3d/v3d_irq.c | 37 +++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 13 deletions(-)

Changes in v2:
- Now axi_id is showed in hexadecimal in error message (Maira Canal)
- Improved commit log description with error example. (Maira Canal)
- Fixed typos in commit log (Maira Canal)

diff --git a/drivers/gpu/drm/v3d/v3d_irq.c b/drivers/gpu/drm/v3d/v3d_irq.c
index 29f63f572d35..d6ce1324905d 100644
--- a/drivers/gpu/drm/v3d/v3d_irq.c
+++ b/drivers/gpu/drm/v3d/v3d_irq.c
@@ -186,27 +186,38 @@ v3d_hub_irq(int irq, void *arg)
 		u32 axi_id = V3D_READ(V3D_MMU_VIO_ID);
 		u64 vio_addr = ((u64)V3D_READ(V3D_MMU_VIO_ADDR) <<
 				(v3d->va_width - 32));
-		static const char *const v3d41_axi_ids[] = {
-			"L2T",
-			"PTB",
-			"PSE",
-			"TLB",
-			"CLE",
-			"TFU",
-			"MMU",
-			"GMP",
+		static const struct {
+			u32 begin;
+			u32 end;
+			const char *client;
+		} v3d41_axi_ids[] = {
+			{0x00, 0x20, "L2T"},
+			{0x20, 0x21, "PTB"},
+			{0x40, 0x41, "PSE"},
+			{0x60, 0x80, "TLB"},
+			{0x80, 0x88, "CLE"},
+			{0xA0, 0xA1, "TFU"},
+			{0xC0, 0xE0, "MMU"},
+			{0xE0, 0xE1, "GMP"},
 		};
 		const char *client = "?";
 
 		V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL));
 
 		if (v3d->ver >= V3D_GEN_41) {
-			axi_id = axi_id >> 5;
-			if (axi_id < ARRAY_SIZE(v3d41_axi_ids))
-				client = v3d41_axi_ids[axi_id];
+			size_t i;
+
+			axi_id = axi_id & 0xFF;
+			for (i = 0; i < ARRAY_SIZE(v3d41_axi_ids); i++) {
+				if (axi_id >= v3d41_axi_ids[i].begin &&
+				    axi_id < v3d41_axi_ids[i].end) {
+					client = v3d41_axi_ids[i].client;
+					break;
+				}
+			}
 		}
 
-		dev_err(v3d->drm.dev, "MMU error from client %s (%d) at 0x%llx%s%s%s\n",
+		dev_err(v3d->drm.dev, "MMU error from client %s (0x%x) at 0x%llx%s%s%s\n",
 			client, axi_id, (long long)vio_addr,
 			((intsts & V3D_HUB_INT_MMU_WRV) ?
 			 ", write violation" : ""),
-- 
2.49.0


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

* [PATCH v2 2/2] drm/v3d: client ranges from axi_ids are different with V3D 7.1
  2025-04-25 12:25 [PATCH v2 1/2] drm/v3d: fix client obtained from axi_ids on V3D 4.1 Jose Maria Casanova Crespo
@ 2025-04-25 12:25 ` Jose Maria Casanova Crespo
  2025-04-27 18:16 ` [PATCH v2 1/2] drm/v3d: fix client obtained from axi_ids on V3D 4.1 Maíra Canal
  1 sibling, 0 replies; 3+ messages in thread
From: Jose Maria Casanova Crespo @ 2025-04-25 12:25 UTC (permalink / raw)
  To: Melissa Wen, Maíra Canal, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter,
	Iago Toral Quiroga
  Cc: Jose Maria Casanova Crespo, dri-devel, linux-kernel, kernel-dev

The client mask has been reduced from 8 bits on V3D 4.1 to 7 bits
on V3D 7.1, so the ranges for each client are not compatible.

On V3D 7.1, the CSD client can also report MMU errors.
Therefore, add its AXI ID to the IDs list.

Fixes: 0ad5bc1ce463 ("drm/v3d: fix up register addresses for V3D 7.x")
Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
---
 drivers/gpu/drm/v3d/v3d_irq.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

Changes in v2:
- Use imperative in commit log. (Maíra Canal)
- Fixed Typos in commit log.

diff --git a/drivers/gpu/drm/v3d/v3d_irq.c b/drivers/gpu/drm/v3d/v3d_irq.c
index d6ce1324905d..2cca5d3a26a2 100644
--- a/drivers/gpu/drm/v3d/v3d_irq.c
+++ b/drivers/gpu/drm/v3d/v3d_irq.c
@@ -199,12 +199,33 @@ v3d_hub_irq(int irq, void *arg)
 			{0xA0, 0xA1, "TFU"},
 			{0xC0, 0xE0, "MMU"},
 			{0xE0, 0xE1, "GMP"},
+		}, v3d71_axi_ids[] = {
+			{0x00, 0x30, "L2T"},
+			{0x30, 0x38, "CLE"},
+			{0x38, 0x39, "PTB"},
+			{0x39, 0x3A, "PSE"},
+			{0x3A, 0x3B, "CSD"},
+			{0x40, 0x60, "TLB"},
+			{0x60, 0x70, "MMU"},
+			{0x7C, 0x7E, "TFU"},
+			{0x7F, 0x80, "GMP"},
 		};
 		const char *client = "?";
 
 		V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL));
 
-		if (v3d->ver >= V3D_GEN_41) {
+		if (v3d->ver >= V3D_GEN_71) {
+			size_t i;
+
+			axi_id = axi_id & 0x7F;
+			for (i = 0; i < ARRAY_SIZE(v3d71_axi_ids); i++) {
+				if (axi_id >= v3d71_axi_ids[i].begin &&
+				    axi_id < v3d71_axi_ids[i].end) {
+					client = v3d71_axi_ids[i].client;
+					break;
+				}
+			}
+		} else if (v3d->ver >= V3D_GEN_41) {
 			size_t i;
 
 			axi_id = axi_id & 0xFF;
-- 
2.49.0


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

* Re: [PATCH v2 1/2] drm/v3d: fix client obtained from axi_ids on V3D 4.1
  2025-04-25 12:25 [PATCH v2 1/2] drm/v3d: fix client obtained from axi_ids on V3D 4.1 Jose Maria Casanova Crespo
  2025-04-25 12:25 ` [PATCH v2 2/2] drm/v3d: client ranges from axi_ids are different with V3D 7.1 Jose Maria Casanova Crespo
@ 2025-04-27 18:16 ` Maíra Canal
  1 sibling, 0 replies; 3+ messages in thread
From: Maíra Canal @ 2025-04-27 18:16 UTC (permalink / raw)
  To: Jose Maria Casanova Crespo, Melissa Wen, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Paul Kocialkowski
  Cc: dri-devel, linux-kernel, kernel-dev

Hi Chema,

On 25/04/25 09:25, Jose Maria Casanova Crespo wrote:
> In the case of MMU errors caused by the TFU unit, the
> client that causes the MMU error is expected to be reported.
> But in the case of MMU TFU errors, a non existing client was
> being reported. This happened because the client calculation
> was taking into account more than the bits 0-7 from the
> axi_id that were representing the client.
> 
> [   27.845132] v3d fec00000.v3d: MMU error from client ? (13) at 0x3bb1000, pte invalid
> 
> Masking the bits and using the correct exi_id ranges fixes the

I changed s/exi_id/axi_id before pushing the patch.

> calculation to report the real guilty client on V3D 4.1 and 4.2.
> 
> Make the MMU error print axi_id with hexadecimal as used in the
> ranges.
> 
> Fixes: 38c2c7917adc ("drm/v3d: Fix and extend MMU error handling.")
> Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>

Applied both patches to misc/kernel.git (drm-misc-next).

Thanks for your patches!

Best Regards,
- Maíra

> ---
>   drivers/gpu/drm/v3d/v3d_irq.c | 37 +++++++++++++++++++++++------------
>   1 file changed, 24 insertions(+), 13 deletions(-)
> 
> Changes in v2:
> - Now axi_id is showed in hexadecimal in error message (Maira Canal)
> - Improved commit log description with error example. (Maira Canal)
> - Fixed typos in commit log (Maira Canal)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_irq.c b/drivers/gpu/drm/v3d/v3d_irq.c
> index 29f63f572d35..d6ce1324905d 100644
> --- a/drivers/gpu/drm/v3d/v3d_irq.c
> +++ b/drivers/gpu/drm/v3d/v3d_irq.c
> @@ -186,27 +186,38 @@ v3d_hub_irq(int irq, void *arg)
>   		u32 axi_id = V3D_READ(V3D_MMU_VIO_ID);
>   		u64 vio_addr = ((u64)V3D_READ(V3D_MMU_VIO_ADDR) <<
>   				(v3d->va_width - 32));
> -		static const char *const v3d41_axi_ids[] = {
> -			"L2T",
> -			"PTB",
> -			"PSE",
> -			"TLB",
> -			"CLE",
> -			"TFU",
> -			"MMU",
> -			"GMP",
> +		static const struct {
> +			u32 begin;
> +			u32 end;
> +			const char *client;
> +		} v3d41_axi_ids[] = {
> +			{0x00, 0x20, "L2T"},
> +			{0x20, 0x21, "PTB"},
> +			{0x40, 0x41, "PSE"},
> +			{0x60, 0x80, "TLB"},
> +			{0x80, 0x88, "CLE"},
> +			{0xA0, 0xA1, "TFU"},
> +			{0xC0, 0xE0, "MMU"},
> +			{0xE0, 0xE1, "GMP"},
>   		};
>   		const char *client = "?";
>   
>   		V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL));
>   
>   		if (v3d->ver >= V3D_GEN_41) {
> -			axi_id = axi_id >> 5;
> -			if (axi_id < ARRAY_SIZE(v3d41_axi_ids))
> -				client = v3d41_axi_ids[axi_id];
> +			size_t i;
> +
> +			axi_id = axi_id & 0xFF;
> +			for (i = 0; i < ARRAY_SIZE(v3d41_axi_ids); i++) {
> +				if (axi_id >= v3d41_axi_ids[i].begin &&
> +				    axi_id < v3d41_axi_ids[i].end) {
> +					client = v3d41_axi_ids[i].client;
> +					break;
> +				}
> +			}
>   		}
>   
> -		dev_err(v3d->drm.dev, "MMU error from client %s (%d) at 0x%llx%s%s%s\n",
> +		dev_err(v3d->drm.dev, "MMU error from client %s (0x%x) at 0x%llx%s%s%s\n",
>   			client, axi_id, (long long)vio_addr,
>   			((intsts & V3D_HUB_INT_MMU_WRV) ?
>   			 ", write violation" : ""),


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

end of thread, other threads:[~2025-04-27 18:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-25 12:25 [PATCH v2 1/2] drm/v3d: fix client obtained from axi_ids on V3D 4.1 Jose Maria Casanova Crespo
2025-04-25 12:25 ` [PATCH v2 2/2] drm/v3d: client ranges from axi_ids are different with V3D 7.1 Jose Maria Casanova Crespo
2025-04-27 18:16 ` [PATCH v2 1/2] drm/v3d: fix client obtained from axi_ids on V3D 4.1 Maíra Canal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®