All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] s390x: io: declare s390x CPU as big endian
@ 2021-11-11 18:48 Pierre Morel
  2021-11-12  7:38 ` Thomas Huth
  0 siblings, 1 reply; 3+ messages in thread
From: Pierre Morel @ 2021-11-11 18:48 UTC (permalink / raw)
  To: kvm; +Cc: frankja, david, thuth, cohuck, imbrenda

To use the swap byte transformations we need to declare
the s390x architecture as big endian.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
 lib/s390x/asm/io.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/s390x/asm/io.h b/lib/s390x/asm/io.h
index 1dc6283b..b5e661cf 100644
--- a/lib/s390x/asm/io.h
+++ b/lib/s390x/asm/io.h
@@ -10,6 +10,7 @@
 #define _ASMS390X_IO_H_
 
 #define __iomem
+#define __cpu_is_be() (1)
 
 #include <asm-generic/io.h>
 
-- 
2.25.1


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

* Re: [kvm-unit-tests PATCH] s390x: io: declare s390x CPU as big endian
  2021-11-11 18:48 [kvm-unit-tests PATCH] s390x: io: declare s390x CPU as big endian Pierre Morel
@ 2021-11-12  7:38 ` Thomas Huth
  2021-11-12  9:10   ` Claudio Imbrenda
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2021-11-12  7:38 UTC (permalink / raw)
  To: Pierre Morel, kvm; +Cc: frankja, david, cohuck, imbrenda

On 11/11/2021 19.48, Pierre Morel wrote:
> To use the swap byte transformations we need to declare
> the s390x architecture as big endian.
> 
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
>   lib/s390x/asm/io.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/lib/s390x/asm/io.h b/lib/s390x/asm/io.h
> index 1dc6283b..b5e661cf 100644
> --- a/lib/s390x/asm/io.h
> +++ b/lib/s390x/asm/io.h
> @@ -10,6 +10,7 @@
>   #define _ASMS390X_IO_H_
>   
>   #define __iomem
> +#define __cpu_is_be() (1)
>   
>   #include <asm-generic/io.h>
>   
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>

Alternatively, I think you could also move this sequence from 
lib/ppc64/asm/io.h into lib/asm-generic/io.h:

#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define __cpu_is_be() (0)
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define __cpu_is_be() (1)
#else
#error Undefined byte order
#endif

(replacing the hardcoded __cpu_is_be() in the generic code).

  Thomas


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

* Re: [kvm-unit-tests PATCH] s390x: io: declare s390x CPU as big endian
  2021-11-12  7:38 ` Thomas Huth
@ 2021-11-12  9:10   ` Claudio Imbrenda
  0 siblings, 0 replies; 3+ messages in thread
From: Claudio Imbrenda @ 2021-11-12  9:10 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Pierre Morel, kvm, frankja, david, cohuck

On Fri, 12 Nov 2021 08:38:38 +0100
Thomas Huth <thuth@redhat.com> wrote:

> On 11/11/2021 19.48, Pierre Morel wrote:
> > To use the swap byte transformations we need to declare
> > the s390x architecture as big endian.
> > 
> > Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> > ---
> >   lib/s390x/asm/io.h | 1 +
> >   1 file changed, 1 insertion(+)
> > 
> > diff --git a/lib/s390x/asm/io.h b/lib/s390x/asm/io.h
> > index 1dc6283b..b5e661cf 100644
> > --- a/lib/s390x/asm/io.h
> > +++ b/lib/s390x/asm/io.h
> > @@ -10,6 +10,7 @@
> >   #define _ASMS390X_IO_H_
> >   
> >   #define __iomem
> > +#define __cpu_is_be() (1)
> >   
> >   #include <asm-generic/io.h>
> >   
> >   
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> 
> Alternatively, I think you could also move this sequence from 
> lib/ppc64/asm/io.h into lib/asm-generic/io.h:
> 
> #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
> #define __cpu_is_be() (0)
> #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
> #define __cpu_is_be() (1)
> #else
> #error Undefined byte order
> #endif
> 
> (replacing the hardcoded __cpu_is_be() in the generic code).
> 
>   Thomas

I think this looks cleaner


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

end of thread, other threads:[~2021-11-12  9:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 18:48 [kvm-unit-tests PATCH] s390x: io: declare s390x CPU as big endian Pierre Morel
2021-11-12  7:38 ` Thomas Huth
2021-11-12  9:10   ` Claudio Imbrenda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.