drm/nv50: Make ctxprog wait until interrupt handler is done.
Subsystems (3)
PATCH 1/2 drm/nv50: Make ctxprog wait until interrupt handler is done.
This will fix races between generated ctxprogs and interrupt handler.
--- drivers/gpu/drm/nouveau/nv50_grctx.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/gpu/drm/nouveau/nv50_grctx.c +5 -0
@@ -64,6 +64,9 @@#define CP_FLAG_ALWAYS ((2 * 32) + 13)#define CP_FLAG_ALWAYS_FALSE 0#define CP_FLAG_ALWAYS_TRUE 1 +#define CP_FLAG_INTR ((2 * 32) + 15) +#define CP_FLAG_INTR_NOT_PENDING 0 +#define CP_FLAG_INTR_PENDING 1#define CP_CTX 0x00100000#define CP_CTX_COUNT 0x000f0000
@@ -214,6 +217,8 @@ nv50_grctx_init(struct nouveau_grctx *ctx)cp_name (ctx, cp_setup_save);cp_set (ctx,UNK1D ,SET );cp_wait (ctx,STATUS ,BUSY ); +cp_wait (ctx,INTR ,PENDING ); +cp_bra (ctx,STATUS ,BUSY , cp_setup_save);cp_set (ctx,UNK01 ,SET );cp_set (ctx,SWAP_DIRECTION ,SAVE );
Signature · 6 lines
1.6.4.1 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 1267400739-528-1-git-send-email-koriakin-mP9o5jsk0RY@public.gmane.org
PATCH 2/2 drm/nv50: Improve PGRAPH interrupt handling.
This makes nouveau recognise and report more kinds of PGRAPH errors, as well as prevent GPU lockups resulting from some of them.
Lots of guesswork was involved and some part of this is probably incorrect. Some potential-lockuop situations are handled by just resetting a whole PGRAPH subunit, which doesn't sound like a "proper" solution, but seems to work just fine... for now.
--- drivers/gpu/drm/nouveau/Makefile | 2 +- drivers/gpu/drm/nouveau/nouveau_drv.h | 4 + drivers/gpu/drm/nouveau/nouveau_irq.c | 598 ++++++++++++++++++++++++++++--- drivers/gpu/drm/nouveau/nouveau_state.c | 4 +- drivers/gpu/drm/nouveau/nv50_fb.c | 31 ++ drivers/gpu/drm/nouveau/nv50_graph.c | 16 + drivers/gpu/drm/nouveau/nv50_grctx.c | 8 +- 7 files changed, 608 insertions(+), 55 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/nv50_fb.c
drivers/gpu/drm/nouveau/Makefile +1 -1
@@ -12,7 +12,7 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \ nouveau_dp.o nouveau_grctx.o \ nv04_timer.o \ nv04_mc.o nv40_mc.o nv50_mc.o \ - nv04_fb.o nv10_fb.o nv40_fb.o \ + nv04_fb.o nv10_fb.o nv40_fb.o nv50_fb.o \ nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o \ nv04_graph.o nv10_graph.o nv20_graph.o \ nv40_graph.o nv50_graph.o \
drivers/gpu/drm/nouveau/nouveau_drv.h +4 -0
@@ -930,6 +930,10 @@ extern void nv40_fb_takedown(struct drm_device *);extern void nv40_fb_set_region_tiling (struct drm_device *,int ,uint32_t ,uint32_t ,uint32_t ); +/* nv50_fb.c */ +extern int nv50_fb_init (struct drm_device *); +extern void nv50_fb_takedown (struct drm_device *); +/* nv04_fifo.c */ extern int nv04_fifo_init (struct drm_device *);extern void nv04_fifo_disable (struct drm_device *);
drivers/gpu/drm/nouveau/nouveau_irq.c +550 -48
653 lines not on this page · raw message
drivers/gpu/drm/nouveau/nouveau_state.c +2 -2
@@ -276,8 +276,8 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) engine->timer.init = nv04_timer_init; engine->timer.read = nv04_timer_read; engine->timer.takedown = nv04_timer_takedown; - engine->fb.init = nouveau_stub_init; - engine->fb.takedown = nouveau_stub_takedown; + engine->fb.init = nv50_fb_init; + engine->fb.takedown = nv50_fb_takedown; engine->graph.grclass = nv50_graph_grclass; engine->graph.init = nv50_graph_init; engine->graph.takedown = nv50_graph_takedown;
drivers/gpu/drm/nouveau/nv50_fb.c new file +31 -0
@@ -0,0 +1,31 @@ +#include "drmP.h" +#include "drm.h" +#include "nouveau_drv.h" +#include "nouveau_drm.h" + +int +nv50_fb_init (struct drm_device *dev) +{ +/* This is needed to get meaningful information from 100c90 +* on traps. No idea what these values mean exactly. */ +struct drm_nouveau_private *dev_priv = dev->dev_private; + +switch (dev_priv->chipset) { +case 0x50 : +nv_wr32 (dev,0x100c90 ,0x0707ff ); +break ; +case 0xa5 : +case 0xa8 : +nv_wr32 (dev,0x100c90 ,0x1d07ff ); +break ; +default : +nv_wr32 (dev,0x100c90 ,0x0d0fff ); +break ; + } +return 0 ; +} + +void +nv50_fb_takedown (struct drm_device *dev) +{ +}
drivers/gpu/drm/nouveau/nv50_graph.c +16 -0
@@ -56,6 +56,10 @@ nv50_graph_init_intr(struct drm_device *dev)static void nv50_graph_init_regs__nv (struct drm_device *dev) { +struct drm_nouveau_private *dev_priv = dev->dev_private; +uint32_t units =nv_rd32 (dev,0x1540 ); +int i; +NV_DEBUG (dev,"\n" );nv_wr32 (dev,0x400804 ,0xc0000000 );
@@ -65,6 +69,18 @@ nv50_graph_init_regs__nv(struct drm_device *dev)nv_wr32 (dev,0x405018 ,0xc0000000 );nv_wr32 (dev,0x402000 ,0xc0000000 ); +for (i =0 ; i <16 ; i++) +if (units &1 << i) +if (dev_priv->chipset <0xa0 ) { +nv_wr32 (dev,0x408900 + (i <<12 ),0xc0000000 ); +nv_wr32 (dev,0x408e08 + (i <<12 ),0xc0000000 ); +nv_wr32 (dev,0x408314 + (i <<12 ),0xc0000000 ); + }else { +nv_wr32 (dev,0x408600 + (i <<11 ),0xc0000000 ); +nv_wr32 (dev,0x408708 + (i <<11 ),0xc0000000 ); +nv_wr32 (dev,0x40831c + (i <<11 ),0xc0000000 ); + } +nv_wr32 (dev,0x400108 ,0xffffffff );nv_wr32 (dev,0x400824 ,0x00004000 );
drivers/gpu/drm/nouveau/nv50_grctx.c +4 -4
@@ -274,7 +274,7 @@ nv50_graph_construct_mmio(struct nouveau_grctx *ctx)int offset, base;uint32_t units =nv_rd32 (ctx->dev,0x1540 ); -/* 0800 */ +/* 0800: DISPATCH */ cp_ctx (ctx,0x400808 ,7 );gr_def (ctx,0x400814 ,0x00000030 );cp_ctx (ctx,0x400834 ,0x32 );
@@ -305,7 +305,7 @@ nv50_graph_construct_mmio(struct nouveau_grctx *ctx)gr_def (ctx,0x400b20 ,0x0001629d ); } -/* 0C00 */ +/* 0C00: VFETCH */ cp_ctx (ctx,0x400c08 ,0x2 );gr_def (ctx,0x400c08 ,0x0000fe0c );
@@ -331,7 +331,7 @@ nv50_graph_construct_mmio(struct nouveau_grctx *ctx)cp_ctx (ctx,0x401540 ,0x5 );gr_def (ctx,0x401550 ,0x00001018 ); -/* 1800 */ +/* 1800: STREAMOUT */ cp_ctx (ctx,0x401814 ,0x1 );gr_def (ctx,0x401814 ,0x000000ff );if (dev_priv->chipset ==0x50 ) {
@@ -646,7 +646,7 @@ nv50_graph_construct_mmio(struct nouveau_grctx *ctx)if (dev_priv->chipset ==0x50 )cp_ctx (ctx,0x4063e0 ,0x1 ); -/* 6800 */ +/* 6800: M2MF */ if (dev_priv->chipset <0x90 ) {cp_ctx (ctx,0x406814 ,0x2b );gr_def (ctx,0x406818 ,0x00000f80 );
Signature · 6 lines
1.6.4.1 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 1267400739-528-2-git-send-email-koriakin-mP9o5jsk0RY@public.gmane.org
Re: [PATCH 2/2] drm/nv50: Improve PGRAPH interrupt handling.
Register 0x402000 is used by nv40 to acknowledge DMA_VTX_PROTECTION (see code), which is caused by out-of-bounds indices in index buffers (and perhaps other vertex-related stuff): maybe it does something similar on nv50.
Also, wouldn't some of this apply to pre-nv50 too? Or is that already implemented?
A message that is not in the archive (sent off-list or not yet received): ff13bc9a1003010526t7b33e893ma4d6a774b49c5085-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH 2/2] drm/nv50: Improve PGRAPH interrupt handling.
Quoted 4 lines
Register
0x402000is used by nv40 to acknowledgeDMA_VTX_PROTECTION(see code), which is caused by out-of-bounds indices in index buffers (and perhaps other vertex-related stuff): maybe it does something similar on nv50.
No. Pre-NV50 traps are totally different than NV50. Trap registers like 400200 take 0xc0000000 to ACK, not writing back the same value. Also, vertex fetches cause trap at 0x400c04 which we already handle, and index buffers are handled by PFIFO [better PFIFO error handling would be much appreciated, but that's best left for another patch].
0x402000 is pretty much certain to work just like 0x400c04, 0x401800, 0x405018, 0x406800 registers, just apply to a different subunit of PGRAPH accessing memory. Since DMA slots mostly have a many-to-one relationship to the trap-reporting PGRAPH subunits [with exception of m2mf's DMA_NOTIFY which is accessed by both DISPATCH for normal notifies and M2MF for buffer notifies], it's likely that it corresponds to that last unknown DMA slot on NV50TCL [as I mentioned in code]. So to RE it, you'd first need to figure out the NV50TCL bits... does anyone know of any type of memory buffer that GPUs use and isn't yet covered by what's in renouveau.xml?
Quoted 2 lines
Also, wouldn't some of this apply to pre-nv50 too? Or is that already implemented?
Mostly no, since the interrupts are much different... the major fault of previous code was assuming that nv50 is just a bigger nv40 and trying to fit stuff forcefully by faking nsource/nstatus. Also, pre-NV50 DISPATCH unit either doesn't exist, or is very different.
Two things that pre-NV50 could get that I know of are MISSING_HW interrupt [0x10, happens for some methods in 0x200-0x20c range on some objects] and SINGLE_STEP interrupt [not that important, since nouveau gives you no way yet to enable single stepping sans manually poking PGRAPH_DEBUG_3].
I fear that pre-NV50 simply needs its own long RE session to make nouveau decode interrupts in as much detail as NV50. I'd recommend taking a look at rules.xml, it should be very relevant at least for NV10-NV30, if not also NV40.
Oh, and a nice thing to do would be decoding 0x400700 bits and displaying them along with the error. Maybe something useful information could come out of it.
Marcin Kościelnicki
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau