Skip to contentSkip to conversation

Introduce PXP Test

PATCH Superseded Alan Previn 5 participants 32 messages Sep 2, 2021 – Sep 10, 2021

Subsystems (2)

v9 of 15 Superseded Latest is v15 →

lore
Share & tools
lore
#0 lore raw

v9 cover Introduce PXP Test

This series adds gem_pxp tests for the new PXP subsystem currently being reviewed at https://patchwork.freedesktop.org/series/90504/.
This series currently includes 4 groups of tests addressing the features and restrictions described by Daniele's series :
1. test i915 interfaces for allocation of protected bo's and contexts and enforcement of UAPI rule disallowing the modification of parameters after it's been created.
2. verify PXP subsystem protected sessions generate encrypted content on protected output buffers and decrypt protected inputs buffers.
3. verify i915 PXP auto-teardown succeeds on suspend-resume cycles and gem-exec of stale protected assets fail. Ensure protected-contexts adhere to stricter invalidation enforcement upon teardown event.
4. Ensure that display plane decryption works as expected with protected buffers.

NOTE: This series is on the ninth revision. R-v-b status is the same as it was at rev7, (i.e. removed the Rvb's from reworked Rev-6 patches that require another review: #11, #12, #13 and #15).

Changes from prior rev1 to now:
v9:
- Remove patch #2 from rev7 as it was duplicating
an existing ioctl wrapper helper
- Fix the false-negative warnings when triggering auto-suspend-resume (remove checking if we are
suspending after the system has already resumed).
v8:
- Nothing - mistaken detection from patchwork
v7:
- In prior rev, Patches #11->13 was testing expected results from calling gem_execbuf with stale pxp-context, pxp-buffer or combinations of them (including an opt-out usage). All of them used a single suspend-resume power state cycles to trigger the PXP teardown event. These patches have been combined into patch #14 that continues to carry the prior rev Rvb.
- In its place, the new patches of #11->#13 do the identical set of tests as before (results from gem_execbuf with various combinations of stale pxp context and buffer), but this time using a debugfs file handle that triggers the same code path taken when the HW triggers the pxp teardown. That said, the code is nearly identical as v6 but I did not keep the Rvb's.
- In patch #15, RESET_STAT now reports invalidated / banned pxp contexts via the existing batch_active's lost count.
v6:
- Addressed rev5 review comments for patch #1, #7, #14
and #17.
- For #17, I'm using Rodrigo's Rv-b because offline discussions concluded that we couldn't use those
test sequences with HDCP and so it was removed it.
- Added Rv-b into all patches that received it.
- Modified the test requirement from a list of device
ids to checking if runtime PXP interface succeeds
due to kernel's build config dependency.
v5:
- Addressed all rev4 review comments. No changes to
overall flow and logic compared to the last rev.
v4:
- Addressed all rev3 review comments. NOTE: that all
test cases and code logic are the same but a decent amount of refactoring has occured due to address
v3 comments to break out subtests into separate
functions while combining certain checks into the same function to reduce test time by minimizing number of suspend-resume power cycles.
v3:
- Addressed all rev2 review comments.
- In line with one of the rev2 comments, a thorough fixup of all line-breaks in function calls was made for a more consistent styling.
- Rebased on igt upstream repo and updated to latest kernel UAPI that added GEM_CREATE_EXT.
v2:
- Addressed all rev1 review comments except these:
1.Chris Wilson : "...have the caller do 1-3 once for its protected
context. Call it something like intel_bb_enable_pxp(), intel_bb_set_pxp if it should be reversible.".
- This couldn't be implemented because [1] HW needs different instruction sequences for enabling/disabling PXP depending on the engine class and [2] the pair of "pxp-enable" and "pxp- disable" instructions need to be contained within the same batch that is dispatched to the hardware. That said, implementing internal intel_batchbuffer funtionality for this would conflict with how rendercopy_gen9 uses batch buffer memory by repositioing the pointer and consuming unused portions of the batch buffer as 3d state offsets that batchbuffer has no visibility.

- Added these additional subtests:
1. verify that buffer sharing works across testing pxp context.
2. verify teardown bans contexts via DRM_IOCTL_I915_GET_RESET_STAT.
3. verify display plane decryption of protected buffers.

Alan Previn (15):
Add PXP UAPI support in i915_drm.h
Add basic PXP testing of buffer and context alloc
Perform a regular 3d copy as a control checkpoint
Add PXP attribute support in batchbuffer and buffer_ops libs Add MI_SET_APPID instruction definition
Enable protected session cmd in gen12_render_copyfunc
Add subtest to copy raw source to protected dest
Add test where both src and dest are protected
Verify PXP teardown occurred through suspend-resume
Verify execbuf fails with stale PXP context after teardown Verify execbuf fails with stale PXP buffer after teardown Verify execbuf ok with stale PXP buf in opt-out use
Verify execution behavior with stale PXP assets through suspend-resume Ensure RESET_STATS reports invalidated protected contexts Verify protected surfaces are dma buffer sharable

Karthik B S (1):
tests/i915_pxp: CRC validation for display tests.

 include/drm-uapi/i915_drm.h |   53 ++
 lib/intel_batchbuffer.c     |   23 +-
 lib/intel_batchbuffer.h     |   31 +
 lib/intel_bufops.h          |   15 +
 lib/intel_reg.h             |    8 +
 lib/rendercopy_gen9.c       |   57 ++
 tests/i915/gem_pxp.c        | 1346 +++++++++++++++++++++++++++++++++++
 tests/meson.build           |    1 +
 8 files changed, 1533 insertions(+), 1 deletion(-)
 create mode 100644 tests/i915/gem_pxp.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH v9 1/16 Add PXP UAPI support in i915_drm.h

At the time of this commit, PXP hasnt been merged into upstream kernel so this has no kernel tag reference yet

---
 include/drm-uapi/i915_drm.h | 53 +++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
include/drm-uapi/i915_drm.h +53 -0
index b9632bb2..98149a7d 100644
@@ -1815,6 +1815,25 @@ struct drm_i915_gem_context_param {
  * attempted to use it, never re-use this context param number.
  */
 #define I915_CONTEXT_PARAM_RINGSIZE	0xc
+
+/*
+ * I915_CONTEXT_PARAM_PROTECTED_CONTENT:
+ *
+ * Mark that the context makes use of protected content, which will result
+ * in the context being invalidated when the protected content session is.
+ * This flag can only be set at context creation time and, when set to true,
+ * must be preceded by an explicit setting of I915_CONTEXT_PARAM_RECOVERABLE
+ * to false. This flag can't be set to true in conjunction with setting the
+ * I915_CONTEXT_PARAM_BANNABLE flag to false.
+ *
+ * Given the numerous restriction on this flag, there are several unique
+ * failure cases:
+ *
+ * -ENODEV: feature not available
+ * -EPERM: trying to mark a recoverable or not bannable context as protected
+ * -EACCES: submitting an invalidated context for execution
+ */
+#define I915_CONTEXT_PARAM_PROTECTED_CONTENT    0xd
 /* Must be kept compact -- no holes and well documented */
 
 	__u64 value;
@@ -2931,8 +2950,12 @@ struct drm_i915_gem_create_ext {
 	 *
 	 * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see
 	 * struct drm_i915_gem_create_ext_memory_regions.
+	 *
+	 * For I915_GEM_CREATE_EXT_PROTECTED_CONTENT usage see
+	 * struct drm_i915_gem_create_ext_protected_content.
 	 */
 #define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
+#define I915_GEM_CREATE_EXT_PROTECTED_CONTENT 1
 	__u64 extensions;
 };
 
@@ -2990,6 +3013,36 @@ struct drm_i915_gem_create_ext_memory_regions {
 	__u64 regions;
 };
 
+/**
+ * struct drm_i915_gem_create_ext_protected_content - The
+ * I915_OBJECT_PARAM_PROTECTED_CONTENT extension.
+ *
+ * If this extension is provided, buffer contents are expected to be
+ * protected by PXP encryption and requires decryption for scan out
+ * and processing. This is only possible on platforms that have PXP enabled,
+ * on all other scenarios ysing this extension will cause the ioctl to fail
+ * and return -ENODEV. The flags parameter is reserved for future expansion and
+ * must currently be set to zero.
+ *
+ * The buffer contents are considered invalid after a PXP session teardown.
+ *
+ * The encryption is guaranteed to be processed correctly only if the object
+ * is submitted with a context created using the
+ * I915_CONTEXT_PARAM_PROTECTED_CONTENT flag. This will also enable extra checks
+ * at submission time on the validity of the objects involved, which can lead to
+ * the following errors being returned from the execbuf ioctl:
+ *
+ * -ENODEV: PXP session not currently active
+ * -ENOEXEC: buffer has become invalid after a teardown event
+ */
+struct drm_i915_gem_create_ext_protected_content {
+	struct i915_user_extension base;
+	__u32 flags;
+};
+
+/* ID of the protected content session managed by i915 when PXP is active */
+#define I915_PROTECTED_CONTENT_DEFAULT_SESSION 0xf
+
 #if defined(__cplusplus)
 }
 #endif
Signature · 1 line
2.25.1
#2 lore raw

Re: [igt-dev] [PATCH i-g-t v9 01/16] Add PXP UAPI support in i915_drm.h

Quoted 2 lines · Alan Previn

At the time of this commit, PXP hasnt been merged into upstream kernel so this has no kernel tag reference yet

Please use the newly added lib/i915/i915_drm_local.h for these additions then.

Signature · 1 line
Petri Latvala
Quoted 89 lines
---
 include/drm-uapi/i915_drm.h | 53 +++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
include/drm-uapi/i915_drm.h +53 -0
index b9632bb2..98149a7d 100644
@@ -1815,6 +1815,25 @@ struct drm_i915_gem_context_param {
  * attempted to use it, never re-use this context param number.
  */
 #define I915_CONTEXT_PARAM_RINGSIZE	0xc
+
+/*
+ * I915_CONTEXT_PARAM_PROTECTED_CONTENT:
+ *
+ * Mark that the context makes use of protected content, which will result
+ * in the context being invalidated when the protected content session is.
+ * This flag can only be set at context creation time and, when set to true,
+ * must be preceded by an explicit setting of I915_CONTEXT_PARAM_RECOVERABLE
+ * to false. This flag can't be set to true in conjunction with setting the
+ * I915_CONTEXT_PARAM_BANNABLE flag to false.
+ *
+ * Given the numerous restriction on this flag, there are several unique
+ * failure cases:
+ *
+ * -ENODEV: feature not available
+ * -EPERM: trying to mark a recoverable or not bannable context as protected
+ * -EACCES: submitting an invalidated context for execution
+ */
+#define I915_CONTEXT_PARAM_PROTECTED_CONTENT    0xd
 /* Must be kept compact -- no holes and well documented */
 
 	__u64 value;
@@ -2931,8 +2950,12 @@ struct drm_i915_gem_create_ext {
 	 *
 	 * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see
 	 * struct drm_i915_gem_create_ext_memory_regions.
+	 *
+	 * For I915_GEM_CREATE_EXT_PROTECTED_CONTENT usage see
+	 * struct drm_i915_gem_create_ext_protected_content.
 	 */
 #define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
+#define I915_GEM_CREATE_EXT_PROTECTED_CONTENT 1
 	__u64 extensions;
 };
 
@@ -2990,6 +3013,36 @@ struct drm_i915_gem_create_ext_memory_regions {
 	__u64 regions;
 };
 
+/**
+ * struct drm_i915_gem_create_ext_protected_content - The
+ * I915_OBJECT_PARAM_PROTECTED_CONTENT extension.
+ *
+ * If this extension is provided, buffer contents are expected to be
+ * protected by PXP encryption and requires decryption for scan out
+ * and processing. This is only possible on platforms that have PXP enabled,
+ * on all other scenarios ysing this extension will cause the ioctl to fail
+ * and return -ENODEV. The flags parameter is reserved for future expansion and
+ * must currently be set to zero.
+ *
+ * The buffer contents are considered invalid after a PXP session teardown.
+ *
+ * The encryption is guaranteed to be processed correctly only if the object
+ * is submitted with a context created using the
+ * I915_CONTEXT_PARAM_PROTECTED_CONTENT flag. This will also enable extra checks
+ * at submission time on the validity of the objects involved, which can lead to
+ * the following errors being returned from the execbuf ioctl:
+ *
+ * -ENODEV: PXP session not currently active
+ * -ENOEXEC: buffer has become invalid after a teardown event
+ */
+struct drm_i915_gem_create_ext_protected_content {
+	struct i915_user_extension base;
+	__u32 flags;
+};
+
+/* ID of the protected content session managed by i915 when PXP is active */
+#define I915_PROTECTED_CONTENT_DEFAULT_SESSION 0xf
+
 #if defined(__cplusplus)
 }
 #endif
Signature · 1 line
2.25.1
#3 lore raw

Re: [igt-dev] [PATCH i-g-t v9 01/16] Add PXP UAPI support in i915_drm.h

oops - my bad - didnt realize we had that - will do.

While on this, would it make sense to permanently include lib/i915/i915_drm_local.h from include/drm- uapi/i915_drm.h (but latter would always remain empty on upstream)?. This way, when kernel support is added for UAPI changes, we move the definitions across but dont add and need remove the '#include "lib/i915/i915_drm_local.h" from the other source files (requiring another change)?

...alan

Quoted 100 lines · Petri Latvala
Quoted 2 lines · Alan Previn

At the time of this commit, PXP hasnt been merged into upstream kernel so this has no kernel tag reference yet

Please use the newly added lib/i915/i915_drm_local.h for these additions then.

Signature · 1 line
Petri Latvala
Quoted 88 lines
---
 include/drm-uapi/i915_drm.h | 53 +++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
include/drm-uapi/i915_drm.h +53 -0
index b9632bb2..98149a7d 100644
@@ -1815,6 +1815,25 @@ struct drm_i915_gem_context_param {
  * attempted to use it, never re-use this context param number.
  */
 #define I915_CONTEXT_PARAM_RINGSIZE	0xc
+
+/*
+ * I915_CONTEXT_PARAM_PROTECTED_CONTENT:
+ *
+ * Mark that the context makes use of protected content, which will result
+ * in the context being invalidated when the protected content session is.
+ * This flag can only be set at context creation time and, when set to true,
+ * must be preceded by an explicit setting of I915_CONTEXT_PARAM_RECOVERABLE
+ * to false. This flag can't be set to true in conjunction with setting the
+ * I915_CONTEXT_PARAM_BANNABLE flag to false.
+ *
+ * Given the numerous restriction on this flag, there are several unique
+ * failure cases:
+ *
+ * -ENODEV: feature not available
+ * -EPERM: trying to mark a recoverable or not bannable context as protected
+ * -EACCES: submitting an invalidated context for execution
+ */
+#define I915_CONTEXT_PARAM_PROTECTED_CONTENT    0xd
 /* Must be kept compact -- no holes and well documented */
 
 	__u64 value;
@@ -2931,8 +2950,12 @@ struct drm_i915_gem_create_ext {
 	 *
 	 * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see
 	 * struct drm_i915_gem_create_ext_memory_regions.
+	 *
+	 * For I915_GEM_CREATE_EXT_PROTECTED_CONTENT usage see
+	 * struct drm_i915_gem_create_ext_protected_content.
 	 */
 #define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
+#define I915_GEM_CREATE_EXT_PROTECTED_CONTENT 1
 	__u64 extensions;
 };
 
@@ -2990,6 +3013,36 @@ struct drm_i915_gem_create_ext_memory_regions {
 	__u64 regions;
 };
 
+/**
+ * struct drm_i915_gem_create_ext_protected_content - The
+ * I915_OBJECT_PARAM_PROTECTED_CONTENT extension.
+ *
+ * If this extension is provided, buffer contents are expected to be
+ * protected by PXP encryption and requires decryption for scan out
+ * and processing. This is only possible on platforms that have PXP enabled,
+ * on all other scenarios ysing this extension will cause the ioctl to fail
+ * and return -ENODEV. The flags parameter is reserved for future expansion and
+ * must currently be set to zero.
+ *
+ * The buffer contents are considered invalid after a PXP session teardown.
+ *
+ * The encryption is guaranteed to be processed correctly only if the object
+ * is submitted with a context created using the
+ * I915_CONTEXT_PARAM_PROTECTED_CONTENT flag. This will also enable extra checks
+ * at submission time on the validity of the objects involved, which can lead to
+ * the following errors being returned from the execbuf ioctl:
+ *
+ * -ENODEV: PXP session not currently active
+ * -ENOEXEC: buffer has become invalid after a teardown event
+ */
+struct drm_i915_gem_create_ext_protected_content {
+	struct i915_user_extension base;
+	__u32 flags;
+};
+
+/* ID of the protected content session managed by i915 when PXP is active */
+#define I915_PROTECTED_CONTENT_DEFAULT_SESSION 0xf
+
 #if defined(__cplusplus)
 }
 #endif
Signature · 1 line
2.25.1
#4 lore raw

Re: [igt-dev] [PATCH i-g-t v9 01/16] Add PXP UAPI support in i915_drm.h

Quoted 6 lines · Alan Previn

oops - my bad - didnt realize we had that - will do.

While on this, would it make sense to permanently include lib/i915/i915_drm_local.h from include/drm- uapi/i915_drm.h (but latter would always remain empty on upstream)?. This way, when kernel support is added for UAPI changes, we move the definitions across but dont add and need remove the '#include "lib/i915/i915_drm_local.h" from the other source files (requiring another change)?

It would, but it's impossible. include/drm-uapi/i915_drm.h is supposed to be a pristine unchanged drop from the kernel.

The other way around might work but looks more odd from the .c side.

Signature · 1 line
Petri Latvala
Quoted 105 lines

...alan

Quoted 100 lines · Petri Latvala
Quoted 2 lines · Alan Previn

At the time of this commit, PXP hasnt been merged into upstream kernel so this has no kernel tag reference yet

Please use the newly added lib/i915/i915_drm_local.h for these additions then.

--
Petri Latvala

Quoted 88 lines
---
 include/drm-uapi/i915_drm.h | 53 +++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
include/drm-uapi/i915_drm.h +53 -1
index b9632bb2..98149a7d 100644
@@ -1815,6 +1815,25 @@ struct drm_i915_gem_context_param {
  * attempted to use it, never re-use this context param number.
  */
 #define I915_CONTEXT_PARAM_RINGSIZE        0xc
+
+/*
+ * I915_CONTEXT_PARAM_PROTECTED_CONTENT:
+ *
+ * Mark that the context makes use of protected content, which will result
+ * in the context being invalidated when the protected content session is.
+ * This flag can only be set at context creation time and, when set to true,
+ * must be preceded by an explicit setting of I915_CONTEXT_PARAM_RECOVERABLE
+ * to false. This flag can't be set to true in conjunction with setting the
+ * I915_CONTEXT_PARAM_BANNABLE flag to false.
+ *
+ * Given the numerous restriction on this flag, there are several unique
+ * failure cases:
+ *
+ * -ENODEV: feature not available
+ * -EPERM: trying to mark a recoverable or not bannable context as protected
+ * -EACCES: submitting an invalidated context for execution
+ */
+#define I915_CONTEXT_PARAM_PROTECTED_CONTENT    0xd
 /* Must be kept compact -- no holes and well documented */
 
    __u64 value;
@@ -2931,8 +2950,12 @@ struct drm_i915_gem_create_ext {
     *
     * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see
     * struct drm_i915_gem_create_ext_memory_regions.
+    *
+    * For I915_GEM_CREATE_EXT_PROTECTED_CONTENT usage see
+    * struct drm_i915_gem_create_ext_protected_content.
     */
 #define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
+#define I915_GEM_CREATE_EXT_PROTECTED_CONTENT 1
    __u64 extensions;
 };
 
@@ -2990,6 +3013,36 @@ struct drm_i915_gem_create_ext_memory_regions {
    __u64 regions;
 };
 
+/**
+ * struct drm_i915_gem_create_ext_protected_content - The
+ * I915_OBJECT_PARAM_PROTECTED_CONTENT extension.
+ *
+ * If this extension is provided, buffer contents are expected to be
+ * protected by PXP encryption and requires decryption for scan out
+ * and processing. This is only possible on platforms that have PXP enabled,
+ * on all other scenarios ysing this extension will cause the ioctl to fail
+ * and return -ENODEV. The flags parameter is reserved for future expansion and
+ * must currently be set to zero.
+ *
+ * The buffer contents are considered invalid after a PXP session teardown.
+ *
+ * The encryption is guaranteed to be processed correctly only if the object
+ * is submitted with a context created using the
+ * I915_CONTEXT_PARAM_PROTECTED_CONTENT flag. This will also enable extra checks
+ * at submission time on the validity of the objects involved, which can lead to
+ * the following errors being returned from the execbuf ioctl:
+ *
+ * -ENODEV: PXP session not currently active
+ * -ENOEXEC: buffer has become invalid after a teardown event
+ */
+struct drm_i915_gem_create_ext_protected_content {
+   struct i915_user_extension base;
+   __u32 flags;
+};
+
+/* ID of the protected content session managed by i915 when PXP is active */
+#define I915_PROTECTED_CONTENT_DEFAULT_SESSION 0xf
+
 #if defined(__cplusplus)
 }
 #endif
--

2.25.1

#5 lore raw

Re: [igt-dev] [PATCH i-g-t v9 01/16] Add PXP UAPI support in i915_drm.h

Quoted 11 lines · Petri Latvala
Quoted 8 lines · Alan Previn

oops - my bad - didnt realize we had that - will do.

While on this, would it make sense to permanently include lib/i915/i915_drm_local.h from include/drm- uapi/i915_drm.h (but latter would always remain empty on upstream)?. This way, when kernel support is added for UAPI changes, we move the definitions across but dont add and need remove the '#include "lib/i915/i915_drm_local.h" from the other source files (requiring another change)?

Quoted 4 lines

It would, but it's impossible. include/drm-uapi/i915_drm.h is supposed to be a pristine unchanged drop from the kernel.

The other way around might work but looks more odd from the .c side.

But each source file does not have to include i915_drm_local.h since it is included in igt_gt.h. So as long as igt_gt.h is included (which should be, directly or indirectly) i915_drm_local.h is automatically included and does not have to be explicitly included.

#6 lore raw

PATCH v9 2/16 Add basic PXP testing of buffer and context alloc

In reply to Alan Previn

Test PXP capability support as well as the allocation of protected buffers and protected contexts.

---
 tests/i915/gem_pxp.c | 353 +++++++++++++++++++++++++++++++++++++++++++
 tests/meson.build    |   1 +
 2 files changed, 354 insertions(+)
 create mode 100644 tests/i915/gem_pxp.c
tests/i915/gem_pxp.c new file +353 -0
new file mode 100644
index 00000000..d43fc26b
@@ -0,0 +1,353 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2021 Intel Corporation
+ */
+
+#include "igt.h"
+#include "i915/gem.h"
+
+IGT_TEST_DESCRIPTION("Test PXP that manages protected content through arbitrated HW-PXP-session");
+/* Note: PXP = "Protected Xe Path" */
+
+static int create_bo_ext(int i915, uint32_t size, bool protected_is_true, uint32_t *bo_out)
+{
+	int ret;
+
+	struct drm_i915_gem_create_ext_protected_content protected_ext = {
+		.base = { .name = I915_GEM_CREATE_EXT_PROTECTED_CONTENT },
+		.flags = 0,
+	};
+
+	struct drm_i915_gem_create_ext create_ext = {
+		.size = size,
+		.extensions = 0,
+	};
+
+	if (protected_is_true)
+		create_ext.extensions = (uintptr_t)&protected_ext;
+
+	ret = igt_ioctl(i915, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);
+	if (!ret)
+		*bo_out = create_ext.handle;
+
+	return ret;
+}
+
+static void test_bo_alloc_pxp_nohw(int i915)
+{
+	int ret;
+	uint32_t bo;
+
+	ret = create_bo_ext(i915, 4096, false, &bo);
+	igt_assert_eq(ret, 0);
+	gem_close(i915, bo);
+
+	ret = create_bo_ext(i915, 4096, true, &bo);
+	igt_assert_eq(ret, -ENODEV);
+	igt_assert_eq(bo, 0);
+}
+
+static void test_bo_alloc_pxp_off(int i915)
+{
+	int ret;
+	uint32_t bo;
+
+	ret = create_bo_ext(i915, 4096, false, &bo);
+	igt_assert_eq(ret, 0);
+	gem_close(i915, bo);
+}
+
+static void test_bo_alloc_pxp_on(int i915)
+{
+	int ret;
+	uint32_t bo;
+
+	ret = create_bo_ext(i915, 4096, true, &bo);
+	igt_assert_eq(ret, 0);
+	gem_close(i915, bo);
+}
+
+static int create_ctx_with_params(int i915, bool with_protected_param, bool protected_is_true,
+				  bool with_recoverable_param, bool recoverable_is_true,
+				  uint32_t *ctx_out)
+{
+	int ret;
+	uint32_t flags = 0;
+	uint64_t extensions = 0;
+
+	struct drm_i915_gem_context_create_ext_setparam p_prot = {
+		.base = {
+			.name = I915_CONTEXT_CREATE_EXT_SETPARAM,
+			.next_extension = 0,
+		},
+		.param = {
+			.param = I915_CONTEXT_PARAM_PROTECTED_CONTENT,
+			.value = 0,
+		}
+	};
+	struct drm_i915_gem_context_create_ext_setparam p_norecover = {
+		.base = {
+			.name = I915_CONTEXT_CREATE_EXT_SETPARAM,
+			.next_extension = 0,
+		},
+		.param = {
+			.param = I915_CONTEXT_PARAM_RECOVERABLE,
+			.value = 0,
+		}
+	};
+
+	p_prot.param.value = protected_is_true;
+	p_norecover.param.value = recoverable_is_true;
+
+	if (with_protected_param && with_recoverable_param) {
+		p_norecover.base.next_extension = to_user_pointer(&(p_prot.base));
+		flags = I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS;
+		extensions = to_user_pointer(&(p_norecover.base));
+	} else if (!with_protected_param && with_recoverable_param) {
+		p_norecover.base.next_extension = 0;
+		flags = I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS;
+		extensions = to_user_pointer(&(p_norecover.base));
+	} else if (with_protected_param && !with_recoverable_param) {
+		p_prot.base.next_extension = 0;
+		flags = I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS;
+		extensions = to_user_pointer(&(p_prot.base));
+	}
+
+	ret = __gem_context_create_ext(i915, flags, extensions, ctx_out);
+
+	return ret;
+}
+
+#define CHANGE_PARAM_PROTECTED 0x0001
+#define CHANGE_PARAM_RECOVERY 0x0002
+
+static int modify_ctx_param(int i915, uint32_t ctx_id, uint32_t param_mask, bool param_value)
+{
+	int ret;
+
+	struct drm_i915_gem_context_param ctx_param = {
+		.ctx_id = ctx_id,
+		.param = 0,
+		.value = 0,
+	};
+
+	if (param_mask == CHANGE_PARAM_PROTECTED) {
+		ctx_param.param = I915_CONTEXT_PARAM_PROTECTED_CONTENT;
+		ctx_param.value = (int)param_value;
+	} else if (param_mask == CHANGE_PARAM_RECOVERY) {
+		ctx_param.param = I915_CONTEXT_PARAM_RECOVERABLE;
+		ctx_param.value = (int)param_value;
+	}
+
+	ret = igt_ioctl(i915, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &ctx_param);
+
+	return ret;
+}
+
+static int get_ctx_protected_param(int i915, uint32_t ctx_id)
+{
+	int ret;
+
+	struct drm_i915_gem_context_param ctx_param = {
+		.ctx_id = ctx_id,
+		.param = I915_CONTEXT_PARAM_PROTECTED_CONTENT,
+	};
+
+	ret = igt_ioctl(i915, DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &ctx_param);
+	igt_assert_eq(ret, 0);
+
+	return ctx_param.value;
+}
+
+static int get_ctx_recovery_param(int i915, uint32_t ctx_id)
+{
+	int ret;
+
+	struct drm_i915_gem_context_param ctx_param = {
+		.ctx_id = ctx_id,
+		.param = I915_CONTEXT_PARAM_RECOVERABLE,
+	};
+
+	ret = igt_ioctl(i915, DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &ctx_param);
+	igt_assert_eq(ret, 0);
+
+	return ctx_param.value;
+}
+
+static bool is_pxp_hw_supported(int i915)
+{
+	uint32_t tmpctx;
+	int ret;
+
+	ret = create_ctx_with_params(i915, true, true, true, false, &tmpctx);
+	if (ret == 0) {
+		gem_context_destroy(i915, tmpctx);
+		return true;
+	}
+	return false;
+}
+
+static void test_ctx_alloc_pxp_nohw(int i915)
+{
+	uint32_t ctx;
+
+	igt_assert_eq(create_ctx_with_params(i915, true, true, true, false, &ctx), -ENODEV);
+	igt_assert_eq(create_ctx_with_params(i915, true, false, true, false, &ctx), 0);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 0);
+	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 0);
+	gem_context_destroy(i915, ctx);
+}
+
+static void test_ctx_alloc_recover_off_protect_off(int i915)
+{
+	uint32_t ctx;
+
+	igt_assert_eq(create_ctx_with_params(i915, true, false, true, false, &ctx), 0);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 0);
+	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 0);
+	gem_context_destroy(i915, ctx);
+}
+
+static void test_ctx_alloc_recover_off_protect_on(int i915)
+{
+	uint32_t ctx;
+
+	igt_assert_eq(create_ctx_with_params(i915, true, true, true, false, &ctx), 0);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 1);
+	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 0);
+	gem_context_destroy(i915, ctx);
+}
+
+static void test_ctx_alloc_recover_on_protect_off(int i915)
+{
+	uint32_t ctx;
+
+	igt_assert_eq(create_ctx_with_params(i915, true, false, true, true, &ctx), 0);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 0);
+	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 1);
+	gem_context_destroy(i915, ctx);
+}
+
+static void test_ctx_alloc_recover_on_protect_on(int i915)
+{
+	uint32_t ctx;
+
+	igt_assert_eq(create_ctx_with_params(i915, true, true, true, true, &ctx), -EPERM);
+	igt_assert_eq(create_ctx_with_params(i915, true, true, false, false, &ctx), -EPERM);
+}
+
+static void test_ctx_mod_recover_off_to_on(int i915)
+{
+	uint32_t ctx;
+
+	igt_assert_eq(create_ctx_with_params(i915, true, true, true, false, &ctx), 0);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 1);
+	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 0);
+	igt_assert_eq(modify_ctx_param(i915, ctx, CHANGE_PARAM_RECOVERY, true), -EPERM);
+	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 0);
+	gem_context_destroy(i915, ctx);
+}
+
+static void test_ctx_mod_protected_on_to_off(int i915)
+{
+	uint32_t ctx;
+
+	igt_assert_eq(create_ctx_with_params(i915, true, true, true, false, &ctx), 0);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 1);
+	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 0);
+	igt_assert_eq(modify_ctx_param(i915, ctx, CHANGE_PARAM_PROTECTED, false), -EPERM);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 1);
+	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 0);
+	gem_context_destroy(i915, ctx);
+}
+
+static void test_ctx_mod_protected_to_all_invalid(int i915)
+{
+	uint32_t ctx;
+
+	igt_assert_eq(create_ctx_with_params(i915, true, true, true, false, &ctx), 0);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 1);
+	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 0);
+	igt_assert_eq(modify_ctx_param(i915, ctx, CHANGE_PARAM_RECOVERY, true), -EPERM);
+	igt_assert_eq(modify_ctx_param(i915, ctx, CHANGE_PARAM_PROTECTED, false), -EPERM);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 1);
+	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 0);
+	gem_context_destroy(i915, ctx);
+}
+
+static void test_ctx_mod_regular_to_all_valid(int i915)
+{
+	uint32_t ctx;
+
+	igt_assert_eq(create_ctx_with_params(i915, false, false, false, false, &ctx), 0);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 0);
+	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 1);
+	igt_assert_eq(modify_ctx_param(i915, ctx, CHANGE_PARAM_RECOVERY, false), 0);
+	igt_assert_eq(modify_ctx_param(i915, ctx, CHANGE_PARAM_PROTECTED, true), -EPERM);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 0);
+	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 0);
+	gem_context_destroy(i915, ctx);
+}
+
+igt_main
+{
+	int i915 = -1;
+	bool pxp_supported = false;
+
+	igt_fixture
+	{
+		i915 = drm_open_driver(DRIVER_INTEL);
+		igt_require(i915);
+		igt_require_gem(i915);
+		pxp_supported = is_pxp_hw_supported(i915);
+	}
+
+	igt_subtest_group {
+		igt_fixture {
+			igt_require((pxp_supported == 0));
+		}
+
+		igt_describe("Verify protected buffer on unsupported hw:");
+		igt_subtest("hw-rejects-pxp-buffer")
+			test_bo_alloc_pxp_nohw(i915);
+		igt_describe("Verify protected context on unsupported hw:");
+		igt_subtest("hw-rejects-pxp-context")
+			test_ctx_alloc_pxp_nohw(i915);
+	}
+
+	igt_subtest_group {
+		igt_fixture {
+			igt_require(pxp_supported);
+		}
+
+		igt_describe("Verify protected buffer on supported hw:");
+		igt_subtest("create-regular-buffer")
+			test_bo_alloc_pxp_off(i915);
+		igt_subtest("create-protected-buffer")
+			test_bo_alloc_pxp_on(i915);
+
+		igt_describe("Verify protected context on supported hw:");
+		igt_subtest("create-regular-context-1")
+			test_ctx_alloc_recover_off_protect_off(i915);
+		igt_subtest("create-regular-context-2")
+			test_ctx_alloc_recover_on_protect_off(i915);
+		igt_subtest("fail-invalid-protected-context")
+			test_ctx_alloc_recover_on_protect_on(i915);
+		igt_subtest("create-valid-protected-context")
+			test_ctx_alloc_recover_off_protect_on(i915);
+
+		igt_describe("Verify protected context integrity:");
+		igt_subtest("reject-modify-context-protection-on")
+			test_ctx_mod_regular_to_all_valid(i915);
+		igt_subtest("reject-modify-context-protection-off-1")
+			test_ctx_mod_recover_off_to_on(i915);
+		igt_subtest("reject-modify-context-protection-off-2")
+			test_ctx_mod_protected_on_to_off(i915);
+		igt_subtest("reject-modify-context-protection-off-3")
+			test_ctx_mod_protected_to_all_invalid(i915);
+	}
+
+	igt_fixture {
+		close(i915);
+	}
+}
tests/meson.build +1 -0
index 1bdfddbb..ac91a1ce 100644
@@ -187,6 +187,7 @@ i915_progs = [
 	'gem_pread_after_blit',
 	'gem_pwrite',
 	'gem_pwrite_snooped',
+	'gem_pxp',
 	'gem_read_read_speed',
 	'gem_readwrite',
 	'gem_reg_read',
Signature · 1 line
2.25.1
#7 lore raw

PATCH v9 3/16 Perform a regular 3d copy as a control checkpoint

In reply to Alan Previn

As a control checkpoint, allocate buffers to be used as texture and render target in the 3d engine for a regular src to dest copy blit and verify buffer pixels.

---
 tests/i915/gem_pxp.c | 166 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 157 insertions(+), 9 deletions(-)
tests/i915/gem_pxp.c +157 -9
index d43fc26b..7802a328 100644
@@ -236,6 +236,20 @@ static void test_ctx_alloc_recover_on_protect_on(int i915)
 	igt_assert_eq(create_ctx_with_params(i915, true, true, false, false, &ctx), -EPERM);
 }
 
