[PATCH v9 4/5] tests/xe_pat: use debugfs reserved flags

Xin Wang
2025-12-31T05:55:36Z

Stop hard-coding a reserved PAT index range for Xe2+. Instead,
parse the PAT software configuration via xe_get_pat_sw_config()
and use entries[].rsvd to decide which indices should be rejected
by the kernel.
This keeps the test aligned with kernel PAT layouts across
platforms and future changes.

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 | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/intel/xe_pat.c b/tests/intel/xe_pat.c
index f003f0046..bcc86cd70 100644
--- a/tests/intel/xe_pat.c
+++ b/tests/intel/xe_pat.c
@@ -180,8 +180,8 @@ static void pat_sanity(int fd)
*/
static void pat_index_all(int fd)
{
- uint16_t dev_id = intel_get_drm_devid(fd);
size_t size = xe_get_default_alignment(fd);
+ struct intel_pat_cache pat_sw_config = {};
uint32_t vm, bo;
uint8_t pat_index;

@@ -210,10 +210,12 @@ static void pat_index_all(int fd)

igt_assert(intel_get_max_pat_index(fd));

+ xe_fetch_pat_sw_config_or_skip(fd, &pat_sw_config);
+
for (pat_index = 0; pat_index <= intel_get_max_pat_index(fd);
pat_index++) {
- if (intel_get_device_info(dev_id)->graphics_ver >= 20 &&
- pat_index >= 16 && pat_index <= 19) { /* hw reserved */
+
+ if (pat_sw_config.entries[pat_index].rsvd) {
igt_assert_eq(__xe_vm_bind(fd, vm, 0, bo, 0, 0x40000,
size, DRM_XE_VM_BIND_OP_MAP, 0, NULL, 0, 0,
pat_index, 0),
--
2.43.0