All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 4/7] drm/i915/gt: Do not restore invalid RS state
Date: Sun, 29 Dec 2019 18:31:50 +0000	[thread overview]
Message-ID: <20191229183153.3719869-4-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20191229183153.3719869-1-chris@chris-wilson.co.uk>

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/446
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 .../gpu/drm/i915/gt/intel_ring_submission.c   | 24 +++++++++----------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_ring_submission.c b/drivers/gpu/drm/i915/gt/intel_ring_submission.c
index 81f872f9ef03..066c4eddf5d0 100644
--- a/drivers/gpu/drm/i915/gt/intel_ring_submission.c
+++ b/drivers/gpu/drm/i915/gt/intel_ring_submission.c
@@ -1408,14 +1408,6 @@ static inline int mi_set_context(struct i915_request *rq, u32 flags)
 	int len;
 	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;
 	if (IS_GEN(i915, 7))
 		len += 2 + (num_engines ? 4 * num_engines + 6 : 0);
@@ -1607,15 +1599,21 @@ static int switch_context(struct i915_request *rq)
 		return ret;
 
 	if (ce->state) {
-		u32 hw_flags;
+		u32 flags;
 
 		GEM_BUG_ON(rq->engine->id != RCS0);
 
-		hw_flags = 0;
-		if (!test_bit(CONTEXT_VALID_BIT, &ce->flags))
-			hw_flags = MI_RESTORE_INHIBIT;
+		/* For resource streamer on HSW+ and power context elsewhere */
+		BUILD_BUG_ON(HSW_MI_RS_SAVE_STATE_EN != MI_SAVE_EXT_STATE_EN);
+		BUILD_BUG_ON(HSW_MI_RS_RESTORE_STATE_EN != MI_RESTORE_EXT_STATE_EN);
+
+		flags = MI_SAVE_EXT_STATE_EN | MI_MM_SPACE_GTT;
+		if (test_bit(CONTEXT_VALID_BIT, &ce->flags))
+			flags |= MI_RESTORE_EXT_STATE_EN;
+		else
+			flags |= MI_RESTORE_INHIBIT;
 
-		ret = mi_set_context(rq, hw_flags);
+		ret = mi_set_context(rq, flags);
 		if (ret)
 			return ret;
 	}
-- 
2.25.0.rc0

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

  parent reply	other threads:[~2019-12-29 18:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-29 18:31 [Intel-gfx] [PATCH 1/7] drm/i915/gt: Ensure that all new contexts clear STOP_RING Chris Wilson
2019-12-29 18:31 ` [Intel-gfx] [PATCH 2/7] drm/i915/gt: Avoid using tag 0 for the very first submission Chris Wilson
2019-12-30 13:43   ` Matthew Auld
2019-12-29 18:31 ` [Intel-gfx] [PATCH 3/7] drm/i915/gt: Avoid using the GPU before initialisation Chris Wilson
2019-12-30 13:58   ` Matthew Auld
2019-12-29 18:31 ` Chris Wilson [this message]
2019-12-30 14:46   ` [Intel-gfx] [PATCH 4/7] drm/i915/gt: Do not restore invalid RS state Matthew Auld
2019-12-29 18:31 ` [Intel-gfx] [PATCH 5/7] drm/i915/gt: Ignore stale context state upon resume Chris Wilson
2019-12-30 16:06   ` Matthew Auld
2019-12-30 16:12     ` Chris Wilson
2019-12-29 18:31 ` [Intel-gfx] [PATCH 6/7] drm/i915/gt: Discard stale context state from across idling Chris Wilson
2019-12-30 16:12   ` Matthew Auld
2019-12-29 18:31 ` [Intel-gfx] [PATCH 7/7] drm/i915/gt: Always poison the kernel_context image before unparking Chris Wilson
2019-12-30 16:16   ` Matthew Auld
2019-12-29 19:20 ` [Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/7] drm/i915/gt: Ensure that all new contexts clear STOP_RING Patchwork
2019-12-29 20:50 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2019-12-29 22:27 ` [Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/7] drm/i915/gt: Ensure that all new contexts clear STOP_RING (rev2) Patchwork
2019-12-30  0:12 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2019-12-30 11:01 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/7] drm/i915/gt: Ensure that all new contexts clear STOP_RING (rev3) Patchwork
2019-12-30 13:33 ` [Intel-gfx] [PATCH 1/7] drm/i915/gt: Ensure that all new contexts clear STOP_RING Matthew Auld
2019-12-30 14:03 ` [Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/7] drm/i915/gt: Ensure that all new contexts clear STOP_RING (rev4) Patchwork
2019-12-30 21:07 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191229183153.3719869-4-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.