Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/xe/xe_ioctl: Fix compilation on 32-bit armhf
@ 2025-04-28 16:21 Kamil Konieczny
  2025-04-28 16:26 ` Francois Dugast
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Kamil Konieczny @ 2025-04-28 16:21 UTC (permalink / raw)
  To: igt-dev; +Cc: Kamil Konieczny, Matthew Brost, Jonathan Cavitt, Francois Dugast

Fix some compilation eerors on 32-bit platforms like armhf:

../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@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>
---
 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


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

* Re: [PATCH i-g-t] lib/xe/xe_ioctl: Fix compilation on 32-bit armhf
  2025-04-28 16:21 [PATCH i-g-t] lib/xe/xe_ioctl: Fix compilation on 32-bit armhf Kamil Konieczny
@ 2025-04-28 16:26 ` Francois Dugast
  2025-04-29  9:14   ` Kamil Konieczny
  2025-04-28 16:58 ` Matthew Brost
  2025-04-30  0:06 ` ✗ Fi.CI.BAT: failure for " Patchwork
  2 siblings, 1 reply; 5+ messages in thread
From: Francois Dugast @ 2025-04-28 16:26 UTC (permalink / raw)
  To: Kamil Konieczny; +Cc: igt-dev, Matthew Brost, Jonathan Cavitt

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@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>

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@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
> 

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

* Re: [PATCH i-g-t] lib/xe/xe_ioctl: Fix compilation on 32-bit armhf
  2025-04-28 16:21 [PATCH i-g-t] lib/xe/xe_ioctl: Fix compilation on 32-bit armhf Kamil Konieczny
  2025-04-28 16:26 ` Francois Dugast
@ 2025-04-28 16:58 ` Matthew Brost
  2025-04-30  0:06 ` ✗ Fi.CI.BAT: failure for " Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Matthew Brost @ 2025-04-28 16:58 UTC (permalink / raw)
  To: Kamil Konieczny; +Cc: igt-dev, Jonathan Cavitt, Francois Dugast

On Mon, Apr 28, 2025 at 06:21:22PM +0200, Kamil Konieczny wrote:
> Fix some compilation eerors on 32-bit platforms like armhf:
> 
> ../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@intel.com>

Thanks for the fix:
Reviewed-by: 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>
> ---
>  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
> 

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

* Re: [PATCH i-g-t] lib/xe/xe_ioctl: Fix compilation on 32-bit armhf
  2025-04-28 16:26 ` Francois Dugast
@ 2025-04-29  9:14   ` Kamil Konieczny
  0 siblings, 0 replies; 5+ messages in thread
From: Kamil Konieczny @ 2025-04-29  9:14 UTC (permalink / raw)
  To: Francois Dugast; +Cc: igt-dev, Matthew Brost, Jonathan Cavitt

Hi Francois,
On 2025-04-28 at 18:26:57 +0200, Francois Dugast wrote:
> 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@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>
> 
> 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@intel.com>
> 
> Francois
> 

Uh, it looks more complicated, let me dig in into this as there
are still compilation errors in those 32-bit containers.

Regards,
Kamil

> > ---
> >  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
> > 

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

* ✗ Fi.CI.BAT: failure for lib/xe/xe_ioctl: Fix compilation on 32-bit armhf
  2025-04-28 16:21 [PATCH i-g-t] lib/xe/xe_ioctl: Fix compilation on 32-bit armhf Kamil Konieczny
  2025-04-28 16:26 ` Francois Dugast
  2025-04-28 16:58 ` Matthew Brost
@ 2025-04-30  0:06 ` Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2025-04-30  0:06 UTC (permalink / raw)
  To: Kamil Konieczny; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

== Series Details ==

Series: lib/xe/xe_ioctl: Fix compilation on 32-bit armhf
URL   : https://patchwork.freedesktop.org/series/148375/
State : failure

== Summary ==

Series 148375 revision 1 was fully merged or fully failed: no git log



[-- Attachment #2: Type: text/html, Size: 709 bytes --]

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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-28 16:21 [PATCH i-g-t] lib/xe/xe_ioctl: Fix compilation on 32-bit armhf Kamil Konieczny
2025-04-28 16:26 ` Francois Dugast
2025-04-29  9:14   ` Kamil Konieczny
2025-04-28 16:58 ` Matthew Brost
2025-04-30  0:06 ` ✗ Fi.CI.BAT: failure for " Patchwork

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