[PATCH 2/6] drm/i915/selftests: Confirm that ctx_wa are applied to context saved regs
Chris Wilson
chris at chris-wilson.co.uk
Sat Jan 25 10:17:01 UTC 2020
The idea behind setting ctx_wa are that they need to be stored in the
context, and to be sure that they will be saved we apply them to a live
context. Any registers not stored in the context should not need to be
applied in this fashion and can use regular mmio.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
.../gpu/drm/i915/gt/selftest_workarounds.c | 56 +++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/drivers/gpu/drm/i915/gt/selftest_workarounds.c b/drivers/gpu/drm/i915/gt/selftest_workarounds.c
index ac1921854cbf..336cfd19dd4e 100644
--- a/drivers/gpu/drm/i915/gt/selftest_workarounds.c
+++ b/drivers/gpu/drm/i915/gt/selftest_workarounds.c
@@ -691,6 +691,61 @@ static int check_dirty_whitelist(struct intel_context *ce)
return err;
}
+static bool find_register_in_context_image(const u32 *state, u32 offset)
+{
+ int i;
+
+ /* Brute force search of the first page */
+ for (i = 0; i < PAGE_SIZE / sizeof(u32); i++)
+ if (state[i] == offset)
+ return true;
+
+ return false;
+}
+
+static int live_context_whitelist(void *arg)
+{
+ struct intel_gt *gt = arg;
+ struct intel_engine_cs *engine;
+ enum intel_engine_id id;
+ int err = 0;
+
+ for_each_engine(engine, gt, id) {
+ struct i915_wa_list ctx_wa;
+ const void *state;
+ int i;
+
+ if (!engine->default_state)
+ continue;
+
+ __intel_engine_init_ctx_wa(engine, &ctx_wa, "CTX_REF");
+ if (!ctx_wa.count)
+ continue;
+
+ state = i915_gem_object_pin_map(engine->default_state,
+ I915_MAP_WB);
+ if (IS_ERR(state))
+ return PTR_ERR(state);
+
+ if (HAS_EXECLISTS(engine->i915))
+ state += PAGE_SIZE; /* skip ppHWSP */
+
+ for (i = 0; i < ctx_wa.count; i++) {
+ u32 reg = i915_mmio_reg_offset(ctx_wa.list[i].reg);
+
+ if (!find_register_in_context_image(state, reg)) {
+ pr_err("%s ctx_wa reg:%04x is not context saved!\n",
+ engine->name, reg);
+ err = -EINVAL;
+ }
+ }
+
+ i915_gem_object_unpin_map(engine->default_state);
+ }
+
+ return err;
+}
+
static int live_dirty_whitelist(void *arg)
{
struct intel_gt *gt = arg;
@@ -1257,6 +1312,7 @@ live_engine_reset_workarounds(void *arg)
int intel_workarounds_live_selftests(struct drm_i915_private *i915)
{
static const struct i915_subtest tests[] = {
+ SUBTEST(live_context_whitelist),
SUBTEST(live_dirty_whitelist),
SUBTEST(live_reset_whitelist),
SUBTEST(live_isolated_whitelist),
--
2.25.0
More information about the Intel-gfx-trybot
mailing list