Commit 61a05870 authored by Chris Wilson's avatar Chris Wilson Committed by Jani Nikula

drm/i915: Reset the breadcrumbs IRQ more carefully

Along with the interrupt, we want to restore the fake-irq and
wait-timeout detection. If we use the breadcrumbs interface to setup the
interrupt as it wants, the auxiliary timers will also be restored.

v2: Cancel both timers as well, sanitize the IMR.

Fixes: 821ed7df ("drm/i915: Update reset path to fix incomplete requests")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161007065327.24515-3-chris@chris-wilson.co.uk
(cherry picked from commit ad07dfcd)
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent c92fa4fe
...@@ -578,6 +578,36 @@ int intel_engine_init_breadcrumbs(struct intel_engine_cs *engine) ...@@ -578,6 +578,36 @@ int intel_engine_init_breadcrumbs(struct intel_engine_cs *engine)
return 0; return 0;
} }
static void cancel_fake_irq(struct intel_engine_cs *engine)
{
struct intel_breadcrumbs *b = &engine->breadcrumbs;
del_timer_sync(&b->hangcheck);
del_timer_sync(&b->fake_irq);
clear_bit(engine->id, &engine->i915->gpu_error.missed_irq_rings);
}
void intel_engine_reset_breadcrumbs(struct intel_engine_cs *engine)
{
struct intel_breadcrumbs *b = &engine->breadcrumbs;
cancel_fake_irq(engine);
spin_lock(&b->lock);
__intel_breadcrumbs_disable_irq(b);
if (intel_engine_has_waiter(engine)) {
b->timeout = wait_timeout();
__intel_breadcrumbs_enable_irq(b);
if (READ_ONCE(b->irq_posted))
wake_up_process(b->first_wait->tsk);
} else {
/* sanitize the IMR and unmask any auxiliary interrupts */
irq_disable(engine);
}
spin_unlock(&b->lock);
}
void intel_engine_fini_breadcrumbs(struct intel_engine_cs *engine) void intel_engine_fini_breadcrumbs(struct intel_engine_cs *engine)
{ {
struct intel_breadcrumbs *b = &engine->breadcrumbs; struct intel_breadcrumbs *b = &engine->breadcrumbs;
...@@ -585,8 +615,7 @@ void intel_engine_fini_breadcrumbs(struct intel_engine_cs *engine) ...@@ -585,8 +615,7 @@ void intel_engine_fini_breadcrumbs(struct intel_engine_cs *engine)
if (!IS_ERR_OR_NULL(b->signaler)) if (!IS_ERR_OR_NULL(b->signaler))
kthread_stop(b->signaler); kthread_stop(b->signaler);
del_timer_sync(&b->hangcheck); cancel_fake_irq(engine);
del_timer_sync(&b->fake_irq);
} }
unsigned int intel_kick_waiters(struct drm_i915_private *i915) unsigned int intel_kick_waiters(struct drm_i915_private *i915)
......
...@@ -210,9 +210,6 @@ void intel_engine_init_seqno(struct intel_engine_cs *engine, u32 seqno) ...@@ -210,9 +210,6 @@ void intel_engine_init_seqno(struct intel_engine_cs *engine, u32 seqno)
void intel_engine_init_hangcheck(struct intel_engine_cs *engine) void intel_engine_init_hangcheck(struct intel_engine_cs *engine)
{ {
memset(&engine->hangcheck, 0, sizeof(engine->hangcheck)); memset(&engine->hangcheck, 0, sizeof(engine->hangcheck));
clear_bit(engine->id, &engine->i915->gpu_error.missed_irq_rings);
if (intel_engine_has_waiter(engine))
i915_queue_hangcheck(engine->i915);
} }
static void intel_engine_init_requests(struct intel_engine_cs *engine) static void intel_engine_init_requests(struct intel_engine_cs *engine)
...@@ -307,18 +304,6 @@ int intel_engine_init_common(struct intel_engine_cs *engine) ...@@ -307,18 +304,6 @@ int intel_engine_init_common(struct intel_engine_cs *engine)
return 0; return 0;
} }
void intel_engine_reset_irq(struct intel_engine_cs *engine)
{
struct drm_i915_private *dev_priv = engine->i915;
spin_lock_irq(&dev_priv->irq_lock);
if (intel_engine_has_waiter(engine))
engine->irq_enable(engine);
else
engine->irq_disable(engine);
spin_unlock_irq(&dev_priv->irq_lock);
}
/** /**
* intel_engines_cleanup_common - cleans up the engine state created by * intel_engines_cleanup_common - cleans up the engine state created by
* the common initiailizers. * the common initiailizers.
......
...@@ -1235,7 +1235,7 @@ static int gen8_init_common_ring(struct intel_engine_cs *engine) ...@@ -1235,7 +1235,7 @@ static int gen8_init_common_ring(struct intel_engine_cs *engine)
lrc_init_hws(engine); lrc_init_hws(engine);
intel_engine_reset_irq(engine); intel_engine_reset_breadcrumbs(engine);
I915_WRITE(RING_HWSTAM(engine->mmio_base), 0xffffffff); I915_WRITE(RING_HWSTAM(engine->mmio_base), 0xffffffff);
......
...@@ -564,7 +564,7 @@ static int init_ring_common(struct intel_engine_cs *engine) ...@@ -564,7 +564,7 @@ static int init_ring_common(struct intel_engine_cs *engine)
else else
intel_ring_setup_status_page(engine); intel_ring_setup_status_page(engine);
intel_engine_reset_irq(engine); intel_engine_reset_breadcrumbs(engine);
/* Enforce ordering by reading HEAD register back */ /* Enforce ordering by reading HEAD register back */
I915_READ_HEAD(engine); I915_READ_HEAD(engine);
......
...@@ -493,7 +493,6 @@ int __intel_ring_space(int head, int tail, int size); ...@@ -493,7 +493,6 @@ int __intel_ring_space(int head, int tail, int size);
void intel_ring_update_space(struct intel_ring *ring); void intel_ring_update_space(struct intel_ring *ring);
void intel_engine_init_seqno(struct intel_engine_cs *engine, u32 seqno); void intel_engine_init_seqno(struct intel_engine_cs *engine, u32 seqno);
void intel_engine_reset_irq(struct intel_engine_cs *engine);
void intel_engine_setup_common(struct intel_engine_cs *engine); void intel_engine_setup_common(struct intel_engine_cs *engine);
int intel_engine_init_common(struct intel_engine_cs *engine); int intel_engine_init_common(struct intel_engine_cs *engine);
...@@ -585,6 +584,7 @@ static inline bool intel_engine_wakeup(const struct intel_engine_cs *engine) ...@@ -585,6 +584,7 @@ static inline bool intel_engine_wakeup(const struct intel_engine_cs *engine)
return wakeup; return wakeup;
} }
void intel_engine_reset_breadcrumbs(struct intel_engine_cs *engine);
void intel_engine_fini_breadcrumbs(struct intel_engine_cs *engine); void intel_engine_fini_breadcrumbs(struct intel_engine_cs *engine);
unsigned int intel_kick_waiters(struct drm_i915_private *i915); unsigned int intel_kick_waiters(struct drm_i915_private *i915);
unsigned int intel_kick_signalers(struct drm_i915_private *i915); unsigned int intel_kick_signalers(struct drm_i915_private *i915);
......
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