intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915/execlists: Clear STOP_RING bit before restoring the context
@ 2018-08-14 13:58 Chris Wilson
  2018-08-14 13:58 ` [PATCH 2/2] drm/i915/execlists: Refind the active request before resetting Chris Wilson
  2018-08-14 15:12 ` ✗ Fi.CI.BAT: failure for series starting with [1/2] drm/i915/execlists: Clear STOP_RING bit before restoring the context Patchwork
  0 siblings, 2 replies; 6+ messages in thread
From: Chris Wilson @ 2018-08-14 13:58 UTC (permalink / raw)
  To: intel-gfx

Before a reset, we set the STOP_RING bit of RING_MI_MODE to freeze the
engine. However, sometimes we observe that upon restart, the engine
freezes again with the STOP_RING bit still asserted. By inspection, we
know that the register itself is cleared by the GPU reset, so that bit
must be preserved inside the context image and reloaded from there. A
simple fix (as the RING_MI_MODE is at a fixed offset in a valid context)
is to clobber the STOP_RING bit inside the image before replaying the
request.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_lrc.c     | 17 +++++++++++++++--
 drivers/gpu/drm/i915/intel_lrc_reg.h |  2 ++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 3f90c74038ef..37fe842de639 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1918,6 +1918,20 @@ static void execlists_reset(struct intel_engine_cs *engine,
 
 	spin_unlock_irqrestore(&engine->timeline.lock, flags);
 
+	if (!request)
+		return;
+
+	regs = request->hw_context->lrc_reg_state;
+
+	/*
+	 * After a reset, the context may have preserved the STOP bit
+	 * of RING_MI_MODE we used to freeze the active engine before
+	 * the reset. If that bit is restored the ring stops instead
+	 * of being executed.
+	 */
+	regs[CTX_MI_MODE + 1] |= STOP_RING << 16;
+	regs[CTX_MI_MODE + 1] &= ~STOP_RING;
+
 	/*
 	 * If the request was innocent, we leave the request in the ELSP
 	 * and will try to replay it on restarting. The context image may
@@ -1929,7 +1943,7 @@ static void execlists_reset(struct intel_engine_cs *engine,
 	 * and have to at least restore the RING register in the context
 	 * image back to the expected values to skip over the guilty request.
 	 */
-	if (!request || request->fence.error != -EIO)
+	if (request->fence.error != -EIO)
 		return;
 
 	/*
@@ -1940,7 +1954,6 @@ static void execlists_reset(struct intel_engine_cs *engine,
 	 * future request will be after userspace has had the opportunity
 	 * to recreate its own state.
 	 */
-	regs = request->hw_context->lrc_reg_state;
 	if (engine->pinned_default_state) {
 		memcpy(regs, /* skip restoring the vanilla PPHWSP */
 		       engine->pinned_default_state + LRC_STATE_PN * PAGE_SIZE,
diff --git a/drivers/gpu/drm/i915/intel_lrc_reg.h b/drivers/gpu/drm/i915/intel_lrc_reg.h
index 5ef932d810a7..3b155ecbfa92 100644
--- a/drivers/gpu/drm/i915/intel_lrc_reg.h
+++ b/drivers/gpu/drm/i915/intel_lrc_reg.h
@@ -39,6 +39,8 @@
 #define CTX_R_PWR_CLK_STATE		0x42
 #define CTX_END				0x44
 
+#define CTX_MI_MODE			0x54
+
 #define CTX_REG(reg_state, pos, reg, val) do { \
 	u32 *reg_state__ = (reg_state); \
 	const u32 pos__ = (pos); \
-- 
2.18.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-08-14 19:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-14 13:58 [PATCH 1/2] drm/i915/execlists: Clear STOP_RING bit before restoring the context Chris Wilson
2018-08-14 13:58 ` [PATCH 2/2] drm/i915/execlists: Refind the active request before resetting Chris Wilson
2018-08-14 14:12   ` [PATCH] " Chris Wilson
2018-08-14 14:49   ` ✓ Fi.CI.BAT: success for " Patchwork
2018-08-14 19:41   ` ✓ Fi.CI.IGT: " Patchwork
2018-08-14 15:12 ` ✗ Fi.CI.BAT: failure for series starting with [1/2] drm/i915/execlists: Clear STOP_RING bit before restoring the context Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).