Commit 835051d3 authored by Chris Wilson's avatar Chris Wilson

drm/i915/ringbuffer: Move irq seqno barrier to the GPU for gen5

The irq_seqno_barrier is a tradeoff between doing work on every request
(on the GPU) and doing work after every interrupt (on the CPU). We
presume we have many more requests than interrupts! However, for
Ironlake, the workaround is a pretty hideous usleep() and so even though
it was found we need to repeat the MI_STORE_DWORD_IMM 8 times, or about
1us of GPU time, doing so is preferrable than requiring a sleep of
125-250us on the CPU where we desire to respond immediately (ideally from
within the interrupt handler)!

The additional MI_STORE_DWORD_IMM also have the side-effect of flushing
MI operations from userspace which are not caught by MI_FLUSH!

Testcase: igt/gem_sync
Testcase: igt/gem_exec_whisper
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181228171641.16531-5-chris@chris-wilson.co.uk
parent 1212bd82
...@@ -881,26 +881,29 @@ static void i9xx_emit_breadcrumb(struct i915_request *rq, u32 *cs) ...@@ -881,26 +881,29 @@ static void i9xx_emit_breadcrumb(struct i915_request *rq, u32 *cs)
rq->tail = intel_ring_offset(rq, cs); rq->tail = intel_ring_offset(rq, cs);
assert_ring_tail_valid(rq->ring, rq->tail); assert_ring_tail_valid(rq->ring, rq->tail);
} }
static const int i9xx_emit_breadcrumb_sz = 6; static const int i9xx_emit_breadcrumb_sz = 6;
static void #define GEN5_WA_STORES 8 /* must be at least 1! */
gen5_seqno_barrier(struct intel_engine_cs *engine) static void gen5_emit_breadcrumb(struct i915_request *rq, u32 *cs)
{ {
/* MI_STORE are internally buffered by the GPU and not flushed int i;
* either by MI_FLUSH or SyncFlush or any other combination of
* MI commands. *cs++ = MI_FLUSH;
*
* "Only the submission of the store operation is guaranteed. BUILD_BUG_ON(GEN5_WA_STORES < 1);
* The write result will be complete (coherent) some time later for (i = 0; i < GEN5_WA_STORES; i++) {
* (this is practically a finite period but there is no guaranteed *cs++ = MI_STORE_DWORD_INDEX;
* latency)." *cs++ = I915_GEM_HWS_INDEX_ADDR;
* *cs++ = rq->global_seqno;
* Empirically, we observe that we need a delay of at least 75us to }
* be sure that the seqno write is visible by the CPU.
*/ *cs++ = MI_USER_INTERRUPT;
usleep_range(125, 250);
rq->tail = intel_ring_offset(rq, cs);
assert_ring_tail_valid(rq->ring, rq->tail);
} }
static const int gen5_emit_breadcrumb_sz = GEN5_WA_STORES * 3 + 2;
#undef GEN5_WA_STORES
static void static void
gen5_irq_enable(struct intel_engine_cs *engine) gen5_irq_enable(struct intel_engine_cs *engine)
...@@ -2148,7 +2151,6 @@ static void intel_ring_init_irq(struct drm_i915_private *dev_priv, ...@@ -2148,7 +2151,6 @@ static void intel_ring_init_irq(struct drm_i915_private *dev_priv,
} else if (INTEL_GEN(dev_priv) >= 5) { } else if (INTEL_GEN(dev_priv) >= 5) {
engine->irq_enable = gen5_irq_enable; engine->irq_enable = gen5_irq_enable;
engine->irq_disable = gen5_irq_disable; engine->irq_disable = gen5_irq_disable;
engine->irq_seqno_barrier = gen5_seqno_barrier;
} else if (INTEL_GEN(dev_priv) >= 3) { } else if (INTEL_GEN(dev_priv) >= 3) {
engine->irq_enable = i9xx_irq_enable; engine->irq_enable = i9xx_irq_enable;
engine->irq_disable = i9xx_irq_disable; engine->irq_disable = i9xx_irq_disable;
...@@ -2191,6 +2193,10 @@ static void intel_ring_default_vfuncs(struct drm_i915_private *dev_priv, ...@@ -2191,6 +2193,10 @@ static void intel_ring_default_vfuncs(struct drm_i915_private *dev_priv,
engine->emit_breadcrumb = i9xx_emit_breadcrumb; engine->emit_breadcrumb = i9xx_emit_breadcrumb;
engine->emit_breadcrumb_sz = i9xx_emit_breadcrumb_sz; engine->emit_breadcrumb_sz = i9xx_emit_breadcrumb_sz;
if (IS_GEN(dev_priv, 5)) {
engine->emit_breadcrumb = gen5_emit_breadcrumb;
engine->emit_breadcrumb_sz = gen5_emit_breadcrumb_sz;
}
engine->set_default_submission = i9xx_set_default_submission; engine->set_default_submission = i9xx_set_default_submission;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment