summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Previn <alan.previn.teres.alexis@intel.com>2021-10-05 12:41:29 -0700
committerRodrigo Vivi <rodrigo.vivi@intel.com>2021-10-06 05:08:16 -0400
commit849c224e3f2bb399160a5ec667c086ea795e203d (patch)
tree98241db1d13f267560c29f64157b730637cf37fd
parent8f19aeba0b12b818c338a208ab6b56bfd31b7878 (diff)
tests/i915/gem_pxp: Verify execbuf fails with stale PXP buffer after teardown
Add a check to verify that reusing a stale protected buffer in a gem_execbuff (with a protected context) after a teardown event fails with -ENOEXEC error. Trigger the teardown via the pxp invalidation debugfs that simulates a HW teardown IRQ. NOTE: The end-to-end architecture requirement includes that any break in the links of the PXP sessions needs to trigger a full teardown and the application needs to be made aware of that allowing it to re-establish the end-to-end pipeline of buffers, contexts and renders again if it chooses to. This stricter behavior targets only contexts created with PXP enabled. Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
-rw-r--r--tests/i915/gem_pxp.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/i915/gem_pxp.c b/tests/i915/gem_pxp.c
index 7d508674..22a2e5a4 100644
--- a/tests/i915/gem_pxp.c
+++ b/tests/i915/gem_pxp.c
@@ -796,6 +796,39 @@ static void test_pxp_stale_ctx_execution(int i915)
free_exec_assets(i915, &data);
}
+static void test_pxp_stale_buf_execution(int i915)
+{
+ int ret;
+ struct simple_exec_assets data = {0};
+ uint32_t ctx2;
+ struct intel_bb *ibb2;
+
+ /* Use pxp buffers with pxp context for testing for invalidation of protected buffers. */
+ prepare_exec_assets(i915, &data, true, true);
+ ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
+ igt_assert(ret == 0);
+
+ trigger_pxp_debugfs_forced_teardown(i915);
+
+ /*
+ * After teardown, use a new pxp context but reuse the stale bo to ensure
+ * the kernel is catching the invalidated bo (not context)
+ */
+ ret = create_ctx_with_params(i915, true, true, true, false, &ctx2);
+ igt_assert_eq(ret, 0);
+ igt_assert_eq(get_ctx_protected_param(i915, ctx2), 1);
+ ibb2 = intel_bb_create_with_context(i915, ctx2, 4096);
+ igt_assert(ibb2);
+ intel_bb_remove_intel_buf(data.ibb, data.fencebuf);
+ intel_bb_add_intel_buf(ibb2, data.fencebuf, true);
+ ret = gem_execbuf_flush_store_dw(i915, ibb2, ctx2, data.fencebuf);
+ igt_assert_f((ret == -ENOEXEC), "Executing stale pxp buffer didn't fail with -ENOEXEC\n");
+
+ intel_bb_destroy(ibb2);
+ gem_context_destroy(i915, ctx2);
+ free_exec_assets(i915, &data);
+}
+
igt_main
{
int i915 = -1;
@@ -887,6 +920,8 @@ igt_main
test_pxp_pwrcycle_teardown_keychange(i915, &pm);
igt_subtest("verify-pxp-stale-ctx-execution")
test_pxp_stale_ctx_execution(i915);
+ igt_subtest("verify-pxp-stale-buf-execution")
+ test_pxp_stale_buf_execution(i915);
}
igt_fixture {