All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau: Acknowledge DMA_VTX_PROTECTION PGRAPH interrupts
@ 2010-01-16 14:27 Luca Barbieri
       [not found] ` <1263652071-17874-1-git-send-email-luca-Ukmtq+NC3rhBHFWNQifrYwC/G2K4zDHf@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Luca Barbieri @ 2010-01-16 14:27 UTC (permalink / raw)
  To: skeggsb-Re5JQEeQqe8AvxtiuMwx3w
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Luca Barbieri

Currently Nouveau is unable to dismiss DMA_VTX_PROTECTION errors,
which results in an infinite loop in the interrupt handler.

These errors are caused both by bugs in the Gallium driver and by
user-specified index buffers with out of bounds indices.

By mmio-tracing the nVidia drivers, I found out how this is done.
On DMA_VTX_PROTECTION, The nVidia driver reads the register 0x402000,
always getting the value 4, and then writes 4 back to 0x402000.

This patch adds that logic by reading 0x402000 and writing the same
value back.
It's unclear what should happen if the value read is not 4, and
the current approach might not be the correct one.

To test this, modify mesa/progs/trivial/vbo-drawrange.c, defining
ELTOBJ to 1 and replacing indices with huge out of bounds integers.

Without this patch, the GPU and/or kernel should lock up.
With this patch, it should misrender as expected but not lock up.

The errors are still logged since they are useful for development.

This has been tested on NV49 and may not work on other cards.

To find out how things work on other cards, run the aforementioned
test using the blob with mmiotrace and grep for a read of the PGRAPH
source register.

Signed-off-by: Luca Barbieri <luca-Ukmtq+NC3rhBHFWNQifrYwC/G2K4zDHf@public.gmane.org>
---
 drivers/gpu/drm/nouveau/nouveau_irq.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c
index 919a619..14de5a1 100644
--- a/drivers/gpu/drm/nouveau/nouveau_irq.c
+++ b/drivers/gpu/drm/nouveau/nouveau_irq.c
@@ -483,9 +483,16 @@ nouveau_pgraph_intr_error(struct drm_device *dev, uint32_t nsource)
 	if (nsource & NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD) {
 		if (nouveau_pgraph_intr_swmthd(dev, &trap))
 			unhandled = 1;
-	} else {
+	} else if(nsource & NV03_PGRAPH_NSOURCE_DMA_VTX_PROTECTION) {
+		uint32_t v = nv_rd32(dev, 0x402000);
+		nv_wr32(dev, 0x402000, v);
+
+		/* dump the error anyway for now: it's useful for
+		   Gallium development */
 		unhandled = 1;
 	}
+	else
+		unhandled = 1;
 
 	if (unhandled && nouveau_ratelimit())
 		nouveau_graph_dump_trap_info(dev, "PGRAPH_ERROR", &trap);
-- 
1.6.3.3

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

* Re: [PATCH] drm/nouveau: Acknowledge DMA_VTX_PROTECTION PGRAPH interrupts
       [not found] ` <1263652071-17874-1-git-send-email-luca-Ukmtq+NC3rhBHFWNQifrYwC/G2K4zDHf@public.gmane.org>
@ 2010-01-17 18:16   ` Francisco Jerez
  0 siblings, 0 replies; 2+ messages in thread
From: Francisco Jerez @ 2010-01-17 18:16 UTC (permalink / raw)
  To: Luca Barbieri; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1.1: Type: text/plain, Size: 2449 bytes --]

Luca Barbieri <luca-Ukmtq+NC3rhBHFWNQifrYwC/G2K4zDHf@public.gmane.org> writes:

> Currently Nouveau is unable to dismiss DMA_VTX_PROTECTION errors,
> which results in an infinite loop in the interrupt handler.
>
> These errors are caused both by bugs in the Gallium driver and by
> user-specified index buffers with out of bounds indices.
>
> By mmio-tracing the nVidia drivers, I found out how this is done.
> On DMA_VTX_PROTECTION, The nVidia driver reads the register 0x402000,
> always getting the value 4, and then writes 4 back to 0x402000.
>
> This patch adds that logic by reading 0x402000 and writing the same
> value back.
> It's unclear what should happen if the value read is not 4, and
> the current approach might not be the correct one.
>
> To test this, modify mesa/progs/trivial/vbo-drawrange.c, defining
> ELTOBJ to 1 and replacing indices with huge out of bounds integers.
>
> Without this patch, the GPU and/or kernel should lock up.
> With this patch, it should misrender as expected but not lock up.
>
> The errors are still logged since they are useful for development.
>
> This has been tested on NV49 and may not work on other cards.
>
> To find out how things work on other cards, run the aforementioned
> test using the blob with mmiotrace and grep for a read of the PGRAPH
> source register.
>
> Signed-off-by: Luca Barbieri <luca-Ukmtq+NC3rhBHFWNQifrYwC/G2K4zDHf@public.gmane.org>
> ---
>  drivers/gpu/drm/nouveau/nouveau_irq.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c
> index 919a619..14de5a1 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_irq.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_irq.c
> @@ -483,9 +483,16 @@ nouveau_pgraph_intr_error(struct drm_device *dev, uint32_t nsource)
>  	if (nsource & NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD) {
>  		if (nouveau_pgraph_intr_swmthd(dev, &trap))
>  			unhandled = 1;
> -	} else {
> +	} else if(nsource & NV03_PGRAPH_NSOURCE_DMA_VTX_PROTECTION) {
> +		uint32_t v = nv_rd32(dev, 0x402000);
> +		nv_wr32(dev, 0x402000, v);
> +
> +		/* dump the error anyway for now: it's useful for
> +		   Gallium development */
>  		unhandled = 1;
>  	}
> +	else
> +		unhandled = 1;
>  
>  	if (unhandled && nouveau_ratelimit())
>  		nouveau_graph_dump_trap_info(dev, "PGRAPH_ERROR", &trap);

Both pushed. Thanks!

[-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 181 bytes --]

_______________________________________________
Nouveau mailing list
Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

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

end of thread, other threads:[~2010-01-17 18:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-16 14:27 [PATCH] drm/nouveau: Acknowledge DMA_VTX_PROTECTION PGRAPH interrupts Luca Barbieri
     [not found] ` <1263652071-17874-1-git-send-email-luca-Ukmtq+NC3rhBHFWNQifrYwC/G2K4zDHf@public.gmane.org>
2010-01-17 18:16   ` Francisco Jerez

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.