Commit 10330997 authored by Chris Wilson's avatar Chris Wilson Committed by Joonas Lahtinen

drm/i915/gt: Do not restore invalid RS state

Only restore valid resource streamer state from the context image, i.e.
avoid restoring if we know the image is invalid.

Closes: https://gitlab.freedesktop.org/drm/intel/issues/446Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191229183153.3719869-4-chris@chris-wilson.co.uk
Cc: stable@vger.kernel.org
(cherry picked from commit ecfcd2da)
Signed-off-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
parent f4b18892
...@@ -1413,14 +1413,6 @@ static inline int mi_set_context(struct i915_request *rq, u32 flags) ...@@ -1413,14 +1413,6 @@ static inline int mi_set_context(struct i915_request *rq, u32 flags)
int len; int len;
u32 *cs; u32 *cs;
flags |= MI_MM_SPACE_GTT;
if (IS_HASWELL(i915))
/* These flags are for resource streamer on HSW+ */
flags |= HSW_MI_RS_SAVE_STATE_EN | HSW_MI_RS_RESTORE_STATE_EN;
else
/* We need to save the extended state for powersaving modes */
flags |= MI_SAVE_EXT_STATE_EN | MI_RESTORE_EXT_STATE_EN;
len = 4; len = 4;
if (IS_GEN(i915, 7)) if (IS_GEN(i915, 7))
len += 2 + (num_engines ? 4 * num_engines + 6 : 0); len += 2 + (num_engines ? 4 * num_engines + 6 : 0);
...@@ -1589,22 +1581,21 @@ static int switch_context(struct i915_request *rq) ...@@ -1589,22 +1581,21 @@ static int switch_context(struct i915_request *rq)
} }
if (ce->state) { if (ce->state) {
u32 hw_flags; u32 flags;
GEM_BUG_ON(rq->engine->id != RCS0); GEM_BUG_ON(rq->engine->id != RCS0);
/* /* For resource streamer on HSW+ and power context elsewhere */
* The kernel context(s) is treated as pure scratch and is not BUILD_BUG_ON(HSW_MI_RS_SAVE_STATE_EN != MI_SAVE_EXT_STATE_EN);
* expected to retain any state (as we sacrifice it during BUILD_BUG_ON(HSW_MI_RS_RESTORE_STATE_EN != MI_RESTORE_EXT_STATE_EN);
* suspend and on resume it may be corrupted). This is ok,
* as nothing actually executes using the kernel context; it flags = MI_SAVE_EXT_STATE_EN | MI_MM_SPACE_GTT;
* is purely used for flushing user contexts. if (!i915_gem_context_is_kernel(rq->gem_context))
*/ flags |= MI_RESTORE_EXT_STATE_EN;
hw_flags = 0; else
if (i915_gem_context_is_kernel(rq->gem_context)) flags |= MI_RESTORE_INHIBIT;
hw_flags = MI_RESTORE_INHIBIT;
ret = mi_set_context(rq, hw_flags); ret = mi_set_context(rq, flags);
if (ret) if (ret)
return ret; return ret;
} }
......
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