]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/i915/gt: Ignore stale context state upon resume
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 2 Jan 2020 13:17:05 +0000 (13:17 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 3 Jan 2020 11:26:01 +0000 (11:26 +0000)
We leave the kernel_context on the HW as we suspend (and while idle).
There is no guarantee that is complete in memory, so we try to inhibit
restoration from the kernel_context. Reinforce the inhibition by
scrubbing the context.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200102131707.1463945-3-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/intel_lrc.c
drivers/gpu/drm/i915/gt/intel_ring_submission.c

index b36fd108f0c6ddcd593d6f93b39016eb419089f4..b21a191bda3b0957db7a4ba7152586719a239ab6 100644 (file)
@@ -2602,6 +2602,9 @@ static int execlists_context_alloc(struct intel_context *ce)
 
 static void execlists_context_reset(struct intel_context *ce)
 {
+       CE_TRACE(ce, "reset\n");
+       GEM_BUG_ON(!intel_context_is_pinned(ce));
+
        /*
         * Because we emit WA_TAIL_DWORDS there may be a disparity
         * between our bookkeeping in ce->ring->head and ce->ring->tail and
@@ -2618,8 +2621,14 @@ static void execlists_context_reset(struct intel_context *ce)
         * So to avoid that we reset the context images upon resume. For
         * simplicity, we just zero everything out.
         */
-       intel_ring_reset(ce->ring, 0);
+       intel_ring_reset(ce->ring, ce->ring->emit);
+
+       /* Scrub away the garbage */
+       execlists_init_reg_state(ce->lrc_reg_state,
+                                ce, ce->engine, ce->ring, true);
        __execlists_update_reg_state(ce, ce->engine);
+
+       ce->lrc_desc |= CTX_DESC_FORCE_RESTORE;
 }
 
 static const struct intel_context_ops execlists_context_ops = {
index 48dbe46edbffd2efe356adacc4487f2d0ed72462..2e1478a48a4b9700e57b6723f58b0d7e88f88b70 100644 (file)
@@ -1347,7 +1347,7 @@ static int ring_context_pin(struct intel_context *ce)
 
 static void ring_context_reset(struct intel_context *ce)
 {
-       intel_ring_reset(ce->ring, 0);
+       intel_ring_reset(ce->ring, ce->ring->emit);
 }
 
 static const struct intel_context_ops ring_context_ops = {