Re: [kvm-unit-tests PATCH v2] io: declare __cpu_is_be in generic code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 11/18/21 15:45, Thomas Huth wrote:
On 18/11/2021 14.48, Pierre Morel wrote:
To use the swap byte transformations in big endian architectures,
we need to declare __cpu_is_be in the generic code.
Let's move it from the ppc code to the generic code.

Signed-off-by: Pierre Morel <pmorel@xxxxxxxxxxxxx>
Suggested-by: Thomas Huth <thuth@xxxxxxxxxx>
---
  lib/asm-generic/io.h | 8 ++++++++
  lib/ppc64/asm/io.h   | 8 --------
  2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/asm-generic/io.h b/lib/asm-generic/io.h
index 88972f3b..9fa76ddb 100644
--- a/lib/asm-generic/io.h
+++ b/lib/asm-generic/io.h
@@ -13,6 +13,14 @@
  #include "asm/page.h"
  #include "asm/barrier.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

Please remove these three later lines in that file now:

#ifndef __cpu_is_be
#define __cpu_is_be() (0)
#endif

  Thomas


grrr, stupid me


  #ifndef __raw_readb
  static inline u8 __raw_readb(const volatile void *addr)
  {
diff --git a/lib/ppc64/asm/io.h b/lib/ppc64/asm/io.h
index 2b4dd2be..08d7297c 100644
--- a/lib/ppc64/asm/io.h
+++ b/lib/ppc64/asm/io.h
@@ -1,14 +1,6 @@
  #ifndef _ASMPPC64_IO_H_
  #define _ASMPPC64_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
-
  #define __iomem
  #include <asm-generic/io.h>



--
Pierre Morel
IBM Lab Boeblingen



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux