Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/intel/xe_exec_system_allocator: Fix 32-bit compilation
@ 2025-04-29 14:30 Kamil Konieczny
  2025-04-29 15:17 ` Francois Dugast
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Kamil Konieczny @ 2025-04-29 14:30 UTC (permalink / raw)
  To: igt-dev; +Cc: Kamil Konieczny, Matthew Brost, Jonathan Cavitt, Francois Dugast

There is one more place which needs fixing of Xe test
compilation for 32-bit platforms, reported errors are:

../tests/intel/xe_exec_system_allocator.c:382:41: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  aligned_alloc_type.ptr = (void *)ALIGN((uint64_t)aligned_alloc_type.__ptr, alignment);
                                         ^
../tests/intel/xe_exec_system_allocator.c:382:27: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  aligned_alloc_type.ptr = (void *)ALIGN((uint64_t)aligned_alloc_type.__ptr, alignment);
                           ^
cc1: some warnings being treated as errors

Fixes: 9eda33fedff7 ("tests/xe: Add system_allocator test")
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Jonathan Cavitt <jonathan.cavitt@intel.com>
Cc: Francois Dugast <francois.dugast@intel.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 tests/intel/xe_exec_system_allocator.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/intel/xe_exec_system_allocator.c b/tests/intel/xe_exec_system_allocator.c
index e1121a862..30b99f3ed 100644
--- a/tests/intel/xe_exec_system_allocator.c
+++ b/tests/intel/xe_exec_system_allocator.c
@@ -374,12 +374,15 @@ struct aligned_alloc_type {
 static struct aligned_alloc_type __aligned_alloc(size_t alignment, size_t size)
 {
 	struct aligned_alloc_type aligned_alloc_type;
+	uint64_t addr;
 
 	aligned_alloc_type.__ptr = mmap(NULL, alignment + size, PROT_NONE, MAP_PRIVATE |
 					MAP_ANONYMOUS, -1, 0);
 	igt_assert(aligned_alloc_type.__ptr != MAP_FAILED);
 
-	aligned_alloc_type.ptr = (void *)ALIGN((uint64_t)aligned_alloc_type.__ptr, alignment);
+	addr = to_user_pointer(aligned_alloc_type.__ptr);
+	addr = ALIGN(addr, (uint64_t)alignment);
+	aligned_alloc_type.ptr = from_user_pointer(addr);
 	aligned_alloc_type.size = size;
 	aligned_alloc_type.__size = size + alignment;
 
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-04-30  8:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-29 14:30 [PATCH i-g-t] tests/intel/xe_exec_system_allocator: Fix 32-bit compilation Kamil Konieczny
2025-04-29 15:17 ` Francois Dugast
2025-04-30  4:00 ` ✓ i915.CI.BAT: success for " Patchwork
2025-04-30  4:28 ` [PATCH i-g-t] " Matthew Brost
2025-04-30  4:49 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-04-30  6:52 ` ✗ Xe.CI.Full: failure " Patchwork
2025-04-30  8:44   ` Kamil Konieczny
2025-04-30  7:19 ` ✗ i915.CI.Full: " Patchwork
2025-04-30  8:39   ` Kamil Konieczny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox