drm/nv50: align size of buffer object to the right boundaries.
Subsystems (3)
PATCH 1/4 drm/nv50: align size of buffer object to the right boundaries.
- Depth and stencil buffers are supposed to be large enough in general.
--- drivers/gpu/drm/nouveau/nouveau_bo.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +5 -5
@@ -65,8 +65,10 @@ nouveau_bo_fixup_align(struct drm_device *dev,/* * Some of the tile_flags have a periodic structure of N*4096 bytes, -* align to to that as well as the page size. Overallocate memory to -* avoid corruption of other buffer objects. +* align to to that as well as the page size. Align the size to the +* appropriate boundaries. This does imply that sizes are rounded up +* 3-7 pages, so be aware of this and do not waste memory by allocating +* many small buffers. */ if (dev_priv->card_type ==NV_50 ) {uint32_t block_size =nouveau_mem_fb_amount (dev) >>15 ;
@@ -77,22 +79,20 @@ nouveau_bo_fixup_align(struct drm_device *dev,case 0x2800 :case 0x4800 :case 0x7a00 : - *size =roundup (*size, block_size);if (is_power_of_2 (block_size)) { - *size +=3 * block_size;for (i =1 ; i <10 ; i++) { *align =12 * i * block_size;if (!(*align %65536 ))break ; } }else { - *size +=6 * block_size;for (i =1 ; i <10 ; i++) { *align =8 * i * block_size;if (!(*align %65536 ))break ; } } + *size =roundup (*size, *align);break ;default :break ;
Signature · 1 line
1.6.6.1
A message that is not in the archive (sent off-list or not yet received): 1265049275-7680-1-git-send-email-madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 2/4 drm/nv50: make the pgraph irq handler loop like the pre-nv50 version
--- drivers/gpu/drm/nouveau/nouveau_irq.c | 140 ++++++++++++++++++--------------- 1 files changed, 76 insertions(+), 64 deletions(-)
drivers/gpu/drm/nouveau/nouveau_irq.c +76 -64
@@ -580,83 +580,95 @@ nouveau_pgraph_irq_handler(struct drm_device *dev)static void nv50_pgraph_irq_handler (struct drm_device *dev) { -uint32_t status, nsource; +uint32_t status; - status =nv_rd32 (dev,NV03_PGRAPH_INTR ); - nsource =nv_rd32 (dev,NV03_PGRAPH_NSOURCE ); +while ((status =nv_rd32 (dev,NV03_PGRAPH_INTR ))) { +uint32_t nsource =nv_rd32 (dev,NV03_PGRAPH_NSOURCE ); -if (status &0x00000001 ) { -nouveau_pgraph_intr_notify (dev, nsource); - status &= ~0x00000001 ; -nv_wr32 (dev,NV03_PGRAPH_INTR ,0x00000001 ); - } +if (status &0x00000001 ) { +nouveau_pgraph_intr_notify (dev, nsource); + status &= ~0x00000001 ; +nv_wr32 (dev,NV03_PGRAPH_INTR ,0x00000001 ); + } -if (status &0x00000010 ) { -nouveau_pgraph_intr_error (dev, nsource | -NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD ); +if (status &0x00000010 ) { +nouveau_pgraph_intr_error (dev, nsource | +NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD ); - status &= ~0x00000010 ; -nv_wr32 (dev,NV03_PGRAPH_INTR ,0x00000010 ); - } + status &= ~0x00000010 ; +nv_wr32 (dev,NV03_PGRAPH_INTR ,0x00000010 ); + } -if (status &0x00001000 ) { -nv_wr32 (dev,0x400500 ,0x00000000 ); -nv_wr32 (dev,NV03_PGRAPH_INTR ,NV_PGRAPH_INTR_CONTEXT_SWITCH ); -nv_wr32 (dev,NV40_PGRAPH_INTR_EN ,nv_rd32 (dev, -NV40_PGRAPH_INTR_EN ) & ~NV_PGRAPH_INTR_CONTEXT_SWITCH ); -nv_wr32 (dev,0x400500 ,0x00010001 ); +if (status &0x00001000 ) { +nv_wr32 (dev,0x400500 ,0x00000000 ); +nv_wr32 (dev,NV03_PGRAPH_INTR ,NV_PGRAPH_INTR_CONTEXT_SWITCH ); +nv_wr32 (dev,NV40_PGRAPH_INTR_EN ,nv_rd32 (dev, +NV40_PGRAPH_INTR_EN ) & ~NV_PGRAPH_INTR_CONTEXT_SWITCH ); +nv_wr32 (dev,0x400500 ,0x00010001 ); -nv50_graph_context_switch (dev); +nv50_graph_context_switch (dev); - status &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH ; - } + status &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH ; + } -if (status &0x00100000 ) { -nouveau_pgraph_intr_error (dev, nsource | -NV03_PGRAPH_NSOURCE_DATA_ERROR ); +if (status &0x00100000 ) { +nouveau_pgraph_intr_error (dev, nsource | +NV03_PGRAPH_NSOURCE_DATA_ERROR ); - status &= ~0x00100000 ; -nv_wr32 (dev,NV03_PGRAPH_INTR ,0x00100000 ); - } + status &= ~0x00100000 ; +nv_wr32 (dev,NV03_PGRAPH_INTR ,0x00100000 ); + } -if (status &0x00200000 ) { -int r; - -nouveau_pgraph_intr_error (dev, nsource | -NV03_PGRAPH_NSOURCE_PROTECTION_ERROR ); - -NV_ERROR (dev,"magic set 1:\n" ); -for (r =0x408900 ; r <=0x408910 ; r +=4 ) -NV_ERROR (dev,"\t0x%08x: 0x%08x\n" , r,nv_rd32 (dev, r)); -nv_wr32 (dev,0x408900 ,nv_rd32 (dev,0x408904 ) |0xc0000000 ); -for (r =0x408e08 ; r <=0x408e24 ; r +=4 ) -NV_ERROR (dev,"\t0x%08x: 0x%08x\n" , r,nv_rd32 (dev, r)); -nv_wr32 (dev,0x408e08 ,nv_rd32 (dev,0x408e08 ) |0xc0000000 ); - -NV_ERROR (dev,"magic set 2:\n" ); -for (r =0x409900 ; r <=0x409910 ; r +=4 ) -NV_ERROR (dev,"\t0x%08x: 0x%08x\n" , r,nv_rd32 (dev, r)); -nv_wr32 (dev,0x409900 ,nv_rd32 (dev,0x409904 ) |0xc0000000 ); -for (r =0x409e08 ; r <=0x409e24 ; r +=4 ) -NV_ERROR (dev,"\t0x%08x: 0x%08x\n" , r,nv_rd32 (dev, r)); -nv_wr32 (dev,0x409e08 ,nv_rd32 (dev,0x409e08 ) |0xc0000000 ); - - status &= ~0x00200000 ; -nv_wr32 (dev,NV03_PGRAPH_NSOURCE , nsource); -nv_wr32 (dev,NV03_PGRAPH_INTR ,0x00200000 ); - } +if (status &0x00200000 ) { +int r; + +nouveau_pgraph_intr_error (dev, nsource | +NV03_PGRAPH_NSOURCE_PROTECTION_ERROR ); + +NV_ERROR (dev,"magic set 1:\n" ); +for (r =0x408900 ; r <=0x408910 ; r +=4 ) +NV_ERROR (dev,"\t0x%08x: 0x%08x\n" , r, +nv_rd32 (dev, r)); +nv_wr32 (dev,0x408900 , +nv_rd32 (dev,0x408904 ) |0xc0000000 ); +for (r =0x408e08 ; r <=0x408e24 ; r +=4 ) +NV_ERROR (dev,"\t0x%08x: 0x%08x\n" , r, +nv_rd32 (dev, r)); +nv_wr32 (dev,0x408e08 , +nv_rd32 (dev,0x408e08 ) |0xc0000000 ); + +NV_ERROR (dev,"magic set 2:\n" ); +for (r =0x409900 ; r <=0x409910 ; r +=4 ) +NV_ERROR (dev,"\t0x%08x: 0x%08x\n" , r, +nv_rd32 (dev, r)); +nv_wr32 (dev,0x409900 , +nv_rd32 (dev,0x409904 ) |0xc0000000 ); +for (r =0x409e08 ; r <=0x409e24 ; r +=4 ) +NV_ERROR (dev,"\t0x%08x: 0x%08x\n" , r, +nv_rd32 (dev, r)); +nv_wr32 (dev,0x409e08 , +nv_rd32 (dev,0x409e08 ) |0xc0000000 ); + + status &= ~0x00200000 ; +nv_wr32 (dev,NV03_PGRAPH_NSOURCE , nsource); +nv_wr32 (dev,NV03_PGRAPH_INTR ,0x00200000 ); + } -if (status) { -NV_INFO (dev,"Unhandled PGRAPH_INTR - 0x%08x\n" , status); -nv_wr32 (dev,NV03_PGRAPH_INTR , status); - } +if (status) { +NV_INFO (dev,"Unhandled PGRAPH_INTR - 0x%08x\n" , + status); +nv_wr32 (dev,NV03_PGRAPH_INTR , status); + } - { -const int isb = (1 <<16 ) | (1 <<0 ); + { +const int isb = (1 <<16 ) | (1 <<0 ); -if ((nv_rd32 (dev,0x400500 ) & isb) != isb) -nv_wr32 (dev,0x400500 ,nv_rd32 (dev,0x400500 ) | isb); -nv_wr32 (dev,0x400824 ,nv_rd32 (dev,0x400824 ) & ~(1 <<31 )); +if ((nv_rd32 (dev,0x400500 ) & isb) != isb) +nv_wr32 (dev,0x400500 , +nv_rd32 (dev,0x400500 ) | isb); +nv_wr32 (dev,0x400824 , +nv_rd32 (dev,0x400824 ) & ~(1 <<31 )); + } }nv_wr32 (dev,NV03_PMC_INTR_0 ,NV_PMC_INTR_0_PGRAPH_PENDING );
Signature · 1 line
1.6.6.1
A message that is not in the archive (sent off-list or not yet received): 1265049275-7680-2-git-send-email-madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 3/4 drm/nv50: avoid unloading pgraph context when ctxprog is running
- We need to disable pgraph fifo access before checking the current channel, otherwise we could still hit a running ctxprog.
- The writes to 0x400500 are already handled by pgraph->fifo_access and are therefore redundant, moreover pgraph fifo access should not be reenabled before current context is set as invalid. So remove them altogether.
--- drivers/gpu/drm/nouveau/nouveau_channel.c | 7 +++---- drivers/gpu/drm/nouveau/nv50_graph.c | 10 +++++++--- 2 files changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/nouveau/nouveau_channel.c +3 -4
@@ -278,12 +278,11 @@ nouveau_channel_free(struct nouveau_channel *chan)/* Ensure the channel is no longer active on the GPU */ pfifo->reassign (dev, false); -if (pgraph->channel (dev) == chan) { - pgraph->fifo_access (dev, false); + pgraph->fifo_access (dev, false); +if (pgraph->channel (dev) == chan) pgraph->unload_context (dev); - pgraph->fifo_access (dev, true); - } pgraph->destroy_context (chan); + pgraph->fifo_access (dev, true);if (pfifo->channel_id (dev) == chan->id) { pfifo->disable (dev);
drivers/gpu/drm/nouveau/nv50_graph.c +7 -3
@@ -165,6 +165,12 @@ nv50_graph_channel(struct drm_device *dev)uint32_t inst;int i; +/* Be sure we're not in the middle of a context switch or bad things +* will happen, such as unloading the wrong pgraph context. +*/ +if (!nv_wait (0x400300 ,0x00000001 ,0x00000000 )) +NV_ERROR (dev,"Ctxprog is still running\n" ); + inst =nv_rd32 (dev,NV50_PGRAPH_CTXCTL_CUR );if (!(inst &NV50_PGRAPH_CTXCTL_CUR_LOADED ))return NULL ;
@@ -275,7 +281,7 @@ nv50_graph_load_context(struct nouveau_channel *chan)int nv50_graph_unload_context (struct drm_device *dev) { -uint32_t inst, fifo =nv_rd32 (dev,0x400500 ); +uint32_t inst; inst =nv_rd32 (dev,NV50_PGRAPH_CTXCTL_CUR );if (!(inst &NV50_PGRAPH_CTXCTL_CUR_LOADED ))
@@ -283,12 +289,10 @@ nv50_graph_unload_context(struct drm_device *dev) inst &=NV50_PGRAPH_CTXCTL_CUR_INSTANCE ;nouveau_wait_for_idle (dev); -nv_wr32 (dev,0x400500 , fifo & ~1 );nv_wr32 (dev,0x400784 , inst);nv_wr32 (dev,0x400824 ,nv_rd32 (dev,0x400824 ) |0x20 );nv_wr32 (dev,0x400304 ,nv_rd32 (dev,0x400304 ) |0x01 );nouveau_wait_for_idle (dev); -nv_wr32 (dev,0x400500 , fifo);nv_wr32 (dev,NV50_PGRAPH_CTXCTL_CUR , inst);return 0 ;
Signature · 1 line
1.6.6.1
A message that is not in the archive (sent off-list or not yet received): 1265049275-7680-3-git-send-email-madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 4/4 drm/nv50: delete ramfc object after disabling fifo, not before
- ramfc is zero'ed upon destruction, so it's safer to do things in the right order.
--- drivers/gpu/drm/nouveau/nv50_fifo.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nv50_fifo.c +6 -3
@@ -317,17 +317,20 @@ void nv50_fifo_destroy_context(struct nouveau_channel *chan) {struct drm_device *dev = chan->dev; +struct nouveau_gpuobj_ref *ramfc = chan->ramfc;NV_DEBUG (dev,"ch%d\n" , chan->id); -nouveau_gpuobj_ref_del (dev, &chan->ramfc); -nouveau_gpuobj_ref_del (dev, &chan->cache); - +/* This will ensure the channel is seen as disabled. */ + chan->ramfc =NULL ;nv50_fifo_channel_disable (dev, chan->id, false);/* Dummy channel, also used on ch 127 */ if (chan->id ==0 )nv50_fifo_channel_disable (dev,127 , false); + +nouveau_gpuobj_ref_del (dev, &ramfc); +nouveau_gpuobj_ref_del (dev, &chan->cache); }int
Signature · 1 line
1.6.6.1
Re: [PATCH 3/4] drm/nv50: avoid unloading pgraph context when ctxprog is running
In reply to a message not in the archiveSomeone should probably check this out on earlier cards as well.
Quoted 75 lines · Maarten Maathuis
- We need to disable pgraph fifo access before checking the current channel, otherwise we could still hit a running ctxprog.
- The writes to0x400500are already handled bypgraph->fifo_accessand are therefore redundant, moreover pgraph fifo access should not be reenabled before current context is set as invalid. So remove them altogether.Signed-off-by Maarten Maathuis <[email protected]>---
drivers/gpu/drm/nouveau/nouveau_channel.c | 7 +++----drivers/gpu/drm/nouveau/nv50_graph.c| 10 +++++++---2 files changed, 10 insertions(+), 7 deletions(-)drivers/gpu/drm/nouveau/nouveau_channel.c +3
-4@@ -278,12 +278,11 @@ nouveau_channel_free(struct nouveau_channel *chan) /* Ensure the channel is no longer active on the GPU */ pfifo->reassign(dev, false); - if (pgraph->channel(dev) == chan) { - pgraph->fifo_access(dev, false); + pgraph->fifo_access(dev, false); + if (pgraph->channel(dev) == chan) pgraph->unload_context(dev); - pgraph->fifo_access(dev, true); - } pgraph->destroy_context(chan); + pgraph->fifo_access(dev, true); if (pfifo->channel_id(dev) == chan->id) { pfifo->disable(dev);drivers/gpu/drm/nouveau/nv50_graph.c +6
-0@@ -165,6 +165,12 @@ nv50_graph_channel(struct drm_device *dev) uint32_t inst; int i; + /* Be sure we're not in the middle of a context switch or bad things + * will happen, such as unloading the wrong pgraph context. + */ + if (!nv_wait(0x400300, 0x00000001, 0x00000000)) + NV_ERROR(dev, "Ctxprog is still running\n"); + inst = nv_rd32(dev, NV50_PGRAPH_CTXCTL_CUR); if (!(inst & NV50_PGRAPH_CTXCTL_CUR_LOADED)) return NULL;@@ -275,7 +281,7 @@ nv50_graph_load_context(struct nouveau_channel *chan)int
nv50_graph_unload_context(structdrm_device*dev) {
-uint32_tinst, fifo =nv_rd32(dev, 0x400500);
+uint32_tinst;inst =
nv_rd32(dev, NV50_PGRAPH_CTXCTL_CUR); if (!(inst &NV50_PGRAPH_CTXCTL_CUR_LOADED))drivers/gpu/drm/nouveau/nv50_graph.c +0
-3@@ -283,12 +289,10 @@ nv50_graph_unload_context(struct drm_device *dev) inst &= NV50_PGRAPH_CTXCTL_CUR_INSTANCE; nouveau_wait_for_idle(dev); - nv_wr32(dev, 0x400500, fifo & ~1); nv_wr32(dev, 0x400784, inst); nv_wr32(dev, 0x400824, nv_rd32(dev, 0x400824) | 0x20); nv_wr32(dev, 0x400304, nv_rd32(dev, 0x400304) | 0x01); nouveau_wait_for_idle(dev); - nv_wr32(dev, 0x400500, fifo); nv_wr32(dev, NV50_PGRAPH_CTXCTL_CUR, inst); return 0; --1.6.6.1
A message that is not in the archive (sent off-list or not yet received): 6d4bc9fc1002011040i538bda6o7f4eb24ac4a4579a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH 3/4] drm/nv50: avoid unloading pgraph context when ctxprog is running
If there are no objections, please share them as soon as possible.
Quoted 79 lines · Maarten Maathuis
Someone should probably check this out on earlier cards as well.
Quoted 75 lines · Maarten Maathuis
- We need to disable pgraph fifo access before checking the current channel, otherwise we could still hit a running ctxprog.
- The writes to0x400500are already handled bypgraph->fifo_accessand are therefore redundant, moreover pgraph fifo access should not be reenabled before current context is set as invalid. So remove them altogether.Signed-off-by Maarten Maathuis <[email protected]>---
drivers/gpu/drm/nouveau/nouveau_channel.c | 7 +++----drivers/gpu/drm/nouveau/nv50_graph.c| 10 +++++++---2 files changed, 10 insertions(+), 7 deletions(-)drivers/gpu/drm/nouveau/nouveau_channel.c +3
-4@@ -278,12 +278,11 @@ nouveau_channel_free(struct nouveau_channel *chan) /* Ensure the channel is no longer active on the GPU */ pfifo->reassign(dev, false); - if (pgraph->channel(dev) == chan) { - pgraph->fifo_access(dev, false); + pgraph->fifo_access(dev, false); + if (pgraph->channel(dev) == chan) pgraph->unload_context(dev); - pgraph->fifo_access(dev, true); - } pgraph->destroy_context(chan); + pgraph->fifo_access(dev, true); if (pfifo->channel_id(dev) == chan->id) { pfifo->disable(dev);drivers/gpu/drm/nouveau/nv50_graph.c +6
-0@@ -165,6 +165,12 @@ nv50_graph_channel(struct drm_device *dev) uint32_t inst; int i; + /* Be sure we're not in the middle of a context switch or bad things + * will happen, such as unloading the wrong pgraph context. + */ + if (!nv_wait(0x400300, 0x00000001, 0x00000000)) + NV_ERROR(dev, "Ctxprog is still running\n"); + inst = nv_rd32(dev, NV50_PGRAPH_CTXCTL_CUR); if (!(inst & NV50_PGRAPH_CTXCTL_CUR_LOADED)) return NULL;@@ -275,7 +281,7 @@ nv50_graph_load_context(struct nouveau_channel *chan)int
nv50_graph_unload_context(structdrm_device*dev) {
-uint32_tinst, fifo =nv_rd32(dev, 0x400500);
+uint32_tinst;inst =
nv_rd32(dev, NV50_PGRAPH_CTXCTL_CUR); if (!(inst &NV50_PGRAPH_CTXCTL_CUR_LOADED))drivers/gpu/drm/nouveau/nv50_graph.c +0
-3@@ -283,12 +289,10 @@ nv50_graph_unload_context(struct drm_device *dev) inst &= NV50_PGRAPH_CTXCTL_CUR_INSTANCE; nouveau_wait_for_idle(dev); - nv_wr32(dev, 0x400500, fifo & ~1); nv_wr32(dev, 0x400784, inst); nv_wr32(dev, 0x400824, nv_rd32(dev, 0x400824) | 0x20); nv_wr32(dev, 0x400304, nv_rd32(dev, 0x400304) | 0x01); nouveau_wait_for_idle(dev); - nv_wr32(dev, 0x400500, fifo); nv_wr32(dev, NV50_PGRAPH_CTXCTL_CUR, inst); return 0; --1.6.6.1
Re: [PATCH 2/4] drm/nv50: make the pgraph irq handler loop like the pre-nv50 version
In reply to a message not in the archiveI'm wondering if the write to 0x400824 should be outside the loop, since it's a flag blocking a ctxprog from continuing. Anyone know why this one wasn't looping but the pre-nv50 one is?
Quoted 173 lines · Maarten Maathuis
Signed-off-by Maarten Maathuis <[email protected]>---
drivers/gpu/drm/nouveau/nouveau_irq.c | 140 ++++++++++++++++++---------------1 files changed, 76 insertions(+), 64 deletions(-)drivers/gpu/drm/nouveau/nouveau_irq.c +0
-0@@ -580,83 +580,95 @@ nouveau_pgraph_irq_handler(struct drm_device *dev)static void
nv50_pgraph_irq_handler(structdrm_device*dev)
{
-uint32_tstatus, nsource;
+uint32_tstatus;- status =
nv_rd32(dev, NV03_PGRAPH_INTR);
- nsource =nv_rd32(dev, NV03_PGRAPH_NSOURCE);
+ while ((status =nv_rd32(dev, NV03_PGRAPH_INTR))) {
+uint32_tnsource =nv_rd32(dev, NV03_PGRAPH_NSOURCE);- if (status &
0x00000001) {
-nouveau_pgraph_intr_notify(dev, nsource);
- status &= ~0x00000001;
-nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000001);
- }
+ if (status &0x00000001) {
+nouveau_pgraph_intr_notify(dev, nsource);
+ status &= ~0x00000001;
+nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000001);
+ }- if (status &
0x00000010) {
- nouveau_pgraph_intr_error(dev, nsource |
-NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD);
+ if (status &0x00000010) {
+ nouveau_pgraph_intr_error(dev, nsource |
+NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD);- status &= ~0x00000010;
-nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000010);
- }
+ status &= ~0x00000010;
+nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000010);
+ }- if (status &
0x00001000) {
-nv_wr32(dev, 0x400500, 0x00000000);
-nv_wr32(dev, NV03_PGRAPH_INTR, NV_PGRAPH_INTR_CONTEXT_SWITCH);
- nv_wr32(dev,NV40_PGRAPH_INTR_EN, nv_rd32(dev,
-NV40_PGRAPH_INTR_EN) & ~NV_PGRAPH_INTR_CONTEXT_SWITCH);
-nv_wr32(dev, 0x400500, 0x00010001);
+ if (status &0x00001000) {
+nv_wr32(dev, 0x400500, 0x00000000);
+nv_wr32(dev, NV03_PGRAPH_INTR, NV_PGRAPH_INTR_CONTEXT_SWITCH);
+ nv_wr32(dev,NV40_PGRAPH_INTR_EN, nv_rd32(dev,
+NV40_PGRAPH_INTR_EN) & ~NV_PGRAPH_INTR_CONTEXT_SWITCH);
+nv_wr32(dev, 0x400500, 0x00010001);-
nv50_graph_context_switch(dev);
+nv50_graph_context_switch(dev);- status &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH;
- }
+ status &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH;
+ }- if (status &
0x00100000) {
- nouveau_pgraph_intr_error(dev, nsource |
-NV03_PGRAPH_NSOURCE_DATA_ERROR);
+ if (status &0x00100000) {
+ nouveau_pgraph_intr_error(dev, nsource |
+NV03_PGRAPH_NSOURCE_DATA_ERROR);- status &= ~0x00100000;
-nv_wr32(dev, NV03_PGRAPH_INTR, 0x00100000);
- }
+ status &= ~0x00100000;
+nv_wr32(dev, NV03_PGRAPH_INTR, 0x00100000);
+ }- if (status &
0x00200000) {
- int r;drivers/gpu/drm/nouveau/nouveau_irq.c +47
-33- - nouveau_pgraph_intr_error(dev, nsource | - NV03_PGRAPH_NSOURCE_PROTECTION_ERROR); - - NV_ERROR(dev, "magic set 1:\n"); - for (r = 0x408900; r <= 0x408910; r += 4) - NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, nv_rd32(dev, r)); - nv_wr32(dev, 0x408900, nv_rd32(dev, 0x408904) | 0xc0000000); - for (r = 0x408e08; r <= 0x408e24; r += 4) - NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, nv_rd32(dev, r)); - nv_wr32(dev, 0x408e08, nv_rd32(dev, 0x408e08) | 0xc0000000); - - NV_ERROR(dev, "magic set 2:\n"); - for (r = 0x409900; r <= 0x409910; r += 4) - NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, nv_rd32(dev, r)); - nv_wr32(dev, 0x409900, nv_rd32(dev, 0x409904) | 0xc0000000); - for (r = 0x409e08; r <= 0x409e24; r += 4) - NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, nv_rd32(dev, r)); - nv_wr32(dev, 0x409e08, nv_rd32(dev, 0x409e08) | 0xc0000000); - - status &= ~0x00200000; - nv_wr32(dev, NV03_PGRAPH_NSOURCE, nsource); - nv_wr32(dev, NV03_PGRAPH_INTR, 0x00200000); - } + if (status & 0x00200000) { + int r; + + nouveau_pgraph_intr_error(dev, nsource | + NV03_PGRAPH_NSOURCE_PROTECTION_ERROR); + + NV_ERROR(dev, "magic set 1:\n"); + for (r = 0x408900; r <= 0x408910; r += 4) + NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, + nv_rd32(dev, r)); + nv_wr32(dev, 0x408900, + nv_rd32(dev, 0x408904) | 0xc0000000); + for (r = 0x408e08; r <= 0x408e24; r += 4) + NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, + nv_rd32(dev, r)); + nv_wr32(dev, 0x408e08, + nv_rd32(dev, 0x408e08) | 0xc0000000); + + NV_ERROR(dev, "magic set 2:\n"); + for (r = 0x409900; r <= 0x409910; r += 4) + NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, + nv_rd32(dev, r)); + nv_wr32(dev, 0x409900, + nv_rd32(dev, 0x409904) | 0xc0000000); + for (r = 0x409e08; r <= 0x409e24; r += 4) + NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r, + nv_rd32(dev, r)); + nv_wr32(dev, 0x409e08, + nv_rd32(dev, 0x409e08) | 0xc0000000); + + status &= ~0x00200000; + nv_wr32(dev, NV03_PGRAPH_NSOURCE, nsource); + nv_wr32(dev, NV03_PGRAPH_INTR, 0x00200000); + } - if (status) { - NV_INFO(dev, "Unhandled PGRAPH_INTR - 0x%08x\n", status); - nv_wr32(dev, NV03_PGRAPH_INTR, status); - } + if (status) { + NV_INFO(dev, "Unhandled PGRAPH_INTR - 0x%08x\n", + status); + nv_wr32(dev, NV03_PGRAPH_INTR, status); + } - { - const int isb = (1 << 16) | (1 << 0); + { + const int isb = (1 << 16) | (1 << 0); - if ((nv_rd32(dev, 0x400500) & isb) != isb) - nv_wr32(dev, 0x400500, nv_rd32(dev, 0x400500) | isb); - nv_wr32(dev, 0x400824, nv_rd32(dev, 0x400824) & ~(1 << 31)); + if ((nv_rd32(dev, 0x400500) & isb) != isb) + nv_wr32(dev, 0x400500, + nv_rd32(dev, 0x400500) | isb); + nv_wr32(dev, 0x400824, + nv_rd32(dev, 0x400824) & ~(1 << 31)); + }}
nv_wr32(dev,
NV03_PMC_INTR_0,NV_PMC_INTR_0_PGRAPH_PENDING); --
1.6.6.1