All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lin Liu <lin.liu@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: "Lin Liu" <lin.liu@citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Ian Jackson" <iwj@xenproject.org>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Julien Grall" <julien@xen.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH v2 6/7] xen: Switch to byteswap.h
Date: Fri, 22 Oct 2021 10:47:27 +0000	[thread overview]
Message-ID: <f5a79881bfdcef06aa950632250f551e0ec26458.1634897942.git.lin.liu@citrix.com> (raw)
In-Reply-To: <cover.1634897942.git.lin.liu@citrix.com>

Update to use byteswap.h to swap bytes.

No functional chagne.

Signed-off-by: Lin Liu <lin.liu@citrix.com>
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Ian Jackson <iwj@xenproject.org>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Julien Grall <julien@xen.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Wei Liu <wl@xen.org>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>
---
 xen/common/bitmap.c                |  2 +-
 xen/common/gdbstub.c               |  2 +-
 xen/common/libelf/libelf-private.h |  8 ++++----
 xen/common/lz4/defs.h              |  2 +-
 xen/common/lzo.c                   |  2 +-
 xen/common/unlzo.c                 |  2 +-
 xen/common/xz/private.h            |  4 ++--
 xen/drivers/char/ehci-dbgp.c       |  2 +-
 xen/include/asm-x86/msi.h          |  2 +-
 xen/include/xen/bitmap.h           |  2 +-
 xen/include/xen/device_tree.h      |  2 +-
 xen/include/xen/unaligned.h        | 14 +++++++-------
 xen/lib/divmod.c                   |  2 +-
 13 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/xen/common/bitmap.c b/xen/common/bitmap.c
index 7d4551f782..be274ca04a 100644
--- a/xen/common/bitmap.c
+++ b/xen/common/bitmap.c
@@ -9,10 +9,10 @@
 #include <xen/errno.h>
 #include <xen/bitmap.h>
 #include <xen/bitops.h>
+#include <xen/byteswap.h>
 #include <xen/cpumask.h>
 #include <xen/guest_access.h>
 #include <xen/lib.h>
-#include <asm/byteorder.h>
 
 /*
  * bitmaps provide an array of bits, implemented using an an
diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c
index 848c1f4327..3c8ed52d6b 100644
--- a/xen/common/gdbstub.c
+++ b/xen/common/gdbstub.c
@@ -33,6 +33,7 @@
 /* Resuming after we've stopped used to work, but more through luck
    than any actual intention.  It doesn't at the moment. */
 
+#include <xen/byteswap.h>
 #include <xen/lib.h>
 #include <xen/spinlock.h>
 #include <xen/serial.h>
@@ -45,7 +46,6 @@
 #include <xen/console.h>
 #include <xen/errno.h>
 #include <xen/delay.h>
-#include <asm/byteorder.h>
 
 /* Printk isn't particularly safe just after we've trapped to the
    debugger. so avoid it. */
diff --git a/xen/common/libelf/libelf-private.h b/xen/common/libelf/libelf-private.h
index 47db679966..b7089cb31b 100644
--- a/xen/common/libelf/libelf-private.h
+++ b/xen/common/libelf/libelf-private.h
@@ -17,10 +17,10 @@
 
 #ifdef __XEN__
 
+#include <xen/byteswap.h>
 #include <xen/lib.h>
 #include <xen/libelf.h>
 #include <xen/softirq.h>
-#include <asm/byteorder.h>
 #include <public/elfnote.h>
 
 /* we would like to use elf->log_callback but we can't because
@@ -31,9 +31,9 @@
    printk(fmt, ## args )
 
 #define strtoull(str, end, base) simple_strtoull(str, end, base)
-#define bswap_16(x) swab16(x)
-#define bswap_32(x) swab32(x)
-#define bswap_64(x) swab64(x)
+#define bswap_16(x) bswap16(x)
+#define bswap_32(x) bswap32(x)
+#define bswap_64(x) bswap64(x)
 
 #else /* !__XEN__ */
 
diff --git a/xen/common/lz4/defs.h b/xen/common/lz4/defs.h
index 10609f5a53..1ce4476478 100644
--- a/xen/common/lz4/defs.h
+++ b/xen/common/lz4/defs.h
@@ -9,7 +9,7 @@
  */
 
 #ifdef __XEN__
-#include <asm/byteorder.h>
+#include <xen/byteswap.h>
 #include <asm/unaligned.h>
 #else
 
