[PATCH i-g-t] lib/xe/xe_ioctl: Fix compilation on 32-bit armhf
Francois Dugast
francois.dugast at intel.com
Mon Apr 28 16:26:57 UTC 2025
Hi,
On Mon, Apr 28, 2025 at 06:21:22PM +0200, Kamil Konieczny wrote:
> Fix some compilation eerors on 32-bit platforms like armhf:
s/eerors/errors/
>
> ../lib/xe/xe_ioctl.c:443:7: error: conflicting types for xe_bo_map_fixed void *xe_bo_map_fixed(int fd, uint32_t bo, size_t size, uint64_t addr)
> ^~~~~~~~~~~~~~~
> In file included from ../lib/xe/xe_ioctl.c:46:
> ../lib/xe/xe_ioctl.h:89:7: note: previous declaration of xe_bo_map_fixed was here
> void *xe_bo_map_fixed(int fd, uint32_t bo, size_t size, long unsigned int addr);
> ^~~~~~~~~~~~~~~
> ../lib/xe/xe_ioctl.c: In function xe_bo_map_fixed:
> ../lib/xe/xe_ioctl.c:449:13: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> map = mmap((void *)addr, size, PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, mmo);
> ^
> 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>
I recently came across the same error and the same solution for commit 18f9cc22
"lib/intel_compute: Allow the user to override input and output addresses", so:
Reviewed-by: Francois Dugast <francois.dugast at intel.com>
Francois
> ---
> lib/xe/xe_ioctl.c | 2 +-
> lib/xe/xe_ioctl.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/xe/xe_ioctl.c b/lib/xe/xe_ioctl.c
> index 785fc9184..53a53cd0d 100644
> --- a/lib/xe/xe_ioctl.c
> +++ b/lib/xe/xe_ioctl.c
> @@ -446,7 +446,7 @@ void *xe_bo_map_fixed(int fd, uint32_t bo, size_t size, uint64_t addr)
> void *map;
>
> mmo = xe_bo_mmap_offset(fd, bo);
> - map = mmap((void *)addr, size, PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, mmo);
> + map = mmap(from_user_pointer(addr), size, PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, mmo);
> igt_assert(map != MAP_FAILED);
>
> return map;
> diff --git a/lib/xe/xe_ioctl.h b/lib/xe/xe_ioctl.h
> index 554a33c9c..522094ae2 100644
> --- a/lib/xe/xe_ioctl.h
> +++ b/lib/xe/xe_ioctl.h
> @@ -86,7 +86,7 @@ uint32_t xe_exec_queue_create_class(int fd, uint32_t vm, uint16_t class);
> void xe_exec_queue_destroy(int fd, uint32_t exec_queue);
> uint64_t xe_bo_mmap_offset(int fd, uint32_t bo);
> void *xe_bo_map(int fd, uint32_t bo, size_t size);
> -void *xe_bo_map_fixed(int fd, uint32_t bo, size_t size, long unsigned int addr);
> +void *xe_bo_map_fixed(int fd, uint32_t bo, size_t size, uint64_t addr);
> void *xe_bo_mmap_ext(int fd, uint32_t bo, size_t size, int prot);
> int __xe_exec(int fd, struct drm_xe_exec *exec);
> void xe_exec(int fd, struct drm_xe_exec *exec);
> --
> 2.49.0
>
More information about the igt-dev
mailing list