From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Intel-gfx@lists.freedesktop.org
Subject: [PATCH 3/7] drm/i915: Verify GT workaround state after GPU init
Date: Mon, 3 Dec 2018 12:50:10 +0000 [thread overview]
Message-ID: <20181203125014.3219-4-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20181203125014.3219-1-tvrtko.ursulin@linux.intel.com>
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Since we now have all the GT workarounds in a table, by adding a simple
shared helper function we can now verify that their values are still
applied after some interesting events in the lifetime of the driver.
Initially we only do this after GPU initialization.
v2:
Chris Wilson:
* Simplify verification by realizing it's a simple xor and and.
* Remove verification from engine reset path.
* Return bool straight away from the verify API.
v3:
* API rename. (Chris Wilson)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_drv.c | 1 +
drivers/gpu/drm/i915/i915_gem.c | 3 +++
drivers/gpu/drm/i915/intel_workarounds.c | 34 ++++++++++++++++++++++++
drivers/gpu/drm/i915/intel_workarounds.h | 2 ++
4 files changed, 40 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index ee5116b62cd2..1ab6ba5771a9 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -53,6 +53,7 @@
#include "i915_vgpu.h"
#include "intel_drv.h"
#include "intel_uc.h"
+#include "intel_workarounds.h"
static struct drm_driver driver;
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 6333a7d6af5a..298f79c137eb 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -5334,7 +5334,10 @@ int i915_gem_init_hw(struct drm_i915_private *dev_priv)
I915_WRITE(MI_PREDICATE_RESULT_2, IS_HSW_GT3(dev_priv) ?
LOWER_SLICE_ENABLED : LOWER_SLICE_DISABLED);
+ /* Apply the GT workarounds... */
intel_gt_apply_workarounds(dev_priv);
+ /* ...and determine whether they are sticking. */
+ intel_gt_verify_workarounds(dev_priv, "init");
i915_gem_init_swizzling(dev_priv);
diff --git a/drivers/gpu/drm/i915/intel_workarounds.c b/drivers/gpu/drm/i915/intel_workarounds.c
index 4ef0dd09bff9..1fc4964528a7 100644
--- a/drivers/gpu/drm/i915/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/intel_workarounds.c
@@ -978,6 +978,40 @@ void intel_gt_apply_workarounds(struct drm_i915_private *dev_priv)
wa_list_apply(dev_priv, &dev_priv->gt_wa_list);
}
+static bool
+wa_verify(const struct i915_wa *wa, u32 cur, const char *name, const char *from)
+{
+ if ((cur ^ wa->val) & wa->mask) {
+ DRM_ERROR("%s workaround lost on %s! (%x=%x/%x, expected %x, mask=%x)\n",
+ name, from, i915_mmio_reg_offset(wa->reg), cur,
+ cur & wa->mask, wa->val, wa->mask);
+
+ return false;
+ }
+
+ return true;
+}
+
+static bool wa_list_verify(struct drm_i915_private *dev_priv,
+ const struct i915_wa_list *wal,
+ const char *from)
+{
+ struct i915_wa *wa;
+ unsigned int i;
+ bool ok = true;
+
+ for (i = 0, wa = wal->list; i < wal->count; i++, wa++)
+ ok &= wa_verify(wa, I915_READ(wa->reg), wal->name, from);
+
+ return ok;
+}
+
+bool intel_gt_verify_workarounds(struct drm_i915_private *dev_priv,
+ const char *from)
+{
+ return wa_list_verify(dev_priv, &dev_priv->gt_wa_list, from);
+}
+
struct whitelist {
i915_reg_t reg[RING_MAX_NONPRIV_SLOTS];
unsigned int count;
diff --git a/drivers/gpu/drm/i915/intel_workarounds.h b/drivers/gpu/drm/i915/intel_workarounds.h
index 979695a53964..8822e6035f8d 100644
--- a/drivers/gpu/drm/i915/intel_workarounds.h
+++ b/drivers/gpu/drm/i915/intel_workarounds.h
@@ -32,6 +32,8 @@ int intel_ctx_workarounds_emit(struct i915_request *rq);
void intel_gt_init_workarounds(struct drm_i915_private *dev_priv);
void intel_gt_apply_workarounds(struct drm_i915_private *dev_priv);
+bool intel_gt_verify_workarounds(struct drm_i915_private *dev_priv,
+ const char *from);
void intel_whitelist_workarounds_apply(struct intel_engine_cs *engine);
--
2.19.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-12-03 12:50 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 12:50 [PATCH v4 0/7] Restore workarounds after engine reset and unify their handling Tvrtko Ursulin
2018-12-03 12:50 ` [PATCH 1/7] drm/i915: Record GT workarounds in a list Tvrtko Ursulin
2018-12-03 12:53 ` Chris Wilson
2018-12-03 13:33 ` Tvrtko Ursulin
2018-12-03 12:50 ` [PATCH 2/7] drm/i915: Introduce per-engine workarounds Tvrtko Ursulin
2018-12-03 13:33 ` Tvrtko Ursulin
2018-12-03 12:50 ` Tvrtko Ursulin [this message]
2018-12-03 12:50 ` [PATCH 4/7] drm/i915/selftests: Add tests for GT and engine workaround verification Tvrtko Ursulin
2018-12-03 12:50 ` [PATCH 5/7] drm/i915: Move register white-listing to the common workaround framework Tvrtko Ursulin
2018-12-03 12:50 ` [PATCH 6/7] drm/i915: Fuse per-context workaround handling with the common framework Tvrtko Ursulin
2018-12-03 13:33 ` Tvrtko Ursulin
2018-12-03 12:50 ` [PATCH 7/7] drm/i915: Trim unused workaround list entries Tvrtko Ursulin
2018-12-03 12:52 ` Chris Wilson
2018-12-03 13:05 ` ✗ Fi.CI.CHECKPATCH: warning for Restore workarounds after engine reset and unify their handling (rev4) Patchwork
2018-12-03 13:08 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-12-03 13:36 ` ✓ Fi.CI.BAT: success " Patchwork
2018-12-03 14:40 ` ✗ Fi.CI.CHECKPATCH: warning for Restore workarounds after engine reset and unify their handling (rev7) Patchwork
2018-12-03 14:43 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-12-03 14:56 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-12-03 17:23 ` ✗ Fi.CI.CHECKPATCH: warning for Restore workarounds after engine reset and unify their handling (rev8) Patchwork
2018-12-03 17:26 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-12-04 8:01 ` ✗ Fi.CI.CHECKPATCH: warning for Restore workarounds after engine reset and unify their handling (rev9) Patchwork
2018-12-04 8:04 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-12-04 8:22 ` ✓ Fi.CI.BAT: success " Patchwork
2018-12-04 8:41 ` ✓ Fi.CI.BAT: success for Restore workarounds after engine reset and unify their handling (rev8) Patchwork
2018-12-04 13:02 ` Tvrtko Ursulin
2018-12-04 9:42 ` ✓ Fi.CI.IGT: success for Restore workarounds after engine reset and unify their handling (rev9) Patchwork
2018-12-04 12:12 ` Chris Wilson
-- strict thread matches above, loose matches on Subject: below --
2018-12-03 11:46 [PATCH v3 0/7] Restore workarounds after engine reset and unify their handling Tvrtko Ursulin
2018-12-03 11:46 ` [PATCH 3/7] drm/i915: Verify GT workaround state after GPU init Tvrtko Ursulin
2018-11-30 17:44 [PATCH v2 0/8] Restore workarounds after engine reset and unify their handling Tvrtko Ursulin
2018-11-30 17:44 ` [PATCH 3/7] drm/i915: Verify GT workaround state after GPU init Tvrtko Ursulin
2018-11-30 21:55 ` Chris Wilson
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=20181203125014.3219-4-tvrtko.ursulin@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--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.