[PATCH] tests/intel/xe_fault_injection: Use valid pat index

Jonathan Cavitt jonathan.cavitt at intel.com
Thu Nov 21 20:29:42 UTC 2024


As a part of vm_bind_ioctl_check_args, all vm binds that use the
DRM_XE_VM_BIND_OP_MAP_USERPTR operation must have a coherency mode of
XE_COH_AT_LEAST_1WAY.  This is determined by the pat_index set in the
bind operation before the bind is performed.

The value is usually set by intel_get_pat_idx_wb, as this is the
default used in the various xe_vm_bind helper functions (or, more
specifically, the pat index value DEFAULT_PAT_INDEX is passed, which
translates to using intel_get_pat_idx_wb to generate the true value sent
to the ioctl).  However, when the ioctl is called manually (through
igt_ioctl, for example), it is up to the calling test to ensure the pat
index value is correctly set, and in xe_vm, for example,
intel_get_pat_idx_wb is used as well to set the pat index.

This step was not done in the simple_vm_bind function in
xe_fault_injection, so use intel_get_pat_idx_wb to set the pat index.

Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/3499
Signed-off-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
CC: Francois Dugast <francois.dugast at intel.com>
CC: Nirmoy Das <nirmoy.das at intel.com>
---
 tests/intel/xe_fault_injection.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/intel/xe_fault_injection.c b/tests/intel/xe_fault_injection.c
index 1b29041745..f8d7278caa 100644
--- a/tests/intel/xe_fault_injection.c
+++ b/tests/intel/xe_fault_injection.c
@@ -17,6 +17,7 @@
 #include "igt_device.h"
 #include "igt_kmod.h"
 #include "igt_sysfs.h"
+#include "intel_pat.h"
 #include "lib/igt_syncobj.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
@@ -213,6 +214,7 @@ simple_vm_bind(int fd, uint32_t vm)
 		.bind.addr = BO_ADDR,
 		.bind.op = DRM_XE_VM_BIND_OP_MAP_USERPTR,
 		.bind.flags = 0,
+		.bind.pat_index = intel_get_pat_idx_wb(fd),
 		.num_syncs = 1,
 		.syncs = (uintptr_t)&syncobj,
 		.exec_queue_id = 0,
-- 
2.43.0



More information about the igt-dev mailing list