[PATCH i-g-t v8 09/10] test

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Wed Mar 8 06:47:51 UTC 2023


---
 tests/xe/xe_exec_threads.c | 49 ++++++++++++++++++++++----------------
 1 file changed, 28 insertions(+), 21 deletions(-)

diff --git a/tests/xe/xe_exec_threads.c b/tests/xe/xe_exec_threads.c
index 9fd49553f7..edf104900c 100644
--- a/tests/xe/xe_exec_threads.c
+++ b/tests/xe/xe_exec_threads.c
@@ -88,9 +88,10 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,
 
 	if (flags & USERPTR) {
 		if (flags & INVALIDATE) {
-			data = mmap((void *)userptr, bo_size, PROT_READ |
-				    PROT_WRITE, MAP_SHARED | MAP_FIXED |
-				    MAP_ANONYMOUS, -1, 0);
+			data = mmap(from_user_pointer(userptr), bo_size,
+				    PROT_READ | PROT_WRITE,
+				    MAP_SHARED | MAP_FIXED | MAP_ANONYMOUS,
+				    -1, 0);
 			igt_assert(data != MAP_FAILED);
 		} else {
 			data = aligned_alloc(xe_get_default_alignment(fd),
@@ -199,9 +200,10 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,
 				continue;
 			}
 
-			data = mmap((void *)userptr, bo_size, PROT_READ |
-				    PROT_WRITE, MAP_SHARED | MAP_FIXED |
-				    MAP_ANONYMOUS, -1, 0);
+			data = mmap(from_user_pointer(userptr), bo_size,
+				    PROT_READ | PROT_WRITE,
+				    MAP_SHARED | MAP_FIXED | MAP_ANONYMOUS,
+				    -1, 0);
 			igt_assert(data != MAP_FAILED);
 		}
 	}
@@ -288,9 +290,10 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 
 	if (flags & USERPTR) {
 		if (flags & INVALIDATE) {
-			data = mmap((void *)userptr, bo_size, PROT_READ |
-				    PROT_WRITE, MAP_SHARED | MAP_FIXED |
-				    MAP_ANONYMOUS, -1, 0);
+			data = mmap(from_user_pointer(userptr), bo_size,
+				    PROT_READ | PROT_WRITE,
+				    MAP_SHARED | MAP_FIXED | MAP_ANONYMOUS,
+				    -1, 0);
 			igt_assert(data != MAP_FAILED);
 		} else {
 			data = aligned_alloc(xe_get_default_alignment(fd),
@@ -397,13 +400,15 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 				map_fd = open("/tmp", O_TMPFILE | O_RDWR,
 					      0x666);
 				write(map_fd, data, bo_size);
-				data = mmap((void *)userptr, bo_size,
-					    PROT_READ | PROT_WRITE, MAP_SHARED |
-					    MAP_FIXED, map_fd, 0);
+				data = mmap(from_user_pointer(userptr), bo_size,
+					    PROT_READ | PROT_WRITE,
+					    MAP_SHARED | MAP_FIXED,
+					    map_fd, 0);
 			} else {
-				data = mmap((void *)userptr, bo_size,
-					    PROT_READ | PROT_WRITE, MAP_SHARED |
-					    MAP_FIXED | MAP_ANONYMOUS, -1, 0);
+				data = mmap(from_user_pointer(userptr), bo_size,
+					    PROT_READ | PROT_WRITE,
+					    MAP_SHARED | MAP_FIXED | MAP_ANONYMOUS,
+					    -1, 0);
 			}
 			igt_assert(data != MAP_FAILED);
 		}
@@ -493,9 +498,10 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 
 	if (flags & USERPTR) {
 		if (flags & INVALIDATE) {
-			data = mmap((void *)userptr, bo_size, PROT_READ |
-				    PROT_WRITE, MAP_SHARED | MAP_FIXED |
-				    MAP_ANONYMOUS, -1, 0);
+			data = mmap(from_user_pointer(userptr), bo_size,
+				    PROT_READ | PROT_WRITE,
+				    MAP_SHARED | MAP_FIXED | MAP_ANONYMOUS,
+				    -1, 0);
 			igt_assert(data != MAP_FAILED);
 		} else {
 			data = aligned_alloc(xe_get_default_alignment(fd),
@@ -638,9 +644,10 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 				continue;
 			}
 
-			data = mmap((void *)userptr, bo_size, PROT_READ |
-				    PROT_WRITE, MAP_SHARED | MAP_FIXED |
-				    MAP_ANONYMOUS, -1, 0);
+			data = mmap(from_user_pointer(userptr), bo_size,
+				    PROT_READ | PROT_WRITE,
+				    MAP_SHARED | MAP_FIXED | MAP_ANONYMOUS,
+				    -1, 0);
 			igt_assert(data != MAP_FAILED);
 		}
 	}
-- 
2.34.1



More information about the Intel-gfx-trybot mailing list