]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Verify GT workaround state after GPU init
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Mon, 3 Dec 2018 12:50:10 +0000 (12:50 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Tue, 4 Dec 2018 12:23:18 +0000 (12:23 +0000)
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>
Link: https://patchwork.freedesktop.org/patch/msgid/20181203125014.3219-4-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/intel_workarounds.c
drivers/gpu/drm/i915/intel_workarounds.h

index 6f497cf31ffc169df8b27f1a4718fef060cba5de..b310a897a4adab444349252503fba2e92134814f 100644 (file)
@@ -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;
 
index ad5a115e47b65f743eb726138c874262f111fd8b..35ecfea4e903285a8e4c897920ecc19a38e0452a 100644 (file)
@@ -5300,7 +5300,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);
 
index 847988d15e8a509b08fdcc3674372cbb87d53289..592226a0c7117d5685a47423c2419eaa7a7c2dbf 100644 (file)
@@ -977,6 +977,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;
index 979695a539648cee1fa4b7e870a9d12a6c4d5892..8822e6035f8d1d8868c57c66185880e6a9161188 100644 (file)
@@ -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);