diff --git a/xen/common/lzo.c b/xen/common/lzo.c
index a87c76dded..17be9675f4 100644
--- a/xen/common/lzo.c
+++ b/xen/common/lzo.c
@@ -96,7 +96,7 @@
 
 #ifdef __XEN__
 #include <xen/lib.h>
-#include <asm/byteorder.h>
+#include <xen/byteswap.h>
 #include <asm/unaligned.h>
 #else
 #define get_unaligned_le16(_p) (*(u16 *)(_p))
diff --git a/xen/common/unlzo.c b/xen/common/unlzo.c
index 74056778eb..f908d2a61f 100644
--- a/xen/common/unlzo.c
+++ b/xen/common/unlzo.c
@@ -33,7 +33,7 @@
 #include <xen/lzo.h>
 
 #ifdef __XEN__
-#include <asm/byteorder.h>
+#include <xen/byteswap.h>
 #include <asm/unaligned.h>
 #else
 
diff --git a/xen/common/xz/private.h b/xen/common/xz/private.h
index 511343fcc2..647f9699a7 100644
--- a/xen/common/xz/private.h
+++ b/xen/common/xz/private.h
@@ -12,7 +12,7 @@
 
 #ifdef __XEN__
 #include <xen/kernel.h>
-#include <asm/byteorder.h>
+#include <xen/byteswap.h>
 #include <asm/unaligned.h>
 #else
 
@@ -28,7 +28,7 @@ static inline void put_unaligned_le32(u32 val, void *p)
 
 #endif
 
-#define get_le32(p) le32_to_cpup((const uint32_t *)(p))
+#define get_le32(p) le32_to_cpu(*(const uint32_t *)(p))
 
 #define false 0
 #define true 1
diff --git a/xen/drivers/char/ehci-dbgp.c b/xen/drivers/char/ehci-dbgp.c
index c893d246de..8412da1b11 100644
--- a/xen/drivers/char/ehci-dbgp.c
+++ b/xen/drivers/char/ehci-dbgp.c
@@ -5,13 +5,13 @@
  * Linux; see the Linux source for authorship and copyrights.
  */
 
+#include <xen/byteswap.h>
 #include <xen/console.h>
 #include <xen/delay.h>
 #include <xen/errno.h>
 #include <xen/param.h>
 #include <xen/pci.h>
 #include <xen/serial.h>
-#include <asm/byteorder.h>
 #include <asm/io.h>
 #include <asm/fixmap.h>
 #include <public/physdev.h>
diff --git a/xen/include/asm-x86/msi.h b/xen/include/asm-x86/msi.h
index e228b0f3f3..277375183c 100644
--- a/xen/include/asm-x86/msi.h
+++ b/xen/include/asm-x86/msi.h
@@ -1,9 +1,9 @@
 #ifndef __ASM_MSI_H
 #define __ASM_MSI_H
 
+#include <xen/byteswap.h>
 #include <xen/cpumask.h>
 #include <xen/pci.h>
