[PATCH i-g-t 2/2] tests/intel/xe_exec_fault_mode: Extend invalid va test

priyanka.dandamudi at intel.com priyanka.dandamudi at intel.com
Mon Mar 25 09:18:10 UTC 2024


From: Priyanka Dandamudi <priyanka.dandamudi at intel.com>

Extend invalid va test by enabling scratch page without pagefault
and check for success of userfence.

v2: Rename flag NOPAGEFAULT to ENABLE_SCRATCH and
add INVALID_VA to test.(Rahul)

Cc: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
Cc: Bommu Krishnaiah <krishnaiah.bommu at intel.com>
Signed-off-by: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
Reviewed-by: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
---
 tests/intel/xe_exec_fault_mode.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/tests/intel/xe_exec_fault_mode.c b/tests/intel/xe_exec_fault_mode.c
index 8b1040103..050d2c782 100644
--- a/tests/intel/xe_exec_fault_mode.c
+++ b/tests/intel/xe_exec_fault_mode.c
@@ -32,12 +32,17 @@
 #define PREFETCH	(0x1 << 5)
 #define INVALID_FAULT	(0x1 << 6)
 #define INVALID_VA	(0x1 << 7)
+#define ENABLE_SCRATCH  (0x1 << 8)
 
 /**
  * SUBTEST: invalid-va
  * Description: Access invalid va and check for EIO through user fence.
  * Test category: functionality test
  *
+ * SUBTEST: invalid-va-scratch-nopagefault
+ * Description: Access invalid va without pageafault with scratch page enabled.
+ * Test category: functionality test
+ *
  * SUBTEST: once-%s
  * Description: Run %arg[1] fault mode test only once
  * Test category: functionality test
@@ -120,8 +125,12 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 
 	igt_assert(n_exec_queues <= MAX_N_EXEC_QUEUES);
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_LR_MODE |
-			  DRM_XE_VM_CREATE_FLAG_FAULT_MODE, 0);
+	if (flags & ENABLE_SCRATCH)
+		vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_LR_MODE |
+				  DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE, 0);
+	else
+		vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_LR_MODE |
+				  DRM_XE_VM_CREATE_FLAG_FAULT_MODE, 0);
 	bo_size = sizeof(*data) * n_execs;
 	bo_size = xe_bb_size(fd, bo_size);
 
@@ -269,7 +278,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		j = flags & INVALIDATE ? n_execs - 1 : 0;
 
 		for (i = j; i < n_execs; i++) {
-			if (flags & INVALID_VA)
+			if (flags & INVALID_VA && !(flags & ENABLE_SCRATCH))
 				igt_assert_eq(__xe_wait_ufence(fd, &data[i].exec_sync, USER_FENCE_VALUE,
 							       exec_queues[i % n_exec_queues], &timeout), EIO);
 			else
@@ -385,6 +394,10 @@ igt_main
 			test_exec(fd, hwe, 1, 1, INVALID_VA);
 		}
 
+	igt_subtest("invalid-va-scratch-nopagefault")
+		xe_for_each_engine(fd, hwe)
+			test_exec(fd, hwe, 1, 1, ENABLE_SCRATCH | INVALID_VA);
+
 	igt_fixture {
 		drm_close_driver(fd);
 	}
-- 
2.25.1



More information about the igt-dev mailing list