[Intel-gfx] [PATCH] drm/i915: Add a security blanket to ring_is_idle()

Chris Wilson chris at chris-wilson.co.uk
Wed Feb 27 17:53:29 UTC 2019


So CI is reporting a few flips on Skylake for intel_engines_are_idle(),
so apply a double check that the ring is valid before inspecting the
registers. However, we keep the forcewake omission in play to avoid the
Sandybridge failure.

Fixes: 0b702dca2658 ("drm/i915: Avoid waking the engines just to check if they are idle")
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala at intel.com>
---
 drivers/gpu/drm/i915/intel_engine_cs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
index 4f244019560d..e3614e483f40 100644
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -987,7 +987,8 @@ static bool ring_is_idle(struct intel_engine_cs *engine)
 	 * If the engine is not awake, both reads return 0 as we do so without
 	 * forcewake.
 	 */
-	if ((I915_READ_FW(RING_HEAD(engine->mmio_base)) & HEAD_ADDR) !=
+	if (I915_READ_FW(RING_CTL(engine->mmio_base)) & RING_VALID &&
+	    (I915_READ_FW(RING_HEAD(engine->mmio_base)) & HEAD_ADDR) !=
 	    (I915_READ_FW(RING_TAIL(engine->mmio_base)) & TAIL_ADDR))
 		idle = false;
 
-- 
2.20.1



More information about the Intel-gfx mailing list