[PATCH 2/2] tests/intel/xe_vm: Use fault injection interface for error injection test

Jonathan Cavitt jonathan.cavitt at intel.com
Thu Aug 21 21:17:44 UTC 2025


The test xe_vm at bind-array-conflict-error-inject currently uses a
separate error injection mechanism that isn't unified with the existing
error injection framework.  This separate error injection framework is
disabled when CONFIG_DRM_XE_DEBUG is not set, which violates the
guarantee CONFIG_DRM_XE_DEBUG has no functional impact.  Modify the test
to use the fault injection framework that the other xe_fault_injection
tests use.

Suggested-by: John Harrison <john.c.harrison at intel.com>
Signed-off-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
---
 tests/intel/xe_vm.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tests/intel/xe_vm.c b/tests/intel/xe_vm.c
index 7a37bfe052..7271ee4123 100644
--- a/tests/intel/xe_vm.c
+++ b/tests/intel/xe_vm.c
@@ -16,6 +16,7 @@
 #include "lib/intel_reg.h"
 #include "xe_drm.h"
 
+#include "xe/xe_fault_injection.h"
 #include "xe/xe_ioctl.h"
 #include "xe/xe_query.h"
 #include "xe/xe_spin.h"
@@ -1177,14 +1178,14 @@ test_bind_array_conflict(int fd, struct drm_xe_engine_class_instance *eci,
 		}
 
 		if (error_inject) {
+			const char *func_name = "vm_bind_ioctl_ops_lock_and_prep";
 			sync[0].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
-			bind_ops[BIND_ARRAY_CONFLICT_NUM_BINDS - 1].flags |=
-				0x1 << 31;
+			injection_list_add(func_name);
+			injection_set_retval(func_name, -ENOSPC);
 			xe_vm_bind_array_err(fd, vm, 0, bind_ops,
 					     BIND_ARRAY_CONFLICT_NUM_BINDS,
 					     sync, 1, ENOSPC);
-			bind_ops[BIND_ARRAY_CONFLICT_NUM_BINDS - 1].flags &=
-				~(0x1 << 31);
+			injection_list_remove(func_name);
 
 			/* Verify existing mappings still works */
 			i = 1;
@@ -2673,9 +2674,13 @@ igt_main
 		xe_for_each_engine(fd, hwe)
 			test_bind_array_conflict(fd, hwe, true, false);
 
-	igt_subtest("bind-array-conflict-error-inject")
+	igt_subtest("bind-array-conflict-error-inject") {
+		igt_require(fail_function_injection_enabled());
+		injection_setup_fault(&default_fault_params);
+		injection_exit_handler();
 		xe_for_each_engine(fd, hwe)
 			test_bind_array_conflict(fd, hwe, false, true);
+	}
 
 	igt_subtest("bind-array-flag-invalid")
 		test_bind_flag_invalid(fd, 16);
-- 
2.43.0



More information about the Intel-gfx-trybot mailing list