-#include <asm/byteorder.h>
 #include <asm/hvm/vmx/vmcs.h>
 
 /*
diff --git a/xen/include/xen/bitmap.h b/xen/include/xen/bitmap.h
index e9175ab54a..c44a1cb63c 100644
--- a/xen/include/xen/bitmap.h
+++ b/xen/include/xen/bitmap.h
@@ -229,7 +229,7 @@ static inline int bitmap_weight(const unsigned long *src, int nbits)
 	return __bitmap_weight(src, nbits);
 }
 
-#include <asm/byteorder.h>
+#include <xen/byteswap.h>
 
 #ifdef __LITTLE_ENDIAN
 #define BITMAP_MEM_ALIGNMENT 8
diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
index fd6cd00b43..4921e6b142 100644
--- a/xen/include/xen/device_tree.h
+++ b/xen/include/xen/device_tree.h
@@ -10,10 +10,10 @@
 #ifndef __XEN_DEVICE_TREE_H__
 #define __XEN_DEVICE_TREE_H__
 
-#include <asm/byteorder.h>
 #include <asm/device.h>
 #include <public/xen.h>
 #include <public/device_tree_defs.h>
+#include <xen/byteswap.h>
 #include <xen/kernel.h>
 #include <xen/string.h>
 #include <xen/types.h>
diff --git a/xen/include/xen/unaligned.h b/xen/include/xen/unaligned.h
index 0a2b16d05d..8a9ec8a0ac 100644
--- a/xen/include/xen/unaligned.h
+++ b/xen/include/xen/unaligned.h
@@ -11,8 +11,8 @@
 #define __XEN_UNALIGNED_H__
 
 #ifdef __XEN__
+#include <xen/byteswap.h>
 #include <xen/types.h>
-#include <asm/byteorder.h>
 #endif
 
 #define get_unaligned(p) (*(p))
@@ -20,7 +20,7 @@
 
 static inline uint16_t get_unaligned_be16(const void *p)
 {
-	return be16_to_cpup(p);
+	return be16_to_cpu(*(uint16_t*)p);
 }
 
 static inline void put_unaligned_be16(uint16_t val, void *p)
@@ -30,7 +30,7 @@ static inline void put_unaligned_be16(uint16_t val, void *p)
 
 static inline uint32_t get_unaligned_be32(const void *p)
 {
-	return be32_to_cpup(p);
+	return be32_to_cpu(*(uint32_t*)p);
 }
 
 static inline void put_unaligned_be32(uint32_t val, void *p)
@@ -40,7 +40,7 @@ static inline void put_unaligned_be32(uint32_t val, void *p)
 
 static inline uint64_t get_unaligned_be64(const void *p)
 {
-	return be64_to_cpup(p);
+	return be64_to_cpu(*(uint64_t*)p);
 }
 
 static inline void put_unaligned_be64(uint64_t val, void *p)
@@ -50,7 +50,7 @@ static inline void put_unaligned_be64(uint64_t val, void *p)
 
 static inline uint16_t get_unaligned_le16(const void *p)
 {
-	return le16_to_cpup(p);
+	return le16_to_cpu(*(uint16_t*)p);
 }
 
 static inline void put_unaligned_le16(uint16_t val, void *p)
@@ -60,7 +60,7 @@ static inline void put_unaligned_le16(uint16_t val, void *p)
 
 static inline uint32_t get_unaligned_le32(const void *p)
 {
-	return le32_to_cpup(p);
+	return le32_to_cpu(*(uint32_t*)p);
 }
 
 static inline void put_unaligned_le32(uint32_t val, void *p)
@@ -70,7 +70,7 @@ static inline void put_unaligned_le32(uint32_t val, void *p)
 
 static inline uint64_t get_unaligned_le64(const void *p)
 {
-	return le64_to_cpup(p);
+	return le64_to_cpu(*(uint64_t*)p);
 }
 
 static inline void put_unaligned_le64(uint64_t val, void *p)
diff --git a/xen/lib/divmod.c b/xen/lib/divmod.c
index 0be6ccc700..dfc1129cfe 100644
--- a/xen/lib/divmod.c
+++ b/xen/lib/divmod.c
@@ -1,6 +1,6 @@
+#include <xen/byteswap.h>
 #include <xen/lib.h>
 #include <xen/types.h>
-#include <asm/byteorder.h>
 
 /*
  * A couple of 64 bit operations ported from FreeBSD.
-- 
2.27.0



  parent reply	other threads:[~2021-10-22 10:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22 10:47 [PATCH v2 0/7] Implement byteswap and update references Lin Liu
2021-10-22 10:47 ` [PATCH v2 1/7] xen: implement byteswap.h Lin Liu
2021-10-22 14:00   ` Andrew Cooper
2021-11-02 14:23   ` Jan Beulich
2021-10-22 10:47 ` [PATCH v2 2/7] crypto/vmac: Simplify code with byteswap.h Lin Liu
2021-11-02 15:00   ` Jan Beulich
2021-10-22 10:47 ` [PATCH v2 3/7] arm64/find_next_bit: Remove ext2_swab() Lin Liu
2021-10-22 10:47 ` [PATCH v2 4/7] arm: Switch to byteswap.h Lin Liu
2021-10-22 10:47 ` [PATCH v2 5/7] xen/xsm: " Lin Liu
2021-10-22 15:46   ` Daniel P. Smith
2021-11-02 15:18     ` Jan Beulich
2021-10-22 10:47 ` Lin Liu [this message]
2021-10-22 11:25   ` [PATCH v2 6/7] xen: " Andrew Cooper
2021-11-02 15:23   ` Jan Beulich
2021-10-22 10:47 ` [PATCH v2 7/7] byteorder: Remove byteorder Lin Liu
2021-10-22 11:50 ` [PATCH v2 0/7] Implement byteswap and update references Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f5a79881bfdcef06aa950632250f551e0ec26458.1634897942.git.lin.liu@citrix.com \
    --to=lin.liu@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.