+static void test_ctx_mod_regular_to_all_valid(int i915)
+{
+	uint32_t ctx;
+
+	igt_assert_eq(create_ctx_with_params(i915, false, false, false, false, &ctx), 0);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 0);
+	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 1);
+	igt_assert_eq(modify_ctx_param(i915, ctx, CHANGE_PARAM_RECOVERY, false), 0);
+	igt_assert_eq(modify_ctx_param(i915, ctx, CHANGE_PARAM_PROTECTED, true), -EPERM);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 0);
+	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 0);
+	gem_context_destroy(i915, ctx);
+}
+
 static void test_ctx_mod_recover_off_to_on(int i915)
 {
 	uint32_t ctx;
@@ -275,24 +289,145 @@ static void test_ctx_mod_protected_to_all_invalid(int i915)
 	gem_context_destroy(i915, ctx);
 }
 
-static void test_ctx_mod_regular_to_all_valid(int i915)
+static void fill_bo_content(int i915, uint32_t bo, uint32_t size, uint32_t initcolor)
 {
-	uint32_t ctx;
+	uint32_t *ptr, *ptrtmp;
+	int loop = 0;
 
-	igt_assert_eq(create_ctx_with_params(i915, false, false, false, false, &ctx), 0);
-	igt_assert_eq(get_ctx_protected_param(i915, ctx), 0);
-	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 1);
-	igt_assert_eq(modify_ctx_param(i915, ctx, CHANGE_PARAM_RECOVERY, false), 0);
-	igt_assert_eq(modify_ctx_param(i915, ctx, CHANGE_PARAM_PROTECTED, true), -EPERM);
-	igt_assert_eq(get_ctx_protected_param(i915, ctx), 0);
-	igt_assert_eq(get_ctx_recovery_param(i915, ctx), 0);
+	ptr = gem_mmap__device_coherent(i915, bo, 0, size, PROT_WRITE);
+	ptrtmp = ptr;
+
+	/* read and count all dword matches till size */
+	while (loop++ < (size/4)) {
+		*ptrtmp = initcolor;
+		++ptrtmp;
+	}
+
+	igt_assert(gem_munmap(ptr, size) == 0);
+}
+
+#define COMPARE_COLOR_READIBLE     1
+#define COMPARE_COLOR_UNREADIBLE   2
+#define COMPARE_N_PIXELS_VERBOSELY 0
+
+static void assert_bo_content_check(int i915, uint32_t bo, int compare_op,
+				    uint32_t size, uint32_t color)
+{
+	uint32_t *ptr, *ptrtmp;
+	int loop = 0, num_matches = 0;
+	uint32_t value;
+	bool op_readible = (compare_op == COMPARE_COLOR_READIBLE);
+
+	ptr = gem_mmap__device_coherent(i915, bo, 0, size, PROT_READ);
+	ptrtmp = ptr;
+
+	if (COMPARE_N_PIXELS_VERBOSELY) {
+		igt_info("--------->>>\n");
+		while (loop < COMPARE_N_PIXELS_VERBOSELY && loop < (size/4)) {
+			value = *ptrtmp;
+			igt_info("Color read = 0x%08x ", value);
+			igt_info("expected %c= 0x%08x)\n", op_readible?'=':'!', color);
+			++ptrtmp;
+			++loop;
+		}
+		igt_info("<<<---------\n");
+		ptrtmp = ptr;
+		loop = 0;
+	}
+
+	/* count all pixels for matches */
+	while (loop++ < (size/4)) {
+		value = *ptrtmp;
+		if (value == color)
+			++num_matches;
+		++ptrtmp;
+	}
+
+	if (op_readible)
+		igt_assert_eq(num_matches, (size/4));
+	else
+		igt_assert_eq(num_matches, 0);
+
+	igt_assert(gem_munmap(ptr, size) == 0);
+}
+
+static uint32_t alloc_and_fill_dest_buff(int i915, bool protected, uint32_t size,
+					 uint32_t init_color)
+{
+	uint32_t bo;
+	int ret;
+
+	ret = create_bo_ext(i915, size, protected, &bo);
+	igt_assert_eq(ret, 0);
+	igt_assert(bo);
+	fill_bo_content(i915, bo, size, init_color);
+	assert_bo_content_check(i915, bo, COMPARE_COLOR_READIBLE, size, init_color);
+
+	return bo;
+}
+
+/*
+ * Rendering tests surface attributes, keep it simple:
+ * page aligned width==stride, thus, and size
+ */
+#define TSTSURF_WIDTH       1024
+#define TSTSURF_HEIGHT      128
+#define TSTSURF_BYTESPP     4
+#define TSTSURF_STRIDE      (TSTSURF_WIDTH*TSTSURF_BYTESPP)
+#define TSTSURF_SIZE        (TSTSURF_STRIDE*TSTSURF_HEIGHT)
+#define TSTSURF_FILLCOLOR1  0xfaceface
+#define TSTSURF_INITCOLOR1  0x12341234
+
+static void test_render_baseline(int i915)
+{
+	uint32_t ctx, srcbo, dstbo;
+	struct intel_buf *srcbuf, *dstbuf;
+	struct buf_ops *bops;
+	struct intel_bb *ibb;
+	uint32_t devid;
+	int ret;
+
+	devid = intel_get_drm_devid(i915);
+	igt_assert(devid);
+
+	bops = buf_ops_create(i915);
+	igt_assert(bops);
+
+	/* Perform a regular 3d copy as a control checkpoint */
+	ret = create_ctx_with_params(i915, false, false, false, false, &ctx);
+	igt_assert_eq(ret, 0);
+	ibb = intel_bb_create_with_context(i915, ctx, 4096);
+	igt_assert(ibb);
+
+	dstbo = alloc_and_fill_dest_buff(i915, false, TSTSURF_SIZE, TSTSURF_INITCOLOR1);
+	dstbuf = intel_buf_create_using_handle(bops, dstbo, TSTSURF_WIDTH, TSTSURF_HEIGHT,
+					       TSTSURF_BYTESPP*8, 0, I915_TILING_NONE, 0);
+
+	srcbo = alloc_and_fill_dest_buff(i915, false, TSTSURF_SIZE, TSTSURF_FILLCOLOR1);
+	srcbuf = intel_buf_create_using_handle(bops, srcbo, TSTSURF_WIDTH, TSTSURF_HEIGHT,
+					       TSTSURF_BYTESPP*8, 0, I915_TILING_NONE, 0);
+
+	gen12_render_copyfunc(ibb, srcbuf, 0, 0, TSTSURF_WIDTH, TSTSURF_HEIGHT, dstbuf, 0, 0);
+	gem_sync(i915, dstbo);
+
+	assert_bo_content_check(i915, dstbo, COMPARE_COLOR_READIBLE,
+				TSTSURF_SIZE, TSTSURF_FILLCOLOR1);
+
+	intel_bb_destroy(ibb);
+	intel_buf_destroy(srcbuf);
+	gem_close(i915, srcbo);
+	intel_buf_destroy(dstbuf);
+	gem_close(i915, dstbo);
 	gem_context_destroy(i915, ctx);
+	buf_ops_destroy(bops);
 }
 
 igt_main
 {
 	int i915 = -1;
 	bool pxp_supported = false;
+	igt_render_copyfunc_t rendercopy = NULL;
+	uint32_t devid = 0;
 
 	igt_fixture
 	{
@@ -346,6 +481,19 @@ igt_main
 		igt_subtest("reject-modify-context-protection-off-3")
 			test_ctx_mod_protected_to_all_invalid(i915);
 	}
+	igt_subtest_group {
+		igt_fixture {
+			igt_require(pxp_supported);
+			devid = intel_get_drm_devid(i915);
+			igt_assert(devid);
+			rendercopy = igt_get_render_copyfunc(devid);
+			igt_require(rendercopy);
+		}
+
+		igt_describe("Verify protected render operations:");
+		igt_subtest("regular-baseline-src-copy-readible")
+			test_render_baseline(i915);
+	}
 
 	igt_fixture {
 		close(i915);
Signature · 1 line
2.25.1
#8 lore raw

PATCH v9 4/16 Add PXP attribute support in batchbuffer and buffer_ops libs

In reply to Alan Previn

Eventually when we get to testing PXP rendering capability, we shall reuse lib's rendercopy feature. Rendercopy libraries shall retrieve information about PXP-session-enablement and which buffers are protected from these new flags.

---
 lib/intel_batchbuffer.c | 21 +++++++++++++++++++++
 lib/intel_batchbuffer.h | 28 ++++++++++++++++++++++++++++
 lib/intel_bufops.h      | 15 +++++++++++++++
 3 files changed, 64 insertions(+)
lib/intel_batchbuffer.c +21 -0
index 399d0e99..773d0d27 100644
@@ -2350,6 +2350,27 @@ uint64_t intel_bb_offset_reloc_to_object(struct intel_bb *ibb,
 				  delta, offset, presumed_offset);
 }
 
+/*
+ * @intel_bb_set_pxp:
+ * @ibb: pointer to intel_bb
+ * @new_state: enable or disable pxp session
+ * @apptype: pxp session input identifies what type of session to enable
+ * @appid: pxp session input provides which appid to use
+ *
+ * This function merely stores the pxp state and session information to
+ * be retrieved and programmed later by supporting libraries such as
+ * gen12_render_copy that must program the HW within the same dispatch
+ */
+void intel_bb_set_pxp(struct intel_bb *ibb, bool new_state,
+		      uint32_t apptype, uint32_t appid)
+{
+	igt_assert(ibb);
+
+	ibb->pxp.enabled = new_state;
+	ibb->pxp.apptype = new_state ? apptype : 0;
+	ibb->pxp.appid   = new_state ? appid : 0;
+}
+
 static void intel_bb_dump_execbuf(struct intel_bb *ibb,
 				  struct drm_i915_gem_execbuffer2 *execbuf)
 {
lib/intel_batchbuffer.h +28 -0
index 0839d761..10fa66ee 100644
@@ -446,6 +446,11 @@ typedef void (*igt_media_spinfunc_t)(int i915,
 
 igt_media_spinfunc_t igt_get_media_spinfunc(int devid);
 
+struct igt_pxp {
+	bool     enabled;
+	uint32_t apptype;
+	uint32_t appid;
+};
 
 /*
  * Batchbuffer without libdrm dependency
@@ -472,6 +477,7 @@ struct intel_bb {
 	bool supports_48b_address;
 	bool uses_full_ppgtt;
 
+	struct igt_pxp pxp;
 	uint32_t ctx;
 	uint32_t vm_id;
 
@@ -583,6 +589,27 @@ static inline void intel_bb_out(struct intel_bb *ibb, uint32_t dword)
 	igt_assert(intel_bb_offset(ibb) <= ibb->size);
 }
 
+void intel_bb_set_pxp(struct intel_bb *ibb, bool new_state,
+		      uint32_t apptype, uint32_t appid);
+
+static inline bool intel_bb_pxp_enabled(struct intel_bb *ibb)
+{
+	igt_assert(ibb);
+	return ibb->pxp.enabled;
+}
+
+static inline uint32_t intel_bb_pxp_apptype(struct intel_bb *ibb)
+{
+	igt_assert(ibb);
+	return ibb->pxp.apptype;
+}
+
+static inline uint32_t intel_bb_pxp_appid(struct intel_bb *ibb)
+{
+	igt_assert(ibb);
+	return ibb->pxp.appid;
+}
+
 struct drm_i915_gem_exec_object2 *
 intel_bb_add_object(struct intel_bb *ibb, uint32_t handle, uint64_t size,
 		    uint64_t offset, uint64_t alignment, bool write);
@@ -697,3 +724,4 @@ typedef void (*igt_huc_copyfunc_t)(int fd, uint64_t ahnd,
 
 igt_huc_copyfunc_t	igt_get_huc_copyfunc(int devid);
 #endif
+
lib/intel_bufops.h +15 -0
index 9e57d53e..bffeb1b0 100644
@@ -50,6 +50,9 @@ struct intel_buf {
 	uint32_t *ptr;
 	bool cpu_write;
 
+	/* Content Protection*/
+	bool is_protected;
+
 	/* For debugging purposes */
 	char name[INTEL_BUF_NAME_MAXSIZE + 1];
 };
@@ -155,6 +158,18 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,
 							 int stride);
 void intel_buf_destroy(struct intel_buf *buf);
 
+static inline void intel_buf_set_pxp(struct intel_buf *buf, bool new_pxp_state)
+{
+	igt_assert(buf);
+	buf->is_protected = new_pxp_state;
+}
+
+static inline bool intel_buf_pxp(const struct intel_buf *buf)
+{
+	igt_assert(buf);
+	return buf->is_protected;
+}
+
 void *intel_buf_cpu_map(struct intel_buf *buf, bool write);
 void *intel_buf_device_map(struct intel_buf *buf, bool write);
 void intel_buf_unmap(struct intel_buf *buf);
Signature · 1 line
2.25.1
#9 lore raw

PATCH v9 5/16 Add MI_SET_APPID instruction definition

In reply to Alan Previn

Add MI_SET_APPID instruction and param definitions

---
 lib/intel_reg.h | 8 ++++++++
 1 file changed, 8 insertions(+)
lib/intel_reg.h +8 -0
index ac1fc6cb..ab01a283 100644
@@ -2546,6 +2546,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define CTXT_PALETTE_SAVE_DISABLE	(1<<3)
 #define CTXT_PALETTE_RESTORE_DISABLE	(1<<2)
 
+#define MI_SET_APPID                    (0x0E << 23)
+#define APPID_CTXREST_INHIBIT           (1 << 9)
+#define APPID_CTXSAVE_INHIBIT           (1 << 8)
+#define APPTYPE(n)                      ((n) << 7)
+#define  DISPLAY_APPTYPE                (0)
+#define  TRANSCODE_APPTYPE              (1)
+#define APPID(n)                        ((n) & 0x7f)
+
 /* Dword 0 */
 #define MI_VERTEX_BUFFER		(0x17<<23)
 #define MI_VERTEX_BUFFER_IDX(x)		(x<<20)
Signature · 1 line
2.25.1
#10 lore raw

PATCH v9 6/16 Enable protected session cmd in gen12_render_copyfunc

In reply to Alan Previn

1. In _gen9_render_op, check if the incoming batchbuffer is marked with pxp enabled. If so, insert MI_SET_APPID along with PIPE_CONTROL instructions at the start and end of the rendering operation in the command buffer.

2. The two PIPE_CONTROLs will enable protected memory at the start of the batch and disabling protected memory at the end of it. These PIPE_CONTROLs require a Post-Sync operation with a write to memory for hardware to accept.

3. In order to satisfy #2, _gen9_render_op uses unused regions of the ibb buffer for the PIPE_CONTROL PostSync write to memory (no different from how other 3d states are being referenced).

4. _gen9_render_op shall check the incoming surface buffers for "is_protected" flag and if its set, it will mark the SURFACE_STATE's MOCS field accordingly.

NOTE: _gen9_render_op needs to program the HW to enable the PXP session as part of the rendering batch buffer because the HW requires that enabling/disabling protected memory access must be programmed in pairs within the same "dispatch of rendering commands" to HW.

---
 lib/rendercopy_gen9.c | 57 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
lib/rendercopy_gen9.c +57 -0
index 0356964e..f021f4cb 100644
@@ -183,6 +183,8 @@ gen8_bind_buf(struct intel_bb *ibb, const struct intel_buf *buf, int is_dst) {
 		ss->ss0.tiled_mode = 3;
 
 	ss->ss1.memory_object_control = intel_get_uc_mocs(i915);
+	if (intel_buf_pxp(buf))
+		ss->ss1.memory_object_control |= 1;
 
 	if (buf->tiling == I915_TILING_Yf)
 		ss->ss5.trmode = 1;
@@ -904,6 +906,53 @@ static void gen8_emit_primitive(struct intel_bb *ibb, uint32_t offset)
 	intel_bb_out(ibb, 0);	/* index buffer offset, ignored */
 }
 
+#define GFX_OP_PIPE_CONTROL    ((3 << 29) | (3 << 27) | (2 << 24))
+#define PIPE_CONTROL_CS_STALL	            (1 << 20)
+#define PIPE_CONTROL_RENDER_TARGET_FLUSH    (1 << 12)
+#define PIPE_CONTROL_FLUSH_ENABLE           (1 << 7)
+#define PIPE_CONTROL_DATA_CACHE_INVALIDATE  (1 << 5)
+#define PIPE_CONTROL_PROTECTEDPATH_DISABLE  (1 << 27)
+#define PIPE_CONTROL_PROTECTEDPATH_ENABLE   (1 << 22)
+#define PIPE_CONTROL_POST_SYNC_OP           (1 << 14)
+#define PIPE_CONTROL_POST_SYNC_OP_STORE_DW_IDX (1 << 21)
+#define PS_OP_TAG_START                     0x1234fed0
+#define PS_OP_TAG_END                       0x5678cbaf
+static void gen12_emit_pxp_state(struct intel_bb *ibb, bool enable,
+		 uint32_t pxp_write_op_offset)
+{
+	uint32_t pipe_ctl_flags;
+	uint32_t set_app_id, ps_op_id;
+
+	if (enable) {
+		pipe_ctl_flags = PIPE_CONTROL_FLUSH_ENABLE;
+		intel_bb_out(ibb, GFX_OP_PIPE_CONTROL);
+		intel_bb_out(ibb, pipe_ctl_flags);
+
+		set_app_id =  MI_SET_APPID |
+			      APPTYPE(intel_bb_pxp_apptype(ibb)) |
+			      APPID(intel_bb_pxp_appid(ibb));
+		intel_bb_out(ibb, set_app_id);
+
+		pipe_ctl_flags = PIPE_CONTROL_PROTECTEDPATH_ENABLE;
+		ps_op_id = PS_OP_TAG_START;
+	} else {
+		pipe_ctl_flags = PIPE_CONTROL_PROTECTEDPATH_DISABLE;
+		ps_op_id = PS_OP_TAG_END;
+	}
+
+	pipe_ctl_flags |= (PIPE_CONTROL_CS_STALL |
+			   PIPE_CONTROL_RENDER_TARGET_FLUSH |
+			   PIPE_CONTROL_DATA_CACHE_INVALIDATE |
+			   PIPE_CONTROL_POST_SYNC_OP);
+	intel_bb_out(ibb, GFX_OP_PIPE_CONTROL | 4);
+	intel_bb_out(ibb, pipe_ctl_flags);
+	intel_bb_emit_reloc(ibb, ibb->handle, 0, I915_GEM_DOMAIN_COMMAND,
+			    (enable ? pxp_write_op_offset : (pxp_write_op_offset+8)),
+			    ibb->batch_offset);
+	intel_bb_out(ibb, ps_op_id);
+	intel_bb_out(ibb, ps_op_id);
+}
+
 /* The general rule is if it's named gen6 it is directly copied from
  * gen6_render_copyfunc.
  *
@@ -953,6 +1002,7 @@ void _gen9_render_op(struct intel_bb *ibb,
 	uint32_t vertex_buffer;
 	uint32_t aux_pgtable_state;
 	bool fast_clear = !src;
+	uint32_t pxp_scratch_offset;
 
 	if (!fast_clear)
 		igt_assert(src->bpp == dst->bpp);
@@ -981,8 +1031,12 @@ void _gen9_render_op(struct intel_bb *ibb,
 	aux_pgtable_state = gen12_create_aux_pgtable_state(ibb, aux_pgtable_buf);
 
 	/* TODO: there is other state which isn't setup */
+	pxp_scratch_offset = intel_bb_offset(ibb);
 	intel_bb_ptr_set(ibb, 0);
 
+	if (intel_bb_pxp_enabled(ibb))
+		gen12_emit_pxp_state(ibb, true, pxp_scratch_offset);
+
 	/* Start emitting the commands. The order roughly follows the mesa blorp
 	 * order */
 	intel_bb_out(ibb, G4X_PIPELINE_SELECT | PIPELINE_SELECT_3D |
@@ -1054,6 +1108,9 @@ void _gen9_render_op(struct intel_bb *ibb,
 	gen8_emit_vf_topology(ibb);
 	gen8_emit_primitive(ibb, vertex_buffer);
 
+	if (intel_bb_pxp_enabled(ibb))
+		gen12_emit_pxp_state(ibb, false, pxp_scratch_offset);
+
 	intel_bb_emit_bbe(ibb);
 	intel_bb_exec(ibb, intel_bb_offset(ibb),
 		      I915_EXEC_RENDER | I915_EXEC_NO_RELOC, false);
Signature · 1 line
2.25.1
#11 lore raw

PATCH v9 7/16 Add subtest to copy raw source to protected dest

In reply to Alan Previn

Add subtest to 3d-copy raw source buffer (with known readible content) to a destination buffer marked as protected with a protected session using default session keys. The destination buffer is verified to be different from the source (when read via CPU) because its encrypted.

---
 tests/i915/gem_pxp.c | 55 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
tests/i915/gem_pxp.c +55 -0
index 7802a328..f34d6a7c 100644
@@ -376,7 +376,9 @@ static uint32_t alloc_and_fill_dest_buff(int i915, bool protected, uint32_t size
 #define TSTSURF_STRIDE      (TSTSURF_WIDTH*TSTSURF_BYTESPP)
 #define TSTSURF_SIZE        (TSTSURF_STRIDE*TSTSURF_HEIGHT)
 #define TSTSURF_FILLCOLOR1  0xfaceface
+#define TSTSURF_FILLCOLOR2  0xdeaddead
 #define TSTSURF_INITCOLOR1  0x12341234
+#define TSTSURF_INITCOLOR2  0x56785678
 
 static void test_render_baseline(int i915)
 {
@@ -422,6 +424,57 @@ static void test_render_baseline(int i915)
 	buf_ops_destroy(bops);
 }
 
+static void test_render_pxp_src_to_protdest(int i915)
+{
+	uint32_t ctx, srcbo, dstbo;
+	struct intel_buf *srcbuf, *dstbuf;
+	struct buf_ops *bops;
+	struct intel_bb *ibb;
+	uint32_t devid;
+	int ret;
+
+	devid = intel_get_drm_devid(i915);
+	igt_assert(devid);
+
+	bops = buf_ops_create(i915);
+	igt_assert(bops);
+
+	/*
+	 * Perform a protected render operation but only label
+	 * the dest as protected. After rendering, the content
+	 * should be encrypted
+	 */
+	ret = create_ctx_with_params(i915, true, true, true, false, &ctx);
+	igt_assert_eq(ret, 0);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 1);
+	ibb = intel_bb_create_with_context(i915, ctx, 4096);
+	igt_assert(ibb);
+	intel_bb_set_pxp(ibb, true, DISPLAY_APPTYPE, I915_PROTECTED_CONTENT_DEFAULT_SESSION);
+
+	dstbo = alloc_and_fill_dest_buff(i915, true, TSTSURF_SIZE, TSTSURF_INITCOLOR2);
+	dstbuf = intel_buf_create_using_handle(bops, dstbo, TSTSURF_WIDTH, TSTSURF_HEIGHT,
+						TSTSURF_BYTESPP*8, 0, I915_TILING_NONE, 0);
+	intel_buf_set_pxp(dstbuf, true);
+
+	srcbo = alloc_and_fill_dest_buff(i915, false, TSTSURF_SIZE, TSTSURF_FILLCOLOR2);
+	srcbuf = intel_buf_create_using_handle(bops, srcbo, TSTSURF_WIDTH, TSTSURF_HEIGHT,
+						TSTSURF_BYTESPP*8, 0, I915_TILING_NONE, 0);
+
+	gen12_render_copyfunc(ibb, srcbuf, 0, 0, TSTSURF_WIDTH, TSTSURF_HEIGHT, dstbuf, 0, 0);
+	gem_sync(i915, dstbo);
+
+	assert_bo_content_check(i915, dstbo, COMPARE_COLOR_UNREADIBLE,
+				TSTSURF_SIZE, TSTSURF_FILLCOLOR2);
+
+	intel_bb_destroy(ibb);
+	intel_buf_destroy(srcbuf);
+	gem_close(i915, srcbo);
+	intel_buf_destroy(dstbuf);
+	gem_close(i915, dstbo);
+	gem_context_destroy(i915, ctx);
+	buf_ops_destroy(bops);
+}
+
 igt_main
 {
 	int i915 = -1;
@@ -493,6 +546,8 @@ igt_main
 		igt_describe("Verify protected render operations:");
 		igt_subtest("regular-baseline-src-copy-readible")
 			test_render_baseline(i915);
+		igt_subtest("protected-raw-src-copy-not-readible")
+			test_render_pxp_src_to_protdest(i915);
 	}
 
 	igt_fixture {
Signature · 1 line
2.25.1
#12 lore raw

PATCH v9 8/16 Add test where both src and dest are protected

In reply to Alan Previn

When both the source and destination surfaces are protected, the destination pixel result of the 3d copy operation would be the same as the source. By appending this test case to the end of the prior test (raw-src to protected-dest) and reusing the previous' test destination as the current source, we can prove that new-source was decrypted properly as we would see the difference in results: repeating the same render operation but with a src buffer that is protected in this case yields matching (but still encrypted) output rendered pixels.

---
 tests/i915/gem_pxp.c | 144 +++++++++++++++++++++++++++++++++++++++----
 1 file changed, 133 insertions(+), 11 deletions(-)
tests/i915/gem_pxp.c +133 -11
index f34d6a7c..af40e893 100644
@@ -308,29 +308,51 @@ static void fill_bo_content(int i915, uint32_t bo, uint32_t size, uint32_t initc
 
 #define COMPARE_COLOR_READIBLE     1
 #define COMPARE_COLOR_UNREADIBLE   2
+#define COMPARE_BUFFER_READIBLE    3
+#define COMPARE_BUFFER_UNREADIBLE  4
+#define COPY_BUFFER                5
 #define COMPARE_N_PIXELS_VERBOSELY 0
 
-static void assert_bo_content_check(int i915, uint32_t bo, int compare_op,
-				    uint32_t size, uint32_t color)
+static void assert_bo_content_check(int i915, uint32_t bo, int compare_op, uint32_t size,
+				    uint32_t color, uint32_t *auxptr, int auxsize)
 {
-	uint32_t *ptr, *ptrtmp;
+	uint32_t *ptr, *ptrtmp, *auxtmp;
 	int loop = 0, num_matches = 0;
 	uint32_t value;
-	bool op_readible = (compare_op == COMPARE_COLOR_READIBLE);
+	bool op_readible = ((compare_op == COMPARE_COLOR_READIBLE) ||
+		 (compare_op == COMPARE_BUFFER_READIBLE));
+	bool chk_buff = ((compare_op == COMPARE_BUFFER_READIBLE) ||
+		 (compare_op == COMPARE_BUFFER_UNREADIBLE));
+	bool copy_buff = (compare_op == COPY_BUFFER);
 
 	ptr = gem_mmap__device_coherent(i915, bo, 0, size, PROT_READ);
 	ptrtmp = ptr;
 
+	if (chk_buff || copy_buff) {
+		if (auxsize < size)
+			auxptr = NULL;
+		igt_assert(auxptr);
+		auxtmp = auxptr;
+	}
+
 	if (COMPARE_N_PIXELS_VERBOSELY) {
 		igt_info("--------->>>\n");
 		while (loop < COMPARE_N_PIXELS_VERBOSELY && loop < (size/4)) {
 			value = *ptrtmp;
-			igt_info("Color read = 0x%08x ", value);
-			igt_info("expected %c= 0x%08x)\n", op_readible?'=':'!', color);
+			if (chk_buff)
+				color = *auxtmp;
+			if (copy_buff)
+				igt_info("Color copy = 0x%08x\n", value);
+			else {
+				igt_info("Color read = 0x%08x ", value);
+				igt_info("expected %c= 0x%08x)\n", op_readible?'=':'!', color);
+			}
+			++auxtmp;
 			++ptrtmp;
 			++loop;
 		}
 		igt_info("<<<---------\n");
+		auxtmp = auxptr;
 		ptrtmp = ptr;
 		loop = 0;
 	}
@@ -338,8 +360,25 @@ static void assert_bo_content_check(int i915, uint32_t bo, int compare_op,
 	/* count all pixels for matches */
 	while (loop++ < (size/4)) {
 		value = *ptrtmp;
-		if (value == color)
-			++num_matches;
+		switch (compare_op) {
+		case COMPARE_COLOR_READIBLE:
+		case COMPARE_COLOR_UNREADIBLE:
+			if (value == color)
+				++num_matches;
+			break;
+		case COMPARE_BUFFER_READIBLE:
+		case COMPARE_BUFFER_UNREADIBLE:
+			if (value == (*auxtmp))
+				++num_matches;
+			++auxtmp;
+			break;
+		case COPY_BUFFER:
+			*auxtmp = value;
+			++auxtmp;
+			break;
+		default:
+			break;
+		}
 		++ptrtmp;
 	}
 
@@ -361,7 +400,8 @@ static uint32_t alloc_and_fill_dest_buff(int i915, bool protected, uint32_t size
 	igt_assert_eq(ret, 0);
 	igt_assert(bo);
 	fill_bo_content(i915, bo, size, init_color);
-	assert_bo_content_check(i915, bo, COMPARE_COLOR_READIBLE, size, init_color);
+	assert_bo_content_check(i915, bo, COMPARE_COLOR_READIBLE,
+				size, init_color, NULL, 0);
 
 	return bo;
 }
@@ -379,6 +419,7 @@ static uint32_t alloc_and_fill_dest_buff(int i915, bool protected, uint32_t size
 #define TSTSURF_FILLCOLOR2  0xdeaddead
 #define TSTSURF_INITCOLOR1  0x12341234
 #define TSTSURF_INITCOLOR2  0x56785678
+#define TSTSURF_INITCOLOR3  0xabcdabcd
 
 static void test_render_baseline(int i915)
 {
@@ -413,7 +454,7 @@ static void test_render_baseline(int i915)
 	gem_sync(i915, dstbo);
 
 	assert_bo_content_check(i915, dstbo, COMPARE_COLOR_READIBLE,
-				TSTSURF_SIZE, TSTSURF_FILLCOLOR1);
+				TSTSURF_SIZE, TSTSURF_FILLCOLOR1, NULL, 0);
 
 	intel_bb_destroy(ibb);
 	intel_buf_destroy(srcbuf);
@@ -464,13 +505,92 @@ static void test_render_pxp_src_to_protdest(int i915)
 	gem_sync(i915, dstbo);
 
 	assert_bo_content_check(i915, dstbo, COMPARE_COLOR_UNREADIBLE,
-				TSTSURF_SIZE, TSTSURF_FILLCOLOR2);
+				TSTSURF_SIZE, TSTSURF_FILLCOLOR2, NULL, 0);
+
+	intel_bb_destroy(ibb);
+	intel_buf_destroy(srcbuf);
+	gem_close(i915, srcbo);
+	intel_buf_destroy(dstbuf);
+	gem_close(i915, dstbo);
+	gem_context_destroy(i915, ctx);
+	buf_ops_destroy(bops);
+}
+
+static void test_render_pxp_protsrc_to_protdest(int i915)
+{
+	uint32_t ctx, srcbo, dstbo, dstbo2;
+	struct intel_buf *srcbuf, *dstbuf, *dstbuf2;
+	struct buf_ops *bops;
+	struct intel_bb *ibb;
+	uint32_t devid;
+	int ret;
+	uint32_t encrypted[TSTSURF_SIZE/TSTSURF_BYTESPP];
+
+	devid = intel_get_drm_devid(i915);
+	igt_assert(devid);
+
+	bops = buf_ops_create(i915);
+	igt_assert(bops);
+
+	/*
+	 * Perform a protected render operation but only label
+	 * the dest as protected. After rendering, the content
+	 * should be encrypted
+	 */
+	ret = create_ctx_with_params(i915, true, true, true, false, &ctx);
+	igt_assert_eq(ret, 0);
+	igt_assert_eq(get_ctx_protected_param(i915, ctx), 1);
+	ibb = intel_bb_create_with_context(i915, ctx, 4096);
+	igt_assert(ibb);
+	intel_bb_set_pxp(ibb, true, DISPLAY_APPTYPE, I915_PROTECTED_CONTENT_DEFAULT_SESSION);
+
+	dstbo = alloc_and_fill_dest_buff(i915, true, TSTSURF_SIZE, TSTSURF_INITCOLOR2);
+	dstbuf = intel_buf_create_using_handle(bops, dstbo, TSTSURF_WIDTH, TSTSURF_HEIGHT,
+						TSTSURF_BYTESPP*8, 0, I915_TILING_NONE, 0);
+	intel_buf_set_pxp(dstbuf, true);
+
+	srcbo = alloc_and_fill_dest_buff(i915, false, TSTSURF_SIZE, TSTSURF_FILLCOLOR2);
+	srcbuf = intel_buf_create_using_handle(bops, srcbo, TSTSURF_WIDTH, TSTSURF_HEIGHT,
+						TSTSURF_BYTESPP*8, 0, I915_TILING_NONE, 0);
+
+	gen12_render_copyfunc(ibb, srcbuf, 0, 0, TSTSURF_WIDTH, TSTSURF_HEIGHT, dstbuf, 0, 0);
+	gem_sync(i915, dstbo);
+
+	assert_bo_content_check(i915, dstbo, COMPARE_COLOR_UNREADIBLE,
+				TSTSURF_SIZE, TSTSURF_FILLCOLOR2, NULL, 0);
+
+	/*
+	 * Reuse prior dst as the new-src and create dst2 as the new-dest.
+	 * Take a copy of encrypted content from new-src for comparison after render
+	 * operation. After the rendering, we should find no difference in content
+	 * since both new-src and new-dest are labelled as encrypted. HW should read
+	 * and decrypt new-src, perform the render and re-encrypt when going into
+	 * new-dest
+	 */
+	assert_bo_content_check(i915, dstbo, COPY_BUFFER,
+				TSTSURF_SIZE, 0, encrypted, TSTSURF_SIZE);
+
+	dstbo2 = alloc_and_fill_dest_buff(i915, true, TSTSURF_SIZE, TSTSURF_INITCOLOR3);
+	dstbuf2 = intel_buf_create_using_handle(bops, dstbo2, TSTSURF_WIDTH, TSTSURF_HEIGHT,
+						TSTSURF_BYTESPP*8, 0, I915_TILING_NONE, 0);
+	intel_buf_set_pxp(dstbuf2, true);
+	intel_buf_set_pxp(dstbuf, true);/*this time, src is protected*/
+
+	intel_bb_set_pxp(ibb, true, DISPLAY_APPTYPE, I915_PROTECTED_CONTENT_DEFAULT_SESSION);
+
+	gen12_render_copyfunc(ibb, dstbuf, 0, 0, TSTSURF_WIDTH, TSTSURF_HEIGHT, dstbuf2, 0, 0);
+	gem_sync(i915, dstbo2);
+
+	assert_bo_content_check(i915, dstbo2, COMPARE_BUFFER_READIBLE,
+				TSTSURF_SIZE, 0, encrypted, TSTSURF_SIZE);
 
 	intel_bb_destroy(ibb);
 	intel_buf_destroy(srcbuf);
 	gem_close(i915, srcbo);
 	intel_buf_destroy(dstbuf);
 	gem_close(i915, dstbo);
+	intel_buf_destroy(dstbuf2);
+	gem_close(i915, dstbo2);
 	gem_context_destroy(i915, ctx);
 	buf_ops_destroy(bops);
 }
@@ -548,6 +668,8 @@ igt_main
 			test_render_baseline(i915);
 		igt_subtest("protected-raw-src-copy-not-readible")
 			test_render_pxp_src_to_protdest(i915);
+		igt_subtest("protected-encrypted-src-copy-not-readible")
+			test_render_pxp_protsrc_to_protdest(i915);
 	}
 
 	igt_fixture {
Signature · 1 line
2.25.1
#13 lore raw

PATCH v9 9/16 Verify PXP teardown occurred through suspend-resume

In reply to Alan Previn

During a suspend-resume cycle, the driver shall ensure the PXP session and keys are torn down and re-established. Verify that key change did occur by repeating the 3d rendercopy operation before and after the suspend-resume cycle and ensuring the encrypted output is different.

---
 tests/i915/gem_pxp.c | 66 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 65 insertions(+), 1 deletion(-)
tests/i915/gem_pxp.c +65 -1
index af40e893..b997b058 100644
@@ -9,6 +9,12 @@
 IGT_TEST_DESCRIPTION("Test PXP that manages protected content through arbitrated HW-PXP-session");
 /* Note: PXP = "Protected Xe Path" */
 
+/* Struct and definitions for power management. */
+struct powermgt_data {
+	int debugfsdir;
+	bool has_runtime_pm;
+};
+
 static int create_bo_ext(int i915, uint32_t size, bool protected_is_true, uint32_t *bo_out)
 {
 	int ret;
@@ -465,7 +471,7 @@ static void test_render_baseline(int i915)
 	buf_ops_destroy(bops);
 }
 
-static void test_render_pxp_src_to_protdest(int i915)
+static void __test_render_pxp_src_to_protdest(int i915, uint32_t *outpixels, int outsize)
 {
 	uint32_t ctx, srcbo, dstbo;
 	struct intel_buf *srcbuf, *dstbuf;
@@ -507,6 +513,10 @@ static void test_render_pxp_src_to_protdest(int i915)
 	assert_bo_content_check(i915, dstbo, COMPARE_COLOR_UNREADIBLE,
 				TSTSURF_SIZE, TSTSURF_FILLCOLOR2, NULL, 0);
 
+	if (outpixels)
+		assert_bo_content_check(i915, dstbo, COPY_BUFFER,
+					TSTSURF_SIZE, 0, outpixels, outsize);
+
 	intel_bb_destroy(ibb);
 	intel_buf_destroy(srcbuf);
 	gem_close(i915, srcbo);
@@ -516,6 +526,11 @@ static void test_render_pxp_src_to_protdest(int i915)
 	buf_ops_destroy(bops);
 }
 
+static void test_render_pxp_src_to_protdest(int i915)
+{
+	__test_render_pxp_src_to_protdest(i915, NULL, 0);
+}
+
 static void test_render_pxp_protsrc_to_protdest(int i915)
 {
 	uint32_t ctx, srcbo, dstbo, dstbo2;
@@ -595,10 +610,46 @@ static void test_render_pxp_protsrc_to_protdest(int i915)
 	buf_ops_destroy(bops);
 }
 
+static void init_powermgt_resources(int i915, struct powermgt_data *pm)
+{
+	pm->debugfsdir = igt_debugfs_dir(i915);
+	igt_require(pm->debugfsdir != -1);
+	pm->has_runtime_pm = igt_setup_runtime_pm(i915);
+	igt_require(pm->has_runtime_pm);
+}
+
+static void trigger_powermgt_suspend_cycle(int i915,
+	struct powermgt_data *pm)
+{
+	igt_pm_enable_sata_link_power_management();
+	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_DEVICES);
+}
+
+static void test_pxp_pwrcycle_teardown_keychange(int i915, struct powermgt_data *pm)
+{
+	uint32_t encrypted_pixels_b4[TSTSURF_SIZE/TSTSURF_BYTESPP];
+	uint32_t encrypted_pixels_aft[TSTSURF_SIZE/TSTSURF_BYTESPP];
+	int matched_after_keychange = 0, loop = 0;
+
+	__test_render_pxp_src_to_protdest(i915, encrypted_pixels_b4, TSTSURF_SIZE);
+
+	trigger_powermgt_suspend_cycle(i915, pm);
+
+	__test_render_pxp_src_to_protdest(i915, encrypted_pixels_aft, TSTSURF_SIZE);
+
+	while (loop < (TSTSURF_SIZE/TSTSURF_BYTESPP)) {
+		if (encrypted_pixels_b4[loop] == encrypted_pixels_aft[loop])
+			++matched_after_keychange;
+		++loop;
+	}
+	igt_assert_eq(matched_after_keychange, 0);
+}
+
 igt_main
 {
 	int i915 = -1;
 	bool pxp_supported = false;
+	struct powermgt_data pm = {0};
 	igt_render_copyfunc_t rendercopy = NULL;
 	uint32_t devid = 0;
 
@@ -671,6 +722,19 @@ igt_main
 		igt_subtest("protected-encrypted-src-copy-not-readible")
 			test_render_pxp_protsrc_to_protdest(i915);
 	}
+	igt_subtest_group {
+		igt_fixture {
+			igt_require(pxp_supported);
+			devid = intel_get_drm_devid(i915);
+			igt_assert(devid);
+			rendercopy = igt_get_render_copyfunc(devid);
+			igt_require(rendercopy);
+			init_powermgt_resources(i915, &pm);
+		}
+		igt_describe("Verify suspend-resume teardown management:");
+		igt_subtest("verify-pxp-key-change-after-suspend-resume")
+			test_pxp_pwrcycle_teardown_keychange(i915, &pm);
+	}
 
 	igt_fixture {
 		close(i915);
Signature · 1 line
2.25.1
#14 lore raw

Re: [igt-dev] [PATCH i-g-t v9 09/16] Verify PXP teardown occurred through suspend-resume

Quoted 5 lines · Alan Previn

During a suspend-resume cycle, the driver shall ensure the PXP session and keys are torn down and re-established. Verify that key change did occur by repeating the 3d rendercopy operation before and after the suspend-resume cycle and ensuring the encrypted output is different.

Is this aligned with the latest series from Daniele? In the latest version we are blocking the runtime_pm if there's active protected context. So we might do only system-suspend tests?

Anyway, I have a feeling that those changes might impact this case.

Quoted 126 lines
---
 tests/i915/gem_pxp.c | 66 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 65 insertions(+), 1 deletion(-)
tests/i915/gem_pxp.c +65 -1
index af40e893..b997b058 100644
@@ -9,6 +9,12 @@
 IGT_TEST_DESCRIPTION("Test PXP that manages protected content through arbitrated HW-PXP-session");
 /* Note: PXP = "Protected Xe Path" */
 
+/* Struct and definitions for power management. */
+struct powermgt_data {
+	int debugfsdir;
+	bool has_runtime_pm;
+};
+
 static int create_bo_ext(int i915, uint32_t size, bool protected_is_true, uint32_t *bo_out)
 {
 	int ret;
@@ -465,7 +471,7 @@ static void test_render_baseline(int i915)
 	buf_ops_destroy(bops);
 }
 
-static void test_render_pxp_src_to_protdest(int i915)
+static void __test_render_pxp_src_to_protdest(int i915, uint32_t *outpixels, int outsize)
 {
 	uint32_t ctx, srcbo, dstbo;
 	struct intel_buf *srcbuf, *dstbuf;
@@ -507,6 +513,10 @@ static void test_render_pxp_src_to_protdest(int i915)
 	assert_bo_content_check(i915, dstbo, COMPARE_COLOR_UNREADIBLE,
 				TSTSURF_SIZE, TSTSURF_FILLCOLOR2, NULL, 0);
 
+	if (outpixels)
+		assert_bo_content_check(i915, dstbo, COPY_BUFFER,
+					TSTSURF_SIZE, 0, outpixels, outsize);
+
 	intel_bb_destroy(ibb);
 	intel_buf_destroy(srcbuf);
 	gem_close(i915, srcbo);
@@ -516,6 +526,11 @@ static void test_render_pxp_src_to_protdest(int i915)
 	buf_ops_destroy(bops);
 }
 
+static void test_render_pxp_src_to_protdest(int i915)
+{
+	__test_render_pxp_src_to_protdest(i915, NULL, 0);
+}
+
 static void test_render_pxp_protsrc_to_protdest(int i915)
 {
 	uint32_t ctx, srcbo, dstbo, dstbo2;
@@ -595,10 +610,46 @@ static void test_render_pxp_protsrc_to_protdest(int i915)
 	buf_ops_destroy(bops);
 }
 
+static void init_powermgt_resources(int i915, struct powermgt_data *pm)
+{
+	pm->debugfsdir = igt_debugfs_dir(i915);
+	igt_require(pm->debugfsdir != -1);
+	pm->has_runtime_pm = igt_setup_runtime_pm(i915);
+	igt_require(pm->has_runtime_pm);
+}
+
+static void trigger_powermgt_suspend_cycle(int i915,
+	struct powermgt_data *pm)
+{
+	igt_pm_enable_sata_link_power_management();
+	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_DEVICES);
+}
+
+static void test_pxp_pwrcycle_teardown_keychange(int i915, struct powermgt_data *pm)
+{
+	uint32_t encrypted_pixels_b4[TSTSURF_SIZE/TSTSURF_BYTESPP];
+	uint32_t encrypted_pixels_aft[TSTSURF_SIZE/TSTSURF_BYTESPP];
+	int matched_after_keychange = 0, loop = 0;
+
+	__test_render_pxp_src_to_protdest(i915, encrypted_pixels_b4, TSTSURF_SIZE);
+
+	trigger_powermgt_suspend_cycle(i915, pm);
+
+	__test_render_pxp_src_to_protdest(i915, encrypted_pixels_aft, TSTSURF_SIZE);
+
+	while (loop < (TSTSURF_SIZE/TSTSURF_BYTESPP)) {
+		if (encrypted_pixels_b4[loop] == encrypted_pixels_aft[loop])
+			++matched_after_keychange;
+		++loop;
+	}
+	igt_assert_eq(matched_after_keychange, 0);
+}
+
 igt_main
 {
 	int i915 = -1;
 	bool pxp_supported = false;
+	struct powermgt_data pm = {0};
 	igt_render_copyfunc_t rendercopy = NULL;
 	uint32_t devid = 0;
 
@@ -671,6 +722,19 @@ igt_main
 		igt_subtest("protected-encrypted-src-copy-not-readible")
 			test_render_pxp_protsrc_to_protdest(i915);
 	}
+	igt_subtest_group {
+		igt_fixture {
+			igt_require(pxp_supported);
+			devid = intel_get_drm_devid(i915);
+			igt_assert(devid);
+			rendercopy = igt_get_render_copyfunc(devid);
+			igt_require(rendercopy);
+			init_powermgt_resources(i915, &pm);
+		}
+		igt_describe("Verify suspend-resume teardown management:");
+		igt_subtest("verify-pxp-key-change-after-suspend-resume")
+			test_pxp_pwrcycle_teardown_keychange(i915, &pm);
+	}
 
 	igt_fixture {
 		close(i915);
Signature · 1 line
2.25.1
#15 lore raw

Re: [igt-dev] [PATCH i-g-t v9 09/16] Verify PXP teardown occurred through suspend-resume

Quoted 7 lines · Rodrigo Vivi
Quoted 5 lines · Alan Previn

During a suspend-resume cycle, the driver shall ensure the PXP session and keys are torn down and re-established. Verify that key change did occur by repeating the 3d rendercopy operation before and after the suspend-resume cycle and ensuring the encrypted output is different.

Quoted 6 lines

Is this aligned with the latest series from Daniele? In the latest version we are blocking the runtime_pm if there's active protected context. So we might do only system-suspend tests?

Anyway, I have a feeling that those changes might impact this case.

when you say "might impact this case", do u mean this specific subtest - i.e. teardown-check-after- suspend-resume? if so, I dont beleive its impacted because this subtest does pxp rendering operation before the explicit system level suspend-resume cycle and then does a second rendering operation after resuming, thus it should observe the encrypted content changed. Danielle and I tested on a couple of hw with pxp support.

Quoted 126 lines
Quoted 126 lines
---
 tests/i915/gem_pxp.c | 66 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 65 insertions(+), 1 deletion(-)
tests/i915/gem_pxp.c +65 -1
index af40e893..b997b058 100644
@@ -9,6 +9,12 @@
 IGT_TEST_DESCRIPTION("Test PXP that manages protected content through arbitrated HW-PXP-session");
 /* Note: PXP = "Protected Xe Path" */
 
+/* Struct and definitions for power management. */
+struct powermgt_data {
+	int debugfsdir;
+	bool has_runtime_pm;
+};
+
 static int create_bo_ext(int i915, uint32_t size, bool protected_is_true, uint32_t *bo_out)
 {
 	int ret;
@@ -465,7 +471,7 @@ static void test_render_baseline(int i915)
 	buf_ops_destroy(bops);
 }
 
-static void test_render_pxp_src_to_protdest(int i915)
+static void __test_render_pxp_src_to_protdest(int i915, uint32_t *outpixels, int outsize)
 {
 	uint32_t ctx, srcbo, dstbo;
 	struct intel_buf *srcbuf, *dstbuf;
@@ -507,6 +513,10 @@ static void test_render_pxp_src_to_protdest(int i915)
 	assert_bo_content_check(i915, dstbo, COMPARE_COLOR_UNREADIBLE,
 				TSTSURF_SIZE, TSTSURF_FILLCOLOR2, NULL, 0);
 
+	if (outpixels)
+		assert_bo_content_check(i915, dstbo, COPY_BUFFER,
+					TSTSURF_SIZE, 0, outpixels, outsize);
+
 	intel_bb_destroy(ibb);
 	intel_buf_destroy(srcbuf);
 	gem_close(i915, srcbo);
@@ -516,6 +526,11 @@ static void test_render_pxp_src_to_protdest(int i915)
 	buf_ops_destroy(bops);
 }
 
+static void test_render_pxp_src_to_protdest(int i915)
+{
+	__test_render_pxp_src_to_protdest(i915, NULL, 0);
+}
+
 static void test_render_pxp_protsrc_to_protdest(int i915)
 {
 	uint32_t ctx, srcbo, dstbo, dstbo2;
@@ -595,10 +610,46 @@ static void test_render_pxp_protsrc_to_protdest(int i915)
 	buf_ops_destroy(bops);
 }
 
+static void init_powermgt_resources(int i915, struct powermgt_data *pm)
+{
+	pm->debugfsdir = igt_debugfs_dir(i915);
+	igt_require(pm->debugfsdir != -1);
+	pm->has_runtime_pm = igt_setup_runtime_pm(i915);
+	igt_require(pm->has_runtime_pm);
+}
+
+static void trigger_powermgt_suspend_cycle(int i915,
+	struct powermgt_data *pm)
+{
+	igt_pm_enable_sata_link_power_management();
+	igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_DEVICES);
+}
+
+static void test_pxp_pwrcycle_teardown_keychange(int i915, struct powermgt_data *pm)
+{
+	uint32_t encrypted_pixels_b4[TSTSURF_SIZE/TSTSURF_BYTESPP];
+	uint32_t encrypted_pixels_aft[TSTSURF_SIZE/TSTSURF_BYTESPP];
+	int matched_after_keychange = 0, loop = 0;
+
+	__test_render_pxp_src_to_protdest(i915, encrypted_pixels_b4, TSTSURF_SIZE);
+
+	trigger_powermgt_suspend_cycle(i915, pm);
+
+	__test_render_pxp_src_to_protdest(i915, encrypted_pixels_aft, TSTSURF_SIZE);
+
+	while (loop < (TSTSURF_SIZE/TSTSURF_BYTESPP)) {
+		if (encrypted_pixels_b4[loop] == encrypted_pixels_aft[loop])
+			++matched_after_keychange;
+		++loop;
+	}
+	igt_assert_eq(matched_after_keychange, 0);
+}
+
 igt_main
 {
 	int i915 = -1;
 	bool pxp_supported = false;
+	struct powermgt_data pm = {0};
 	igt_render_copyfunc_t rendercopy = NULL;
 	uint32_t devid = 0;
 
@@ -671,6 +722,19 @@ igt_main
 		igt_subtest("protected-encrypted-src-copy-not-readible")
 			test_render_pxp_protsrc_to_protdest(i915);
 	}
+	igt_subtest_group {
+		igt_fixture {
+			igt_require(pxp_supported);
+			devid = intel_get_drm_devid(i915);
+			igt_assert(devid);
+			rendercopy = igt_get_render_copyfunc(devid);
+			igt_require(rendercopy);
+			init_powermgt_resources(i915, &pm);
+		}
+		igt_describe("Verify suspend-resume teardown management:");
+		igt_subtest("verify-pxp-key-change-after-suspend-resume")
+			test_pxp_pwrcycle_teardown_keychange(i915, &pm);
+	}
 
 	igt_fixture {
 		close(i915);
Signature · 1 line
2.25.1
#16 lore raw

PATCH v9 10/16 Verify execbuf fails with stale PXP context after teardown

In reply to Alan Previn

Add a subtest to verify that reusing a stale protected context in a gem_execbuff after a teardown fails with -EIO error because it's banned. 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.

---
 lib/intel_batchbuffer.c |   2 +-
 lib/intel_batchbuffer.h |   3 +
 tests/i915/gem_pxp.c    | 151 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+), 1 deletion(-)
lib/intel_batchbuffer.c +1 -1
index 773d0d27..3aebcc16 100644
@@ -2529,7 +2529,7 @@ static void update_offsets(struct intel_bb *ibb,
  * Note: In this step execobj for bb is allocated and inserted to the objects
  * array.
 */
-static int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,
+int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,
 			   uint64_t flags, bool sync)
 {
 	struct drm_i915_gem_execbuffer2 execbuf;
lib/intel_batchbuffer.h +3 -0
index 10fa66ee..58bddb1a 100644
@@ -668,6 +668,9 @@ uint64_t intel_bb_offset_reloc_to_object(struct intel_bb *ibb,
 					 uint32_t offset,
 					 uint64_t presumed_offset);
 
+int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,
+			uint64_t flags, bool sync);
+
 void intel_bb_dump_cache(struct intel_bb *ibb);
 
 void intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,
tests/i915/gem_pxp.c +151 -0

175 lines not on this page · raw message

Signature · 1 line
2.25.1
#17 lore raw

Re: [igt-dev] [PATCH i-g-t v9 10/16] Verify execbuf fails with stale PXP context after teardown

Quoted 203 lines · Alan Previn

Add a subtest to verify that reusing a stale protected context in a gem_execbuff after a teardown fails with -EIO error because it's banned. 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.

---
 lib/intel_batchbuffer.c |   2 +-
 lib/intel_batchbuffer.h |   3 +
 tests/i915/gem_pxp.c    | 151 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+), 1 deletion(-)
lib/intel_batchbuffer.c +1 -1
index 773d0d27..3aebcc16 100644
@@ -2529,7 +2529,7 @@ static void update_offsets(struct intel_bb *ibb,
  * Note: In this step execobj for bb is allocated and inserted to the objects
  * array.
 */
-static int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,
+int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,
 			   uint64_t flags, bool sync)
 {
 	struct drm_i915_gem_execbuffer2 execbuf;
lib/intel_batchbuffer.h +3 -0
index 10fa66ee..58bddb1a 100644
@@ -668,6 +668,9 @@ uint64_t intel_bb_offset_reloc_to_object(struct intel_bb *ibb,
 					 uint32_t offset,
 					 uint64_t presumed_offset);
 
+int __intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,
+			uint64_t flags, bool sync);
+
 void intel_bb_dump_cache(struct intel_bb *ibb);
 
 void intel_bb_exec(struct intel_bb *ibb, uint32_t end_offset,
tests/i915/gem_pxp.c +135 -0
index b997b058..6884e0d7 100644
@@ -5,6 +5,7 @@
 
 #include "igt.h"
 #include "i915/gem.h"
+#include <fcntl.h>
 
 IGT_TEST_DESCRIPTION("Test PXP that manages protected content through arbitrated HW-PXP-session");
 /* Note: PXP = "Protected Xe Path" */
@@ -15,6 +16,14 @@ struct powermgt_data {
 	bool has_runtime_pm;
 };
 
+struct simple_exec_assets {
+	uint32_t ctx;
+	uint32_t fencebo;
+	struct intel_buf *fencebuf;
+	struct buf_ops *bops;
+	struct intel_bb *ibb;
+};
+
 static int create_bo_ext(int i915, uint32_t size, bool protected_is_true, uint32_t *bo_out)
 {
 	int ret;
@@ -645,6 +654,146 @@ static void test_pxp_pwrcycle_teardown_keychange(int i915, struct powermgt_data
 	igt_assert_eq(matched_after_keychange, 0);
 }
 
+#define GFX_OP_PIPE_CONTROL    ((3 << 29) | (3 << 27) | (2 << 24))
+#define PIPE_CONTROL_CS_STALL	            (1 << 20)
+#define PIPE_CONTROL_RENDER_TARGET_FLUSH    (1 << 12)
+#define PIPE_CONTROL_FLUSH_ENABLE           (1 << 7)
+#define PIPE_CONTROL_DATA_CACHE_INVALIDATE  (1 << 5)
+#define PIPE_CONTROL_PROTECTEDPATH_DISABLE  (1 << 27)
+#define PIPE_CONTROL_PROTECTEDPATH_ENABLE   (1 << 22)
+#define PIPE_CONTROL_POST_SYNC_OP           (1 << 14)
+#define PIPE_CONTROL_POST_SYNC_OP_STORE_DW_IDX (1 << 21)
+#define PS_OP_TAG_BEFORE                    0x1234fed0
+#define PS_OP_TAG_AFTER                     0x5678cbaf
+
+static void emit_pipectrl(struct intel_bb *ibb, struct intel_buf *fenceb, bool before)
+{
+	uint32_t pipe_ctl_flags = 0;
+	uint32_t ps_op_id;
+
+	intel_bb_out(ibb, GFX_OP_PIPE_CONTROL);
+	intel_bb_out(ibb, pipe_ctl_flags);
+
+	if (before)
+		ps_op_id = PS_OP_TAG_BEFORE;
+	else
+		ps_op_id = PS_OP_TAG_AFTER;
+
+	pipe_ctl_flags = (PIPE_CONTROL_FLUSH_ENABLE |
+			  PIPE_CONTROL_CS_STALL |
+			  PIPE_CONTROL_POST_SYNC_OP);
+	intel_bb_out(ibb, GFX_OP_PIPE_CONTROL | 4);
+	intel_bb_out(ibb, pipe_ctl_flags);
+	intel_bb_emit_reloc(ibb, fenceb->handle, 0, I915_GEM_DOMAIN_COMMAND, (before?0:8),
+			    fenceb->addr.offset);
+	intel_bb_out(ibb, ps_op_id);
+	intel_bb_out(ibb, ps_op_id);
+	intel_bb_out(ibb, MI_NOOP);
+	intel_bb_out(ibb, MI_NOOP);
+}
+
+static void assert_pipectl_storedw_done(int i915, uint32_t bo)
+{
+	uint32_t *ptr;
+	uint32_t success_mask = 0x0;
+
+	ptr = gem_mmap__device_coherent(i915, bo, 0, 4096, PROT_READ);
+
+	if (ptr[0] == PS_OP_TAG_BEFORE && ptr[1] == PS_OP_TAG_BEFORE)
+		success_mask |= 0x1;
+
+	igt_assert_eq(success_mask, 0x1);
+	igt_assert(gem_munmap(ptr, 4096) == 0);
+}
+
+static int gem_execbuf_flush_store_dw(int i915, struct intel_bb *ibb, uint32_t ctx,
+				      struct intel_buf *fence)
+{
+	int ret;
+
+	intel_bb_ptr_set(ibb, 0);
+	intel_bb_add_intel_buf(ibb, fence, true);
+	emit_pipectrl(ibb, fence, true);
+	intel_bb_emit_bbe(ibb);
+	ret = __intel_bb_exec(ibb, intel_bb_offset(ibb),
+				  I915_EXEC_RENDER | I915_EXEC_NO_RELOC, false);
+	if (ret == 0) {
+		gem_sync(ibb->i915, fence->handle);
+		assert_pipectl_storedw_done(i915, fence->handle);
+	}
+	return ret;
+}
+
+static void prepare_exec_assets(int i915, struct simple_exec_assets *data, bool ctx_pxp,
+				bool buf_pxp)
+{
+	int ret;
+
+	if (ctx_pxp)
+		ret = create_ctx_with_params(i915, true, true, true, false, &(data->ctx));
+	else
+		ret = create_ctx_with_params(i915, false, false, false, false, &(data->ctx));
+	igt_assert_eq(ret, 0);
+	igt_assert_eq(get_ctx_protected_param(i915, data->ctx), ctx_pxp);
+	data->ibb = intel_bb_create_with_context(i915, data->ctx, 4096);
+	igt_assert(data->ibb);
+
+	data->fencebo = alloc_and_fill_dest_buff(i915, buf_pxp, 4096, 0);
+
+	data->bops = buf_ops_create(i915);
+	igt_assert(data->bops);
+
+	data->fencebuf = intel_buf_create_using_handle(data->bops, data->fencebo, 256, 4,
+						       32, 0, I915_TILING_NONE, 0);
+	intel_bb_add_intel_buf(data->ibb, data->fencebuf, true);
+}
+
+static void free_exec_assets(int i915, struct simple_exec_assets *data)
+{
+	intel_bb_destroy(data->ibb);
+	gem_close(i915, data->fencebo);
+	intel_buf_destroy(data->fencebuf);
+	gem_context_destroy(i915, data->ctx);
+	buf_ops_destroy(data->bops);
+}
+
+static void trigger_pxp_debugfs_forced_teardown(int i915)
+{
+	int fd, ret;
+	char str[32];
+
+	fd = igt_debugfs_open(i915, "gt/pxp/invalidate", O_RDWR);
+	igt_assert_f(fd >= 0, "Can't open pxp invalidation debugfs\n");
+	ret = snprintf(str, sizeof(str), "0x1");
+	igt_assert(ret > 2 && ret < sizeof(str));
+	ret = write(fd, str, ret);
+	igt_assert_f(ret > 0, "Can't write pxp invalidation debugfs\n");
+
+	close(fd);
+}
+
+static void test_pxp_stale_ctx_execution(int i915)
+{
+	int ret;
+	struct simple_exec_assets data = {0};
+
+	/*
+	 * Use normal buffers for testing for invalidation
+	 * of protected contexts to ensure kernel is catching

tests/i915/gem_pxp.c static void test_pxp_pwrcycle_teardown_keychange(int i915, struct powermgt_data · line 792

Quoted 10 lines
tests/i915/gem_pxp.c +10 -0
+	 * the invalidated context (not buffer)
+	 */
+	prepare_exec_assets(i915, &data, true, false);
+	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
+	igt_assert(ret == 0);
+
+	trigger_pxp_debugfs_forced_teardown(i915);
+
+	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
+	igt_assert_f((ret == -EIO), "Executing stale pxp context didn't fail with -EIO\n");

I believe you meant the opposite right?
other then that, the patch looks good to me...

Quoted 19 lines
tests/i915/gem_pxp.c +6 -0
+
+	free_exec_assets(i915, &data);
+}
+
 igt_main
 {
 	int i915 = -1;
@@ -734,6 +883,8 @@ igt_main
 		igt_describe("Verify suspend-resume teardown management:");
 		igt_subtest("verify-pxp-key-change-after-suspend-resume")
 			test_pxp_pwrcycle_teardown_keychange(i915, &pm);
+		igt_subtest("verify-pxp-stale-ctx-execution")
+			test_pxp_stale_ctx_execution(i915);
 	}
 
 	igt_fixture {
Signature · 1 line
2.25.1
#18 lore raw

Re: [igt-dev] [PATCH i-g-t v9 10/16] Verify execbuf fails with stale PXP context after teardown

Quoted 33 lines · Rodrigo Vivi
Quoted 32 lines · Alan Previn

Add a subtest to verify that reusing a stale protected context in a gem_execbuff after a teardown fails with -EIO error because it's banned. 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.

---
 lib/intel_batchbuffer.c |   2 +-
 lib/intel_batchbuffer.h |   3 +
 tests/i915/gem_pxp.c    | 151 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+), 1 deletion(-)
tests/i915/gem_pxp.c +13 -0
+static void test_pxp_stale_ctx_execution(int i915)
+{
+	int ret;
+	struct simple_exec_assets data = {0};
+
+	/*
+	 * Use normal buffers for testing for invalidation
+	 * of protected contexts to ensure kernel is catching
+	 * the invalidated context (not buffer)
+	 */
+	prepare_exec_assets(i915, &data, true, false);
+	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
+	igt_assert(ret == 0);
Quoted 8 lines

tests/i915/gem_pxp.c static void test_pxp_pwrcycle_teardown_keychange(int i915, struct powermgt_data · line 792

Quoted 5 lines
tests/i915/gem_pxp.c +5 -0
+
+	trigger_pxp_debugfs_forced_teardown(i915);
+
+	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
+	igt_assert_f((ret == -EIO), "Executing stale pxp context didn't fail with -EIO\n");

I believe you meant the opposite right?
other then that, the patch looks good to me...

No, I actually DID want to ensure I get the -EIO failure when executing with stale PXP and so the error does read correctly. I can modify it to "Executing stale pxp was expected to fail with -EIO\n" if you like. Can i still get a conditional R-v-b at least? (i do have to double check that the error type hasnt changed - this had changed a few times on the kernel side and i need to check the latest rev today).

...alan

Reviewed-by
#19 lore raw

Re: [igt-dev] [PATCH i-g-t v9 10/16] Verify execbuf fails with stale PXP context after teardown

Quoted 44 lines · Alan Previn
Quoted 33 lines · Rodrigo Vivi
Quoted 32 lines · Alan Previn

Add a subtest to verify that reusing a stale protected context in a gem_execbuff after a teardown fails with -EIO error because it's banned. 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.

---
 lib/intel_batchbuffer.c |   2 +-
 lib/intel_batchbuffer.h |   3 +
 tests/i915/gem_pxp.c    | 151 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+), 1 deletion(-)
tests/i915/gem_pxp.c +13 -0
+static void test_pxp_stale_ctx_execution(int i915)
+{
+	int ret;
+	struct simple_exec_assets data = {0};
+
+	/*
+	 * Use normal buffers for testing for invalidation
+	 * of protected contexts to ensure kernel is catching
+	 * the invalidated context (not buffer)
+	 */
+	prepare_exec_assets(i915, &data, true, false);
+	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
+	igt_assert(ret == 0);
Quoted 8 lines

tests/i915/gem_pxp.c static void test_pxp_pwrcycle_teardown_keychange(int i915, struct powermgt_data · line 792

Quoted 5 lines
tests/i915/gem_pxp.c +5 -0
+
+	trigger_pxp_debugfs_forced_teardown(i915);
+
+	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
+	igt_assert_f((ret == -EIO), "Executing stale pxp context didn't fail with -EIO\n");

I believe you meant the opposite right?
other then that, the patch looks good to me...

Quoted 4 lines

No, I actually DID want to ensure I get the -EIO failure when executing with stale PXP and so the error does read correctly. I can modify it to "Executing stale pxp was expected to fail with -EIO\n" if you like. Can i still get a conditional R-v-b at least? (i do have to double check that the error type hasnt changed - this had changed a few times on the kernel side and i need to check the latest rev today).

Sorry man...
I need coffee and a break... but before:

Quoted 2 lines

...alan

author Reviewed-by Rodrigo Vivi
#20 lore raw

Re: [igt-dev] [PATCH i-g-t v9 10/16] Verify execbuf fails with stale PXP context after teardown

No apologies necessary - thanks so much for reviewing all the patches in this series through multiple design revs and thanks for the r-v-b on these 3 today.

...alan

-----Original Message-----
From: Vivi, Rodrigo <[email protected]>
Sent: Friday, September 10, 2021 12:12 PM
To: Teres Alexis, Alan Previn <[email protected]>
Cc: [email protected]
Subject: Re: [igt-dev] [PATCH i-g-t v9 10/16] Verify execbuf fails with stale PXP context after teardown

Quoted 44 lines · Alan Previn
Quoted 33 lines · Rodrigo Vivi
Quoted 32 lines · Alan Previn

Add a subtest to verify that reusing a stale protected context in a gem_execbuff after a teardown fails with -EIO error because it's banned. 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.

---
 lib/intel_batchbuffer.c |   2 +-
 lib/intel_batchbuffer.h |   3 +
 tests/i915/gem_pxp.c    | 151 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+), 1 deletion(-)
tests/i915/gem_pxp.c +13 -0
+static void test_pxp_stale_ctx_execution(int i915) {
+	int ret;
+	struct simple_exec_assets data = {0};
+
+	/*
+	 * Use normal buffers for testing for invalidation
+	 * of protected contexts to ensure kernel is catching
+	 * the invalidated context (not buffer)
+	 */
+	prepare_exec_assets(i915, &data, true, false);
+	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
+	igt_assert(ret == 0);
+
Quoted 8 lines

tests/i915/gem_pxp.c static void test_pxp_pwrcycle_teardown_keychange(int i915, struct powermgt_data

Quoted 5 lines
tests/i915/gem_pxp.c +5 -0
+	trigger_pxp_debugfs_forced_teardown(i915);
+
+	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
+	igt_assert_f((ret == -EIO), "Executing stale pxp context didn't 
+fail with -EIO\n");

I believe you meant the opposite right?
other then that, the patch looks good to me...

Quoted 4 lines

No, I actually DID want to ensure I get the -EIO failure when
executing with stale PXP and so the error does read correctly. I can
modify it to "Executing stale pxp was expected to fail with -EIO\n" if
you like. Can i still get a conditional R-v-b at least? (i do have to double check that the error type hasnt changed - this had changed a few times on the kernel side and i need to check the latest rev today).

Sorry man...
I need coffee and a break... but before:

Quoted 2 lines

...alan

#21 lore raw

PATCH v9 11/16 Verify execbuf fails with stale PXP buffer after teardown

In reply to Alan Previn

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.

---
 tests/i915/gem_pxp.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
tests/i915/gem_pxp.c +35 -0
index 6884e0d7..fab8e28d 100644
@@ -794,6 +794,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;
@@ -885,6 +918,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 {
Signature · 1 line
2.25.1
#22 lore raw

Re: [igt-dev] [PATCH i-g-t v9 11/16] Verify execbuf fails with stale PXP buffer after teardown

Quoted 42 lines · Alan Previn

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.

---
 tests/i915/gem_pxp.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
tests/i915/gem_pxp.c +17 -0
index 6884e0d7..fab8e28d 100644
@@ -794,6 +794,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)

tests/i915/gem_pxp.c static void test_pxp_stale_ctx_execution(int i915) · line 823

Quoted 10 lines
tests/i915/gem_pxp.c +10 -0
+	 */
+	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");

I believe this is opposite as well...
Or I am getting confused...

other than this, everything looks good

Quoted 21 lines
tests/i915/gem_pxp.c +8 -0
+
+	intel_bb_destroy(ibb2);
+	gem_context_destroy(i915, ctx2);
+	free_exec_assets(i915, &data);
+}
+
 igt_main
 {
 	int i915 = -1;
@@ -885,6 +918,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 {
Signature · 1 line
2.25.1
Reviewed-by
#23 lore raw

Re: [igt-dev] [PATCH i-g-t v9 11/16] Verify execbuf fails with stale PXP buffer after teardown

Quoted 48 lines · Rodrigo Vivi
Quoted 47 lines · Alan Previn

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.

---
 tests/i915/gem_pxp.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
tests/i915/gem_pxp.c +22 -0
index 6884e0d7..fab8e28d 100644
@@ -794,6 +794,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);
Quoted 8 lines

tests/i915/gem_pxp.c static void test_pxp_stale_ctx_execution(int i915) · line 823

Quoted 5 lines
tests/i915/gem_pxp.c +5 -0
+	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");

I believe this is opposite as well...
Or I am getting confused...

I am very confused myself... and crazy.. My bad!

Of course, the message is to tell what happened if assertion failed! Duh!

Sorry,
Rodrigo.

Ah, and

Quoted 24 lines

other than this, everything looks good

Quoted 21 lines
tests/i915/gem_pxp.c +8 -0
+
+	intel_bb_destroy(ibb2);
+	gem_context_destroy(i915, ctx2);
+	free_exec_assets(i915, &data);
+}
+
 igt_main
 {
 	int i915 = -1;
@@ -885,6 +918,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 {
Signature · 1 line
2.25.1
#24 lore raw

PATCH v9 12/16 Verify execbuf ok with stale PXP buf in opt-out use

In reply to Alan Previn

Add a check to verify that reusing a stale protected buffer in a gem_execbuff call, but using a regular (not- protected) context will succeed after a teardown event. Trigger the teardown via the pxp invalidation debugfs that simulates a HW teardown IRQ.

This ensures that user space applications that choose not to opt-in for strict PXP teardown awareness (by using a regular context) won't suffer gem_execbuff failures if a protected buffer was among the assets used in any of its rendering operations.

---
 tests/i915/gem_pxp.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
tests/i915/gem_pxp.c +23 -0
index fab8e28d..36dc5c46 100644
@@ -827,6 +827,27 @@ static void test_pxp_stale_buf_execution(int i915)
 	free_exec_assets(i915, &data);
 }
 
+static void test_pxp_stale_buf_optout_execution(int i915)
+{
+	int ret;
+	struct simple_exec_assets data = {0};
+
+	/*
+	 * Use a normal context for testing opt-out behavior
+	 * when executing with a pxp buffer across a teardown event.
+	 */
+	prepare_exec_assets(i915, &data, false, true);
+	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
+	igt_assert(ret == 0);
+
+	trigger_pxp_debugfs_forced_teardown(i915);
+
+	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
+	igt_assert_f((ret == 0), "Opt-out-execution with stale pxp buffer didn't succeed\n");
+
+	free_exec_assets(i915, &data);
+}
+
 igt_main
 {
 	int i915 = -1;
@@ -920,6 +941,8 @@ igt_main
 			test_pxp_stale_ctx_execution(i915);
 		igt_subtest("verify-pxp-stale-buf-execution")
 			test_pxp_stale_buf_execution(i915);
+		igt_subtest("verify-pxp-stale-buf-optout-execution")
+			test_pxp_stale_buf_optout_execution(i915);
 	}
 
 	igt_fixture {
Signature · 1 line
2.25.1
Reviewed-by on v9 12/16
#25 lore raw

Re: [igt-dev] [PATCH i-g-t v9 12/16] Verify execbuf ok with stale PXP buf in opt-out use

Quoted 32 lines · Alan Previn

Add a check to verify that reusing a stale protected buffer in a gem_execbuff call, but using a regular (not- protected) context will succeed after a teardown event. Trigger the teardown via the pxp invalidation debugfs that simulates a HW teardown IRQ.

This ensures that user space applications that choose not to opt-in for strict PXP teardown awareness (by using a regular context) won't suffer gem_execbuff failures if a protected buffer was among the assets used in any of its rendering operations.

---
 tests/i915/gem_pxp.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
tests/i915/gem_pxp.c +7 -0
index fab8e28d..36dc5c46 100644
@@ -827,6 +827,27 @@ static void test_pxp_stale_buf_execution(int i915)
 	free_exec_assets(i915, &data);
 }
 
+static void test_pxp_stale_buf_optout_execution(int i915)
+{
+	int ret;
+	struct simple_exec_assets data = {0};
+
+	/*
+	 * Use a normal context for testing opt-out behavior

tests/i915/gem_pxp.c static void test_pxp_stale_buf_execution(int i915) · line 846

Quoted 10 lines
tests/i915/gem_pxp.c +10 -0
+	 * when executing with a pxp buffer across a teardown event.
+	 */
+	prepare_exec_assets(i915, &data, false, true);
+	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
+	igt_assert(ret == 0);
+
+	trigger_pxp_debugfs_forced_teardown(i915);
+
+	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
+	igt_assert_f((ret == 0), "Opt-out-execution with stale pxp buffer didn't succeed\n");

And only when I had arrived at this one I noticed my confusion and that the message was printed on assertion failure!
Duh!

Quoted 19 lines
tests/i915/gem_pxp.c +6 -0
+
+	free_exec_assets(i915, &data);
+}
+
 igt_main
 {
 	int i915 = -1;
@@ -920,6 +941,8 @@ igt_main
 			test_pxp_stale_ctx_execution(i915);
 		igt_subtest("verify-pxp-stale-buf-execution")
 			test_pxp_stale_buf_execution(i915);
+		igt_subtest("verify-pxp-stale-buf-optout-execution")
+			test_pxp_stale_buf_optout_execution(i915);
 	}
 
 	igt_fixture {
Signature · 1 line
2.25.1
#26 lore raw

PATCH v9 13/16 Verify execution behavior with stale PXP assets through suspend-resume

In reply to Alan Previn

Add a subtest to repeat the same previous three scenarios when attempting to execute work with either stale PXP contexts or buffers but this time trigger the teardown event via an S3 suspend-resume power state cycle.

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.

---
 tests/i915/gem_pxp.c | 65 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
tests/i915/gem_pxp.c +65 -0
index 36dc5c46..38c7925b 100644
@@ -848,6 +848,69 @@ static void test_pxp_stale_buf_optout_execution(int i915)
 	free_exec_assets(i915, &data);
 }
 
+static void test_pxp_pwrcycle_staleasset_execution(int i915, struct powermgt_data *pm)
+{
+	int ret;
+	struct simple_exec_assets data[3] = {{0}, {0}, {0}};
+	uint32_t ctx2;
+	struct intel_bb *ibb2;
+
+	/*
+	 * For asset data[0]: Use normal buffers for testing for invalidation
+	 * of protected contexts to ensure kernel is catching
+	 * the invalidated context (not buffer)
+	 */
+	prepare_exec_assets(i915, &data[0], true, false);
+	ret = gem_execbuf_flush_store_dw(i915, data[0].ibb, data[0].ctx, data[0].fencebuf);
+	igt_assert(ret == 0);
+
+	/*
+	 * For asset data[1]: Use pxp buffers with pxp context for testing for invalidation
+	 * of protected buffers.
+	 */
+	prepare_exec_assets(i915, &data[1], true, true);
+	ret = gem_execbuf_flush_store_dw(i915, data[1].ibb, data[1].ctx, data[1].fencebuf);
+	igt_assert(ret == 0);
+
+	/*
+	 * For asset data[2]: Use a normal context for testing opt-out behavior
+	 * when executing with a pxp buffer across a teardown event.
+	 */
+	prepare_exec_assets(i915, &data[2], false, true);
+	ret = gem_execbuf_flush_store_dw(i915, data[2].ibb, data[2].ctx, data[2].fencebuf);
+	igt_assert(ret == 0);
+
+	/* Do an S3 suspend resume cycle which also causes the pxp teardown event */
+	trigger_powermgt_suspend_cycle(i915, pm);
+
+	ret = gem_execbuf_flush_store_dw(i915, data[0].ibb, data[0].ctx, data[0].fencebuf);
+	igt_assert_f((ret == -EIO), "Executing stale pxp context didn't fail with -EIO\n");
+
+	/*
+	 * For asset data[1]: after teardown, alloc new assets for context but
+	 * reuse the 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[1].ibb, data[1].fencebuf);
+	intel_bb_add_intel_buf(ibb2, data[1].fencebuf, true);
+	ret = gem_execbuf_flush_store_dw(i915, ibb2, ctx2, data[1].fencebuf);
+	igt_assert_f((ret == -ENOEXEC), "Executing stale pxp buffer didn't fail with -ENOEXEC\n");
+
+	ret = gem_execbuf_flush_store_dw(i915, data[2].ibb, data[2].ctx, data[2].fencebuf);
+	igt_assert_f((ret == 0), "Opt-out-execution with stale pxp buffer didn't succeed\n");
+
+	free_exec_assets(i915, &data[0]);
+	intel_bb_destroy(ibb2);
+	gem_context_destroy(i915, ctx2);
+	free_exec_assets(i915, &data[1]);
+	free_exec_assets(i915, &data[2]);
+}
+
 igt_main
 {
 	int i915 = -1;
@@ -943,6 +1006,8 @@ igt_main
 			test_pxp_stale_buf_execution(i915);
 		igt_subtest("verify-pxp-stale-buf-optout-execution")
 			test_pxp_stale_buf_optout_execution(i915);
+		igt_subtest("verify-pxp-execution-after-suspend-resume")
+			test_pxp_pwrcycle_staleasset_execution(i915, &pm);
 	}
 
 	igt_fixture {
Signature · 1 line
2.25.1
#27 lore raw

PATCH v9 14/16 Ensure RESET_STATS reports invalidated protected contexts

In reply to Alan Previn

When protected contexts are created but get invalidated due to PXP session teardown, RESET_STATS ioctl for said context shall log an increased count in lost batch_active equal to all engines of this context indicating the pxp context is now banned.

---
 tests/i915/gem_pxp.c | 73 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 69 insertions(+), 4 deletions(-)
tests/i915/gem_pxp.c +69 -4
index 38c7925b..d538e78c 100644
@@ -772,9 +772,34 @@ static void trigger_pxp_debugfs_forced_teardown(int i915)
 	close(fd);
 }
 
-static void test_pxp_stale_ctx_execution(int i915)
+static int get_context_num_engines(int i915, uint32_t ctx)
+{
+	intel_ctx_cfg_t cfg;
+	int n = 4; /* at the very least Gen12s have 4 engines */
+
+	if (gem_has_engine_topology(i915)) {
+		cfg =  intel_ctx_cfg_all_physical(i915);
+		n = cfg.num_engines;
+	}
+	return n;
+}
+
+static int get_context_lost_count(int i915, uint32_t ctx)
 {
+	struct drm_i915_reset_stats rs;
 	int ret;
+
+	memset(&rs, 0, sizeof(rs));
+	rs.ctx_id = ctx;
+	ret = drmIoctl(i915, DRM_IOCTL_I915_GET_RESET_STATS, &rs);
+	igt_assert(ret == 0);
+
+	return (int)rs.batch_active;
+}
+
+static void test_pxp_stale_ctx_execution(int i915)
+{
+	int ret, lostcount;
 	struct simple_exec_assets data = {0};
 
 	/*
@@ -786,7 +811,15 @@ static void test_pxp_stale_ctx_execution(int i915)
 	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
 	igt_assert(ret == 0);
 
+	lostcount = get_context_lost_count(i915, data.ctx);
 	trigger_pxp_debugfs_forced_teardown(i915);
+	/* After teardown, verify RESET_STATS for pxp context reflects
+	 * the non-recoverable invalidation
+	 */
+	usleep(50000);
+	igt_assert_f(get_context_lost_count(i915, data.ctx) >=
+		     lostcount + get_context_num_engines(i915, data.ctx),
+		     "RESET_STATS didn't reflect stale pxp context1\n");
 
 	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
 	igt_assert_f((ret == -EIO), "Executing stale pxp context didn't fail with -EIO\n");
@@ -796,7 +829,7 @@ static void test_pxp_stale_ctx_execution(int i915)
 
 static void test_pxp_stale_buf_execution(int i915)
 {
-	int ret;
+	int ret, lostcount;
 	struct simple_exec_assets data = {0};
 	uint32_t ctx2;
 	struct intel_bb *ibb2;
@@ -806,7 +839,15 @@ static void test_pxp_stale_buf_execution(int i915)
 	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
 	igt_assert(ret == 0);
 
+	lostcount = get_context_lost_count(i915, data.ctx);
 	trigger_pxp_debugfs_forced_teardown(i915);
+	/* After teardown, verify RESET_STATS for pxp context reflects
+	 * the non-recoverable invalidation
+	 */
+	usleep(50000);
+	igt_assert_f(get_context_lost_count(i915, data.ctx) >=
+		     lostcount + get_context_num_engines(i915, data.ctx),
+		     "RESET_STATS didn't reflect stale pxp context2\n");
 
 	/*
 	 * After teardown, use a new pxp context but reuse the stale bo to ensure
@@ -829,7 +870,7 @@ static void test_pxp_stale_buf_execution(int i915)
 
 static void test_pxp_stale_buf_optout_execution(int i915)
 {
-	int ret;
+	int ret, lostcount;
 	struct simple_exec_assets data = {0};
 
 	/*
@@ -840,7 +881,14 @@ static void test_pxp_stale_buf_optout_execution(int i915)
 	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
 	igt_assert(ret == 0);
 
+	lostcount = get_context_lost_count(i915, data.ctx);
 	trigger_pxp_debugfs_forced_teardown(i915);
+	/* After teardown, verify RESET_STATS for regular context doesn't
+	 * exhibit any invalidation
+	 */
+	usleep(50000);
+	igt_assert_f(get_context_lost_count(i915, data.ctx) ==  lostcount,
+		     "Bad RESET_STATS report for regular context3\n");
 
 	ret = gem_execbuf_flush_store_dw(i915, data.ibb, data.ctx, data.fencebuf);
 	igt_assert_f((ret == 0), "Opt-out-execution with stale pxp buffer didn't succeed\n");
@@ -850,7 +898,7 @@ static void test_pxp_stale_buf_optout_execution(int i915)
 
 static void test_pxp_pwrcycle_staleasset_execution(int i915, struct powermgt_data *pm)
 {
-	int ret;
+	int ret, lostcount[3];
 	struct simple_exec_assets data[3] = {{0}, {0}, {0}};
 	uint32_t ctx2;
 	struct intel_bb *ibb2;
@@ -881,8 +929,25 @@ static void test_pxp_pwrcycle_staleasset_execution(int i915, struct powermgt_dat
 	igt_assert(ret == 0);
 
 	/* Do an S3 suspend resume cycle which also causes the pxp teardown event */
+	lostcount[0] = get_context_lost_count(i915, data[0].ctx);
+	lostcount[1] = get_context_lost_count(i915, data[1].ctx);
+	lostcount[2] = get_context_lost_count(i915, data[2].ctx);
 	trigger_powermgt_suspend_cycle(i915, pm);
 
+	/* After teardown, verify RESET_STATS reflect:
+	 * for data[0]: non-recoverable invalidation
+	 * for data[1]: non-recoverable invalidation
+	 * for data[2]: no invalidation
+	 */
+	igt_assert_f(get_context_lost_count(i915,
+		     data[0].ctx) >= lostcount[0] + get_context_num_engines(i915, data[0].ctx),
+		     "Post-s3 RESET_STATS didn't reflect stale pxp context1\n");
+	igt_assert_f(get_context_lost_count(i915,
+		     data[1].ctx) >= lostcount[1] + get_context_num_engines(i915, data[1].ctx),
+		     "Post-s3 RESET_STATS didn't reflect stale pxp context2\n");
+	igt_assert_f(get_context_lost_count(i915, data[2].ctx) == lostcount[2],
+		     "Post-s3 bad RESET_STATS report for regular context3\n");
+
 	ret = gem_execbuf_flush_store_dw(i915, data[0].ibb, data[0].ctx, data[0].fencebuf);
 	igt_assert_f((ret == -EIO), "Executing stale pxp context didn't fail with -EIO\n");
 
Signature · 1 line
2.25.1
#28 lore raw

PATCH v9 15/16 Verify protected surfaces are dma buffer sharable

In reply to Alan Previn

Verify we can export a protected surface from protected context A into protected context B (with different client driver handles) and protected rendering is successful even after prior file handle is closed (i.e. pxp specific refcounting works).

---
 tests/i915/gem_pxp.c | 102 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
tests/i915/gem_pxp.c +102 -0
index d538e78c..9c5aa33a 100644
@@ -619,6 +619,106 @@ static void test_render_pxp_protsrc_to_protdest(int i915)
 	buf_ops_destroy(bops);
 }
 
+static int export_handle(int fd, uint32_t handle, int *outfd)
+{
+	struct drm_prime_handle args;
+	int ret;
+
+	args.handle = handle;
+	args.flags = DRM_CLOEXEC;
+	args.fd = -1;
+
+	ret = drmIoctl(fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args);
+	if (ret)
+		ret = errno;
+	*outfd = args.fd;
+
+	return ret;
+}
+
+static void test_pxp_dmabuffshare_refcnt(void)
+{
+	uint32_t ctx[2], sbo[2], dbo[2];
+	struct intel_buf *sbuf[2], *dbuf[2];
+	struct buf_ops *bops[2];
+	struct intel_bb *ibb[2];
+	int fd[2], dmabuf_fd = 0, ret, n, num_matches = 0;
+	uint32_t encrypted[2][TSTSURF_SIZE/TSTSURF_BYTESPP];
+
+	/* First, create the client driver handles and
+	 * protected dest buffer (is exported via dma-buff
+	 * from first handle and imported to the second).
+	 */
+	for (n = 0; n < 2; ++n) {
+		fd[n] = drm_open_driver(DRIVER_INTEL);
+		igt_require(fd[n]);
+		if (n == 0) {
+			dbo[0] = alloc_and_fill_dest_buff(fd[0], true, TSTSURF_SIZE,
+							  TSTSURF_INITCOLOR1);
+		} else {
+			ret = export_handle(fd[0], dbo[0], &dmabuf_fd);
+			igt_assert(ret == 0);
+			dbo[1] = prime_fd_to_handle(fd[1], dmabuf_fd);
+			igt_assert(dbo[1]);
+		}
+	}
+	/* Repeat twice: Create a full set of assets to perform
+	 * a protected 3D session but using the same dest buffer
+	 * from above.
+	 */
+	for (n = 0; n < 2; ++n) {
+		ret = create_ctx_with_params(fd[n], true, true, true, false, &ctx[n]);
+		igt_assert_eq(ret, 0);
+		igt_assert_eq(get_ctx_protected_param(fd[n], ctx[n]), 1);
+		ibb[n] = intel_bb_create_with_context(fd[n], ctx[n], 4096);
+		intel_bb_set_pxp(ibb[n], true, DISPLAY_APPTYPE,
+				 I915_PROTECTED_CONTENT_DEFAULT_SESSION);
+
+		bops[n] = buf_ops_create(fd[n]);
+		if (n == 1)
+			fill_bo_content(fd[1], dbo[1], TSTSURF_SIZE, TSTSURF_INITCOLOR2);
+
+		dbuf[n] = intel_buf_create_using_handle(bops[n], dbo[n], TSTSURF_WIDTH,
+							TSTSURF_HEIGHT,	TSTSURF_BYTESPP*8, 0,
+							I915_TILING_NONE, 0);
+		intel_buf_set_pxp(dbuf[n], true);
+
+		sbo[n] = alloc_and_fill_dest_buff(fd[n], false, TSTSURF_SIZE, TSTSURF_FILLCOLOR1);
+		sbuf[n] = intel_buf_create_using_handle(bops[n], sbo[n], TSTSURF_WIDTH,
+							TSTSURF_HEIGHT, TSTSURF_BYTESPP*8, 0,
+							I915_TILING_NONE, 0);
+
+		gen12_render_copyfunc(ibb[n], sbuf[n], 0, 0, TSTSURF_WIDTH, TSTSURF_HEIGHT,
+				      dbuf[n], 0, 0);
+		gem_sync(fd[n], dbo[n]);
+
+		assert_bo_content_check(fd[n], dbo[n], COMPARE_COLOR_UNREADIBLE, TSTSURF_SIZE,
+					TSTSURF_FILLCOLOR1, NULL, 0);
+		assert_bo_content_check(fd[n], dbo[n], COPY_BUFFER, TSTSURF_SIZE, 0, encrypted[n],
+					TSTSURF_SIZE);
+
+		/* free up all assets except the dest buffer to
+		 * verify dma buff refcounting is performed on
+		 * the protected dest buffer on the 2nd loop with
+		 * successful reuse in another protected render.
+		 */
+		intel_bb_destroy(ibb[n]);
+		intel_buf_destroy(sbuf[n]);
+		intel_buf_destroy(dbuf[n]);
+		gem_close(fd[n], sbo[n]);
+		gem_close(fd[n], dbo[n]);
+		gem_context_destroy(fd[n], ctx[n]);
+		close(fd[n]);
+	}
+
+	/* Verify that encrypted output across loops were equal */
+	for (n = 0; n < (TSTSURF_SIZE/4); ++n)
+		if (encrypted[0][n] == encrypted[1][n])
+			++num_matches;
+	igt_assert(num_matches == (TSTSURF_SIZE/4));
+}
+
+
 static void init_powermgt_resources(int i915, struct powermgt_data *pm)
 {
 	pm->debugfsdir = igt_debugfs_dir(i915);
@@ -1052,6 +1152,8 @@ igt_main
 			test_render_pxp_src_to_protdest(i915);
 		igt_subtest("protected-encrypted-src-copy-not-readible")
 			test_render_pxp_protsrc_to_protdest(i915);
+		igt_subtest("dmabuf-shared-protected-dst-is-context-refcounted")
+			test_pxp_dmabuffshare_refcnt();
 	}
 	igt_subtest_group {
 		igt_fixture {
Signature · 1 line
2.25.1
#29 lore raw

PATCH v9 16/16 tests/i915_pxp: CRC validation for display tests.

In reply to Alan Previn

From: Karthik B S <[email protected]>

Added subtests to validate pxp using CRC validation.

---
 tests/i915/gem_pxp.c | 163 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 163 insertions(+)
tests/i915/gem_pxp.c +163 -0
index 9c5aa33a..0418d65e 100644
@@ -435,6 +435,7 @@ static uint32_t alloc_and_fill_dest_buff(int i915, bool protected, uint32_t size
 #define TSTSURF_INITCOLOR1  0x12341234
 #define TSTSURF_INITCOLOR2  0x56785678
 #define TSTSURF_INITCOLOR3  0xabcdabcd
+#define TSTSURF_GREENCOLOR  0xFF00FF00
 
 static void test_render_baseline(int i915)
 {
@@ -1076,6 +1077,152 @@ static void test_pxp_pwrcycle_staleasset_execution(int i915, struct powermgt_dat
 	free_exec_assets(i915, &data[2]);
 }
 
+static void setup_protected_fb(int i915, int width, int height, igt_fb_t *fb, uint32_t ctx)
+{
+	int err;
+	uint32_t srcbo;
+	struct intel_buf *srcbuf, *dstbuf;
+	struct buf_ops *bops;
+	struct intel_bb *ibb;
+	uint32_t devid;
+	igt_render_copyfunc_t rendercopy;
+
+	devid = intel_get_drm_devid(i915);
+	igt_assert(devid);
+
+	rendercopy = igt_get_render_copyfunc(devid);
+	igt_assert(rendercopy);
+
+	bops = buf_ops_create(i915);
+	igt_assert(bops);
+
+	igt_init_fb(fb, i915, width, height, DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
+		    IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
+
+	igt_calc_fb_size(i915, width, height, DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
+			 &fb->size, &fb->strides[0]);
+
+	err = create_bo_ext(i915, fb->size, true, &(fb->gem_handle));
+	igt_assert_eq(err, 0);
+	igt_assert(fb->gem_handle);
+
+	err = __gem_set_tiling(i915, fb->gem_handle, igt_fb_mod_to_tiling(fb->modifier),
+			       fb->strides[0]);
+	igt_assert(err == 0 || err == -EOPNOTSUPP);
+
+	do_or_die(__kms_addfb(fb->fd, fb->gem_handle, fb->width, fb->height, fb->drm_format,
+			      fb->modifier, fb->strides, fb->offsets, fb->num_planes,
+			      DRM_MODE_FB_MODIFIERS, &fb->fb_id));
+
+	dstbuf = intel_buf_create_using_handle(bops, fb->gem_handle, fb->width, fb->height,
+					       fb->plane_bpp[0], 0,
+					       igt_fb_mod_to_tiling(fb->modifier), 0);
+	dstbuf->is_protected = true;
+
+	srcbo = alloc_and_fill_dest_buff(i915, false, fb->size, TSTSURF_GREENCOLOR);
+	srcbuf = intel_buf_create_using_handle(bops, srcbo, fb->width, fb->height,
+					       fb->plane_bpp[0], 0,
+					       igt_fb_mod_to_tiling(fb->modifier), 0);
+
+	ibb = intel_bb_create_with_context(i915, ctx, 4096);
+	igt_assert(ibb);
+
+	ibb->pxp.enabled = true;
+	ibb->pxp.apptype = DISPLAY_APPTYPE;
+	ibb->pxp.appid = I915_PROTECTED_CONTENT_DEFAULT_SESSION;
+
+	gen12_render_copyfunc(ibb, srcbuf, 0, 0, fb->width, fb->height, dstbuf, 0, 0);
+
+	gem_sync(i915, fb->gem_handle);
+	assert_bo_content_check(i915, fb->gem_handle, COMPARE_COLOR_UNREADIBLE, fb->size,
+				TSTSURF_GREENCOLOR, NULL, 0);
+
+	intel_bb_destroy(ibb);
+	intel_buf_destroy(srcbuf);
+	gem_close(i915, srcbo);
+}
+
+#define KERNEL_AUTH_TIME_ALLOWED_MSEC		(3 *  6 * 1000)
+#define KERNEL_DISABLE_TIME_ALLOWED_MSEC	(1 * 1000)
+
+static void test_display_protected_crc(int i915, igt_display_t *display)
+{
+	igt_output_t *output;
+	drmModeModeInfo *mode;
+	igt_fb_t ref_fb, protected_fb;
+	igt_plane_t *plane;
+	igt_pipe_t *pipe;
+	igt_pipe_crc_t *pipe_crc;
+	igt_crc_t ref_crc, new_crc;
+	int width = 0, height = 0, i = 0, ret;
+	uint32_t ctx;
+
+	ret = create_ctx_with_params(i915, true, true, true, false, &ctx);
+	igt_assert_eq(ret, 0);
+
+	for_each_connected_output(display, output) {
+		mode = igt_output_get_mode(output);
+
+		width = max(width, mode->hdisplay);
+		height = max(height, mode->vdisplay);
+	}
+
+	igt_create_color_fb(i915, width, height, DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
+			    0, 1, 0, &ref_fb);
+
+	/* Do a modeset on all outputs */
+	for_each_connected_output(display, output) {
+		mode = igt_output_get_mode(output);
+		pipe = &display->pipes[i];
+		plane = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
+		igt_require(igt_pipe_connector_valid(i, output));
+		igt_output_set_pipe(output, i);
+
+		igt_plane_set_fb(plane, &ref_fb);
+		igt_fb_set_size(&ref_fb, plane, mode->hdisplay, mode->vdisplay);
+		igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
+
+		igt_display_commit2(display, COMMIT_ATOMIC);
+		i++;
+	}
+
+	setup_protected_fb(i915, width, height, &protected_fb, ctx);
+
+	for_each_connected_output(display, output) {
+		mode = igt_output_get_mode(output);
+		pipe = &display->pipes[output->pending_pipe];
+		pipe_crc = igt_pipe_crc_new(i915, pipe->pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+		plane = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
+		igt_require(igt_pipe_connector_valid(pipe->pipe, output));
+		igt_output_set_pipe(output, pipe->pipe);
+
+		igt_plane_set_fb(plane, &ref_fb);
+		igt_fb_set_size(&ref_fb, plane, mode->hdisplay, mode->vdisplay);
+		igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
+
+		igt_display_commit2(display, COMMIT_ATOMIC);
+		igt_pipe_crc_collect_crc(pipe_crc, &ref_crc);
+
+		igt_plane_set_fb(plane, &protected_fb);
+		igt_fb_set_size(&protected_fb, plane, mode->hdisplay, mode->vdisplay);
+		igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
+
+		igt_display_commit2(display, COMMIT_ATOMIC);
+		igt_pipe_crc_collect_crc(pipe_crc, &new_crc);
+		igt_assert_crc_equal(&ref_crc, &new_crc);
+
+		/*
+		 * Testing with one pipe-output combination is sufficient.
+		 * So break the loop.
+		 */
+		break;
+	}
+
+	gem_context_destroy(i915, ctx);
+	igt_remove_fb(i915, &ref_fb);
+	igt_remove_fb(i915, &protected_fb);
+}
+
 igt_main
 {
 	int i915 = -1;
@@ -1083,6 +1230,7 @@ igt_main
 	struct powermgt_data pm = {0};
 	igt_render_copyfunc_t rendercopy = NULL;
 	uint32_t devid = 0;
+	igt_display_t display;
 
 	igt_fixture
 	{
@@ -1176,6 +1324,21 @@ igt_main
 		igt_subtest("verify-pxp-execution-after-suspend-resume")
 			test_pxp_pwrcycle_staleasset_execution(i915, &pm);
 	}
+	igt_subtest_group {
+		igt_fixture {
+			igt_require(pxp_supported);
+			devid = intel_get_drm_devid(i915);
+			igt_assert(devid);
+			rendercopy = igt_get_render_copyfunc(devid);
+			igt_require(rendercopy);
+
+			igt_require_pipe_crc(i915);
+			igt_display_require(&display, i915);
+		}
+		igt_describe("Test the display CRC");
+		igt_subtest("display-protected-crc")
+			test_display_protected_crc(i915, &display);
+	}
 
 	igt_fixture {
 		close(i915);
Signature · 1 line
2.25.1
#30 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for Introduce PXP Test (rev9)

In reply to Alan Previn
== Series Details ==

== Series Details ==

Series: Introduce PXP Test (rev9)
URL : https://patchwork.freedesktop.org/series/87570/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10548 -> IGTPW_6192
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/index.html

Known issues
------------

Here are the changes found in IGTPW_6192 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_pm_rpm@module-reload:
- fi-rkl-11600: [PASS][1] -> [FAIL][2] ([i915#4025])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/fi-rkl-11600/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/fi-rkl-11600/igt@[email protected]

* igt@i915_selftest@live@gt_lrc:
- fi-rkl-guc: [PASS][3] -> [DMESG-WARN][4] ([i915#3958])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/fi-rkl-guc/igt@i915_selftest@live@gt_lrc.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/fi-rkl-guc/igt@i915_selftest@live@gt_lrc.html

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-skl-6600u: [PASS][5] -> [INCOMPLETE][6] ([i915#198])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/fi-skl-6600u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/fi-skl-6600u/igt@[email protected]

* igt@runner@aborted:
- fi-bdw-5557u: NOTRUN -> [FAIL][7] ([i915#1602] / [i915#2029])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/fi-bdw-5557u/igt@[email protected]

[i915#1602]: https://gitlab.freedesktop.org/drm/intel/issues/1602
[i915#198]: https://gitlab.freedesktop.org/drm/intel/issues/198
[i915#2029]: https://gitlab.freedesktop.org/drm/intel/issues/2029
[i915#3958]: https://gitlab.freedesktop.org/drm/intel/issues/3958
[i915#4025]: https://gitlab.freedesktop.org/drm/intel/issues/4025

Participating hosts (48 -> 40)
------------------------------

Missing (8): fi-ilk-m540 bat-adls-5 fi-hsw-4200u bat-dg1-5 fi-bsw-cyan bat-adlp-4 fi-bdw-samus bat-jsl-1

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_6197 -> IGTPW_6192

CI-20190529: 20190529
CI_DRM_10548: 50be9d6f82904be755ea5b04efbd6c5e19e2d945 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_6192: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/index.html
IGT_6197: 40888f97a6ad219f4ed48a1830d0ef3c9617d006 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Testlist changes ==

+igt@gem_pxp@create-protected-buffer +igt@gem_pxp@create-regular-buffer +igt@gem_pxp@create-regular-context-1 +igt@gem_pxp@create-regular-context-2 +igt@gem_pxp@create-valid-protected-context +igt@gem_pxp@display-protected-crc +igt@gem_pxp@dmabuf-shared-protected-dst-is-context-refcounted +igt@gem_pxp@fail-invalid-protected-context +igt@gem_pxp@hw-rejects-pxp-buffer +igt@gem_pxp@hw-rejects-pxp-context +igt@gem_pxp@protected-encrypted-src-copy-not-readible +igt@gem_pxp@protected-raw-src-copy-not-readible +igt@gem_pxp@regular-baseline-src-copy-readible +igt@gem_pxp@reject-modify-context-protection-off-1 +igt@gem_pxp@reject-modify-context-protection-off-2 +igt@gem_pxp@reject-modify-context-protection-off-3 +igt@gem_pxp@reject-modify-context-protection-on +igt@gem_pxp@verify-pxp-execution-after-suspend-resume +igt@gem_pxp@verify-pxp-key-change-after-suspend-resume +igt@gem_pxp@verify-pxp-stale-buf-execution +igt@gem_pxp@verify-pxp-stale-buf-optout-execution +igt@gem_pxp@verify-pxp-stale-ctx-execution

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/index.html

#31 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for Introduce PXP Test (rev9)

In reply to Alan Previn
== Series Details ==

== Series Details ==

Series: Introduce PXP Test (rev9)
URL : https://patchwork.freedesktop.org/series/87570/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10548_full -> IGTPW_6192_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_6192_full:

### IGT changes ###

#### Possible regressions ####

* {igt@gem_pxp@create-regular-context-1} (NEW):
- shard-iclb: NOTRUN -> [SKIP][1] +17 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb1/igt@[email protected]

* {igt@gem_pxp@hw-rejects-pxp-buffer} (NEW):
- shard-tglb: NOTRUN -> [FAIL][2] +1 similar issue
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb5/igt@[email protected]
- shard-snb: NOTRUN -> [FAIL][3] +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-snb7/igt@[email protected]

* {igt@gem_pxp@hw-rejects-pxp-context} (NEW):
- shard-glk: NOTRUN -> [FAIL][4] +1 similar issue
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-glk6/igt@[email protected]
- shard-apl: NOTRUN -> [FAIL][5]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl8/igt@[email protected]
- shard-iclb: NOTRUN -> [FAIL][6] +1 similar issue
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb4/igt@[email protected]
- shard-kbl: NOTRUN -> [FAIL][7] +1 similar issue
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-kbl2/igt@[email protected]

* {igt@gem_pxp@regular-baseline-src-copy-readible} (NEW):
- shard-tglb: NOTRUN -> [SKIP][8] +18 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb5/igt@[email protected]

New tests
---------

New tests have been introduced between CI_DRM_10548_full and IGTPW_6192_full:

### New IGT tests (22) ###

* igt@gem_pxp@create-protected-buffer:
- Statuses :
- Exec time: [None] s

* igt@gem_pxp@create-regular-buffer:
- Statuses : 5 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@create-regular-context-1:
- Statuses : 5 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@create-regular-context-2:
- Statuses : 5 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@create-valid-protected-context:
- Statuses : 6 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@display-protected-crc:
- Statuses : 6 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@dmabuf-shared-protected-dst-is-context-refcounted:
- Statuses : 6 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@fail-invalid-protected-context:
- Statuses : 5 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@hw-rejects-pxp-buffer:
- Statuses : 5 fail(s)
- Exec time: [0.01, 0.12] s

* igt@gem_pxp@hw-rejects-pxp-context:
- Statuses : 6 fail(s)
- Exec time: [0.03, 0.24] s

* igt@gem_pxp@protected-encrypted-src-copy-not-readible:
- Statuses : 5 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@protected-raw-src-copy-not-readible:
- Statuses : 6 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@regular-baseline-src-copy-readible:
- Statuses : 5 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@reject-modify-context-protection-off-1:
- Statuses : 5 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@reject-modify-context-protection-off-2:
- Statuses : 6 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@reject-modify-context-protection-off-3:
- Statuses : 6 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@reject-modify-context-protection-on:
- Statuses : 6 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@verify-pxp-execution-after-suspend-resume:
- Statuses : 5 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@verify-pxp-key-change-after-suspend-resume:
- Statuses : 5 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@verify-pxp-stale-buf-execution:
- Statuses : 5 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@verify-pxp-stale-buf-optout-execution:
- Statuses : 4 skip(s)
- Exec time: [0.0] s

* igt@gem_pxp@verify-pxp-stale-ctx-execution:
- Statuses : 4 skip(s)
- Exec time: [0.0] s

Known issues
------------

Here are the changes found in IGTPW_6192_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@feature_discovery@chamelium:
- shard-tglb: NOTRUN -> [SKIP][9] ([fdo#111827])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb5/igt@[email protected]

* igt@gem_ctx_persistence@smoketest:
- shard-snb: NOTRUN -> [SKIP][10] ([fdo#109271] / [i915#1099]) +3 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-snb6/igt@[email protected]

* igt@gem_eio@in-flight-contexts-immediate:
- shard-tglb: [PASS][11] -> [TIMEOUT][12] ([i915#3063])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-tglb2/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb2/igt@[email protected]

* igt@gem_eio@unwedge-stress:
- shard-iclb: [PASS][13] -> [TIMEOUT][14] ([i915#2369] / [i915#2481] / [i915#3070])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-iclb2/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb5/igt@[email protected]

* igt@gem_exec_fair@basic-deadline:
- shard-kbl: [PASS][15] -> [FAIL][16] ([i915#2846])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-kbl3/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-kbl2/igt@[email protected]
- shard-apl: NOTRUN -> [FAIL][17] ([i915#2846])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl7/igt@[email protected]

* igt@gem_exec_fair@basic-flow@rcs0:
- shard-tglb: [PASS][18] -> [FAIL][19] ([i915#2842]) +1 similar issue
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-tglb8/igt@gem_exec_fair@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb1/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none-rrul@rcs0:
- shard-glk: NOTRUN -> [FAIL][20] ([i915#2842]) +1 similar issue
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-glk1/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none@vcs0:
- shard-kbl: [PASS][21] -> [FAIL][22] ([i915#2842]) +2 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-kbl4/igt@gem_exec_fair@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-kbl2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none@vcs1:
- shard-iclb: NOTRUN -> [FAIL][23] ([i915#2842])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb4/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-glk: [PASS][24] -> [FAIL][25] ([i915#2842]) +2 similar issues
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-glk7/igt@gem_exec_fair@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-glk8/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@bcs0:
- shard-iclb: [PASS][26] -> [FAIL][27] ([i915#2842])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-iclb4/igt@gem_exec_fair@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb3/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@vcs1:
- shard-kbl: [PASS][28] -> [SKIP][29] ([fdo#109271])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-kbl6/igt@gem_exec_fair@[email protected]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-kbl3/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-throttle@rcs0:
- shard-iclb: [PASS][30] -> [FAIL][31] ([i915#2849])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-iclb3/igt@gem_exec_fair@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb5/igt@gem_exec_fair@[email protected]

* igt@gem_exec_whisper@basic-fds-priority-all:
- shard-glk: [PASS][32] -> [DMESG-WARN][33] ([i915#118] / [i915#95]) +1 similar issue
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-glk6/igt@[email protected]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-glk6/igt@[email protected]

* igt@gem_pread@exhaustion:
- shard-apl: NOTRUN -> [WARN][34] ([i915#2658])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl3/igt@[email protected]

* igt@gem_pwrite@basic-exhaustion:
- shard-snb: NOTRUN -> [WARN][35] ([i915#2658]) +1 similar issue
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-snb6/igt@[email protected]

* igt@gem_render_copy@yf-tiled-mc-ccs-to-vebox-yf-tiled:
- shard-iclb: NOTRUN -> [SKIP][36] ([i915#768]) +4 similar issues
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb8/igt@[email protected]

* igt@gem_userptr_blits@vma-merge:
- shard-snb: NOTRUN -> [FAIL][37] ([i915#2724])
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-snb5/igt@[email protected]

* igt@gen3_render_tiledy_blits:
- shard-tglb: NOTRUN -> [SKIP][38] ([fdo#109289]) +2 similar issues
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb6/igt@gen3_render_tiledy_blits.html

* igt@gen9_exec_parse@bb-oversize:
- shard-tglb: NOTRUN -> [SKIP][39] ([i915#2856]) +1 similar issue
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb2/igt@[email protected]

* igt@gen9_exec_parse@unaligned-access:
- shard-iclb: NOTRUN -> [SKIP][40] ([i915#2856]) +2 similar issues
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb5/igt@[email protected]

* igt@i915_pm_rc6_residency@rc6-fence:
- shard-tglb: NOTRUN -> [WARN][41] ([i915#2681])
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb1/igt@[email protected]

* igt@i915_pm_rpm@pc8-residency:
- shard-iclb: NOTRUN -> [SKIP][42] ([fdo#109293] / [fdo#109506])
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb5/igt@[email protected]
- shard-tglb: NOTRUN -> [SKIP][43] ([fdo#109506] / [i915#2411])
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb6/igt@[email protected]

* igt@i915_suspend@forcewake:
- shard-kbl: [PASS][44] -> [DMESG-WARN][45] ([i915#180])
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-kbl2/igt@[email protected]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-kbl7/igt@[email protected]
- shard-apl: [PASS][46] -> [DMESG-WARN][47] ([i915#180]) +1 similar issue
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-apl3/igt@[email protected]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl3/igt@[email protected]

* igt@kms_atomic@plane-primary-overlay-mutable-zpos:
- shard-tglb: NOTRUN -> [SKIP][48] ([i915#404])
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb5/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][49] ([i915#404])
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb4/igt@[email protected]

* igt@kms_big_fb@linear-32bpp-rotate-0:
- shard-glk: NOTRUN -> [DMESG-WARN][50] ([i915#118] / [i915#95])
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-glk1/igt@[email protected]

* igt@kms_big_fb@x-tiled-8bpp-rotate-270:
- shard-iclb: NOTRUN -> [SKIP][51] ([fdo#110725] / [fdo#111614]) +2 similar issues
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb6/igt@[email protected]

* igt@kms_big_fb@x-tiled-max-hw-stride-32bpp-rotate-180-hflip:
- shard-glk: NOTRUN -> [SKIP][52] ([fdo#109271] / [i915#3777])
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-glk6/igt@[email protected]

* igt@kms_big_fb@y-tiled-64bpp-rotate-270:
- shard-tglb: NOTRUN -> [SKIP][53] ([fdo#111614]) +1 similar issue
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb3/igt@[email protected]

* igt@kms_big_fb@y-tiled-max-hw-stride-32bpp-rotate-0-hflip:
- shard-apl: NOTRUN -> [SKIP][54] ([fdo#109271] / [i915#3777]) +1 similar issue
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl3/igt@[email protected]

* igt@kms_big_fb@y-tiled-max-hw-stride-64bpp-rotate-180-hflip-async-flip:
- shard-iclb: [PASS][55] -> [DMESG-WARN][56] ([i915#3621])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-iclb3/igt@kms_big_fb@y-tiled-max-hw-stride-64bpp-rotate-180-hflip-async-flip.html
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb1/igt@kms_big_fb@y-tiled-max-hw-stride-64bpp-rotate-180-hflip-async-flip.html

* igt@kms_big_fb@yf-tiled-64bpp-rotate-0:
- shard-tglb: NOTRUN -> [SKIP][57] ([fdo#111615]) +2 similar issues
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb5/igt@[email protected]

* igt@kms_big_fb@yf-tiled-max-hw-stride-64bpp-rotate-0-hflip-async-flip:
- shard-iclb: NOTRUN -> [SKIP][58] ([fdo#110723]) +1 similar issue
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb3/igt@kms_big_fb@yf-tiled-max-hw-stride-64bpp-rotate-0-hflip-async-flip.html

* igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_mc_ccs:
- shard-tglb: NOTRUN -> [SKIP][59] ([i915#3689] / [i915#3886]) +2 similar issues
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb1/igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_mc_ccs.html

* igt@kms_ccs@pipe-a-crc-primary-rotation-180-y_tiled_gen12_mc_ccs:
- shard-kbl: NOTRUN -> [SKIP][60] ([fdo#109271] / [i915#3886]) +3 similar issues
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-kbl1/igt@kms_ccs@pipe-a-crc-primary-rotation-180-y_tiled_gen12_mc_ccs.html

* igt@kms_ccs@pipe-a-crc-sprite-planes-basic-y_tiled_gen12_mc_ccs:
- shard-iclb: NOTRUN -> [SKIP][61] ([fdo#109278] / [i915#3886]) +6 similar issues
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb3/igt@kms_ccs@pipe-a-crc-sprite-planes-basic-y_tiled_gen12_mc_ccs.html

* igt@kms_ccs@pipe-b-ccs-on-another-bo-y_tiled_gen12_mc_ccs:
- shard-glk: NOTRUN -> [SKIP][62] ([fdo#109271] / [i915#3886]) +5 similar issues
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-glk2/igt@kms_ccs@pipe-b-ccs-on-another-bo-y_tiled_gen12_mc_ccs.html

* igt@kms_ccs@pipe-c-bad-rotation-90-y_tiled_gen12_mc_ccs:
- shard-apl: NOTRUN -> [SKIP][63] ([fdo#109271] / [i915#3886]) +13 similar issues
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl1/igt@kms_ccs@pipe-c-bad-rotation-90-y_tiled_gen12_mc_ccs.html

* igt@kms_ccs@pipe-d-bad-aux-stride-y_tiled_gen12_mc_ccs:
- shard-tglb: NOTRUN -> [SKIP][64] ([i915#3689]) +9 similar issues
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb2/igt@kms_ccs@pipe-d-bad-aux-stride-y_tiled_gen12_mc_ccs.html

* igt@kms_chamelium@hdmi-cmp-planar-formats:
- shard-iclb: NOTRUN -> [SKIP][65] ([fdo#109284] / [fdo#111827]) +3 similar issues
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb3/igt@[email protected]

* igt@kms_chamelium@hdmi-edid-change-during-suspend:
- shard-apl: NOTRUN -> [SKIP][66] ([fdo#109271] / [fdo#111827]) +21 similar issues
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl2/igt@[email protected]

* igt@kms_chamelium@vga-edid-read:
- shard-glk: NOTRUN -> [SKIP][67] ([fdo#109271] / [fdo#111827]) +8 similar issues
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-glk7/igt@[email protected]

* igt@kms_color_chamelium@pipe-b-ctm-negative:
- shard-tglb: NOTRUN -> [SKIP][68] ([fdo#109284] / [fdo#111827]) +6 similar issues
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb5/igt@[email protected]

* igt@kms_color_chamelium@pipe-c-ctm-negative:
- shard-kbl: NOTRUN -> [SKIP][69] ([fdo#109271] / [fdo#111827]) +3 similar issues
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-kbl7/igt@[email protected]

* igt@kms_color_chamelium@pipe-invalid-ctm-matrix-sizes:
- shard-snb: NOTRUN -> [SKIP][70] ([fdo#109271] / [fdo#111827]) +24 similar issues
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-snb6/igt@[email protected]

* igt@kms_content_protection@lic:
- shard-apl: NOTRUN -> [TIMEOUT][71] ([i915#1319]) +2 similar issues
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl1/igt@[email protected]

* igt@kms_content_protection@mei_interface:
- shard-iclb: NOTRUN -> [SKIP][72] ([fdo#109300] / [fdo#111066])
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb5/igt@kms_content_protection@mei_interface.html

* igt@kms_cursor_crc@pipe-a-cursor-512x512-onscreen:
- shard-iclb: NOTRUN -> [SKIP][73] ([fdo#109278] / [fdo#109279]) +2 similar issues
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb3/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-32x32-sliding:
- shard-tglb: NOTRUN -> [SKIP][74] ([i915#3319]) +1 similar issue
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb3/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-512x170-onscreen:
- shard-tglb: NOTRUN -> [SKIP][75] ([fdo#109279] / [i915#3359]) +2 similar issues
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb8/igt@[email protected]

* igt@kms_cursor_crc@pipe-d-cursor-max-size-sliding:
- shard-tglb: NOTRUN -> [SKIP][76] ([i915#3359]) +2 similar issues
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb8/igt@[email protected]

* igt@kms_cursor_legacy@cursorb-vs-flipb-legacy:
- shard-iclb: NOTRUN -> [SKIP][77] ([fdo#109274] / [fdo#109278]) +1 similar issue
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb4/igt@[email protected]

* igt@kms_cursor_legacy@pipe-d-single-bo:
- shard-glk: NOTRUN -> [SKIP][78] ([fdo#109271] / [i915#533]) +1 similar issue
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-glk6/igt@[email protected]
- shard-apl: NOTRUN -> [SKIP][79] ([fdo#109271] / [i915#533])
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl8/igt@[email protected]

* igt@kms_cursor_legacy@pipe-d-single-move:
- shard-iclb: NOTRUN -> [SKIP][80] ([fdo#109278]) +26 similar issues
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb1/igt@[email protected]

* igt@kms_dither@fb-8bpc-vs-panel-8bpc@edp-1-pipe-a:
- shard-iclb: [PASS][81] -> [SKIP][82] ([i915#3788])
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-iclb1/igt@kms_dither@[email protected]
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb2/igt@kms_dither@[email protected]

* igt@kms_draw_crc@draw-method-rgb565-mmap-gtt-xtiled:
- shard-glk: NOTRUN -> [FAIL][83] ([i915#1888] / [i915#3451])
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-glk8/igt@[email protected]

* igt@kms_dsc@basic-dsc-enable:
- shard-iclb: NOTRUN -> [SKIP][84] ([i915#3840])
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb4/igt@[email protected]

* igt@kms_flip@2x-plain-flip-fb-recreate-interruptible:
- shard-iclb: NOTRUN -> [SKIP][85] ([fdo#109274]) +1 similar issue
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb5/igt@[email protected]

* igt@kms_flip_scaled_crc@flip-32bpp-ytileccs-to-64bpp-ytile:
- shard-snb: NOTRUN -> [SKIP][86] ([fdo#109271]) +509 similar issues
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-snb7/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-mmap-cpu:
- shard-glk: NOTRUN -> [SKIP][87] ([fdo#109271]) +124 similar issues
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-glk9/igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-mmap-cpu.html

* igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-indfb-plflip-blt:
- shard-tglb: NOTRUN -> [SKIP][88] ([fdo#111825]) +26 similar issues
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb1/igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-indfb-plflip-blt.html

* igt@kms_frontbuffer_tracking@psr-2p-primscrn-spr-indfb-draw-mmap-cpu:
- shard-iclb: NOTRUN -> [SKIP][89] ([fdo#109280]) +22 similar issues
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb5/igt@kms_frontbuffer_tracking@psr-2p-primscrn-spr-indfb-draw-mmap-cpu.html

* igt@kms_hdr@static-swap:
- shard-tglb: NOTRUN -> [SKIP][90] ([i915#1187])
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb7/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][91] ([i915#1187])
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb5/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
- shard-apl: NOTRUN -> [FAIL][92] ([fdo#108145] / [i915#265])
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl1/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-alpha-7efc:
- shard-kbl: NOTRUN -> [FAIL][93] ([fdo#108145] / [i915#265])
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-kbl6/igt@[email protected]

* igt@kms_plane_scaling@scaler-with-clipping-clamping@pipe-c-scaler-with-clipping-clamping:
- shard-apl: NOTRUN -> [SKIP][94] ([fdo#109271] / [i915#2733])
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl1/igt@kms_plane_scaling@scaler-with-clipping-clamping@pipe-c-scaler-with-clipping-clamping.html

* igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-1:
- shard-apl: NOTRUN -> [SKIP][95] ([fdo#109271] / [i915#658]) +2 similar issues
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl3/igt@[email protected]

* igt@kms_psr2_sf@plane-move-sf-dmg-area-0:
- shard-tglb: NOTRUN -> [SKIP][96] ([i915#2920]) +1 similar issue
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb5/igt@[email protected]

* igt@kms_psr2_sf@plane-move-sf-dmg-area-2:
- shard-glk: NOTRUN -> [SKIP][97] ([fdo#109271] / [i915#658]) +2 similar issues
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-glk4/igt@[email protected]

* igt@kms_psr2_sf@plane-move-sf-dmg-area-3:
- shard-iclb: NOTRUN -> [SKIP][98] ([i915#658]) +1 similar issue
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb8/igt@[email protected]
- shard-kbl: NOTRUN -> [SKIP][99] ([fdo#109271] / [i915#658]) +1 similar issue
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-kbl4/igt@[email protected]

* igt@kms_psr@psr2_cursor_blt:
- shard-iclb: [PASS][100] -> [SKIP][101] ([fdo#109441])
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-iclb2/igt@kms_psr@psr2_cursor_blt.html
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb6/igt@kms_psr@psr2_cursor_blt.html

* igt@kms_psr@psr2_cursor_plane_onoff:
- shard-tglb: NOTRUN -> [FAIL][102] ([i915#132] / [i915#3467])
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb3/igt@kms_psr@psr2_cursor_plane_onoff.html
- shard-iclb: NOTRUN -> [SKIP][103] ([fdo#109441])
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb4/igt@kms_psr@psr2_cursor_plane_onoff.html

* igt@kms_writeback@writeback-check-output:
- shard-apl: NOTRUN -> [SKIP][104] ([fdo#109271] / [i915#2437]) +1 similar issue
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl7/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][105] ([i915#2437])
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb2/igt@[email protected]
- shard-kbl: NOTRUN -> [SKIP][106] ([fdo#109271] / [i915#2437])
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-kbl2/igt@[email protected]
- shard-tglb: NOTRUN -> [SKIP][107] ([i915#2437])
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb1/igt@[email protected]
- shard-glk: NOTRUN -> [SKIP][108] ([fdo#109271] / [i915#2437])
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-glk8/igt@[email protected]

* igt@nouveau_crc@pipe-c-ctx-flip-skip-current-frame:
- shard-tglb: NOTRUN -> [SKIP][109] ([i915#2530])
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb2/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][110] ([i915#2530])
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb1/igt@[email protected]

* igt@perf@unprivileged-single-ctx-counters:
- shard-iclb: NOTRUN -> [SKIP][111] ([fdo#109289]) +2 similar issues
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb2/igt@[email protected]

* igt@prime_nv_api@i915_nv_reimport_twice_check_flink_name:
- shard-apl: NOTRUN -> [SKIP][112] ([fdo#109271]) +252 similar issues
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl7/igt@prime_nv_api@i915_nv_reimport_twice_check_flink_name.html

* igt@prime_nv_pcopy@test2:
- shard-kbl: NOTRUN -> [SKIP][113] ([fdo#109271]) +109 similar issues
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-kbl6/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][114] ([fdo#109291]) +2 similar issues
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-iclb8/igt@[email protected]

* igt@prime_nv_pcopy@test3_2:
- shard-tglb: NOTRUN -> [SKIP][115] ([fdo#109291]) +4 similar issues
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-tglb3/igt@prime_nv_pcopy@test3_2.html

* igt@sysfs_clients@fair-0:
- shard-glk: NOTRUN -> [SKIP][116] ([fdo#109271] / [i915#2994])
[116]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-glk6/igt@[email protected]

* igt@sysfs_clients@fair-7:
- shard-apl: NOTRUN -> [SKIP][117] ([fdo#109271] / [i915#2994]) +3 similar issues
[117]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-apl1/igt@[email protected]

#### Possible fixes ####

* igt@gem_ctx_isolation@preservation-s3@vcs0:
- shard-kbl: [DMESG-WARN][118] ([i915#180]) -> [PASS][119] +3 similar issues
[118]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-kbl7/igt@gem_ctx_isolation@[email protected]
[119]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-kbl4/igt@gem_ctx_isolation@[email protected]

* igt@gem_exec_fair@basic-none-vip@rcs0:
- shard-kbl: [FAIL][120] ([i915#2842]) -> [PASS][121]
[120]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10548/shard-kbl4/igt@gem_exec_fair@[email protected]
[121]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/shard-kbl3/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-tglb: [FAIL][122] ([i915#2842]) -> [PASS][123] +1 similar issue
[122]: https://intel-gfx-ci.01.org/tr

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6192/index.html