drm/i915: PIPE_CONTROL TLB invalidation fix
Subsystems (2)
PATCH 1/1 drm/i915: PIPE_CONTROL TLB invalidation fix
The IVB simulator really doesn't like a TLB invalidate with no post-sync operation, in fact it blows up in an assertion failure. The documentation states that we must issue the TLB invalidate with a CS
stall: "Also Requires stall bit ([20] of DW1) set." This patch doesn't comply with the docs, but we're able to satisfy the simulator with this very small change, and I think simulator has historically trumped docs.
Note, I don't think this belongs in stable as our TLB invalidation should be correct since we use the global invalidation per batch. Using TLB invalidation is itself only a requirement of HW contexts.
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +7 -3
@@ -198,8 +198,12 @@ intel_emit_post_sync_nonzero_flush(struct intel_ring_buffer *ring)if (ret)return ret; +/* NOTE: we want the TLB invalidate for render ring flush, but it must +* be sent with a non-zero post sync op. So it can be stuffed in here +* for convenience. +*/ intel_ring_emit (ring,GFX_OP_PIPE_CONTROL (5 )); -intel_ring_emit (ring,PIPE_CONTROL_QW_WRITE ); +intel_ring_emit (ring,PIPE_CONTROL_QW_WRITE |PIPE_CONTROL_TLB_INVALIDATE );intel_ring_emit (ring, scratch_addr |PIPE_CONTROL_GLOBAL_GTT );/* address */ intel_ring_emit (ring,0 );intel_ring_emit (ring,0 );
@@ -225,10 +229,10 @@ gen6_render_ring_flush(struct intel_ring_buffer *ring,/* Just flush everything. Experiments have shown that reducing the * number of bits based on the write domains has little performance -* impact. +* impact. Note to copy/pasters: the TLB invlidate we want is tucked +* into intel_emit_post_sync_nonzero_flush(). */ flags |=PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH ; - flags |=PIPE_CONTROL_TLB_INVALIDATE ; flags |=PIPE_CONTROL_INSTRUCTION_CACHE_INVALIDATE ; flags |=PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE ; flags |=PIPE_CONTROL_DEPTH_CACHE_FLUSH ;
Signature · 1 line
1.7.11.3
Quoted 7 lines · Ben Widawsky
The IVB simulator really doesn't like a TLB invalidate with no post-sync operation, in fact it blows up in an assertion failure. The documentation states that we must issue the TLB invalidate with a CS
stall: "Also Requires stall bit ([20] of DW1) set." This patch doesn't comply with the docs, but we're able to satisfy the simulator with this very small change, and I think simulator has historically trumped docs.
Quoted 5 lines
Note, I don't think this belongs in stable as our TLB invalidation should be correct since we use the global invalidation per batch. Using TLB invalidation is itself only a requirement of HW contexts.
Signed-off-by Ben Widawsky <[email protected]>
I have another patch from Chris that kills the non-zero post-sync op workaround for ivb ... So I guess we can't do this this easily. -Daniel
Quoted 42 lines
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_ringbuffer.c +7
-3@@ -198,8 +198,12 @@ intel_emit_post_sync_nonzero_flush(struct intel_ring_buffer *ring)if (ret)return ret; +/* NOTE: we want the TLB invalidate for render ring flush, but it must +* be sent with a non-zero post sync op. So it can be stuffed in here +* for convenience. +*/ intel_ring_emit (ring,GFX_OP_PIPE_CONTROL (5 )); -intel_ring_emit (ring,PIPE_CONTROL_QW_WRITE ); +intel_ring_emit (ring,PIPE_CONTROL_QW_WRITE |PIPE_CONTROL_TLB_INVALIDATE );intel_ring_emit (ring, scratch_addr |PIPE_CONTROL_GLOBAL_GTT );/* address */ intel_ring_emit (ring,0 );intel_ring_emit (ring,0 );@@ -225,10 +229,10 @@ gen6_render_ring_flush(struct intel_ring_buffer *ring,/* Just flush everything. Experiments have shown that reducing the * number of bits based on the write domains has little performance -* impact. +* impact. Note to copy/pasters: the TLB invlidate we want is tucked +* into intel_emit_post_sync_nonzero_flush(). */ flags |=PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH ; - flags |=PIPE_CONTROL_TLB_INVALIDATE ; flags |=PIPE_CONTROL_INSTRUCTION_CACHE_INVALIDATE ; flags |=PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE ; flags |=PIPE_CONTROL_DEPTH_CACHE_FLUSH ;Signature · 6 lines
1.7.11.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Quoted 13 lines · On Fri, 27 Jul 2012 07:17:36 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 12 lines · Ben Widawsky
The IVB simulator really doesn't like a TLB invalidate with no post-sync operation, in fact it blows up in an assertion failure. The documentation states that we must issue the TLB invalidate with a CS stall: "Also Requires stall bit ([20] of DW1) set." This patch doesn't comply with the docs, but we're able to satisfy the simulator with this very small change, and I think simulator has historically trumped docs.
Note, I don't think this belongs in stable as our TLB invalidation should be correct since we use the global invalidation per batch. Using TLB invalidation is itself only a requirement of HW contexts.
Quoted 5 lines
Quoted 1 line
Signed-off-by Ben Widawsky <[email protected]>I have another patch from Chris that kills the non-zero post-sync op workaround for ivb ... So I guess we can't do this this easily. -Daniel
Rethink this. The need to emit the TLB invalidation as the simulator dictates essentially means we cannot remove the workaround as Chris' patch does.
Quoted 48 lines
Quoted 47 lines
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/intel_ringbuffer.cindex c58f1b9..339712a 100644 ---a/drivers/gpu/drm/i915/intel_ringbuffer.c+++b/drivers/gpu/drm/i915/intel_ringbuffer.cdrivers/gpu/drm/i915/intel_ringbuffer.c +1
-0@@ -198,8 +198,12 @@ intel_emit_post_sync_nonzero_flush(struct intel_ring_buffer *ring) if (ret)return ret; +/* NOTE: we want the TLB invalidate for render ring flush, but it must
(quoted diff) +1
-0+ * be sent with a non-zero post sync op. So it can bestuffed in here
drivers/gpu/drm/i915/intel_ringbuffer.c +3
-1+* for convenience. +*/ intel_ring_emit (ring,GFX_OP_PIPE_CONTROL (5 )); -intel_ring_emit (ring,PIPE_CONTROL_QW_WRITE ); + intel_ring_emit(ring, PIPE_CONTROL_QW_WRITE |
PIPE_CONTROL_TLB_INVALIDATE);intel_ring_emit(ring, scratch_addr | PIPE_CONTROL_GLOBAL_GTT); /* address */intel_ring_emit(ring, 0);(quoted diff) +0
-0intel_ring_emit(ring, 0);@@ -225,10 +229,10 @@ gen6_render_ring_flush(struct intel_ring_buffer *ring, /* Just flush everything. Experiments have shown thatreducing the
* number of bits based on the write domains has little
performance(quoted diff) +1
-1- * impact. + * impact. Note to copy/pasters: the TLB invlidate we wantis tucked
drivers/gpu/drm/i915/intel_ringbuffer.c +1
-1+* into intel_emit_post_sync_nonzero_flush(). */ flags |=PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH ; - flags |=PIPE_CONTROL_TLB_INVALIDATE ; flags |=PIPE_CONTROL_INSTRUCTION_CACHE_INVALIDATE ; flags |=PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE ; flags |=PIPE_CONTROL_DEPTH_CACHE_FLUSH ;Signature · 6 lines
1.7.11.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
Quoted 18 lines · Ben Widawsky
Quoted 15 lines · On Fri, 27 Jul 2012 07:17:36 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 13 lines · Ben Widawsky
The IVB simulator really doesn't like a TLB invalidate with no post-sync operation, in fact it blows up in an assertion failure. The documentation states that we must issue the TLB invalidate with a CS stall: "Also Requires stall bit ([20] of DW1) set." This patch doesn't comply with the docs, but we're able to satisfy the simulator with this very small change, and I think simulator has historically trumped docs.
Note, I don't think this belongs in stable as our TLB invalidation should be correct since we use the global invalidation per batch. Using TLB invalidation is itself only a requirement of HW contexts.
Signed-off-by Ben Widawsky <[email protected]>
Quoted 7 lines
Quoted 3 lines
I have another patch from Chris that kills the non-zero post-sync op workaround for ivb ... So I guess we can't do this this easily. -Daniel
Rethink this. The need to emit the TLB invalidation as the simulator dictates essentially means we cannot remove the workaround as Chris' patch does.
Afaik that "tlb needs a non-zero post-sync op" just means that we need to have a non-zero post-sync op in the pipe_control cmd with the tlb set. Whereas the gen6 wa dictatest that we need a nonzero postsync op _before_ the pipe_control that sets the render flush bit. So I'm still playing the dense here and don't see the connection (besides that we can abuse the w/a nonzero postsync op to also make the tlb flush happy).
So can't we just set add w/a nonzeor postsync op for gen7 to make the simulator happy?
-Daniel
Signature · 2 lines
Daniel Vetter [email protected] - +41 (0) 79 364 57 48 - http://blog.ffwll.ch
Quoted 39 lines · Daniel Vetter
Quoted 22 lines · Ben Widawsky
Quoted 19 lines · On Fri, 27 Jul 2012 07:17:36 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 3 lines · Ben Widawsky
The IVB simulator really doesn't like a TLB invalidate with no post-sync operation, in fact it blows up in an assertion failure. The documentation states that we must issue the TLB invalidate
with
Quoted 1 line
a CS stall: "Also Requires stall bit ([20] of DW1) set." This
patch
Quoted 5 lines
doesn't comply with the docs, but we're able to satisfy the simulator with this very small change, and I think simulator has historically trumped docs.
Note, I don't think this belongs in stable as our TLB
invalidation
Quoted 2 lines
should be correct since we use the global invalidation per batch. Using TLB invalidation is itself only a requirement of HW
contexts.
Quoted 2 lines
Signed-off-by Ben Widawsky <[email protected]>Quoted 7 lines
Quoted 3 lines
I have another patch from Chris that kills the non-zero post-sync op workaround for ivb ... So I guess we can't do this this easily. -Daniel
Rethink this. The need to emit the TLB invalidation as the simulator dictates essentially means we cannot remove the workaround as Chris' patch does.
Afaik that "tlb needs a non-zero post-sync op" just means that we need to have a non-zero post-sync op in the
pipe_controlcmd with the tlb set. Whereas the gen6 wa dictatest that we need a nonzero postsync op _before_ thepipe_controlthat sets the render flush bit. So I'm still playing the dense here and don't see the connection (besides that we can abuse the w/a nonzero postsync op to also make the tlb flush happy).
Quoted 3 lines
So can't we just set add w/a nonzeor postsync op for gen7 to make the simulator happy?
-Daniel
That is certainly a possibility. I'll double check the bspec or simulator before I submit anything though. I'd like to make sure this doesn't break some other rule. For some reason I was under the assumption that we couldn't just emit a post sync op without several workarounds even on gen7...
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center