dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xe: avoid using writeq() on 32-bit
@ 2024-02-28 12:27 Arnd Bergmann
  2024-02-28 14:44 ` Thomas Hellström
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2024-02-28 12:27 UTC (permalink / raw)
  To: Lucas De Marchi, Oded Gabbay, Thomas Hellström
  Cc: Arnd Bergmann, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Daniel Vetter, Rodrigo Vivi,
	Matt Roper, Matthew Auld, Matthew Brost, Michal Wajdeczko,
	intel-xe, dri-devel, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

32-bit kernels do not provide a writeq(), failing the build:

drivers/gpu/drm/xe/xe_ggtt.c:78:2: error: use of undeclared identifier 'writeq'
   78 |         writeq(pte, &ggtt->gsm[addr >> XE_PTE_SHIFT]);

Using lo_hi_writeq() instead will write the lower 32 bits to the address
before writing the upper 32 bits to the following word, which is likely
the correct replacement to do on 32-bit targets.

Include the linux/io-64-nonatomic-lo-hi.h header to automatically pick
the regular writeq() on 64-bit machines but fall back to lo_hi_writeq()
on 32-bit ones.

Fixes: 237412e45390 ("drm/xe: Enable 32bits build")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/xe/xe_ggtt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
index 5d46958e3144..1ffcc63ca86d 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.c
+++ b/drivers/gpu/drm/xe/xe_ggtt.c
@@ -6,6 +6,7 @@
 #include "xe_ggtt.h"
 
 #include <linux/sizes.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
 
 #include <drm/drm_managed.h>
 #include <drm/i915_drm.h>
-- 
2.39.2


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

* Re: [PATCH] xe: avoid using writeq() on 32-bit
  2024-02-28 12:27 [PATCH] xe: avoid using writeq() on 32-bit Arnd Bergmann
@ 2024-02-28 14:44 ` Thomas Hellström
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Hellström @ 2024-02-28 14:44 UTC (permalink / raw)
  To: Arnd Bergmann, Lucas De Marchi, Oded Gabbay
  Cc: Arnd Bergmann, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Daniel Vetter, Rodrigo Vivi,
	Matt Roper, Matthew Auld, Matthew Brost, Michal Wajdeczko,
	intel-xe, dri-devel, linux-kernel

Hi, Arnd,

On Wed, 2024-02-28 at 13:27 +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 32-bit kernels do not provide a writeq(), failing the build:
> 
> drivers/gpu/drm/xe/xe_ggtt.c:78:2: error: use of undeclared
> identifier 'writeq'
>    78 |         writeq(pte, &ggtt->gsm[addr >> XE_PTE_SHIFT]);
> 
> Using lo_hi_writeq() instead will write the lower 32 bits to the
> address
> before writing the upper 32 bits to the following word, which is
> likely
> the correct replacement to do on 32-bit targets.
> 
> Include the linux/io-64-nonatomic-lo-hi.h header to automatically
> pick
> the regular writeq() on 64-bit machines but fall back to
> lo_hi_writeq()
> on 32-bit ones.
> 
> Fixes: 237412e45390 ("drm/xe: Enable 32bits build")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks for the patch.
We have a patch already on the list pending review comments that fixes
this.

https://patchwork.freedesktop.org/patch/579781/?series=130347&rev=1

/Thomas


> ---
>  drivers/gpu/drm/xe/xe_ggtt.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_ggtt.c
> b/drivers/gpu/drm/xe/xe_ggtt.c
> index 5d46958e3144..1ffcc63ca86d 100644
> --- a/drivers/gpu/drm/xe/xe_ggtt.c
> +++ b/drivers/gpu/drm/xe/xe_ggtt.c
> @@ -6,6 +6,7 @@
>  #include "xe_ggtt.h"
>  
>  #include <linux/sizes.h>
> +#include <linux/io-64-nonatomic-lo-hi.h>
>  
>  #include <drm/drm_managed.h>
>  #include <drm/i915_drm.h>


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

end of thread, other threads:[~2024-02-28 14:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-28 12:27 [PATCH] xe: avoid using writeq() on 32-bit Arnd Bergmann
2024-02-28 14:44 ` Thomas Hellström

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).