[PATCH i-g-t] tests/intel/xe_exec_system_allocator: Fix 32-bit compilation
Kamil Konieczny
kamil.konieczny at linux.intel.com
Tue Apr 29 14:30:51 UTC 2025
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 at intel.com>
Cc: Jonathan Cavitt <jonathan.cavitt at intel.com>
Cc: Francois Dugast <francois.dugast at intel.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny at 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
More information about the igt-dev
mailing list