From: Xin Wang <x.wang@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Xin Wang <x.wang@intel.com>, Matthew Auld <matthew.auld@intel.com>
Subject: [PATCH v2 1/4] tests/intel/xe_pat: add userptr-comp subtest
Date: Thu, 8 Jan 2026 06:59:30 +0000 [thread overview]
Message-ID: <20260108065933.409757-2-x.wang@intel.com> (raw)
In-Reply-To: <20260108065933.409757-1-x.wang@intel.com>
Add a new xe_pat subtest that iterates the debugfs PAT table and
validates that userptr bindings are rejected for PAT entries
enabling compression and for COH_MODE_NONE entries.
Expected failures return -EINVAL.
Cc: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Xin Wang <x.wang@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
---
tests/intel/xe_pat.c | 61 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/tests/intel/xe_pat.c b/tests/intel/xe_pat.c
index a7f8ab088..5ad4922dd 100644
--- a/tests/intel/xe_pat.c
+++ b/tests/intel/xe_pat.c
@@ -887,6 +887,64 @@ static void bo_comp_disable_bind(int fd)
xe_vm_destroy(fd, vm);
}
+/**
+ * SUBTEST: userptr-comp
+ * Test category: functionality test
+ * Description: Validate that userptr mappings cannot be bound with a PAT index
+ * that enables compression (expected to fail with -EINVAL).
+ */
+static void userptr_comp(int fd)
+{
+ size_t size = xe_get_default_alignment(fd);
+ uint16_t dev_id = intel_get_drm_devid(fd);
+ struct intel_pat_cache pat_sw_config = {};
+ int32_t parsed;
+ uint32_t vm;
+ void *data;
+
+ igt_require(intel_get_device_info(dev_id)->graphics_ver >= 20);
+
+ parsed = xe_fetch_pat_sw_config(fd, &pat_sw_config);
+
+ data = mmap(0, size, PROT_READ | PROT_WRITE,
+ MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+ igt_assert(data != MAP_FAILED);
+
+ vm = xe_vm_create(fd, 0, 0);
+
+ for (int i = 0; i < parsed; i++) {
+ uint32_t pat;
+ uint32_t coh_mode;
+ bool compressed;
+ uint64_t va;
+ int expected;
+ int ret;
+
+ if (pat_sw_config.entries[i].rsvd)
+ continue;
+ pat = pat_sw_config.entries[i].pat;
+ compressed = !!(pat & XE2_COMP_EN);
+ coh_mode = REG_FIELD_GET(XE2_COH_MODE, pat);
+
+ /* Spread VAs to keep each attempt independent. */
+ va = 0x40000ull + (uint64_t)i * 0x200000ull;
+
+ if (compressed || coh_mode == COH_MODE_NONE)
+ expected = -EINVAL;
+ else
+ expected = 0;
+ ret = __xe_vm_bind(fd, vm, 0, 0, to_user_pointer(data), va,
+ size, DRM_XE_VM_BIND_OP_MAP_USERPTR, 0, NULL, 0, 0,
+ i, 0);
+ igt_assert_eq(ret, expected);
+ if (!ret)
+ xe_vm_unbind_sync(fd, vm, 0, va, size);
+ }
+
+ munmap(data, size);
+ xe_vm_destroy(fd, vm);
+}
+
/**
* SUBTEST: display-vs-wb-transient
* Test category: functionality test
@@ -1317,6 +1375,9 @@ int igt_main_args("V", NULL, help_str, opt_handler, NULL)
igt_subtest("userptr-coh-none")
userptr_coh_none(fd);
+ igt_subtest("userptr-comp")
+ userptr_comp(fd);
+
igt_subtest("prime-self-import-coh")
prime_self_import_coh();
--
2.43.0
next prev parent reply other threads:[~2026-01-08 6:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 6:59 [PATCH v2 0/4] xe_pat: add compression subtests Xin Wang
2026-01-08 6:59 ` Xin Wang [this message]
2026-01-08 6:59 ` [PATCH v2 2/4] tests/intel/xe_pat: add prime-external-import-comp subtest Xin Wang
2026-01-08 6:59 ` [PATCH v2 3/4] tests/intel/xe_pat: add bo-wb-comp-1way-bind subtest Xin Wang
2026-01-08 10:16 ` Matthew Auld
2026-01-08 6:59 ` [PATCH v2 4/4] intel-ci: add xe_pat compression subtests Xin Wang
2026-01-08 7:46 ` ✗ Xe.CI.BAT: failure for xe_pat: add compression subtests (rev2) Patchwork
2026-01-08 8:21 ` ✓ i915.CI.BAT: success " Patchwork
2026-01-08 10:31 ` ✓ Xe.CI.Full: " Patchwork
2026-01-08 11:07 ` ✗ i915.CI.Full: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260108065933.409757-2-x.wang@intel.com \
--to=x.wang@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox