[PATCH i-g-t v2 07/10] tests/intel/xe_svm: svm-invalid-va
Bommu Krishnaiah
krishnaiah.bommu at intel.com
Tue May 14 07:10:23 UTC 2024
Verify SVM functionality while accessing invalid address
Signed-off-by: Bommu Krishnaiah <krishnaiah.bommu at intel.com>
Cc: Oak Zeng <oak.zeng at intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
---
tests/intel/xe_svm.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/tests/intel/xe_svm.c b/tests/intel/xe_svm.c
index 421d7fd1a..b846ca71a 100644
--- a/tests/intel/xe_svm.c
+++ b/tests/intel/xe_svm.c
@@ -32,6 +32,8 @@
* Description: verify SVM basic functionality by using huge page access
* SUBTEST: svm-atomic-access
* Description: verify SVM basic functionality by using GPU atomic access any location in malloc'ed memory
+ * SUBTEST: svm_invalid_va
+ * Description: verify SVM functionality while accessing invalid address
*/
#include <fcntl.h>
@@ -224,6 +226,34 @@ static void svm_atomic_access(int fd, uint32_t vm, struct drm_xe_engine_class_in
free(dst);
}
+/**
+ * Submit a GPU command to access an invalid address.
+ * Driver should detect a catstrophic error.
+ */
+static void svm_invalid_va(int fd, uint32_t vm, struct drm_xe_engine_class_instance *eci)
+{
+ uint64_t gpu_va = 0x1a0000;
+ size_t bo_size = xe_bb_size(fd, PAGE_ALIGN_UFENCE);
+ uint32_t *dst;
+
+ struct xe_buffer cmd_buf = {
+ .fd = fd,
+ .gpu_addr = (void *)(uintptr_t)gpu_va,
+ .vm = vm,
+ .size = bo_size,
+ .placement = vram_if_possible(fd, eci->gt_id),
+ .flag = DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM
+ };
+
+ dst = (uint32_t *)0x1fffffffffff000;
+
+ xe_create_cmdbuf(&cmd_buf, insert_store, (uint64_t)dst, 0xc0ffee, eci);
+ igt_assert_eq(__xe_submit_cmd(&cmd_buf), -EIO); // for invalid address __xe_wait_ufence will return -EIO
+
+ xe_destroy_cmdbuf(&cmd_buf);
+ free(dst);
+}
+
igt_main
{
int fd;
@@ -262,6 +292,10 @@ igt_main
xe_for_each_engine(fd, hwe)
svm_atomic_access(fd, vm, hwe);
+ igt_subtest_f("svm-invalid-va")
+ xe_for_each_engine(fd, hwe)
+ svm_invalid_va(fd, vm, hwe);
+
igt_fixture {
xe_vm_destroy(fd, vm);
drm_close_driver(fd);
--
2.25.1
More information about the igt-dev
mailing list