xen: Centralise byteswap infrastructure
v5 cover xen: Centralise byteswap infrastructure
The diffstat speaks for itself.
This is a follow-up to Lin's years-old series, rebased to account for RISC-V and PPC, and simplified owing to our new compiler baseline.
Andrew Cooper (8):
xen/lzo: Remove more remanants of TMEM
xen: Remove __{BIG,LITTLE}_ENDIAN_BITFIELD
xsm/flask: Switch {asm -> xen}/byteorder.h
xen/common: Switch {asm -> xen}/byteorder.h
arm: Remove asm/byteorder.h
ppc: Drop asm/byteorder.h
riscv: Remove asm/byteorder.h
x86: Drop asm/byteorder.h
Lin Liu (8):
xen: Implement common byte{order,swap}.h xen/lib: Switch to xen/byteorder.h xen/device-tree: Remove use of *_to_cpup() helpers xen/decompressors: Remove use of *_to_cpup() helpers xen/arch: Switch to new byteorder infrastructure xen/decompressors: Use new byteorder infrastructure
xen: Remove old byteorder infrastructure crypto/vmac: Switch to xen/byteswap.h
.../libs/guest/xg_dom_decompress_unsafe_xz.c | 13 +- .../guest/xg_dom_decompress_unsafe_zstd.c | 3 +- xen/arch/arm/alternative.c | 6 +- xen/arch/arm/arm64/livepatch.c | 2 +- xen/arch/arm/include/asm/arm32/io.h | 3 +- xen/arch/arm/include/asm/arm64/io.h | 3 +- xen/arch/arm/include/asm/byteorder.h | 16 -- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/vgic/vgic-mmio.c | 3 +- xen/arch/ppc/include/asm/byteorder.h | 12 -- xen/arch/ppc/include/asm/page.h | 4 +- xen/arch/ppc/mm-radix.c | 2 +- xen/arch/riscv/include/asm/byteorder.h | 16 -- xen/arch/riscv/include/asm/io.h | 3 +- xen/arch/x86/include/asm/byteorder.h | 29 --- xen/arch/x86/include/asm/msi.h | 1 - xen/common/bitmap.c | 5 +- xen/common/device-tree/device-tree.c | 44 ++--- xen/common/grant_table.c | 4 +- xen/common/libelf/libelf-private.h | 9 +- xen/common/lz4/defs.h | 7 +- xen/common/lzo.c | 22 --- xen/common/unlzo.c | 1 - xen/common/xz/private.h | 13 +- xen/crypto/vmac.c | 76 +------- xen/drivers/char/ehci-dbgp.c | 4 +- xen/include/xen/bitmap.h | 2 +- xen/include/xen/byteorder.h | 44 +++++ xen/include/xen/byteorder/big_endian.h | 102 ---------- xen/include/xen/byteorder/generic.h | 68 ------- xen/include/xen/byteorder/little_endian.h | 102 ---------- xen/include/xen/byteorder/swab.h | 179 ------------------ xen/include/xen/byteswap.h | 15 ++ xen/include/xen/config.h | 6 + xen/include/xen/device_tree.h | 3 +- xen/include/xen/libfdt/libfdt_env.h | 3 +- xen/include/xen/unaligned.h | 3 +- xen/lib/divmod.c | 5 +- xen/lib/find-next-bit.c | 39 +--- xen/xsm/flask/ss/avtab.c | 4 +- xen/xsm/flask/ss/conditional.c | 9 +- xen/xsm/flask/ss/ebitmap.c | 9 +- xen/xsm/flask/ss/policydb.c | 7 +- 43 files changed, 166 insertions(+), 737 deletions(-) delete mode 100644 xen/arch/arm/include/asm/byteorder.h delete mode 100644 xen/arch/ppc/include/asm/byteorder.h delete mode 100644 xen/arch/riscv/include/asm/byteorder.h delete mode 100644 xen/arch/x86/include/asm/byteorder.h create mode 100644 xen/include/xen/byteorder.h delete mode 100644 xen/include/xen/byteorder/big_endian.h delete mode 100644 xen/include/xen/byteorder/generic.h delete mode 100644 xen/include/xen/byteorder/little_endian.h delete mode 100644 xen/include/xen/byteorder/swab.h create mode 100644 xen/include/xen/byteswap.h
base-commit: eecb9f437b2c3e2d22d0af93dc6b1f4d978313a7
Signature · 1 line
2.39.5
PATCH v5 1/16 xen/lzo: Remove more remanants of TMEM
This logic was inserted by commit 447f613c5404 ("lzo: update LZO compression to current upstream version") but was only relevant for the TMEM logic, so should have been deleted in commit c492e19fdd05 ("xen: remove tmem from hypervisor")
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
Notably, this also removes the singular case where anything in Xen cares about the value in __BYTE_ORDER, __LITTLE_ENDIAN and __BIG_ENDIAN, and even then it was only an adaptation to the MiniOS environment.
v5:
* New.
--- xen/common/lzo.c | 21 --------------------- 1 file changed, 21 deletions(-)
xen/common/lzo.c +0 -21
@@ -28,27 +28,6 @@#define COPY4 (dst, src) memcpy(dst, src, 4)#define COPY8 (dst, src) memcpy(dst, src, 8) -#ifdef __MINIOS__ -# include <lib.h> -# if __BYTE_ORDER == __LITTLE_ENDIAN -# undef __BIG_ENDIAN -# endif -# if __BYTE_ORDER == __BIG_ENDIAN -# undef __LITTLE_ENDIAN -# endif -#endif - -#if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) -#error "conflicting endian definitions" -#elif defined(__x86_64__) -#define LZO_USE_CTZ64 1 -#define LZO_USE_CTZ32 1 -#elif defined(__i386__) || defined(__powerpc__) -#define LZO_USE_CTZ32 1 -#elif defined(__arm__) && (__LINUX_ARM_ARCH__ >=5 ) -#define LZO_USE_CTZ32 1 -#endif -#define M1_MAX_OFFSET 0x0400#define M2_MAX_OFFSET 0x0800#define M3_MAX_OFFSET 0x4000
base-commit: eecb9f437b2c3e2d22d0af93dc6b1f4d978313a7
Signature · 1 line
2.39.5
Re: [PATCH v5 01/16] xen/lzo: Remove more remanants of TMEM
Quoted 7 lines · Andrew Cooper
This logic was inserted by commit
447f613c5404("lzo: update LZO compression to current upstream version") but was only relevant for the TMEM logic, so should have been deleted in commitc492e19fdd05("xen: remove tmem from hypervisor")Fixes c492e19fdd05 ("xen: remove tmem from hypervisor")Signed-off-by Andrew Cooper <[email protected]>
PATCH v5 2/16 xen: Remove __{BIG,LITTLE}_ENDIAN_BITFIELD
In reply to Andrew CooperThere is a singular user. It's unlikely we'll gain a big-endian build of Xen, but it's far more unlikely that bitfields will differ from main endianness.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
I'm tempted to simply drop the logic in maptrack_node. If any big-endian build of Xen came along, that's probably the least of it's worries.
v5:
* New.
--- xen/common/grant_table.c | 4 ++-- xen/include/xen/byteorder/big_endian.h | 3 --- xen/include/xen/byteorder/little_endian.h | 3 --- 3 files changed, 2 insertions(+), 8 deletions(-)
xen/common/grant_table.c +2 -2
@@ -979,12 +979,12 @@ static struct active_grant_entry *grant_map_exists(const struct domain *ld,union maptrack_node {struct {/* Radix tree slot pointers use two of the bits. */ -#ifdef __BIG_ENDIAN_BITFIELD +#ifdef __BIG_ENDIANunsigned long _0 :2 ;#endif unsigned long rd :BITS_PER_LONG /2 -1 ;unsigned long wr :BITS_PER_LONG /2 -1 ; -#ifndef __BIG_ENDIAN_BITFIELD +#ifndef __BIG_ENDIANunsigned long _0 :2 ;#endif } cnt;
xen/include/xen/byteorder/big_endian.h +0 -3
@@ -4,9 +4,6 @@#ifndef __BIG_ENDIAN#define __BIG_ENDIAN 4321#endif -#ifndef __BIG_ENDIAN_BITFIELD -#define __BIG_ENDIAN_BITFIELD -#endif #include <xen/types.h> #include <xen/byteorder/swab.h>
xen/include/xen/byteorder/little_endian.h +0 -3
@@ -4,9 +4,6 @@#ifndef __LITTLE_ENDIAN#define __LITTLE_ENDIAN 1234#endif -#ifndef __LITTLE_ENDIAN_BITFIELD -#define __LITTLE_ENDIAN_BITFIELD -#endif #include <xen/types.h> #include <xen/byteorder/swab.h>
Signature · 1 line
2.39.5
Re: [PATCH v5 02/16] xen: Remove __{BIG,LITTLE}_ENDIAN_BITFIELD
Quoted 2 lines · Andrew Cooper
There is a singular user. It's unlikely we'll gain a big-endian build of Xen, but it's far more unlikely that bitfields will differ from main endianness.
Just one point: While endian-ness in general is dictated by hardware, endian- ness of bitfields is entirely a psABI thing, aiui. Hence tying both together (beyond the latter defaulting to the former) doesn't seem quite appropriate to me.
Quoted 2 lines
I'm tempted to simply drop the logic in
maptrack_node. If any big-endian build of Xen came along, that's probably the least of it's worries.
As long as it's not obviously broken, I'd prefer to keep such. While it may not be a primary worry, it's still one less of all the worries then.
Jan
Re: [PATCH v5 02/16] xen: Remove __{BIG,LITTLE}_ENDIAN_BITFIELD
Quoted 8 lines · Jan Beulich
Quoted 2 lines · Andrew Cooper
There is a singular user. It's unlikely we'll gain a big-endian build of Xen, but it's far more unlikely that bitfields will differ from main endianness.
Just one point: While endian-ness in general is dictated by hardware, endian- ness of bitfields is entirely a psABI thing, aiui. Hence tying both together (beyond the latter defaulting to the former) doesn't seem quite appropriate to me.
Quoted 4 lines
Quoted 2 lines
I'm tempted to simply drop the logic in
maptrack_node. If any big-endian build of Xen came along, that's probably the least of it's worries.As long as it's not obviously broken, I'd prefer to keep such. While it may not be a primary worry, it's still one less of all the worries then.
Given the way patch 3 has ended up, this is easier to keep than in earlier revisions.
Still, I think it's of very dubious utility.
~Andrew
PATCH v5 3/16 xen: Implement common byte{order,swap}.h
In reply to Andrew CooperFrom: Lin Liu <[email protected]>
The current swab??() infrastructure is unecesserily complicated, and can be repated entirely with compiler builtins.
All supported compilers provide __BYTE_ORDER__ and __builtin_bswap??().
Nothing in Xen cares about the values of __{BIG,LITTLE}_ENDIAN; just that one of them is defined. Therefore, centralise their definitions in xen/config.h
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
v5:
* Rebase substantially
* Drop PASTE(). It doesn't work when BITS_PER_LONG isn't a plain integer
* Simplify in light of new toolchain baseline
--- xen/include/xen/byteorder.h | 44 +++++++++++++++++++++++ xen/include/xen/byteorder/big_endian.h | 4 --- xen/include/xen/byteorder/little_endian.h | 4 --- xen/include/xen/byteswap.h | 15 ++++++++ xen/include/xen/config.h | 6 ++++ 5 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 xen/include/xen/byteorder.h create mode 100644 xen/include/xen/byteswap.h
xen/include/xen/byteorder.h new file +44 -0
@@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef XEN_BYTEORDER_H +#define XEN_BYTEORDER_H + +#include <xen/byteswap.h> +#include <xen/types.h> + +#if defined(__LITTLE_ENDIAN) + +# define cpu_to_le64 (x) (uint64_t)(x) +# define le64_to_cpu (x) (uint64_t)(x) +# define cpu_to_le32 (x) (uint32_t)(x) +# define le32_to_cpu (x) (uint32_t)(x) +# define cpu_to_le16 (x) (uint16_t)(x) +# define le16_to_cpu (x) (uint16_t)(x) + +# define cpu_to_be64 (x) bswap64(x) +# define be64_to_cpu (x) bswap64(x) +# define cpu_to_be32 (x) bswap32(x) +# define be32_to_cpu (x) bswap32(x) +# define cpu_to_be16 (x) bswap16(x) +# define be16_to_cpu (x) bswap16(x) + +#elif defined(__BIG_ENDIAN) + +# define cpu_to_le64 (x) bswap64(x) +# define le64_to_cpu (x) bswap64(x) +# define cpu_to_le32 (x) bswap32(x) +# define le32_to_cpu (x) bswap32(x) +# define cpu_to_le16 (x) bswap16(x) +# define le16_to_cpu (x) bswap16(x) + +# define cpu_to_be64 (x) (uint64_t)(x) +# define be64_to_cpu (x) (uint64_t)(x) +# define cpu_to_be32 (x) (uint32_t)(x) +# define be32_to_cpu (x) (uint32_t)(x) +# define cpu_to_be16 (x) (uint16_t)(x) +# define be16_to_cpu (x) (uint16_t)(x) + +#else +# error Unknown Endianness +#endif /* __*_ENDIAN */ + +#endif /* XEN_BYTEORDER_H */
xen/include/xen/byteorder/big_endian.h +0 -4
@@ -1,10 +1,6 @@#ifndef __XEN_BYTEORDER_BIG_ENDIAN_H__#define __XEN_BYTEORDER_BIG_ENDIAN_H__ -#ifndef __BIG_ENDIAN -#define __BIG_ENDIAN 4321 -#endif -#include <xen/types.h> #include <xen/byteorder/swab.h>
xen/include/xen/byteorder/little_endian.h +0 -4
@@ -1,10 +1,6 @@#ifndef __XEN_BYTEORDER_LITTLE_ENDIAN_H__#define __XEN_BYTEORDER_LITTLE_ENDIAN_H__ -#ifndef __LITTLE_ENDIAN -#define __LITTLE_ENDIAN 1234 -#endif -#include <xen/types.h> #include <xen/byteorder/swab.h>
xen/include/xen/byteswap.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef XEN_BYTESWAP_H +#define XEN_BYTESWAP_H + +#define bswap16 (x) __builtin_bswap16(x) +#define bswap32 (x) __builtin_bswap32(x) +#define bswap64 (x) __builtin_bswap64(x) + +#if BITS_PER_LONG ==64 +# define bswapl (x) bswap64(x) +#elif BITS_PER_LONG ==32 +# define bswapl (x) bswap32(x) +#endif + +#endif /* XEN_BYTESWAP_H */
xen/include/xen/config.h +6 -0
@@ -98,4 +98,10 @@#define ZERO_BLOCK_PTR ((void *)-1L)#endif +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define __LITTLE_ENDIAN +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# define __BIG_ENDIAN +#endif +#endif /* __XEN_CONFIG_H__ */
Signature · 1 line
2.39.5
Re: [PATCH v5 03/16] xen: Implement common byte{order,swap}.h
Quoted 9 lines · Andrew Cooper
From: Lin Liu <[email protected]>
The current swab??() infrastructure is unecesserily complicated, and can be repated entirely with compiler builtins.
All supported compilers provide
__BYTE_ORDER__and __builtin_bswap??().Nothing in Xen cares about the values of __{BIG,LITTLE}_ENDIAN; just that one of them is defined. Therefore, centralise their definitions in
xen/config.h
And even if we cared somewhere, __ORDER_{BIG,LITTLE}_ENDIAN__ supply them just fine.
Quoted 2 lines
Signed-off-by Lin Liu <[email protected]>Signed-off-by Andrew Cooper <[email protected]>
with two nits taken care of:
xen/include/xen/byteorder.h line 6
Quoted 9 lines
xen/include/xen/byteorder.h new file +6
-0@@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef XEN_BYTEORDER_H +#define XEN_BYTEORDER_H + +#include <xen/byteswap.h> +#include <xen/types.h>
It's stdint.h that's needed here, not types.h?
xen/include/xen/byteorder.h line 15
Quoted 8 lines
xen/include/xen/byteorder.h new file +8
-0+#if defined(__LITTLE_ENDIAN) + +# define cpu_to_le64 (x) (uint64_t)(x) +# define le64_to_cpu (x) (uint64_t)(x) +# define cpu_to_le32 (x) (uint32_t)(x) +# define le32_to_cpu (x) (uint32_t)(x) +# define cpu_to_le16 (x) (uint16_t)(x) +# define le16_to_cpu (x) (uint16_t)(x)
(Not just) for Misra these all need another pair of parentheses around the entire expressions.
Quoted 12 lines
xen/include/xen/byteorder.h new file +12
-0+# define cpu_to_be64 (x) bswap64(x) +# define be64_to_cpu (x) bswap64(x) +# define cpu_to_be32 (x) bswap32(x) +# define be32_to_cpu (x) bswap32(x) +# define cpu_to_be16 (x) bswap16(x) +# define be16_to_cpu (x) bswap16(x) + +#elif defined(__BIG_ENDIAN) + +# define cpu_to_le64 (x) bswap64(x) +# define le64_to_cpu (x) bswap64(x) +# define cpu_to_le32 (x) bswap32(x)
xen/include/xen/byteorder.h line 38
Quoted 10 lines
xen/include/xen/byteorder.h new file +10
-0+# define le32_to_cpu (x) bswap32(x) +# define cpu_to_le16 (x) bswap16(x) +# define le16_to_cpu (x) bswap16(x) + +# define cpu_to_be64 (x) (uint64_t)(x) +# define be64_to_cpu (x) (uint64_t)(x) +# define cpu_to_be32 (x) (uint32_t)(x) +# define be32_to_cpu (x) (uint32_t)(x) +# define cpu_to_be16 (x) (uint16_t)(x) +# define be16_to_cpu (x) (uint16_t)(x)
Same here, even if Eclair likely wouldn't spot this right now.
Jan
Re: [PATCH v5 03/16] xen: Implement common byte{order,swap}.h
Quoted 18 lines · Jan Beulich
Quoted 9 lines · Andrew Cooper
From: Lin Liu <[email protected]>
The current swab??() infrastructure is unecesserily complicated, and can be repated entirely with compiler builtins.
All supported compilers provide
__BYTE_ORDER__and __builtin_bswap??().Nothing in Xen cares about the values of __{BIG,LITTLE}_ENDIAN; just that one of them is defined. Therefore, centralise their definitions in
xen/config.hAnd even if we cared somewhere, __ORDER_{BIG,LITTLE}_ENDIAN__ supply them just fine.
Quoted 2 lines
Signed-off-by Lin Liu <[email protected]>Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>with two nits taken care of:
Quoted 10 lines
xen/include/xen/byteorder.h line 6
Quoted 9 lines
xen/include/xen/byteorder.h new file +6
-0@@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef XEN_BYTEORDER_H +#define XEN_BYTEORDER_H + +#include <xen/byteswap.h> +#include <xen/types.h> It's
stdint.hthat's needed here, nottypes.h?
Perhaps.
Quoted 11 lines
xen/include/xen/byteorder.h line 15
Quoted 9 lines
xen/include/xen/byteorder.h new file +8
-0+#if defined(__LITTLE_ENDIAN) + +# define cpu_to_le64 (x) (uint64_t)(x) +# define le64_to_cpu (x) (uint64_t)(x) +# define cpu_to_le32 (x) (uint32_t)(x) +# define le32_to_cpu (x) (uint32_t)(x) +# define cpu_to_le16 (x) (uint16_t)(x) +# define le16_to_cpu (x) (uint16_t)(x)(Not just) for Misra these all need another pair of parentheses around the entire expressions.
Why? For both points? Eclair is happy, with this at least.
What does fail is a bit a of a curveball.
cpu_to_le64() turns from a real function to a macro under ARM, meaning that the #ifdef __BIG_ENDIAN in the middle of a bunch of constants becomes UB.
I'll need to fix that separately.
~Andrew
Re: [PATCH v5 03/16] xen: Implement common byte{order,swap}.h
Quoted 13 lines · Andrew Cooper
Quoted 11 lines · Jan Beulich
xen/include/xen/byteorder.h line 15
Quoted 8 lines · Andrew Cooper
xen/include/xen/byteorder.h new file +8
-0+#if defined(__LITTLE_ENDIAN) + +# define cpu_to_le64 (x) (uint64_t)(x) +# define le64_to_cpu (x) (uint64_t)(x) +# define cpu_to_le32 (x) (uint32_t)(x) +# define le32_to_cpu (x) (uint32_t)(x) +# define cpu_to_le16 (x) (uint16_t)(x) +# define le16_to_cpu (x) (uint16_t)(x)(Not just) for Misra these all need another pair of parentheses around the entire expressions.
Quoted 1 line
Why? For both points? Eclair is happy, with this at least.
As was explained to us, Eclair looks at the final, expanded code. Hence it may well be that right now, in the code Eclair checks, we have no violations. Ones may start to appear elsewhere or later, though. The fix then would still be to get these macros into fully parenthesized shape.
That said, I can't think of any "good" code needing these parentheses here. I can think of bad code though, which would properly fail to compile if the parentheses were added, e.g.
le32_to_cpu(a)++;
I fear I can't answer the 2nd question - what do you mean by "For both points?"?
Jan
PATCH v5 4/16 xen/lib: Switch to xen/byteorder.h
In reply to Andrew CooperFrom: Lin Liu <[email protected]>
In divmod.c, additionally swap xen/lib.h for xen/macros.h as only ABS() is needed.
In find-next-bit.c, ext2 has nothing to do with this logic. Despite the comments, it was a local modification when the logic was imported from Linux, because Xen didn't have a suitable helper.
The new infrsatructure does have a suitable primitive, so use it.
No functional change.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
The find-next-bit.c changes, being inside __BIG_ENDIAN aren't even compiled in any build of Xen. I manually checked that they compiled.
v5:
* Rebase
* Include a fixto divmod.c
* Explain why even Linux has never had anything by the name ext2_swab()
--- xen/lib/divmod.c | 5 ++--- xen/lib/find-next-bit.c | 39 +++++++-------------------------------- 2 files changed, 9 insertions(+), 35 deletions(-)
xen/lib/divmod.c +2 -3
@@ -1,6 +1,5 @@ -#include <xen/lib.h> -#include <xen/types.h> -#include <asm/byteorder.h> +#include <xen/byteorder.h> +#include <xen/macros.h> /* * A couple of 64 bit operations ported from FreeBSD.
xen/lib/find-next-bit.c +7 -32
@@ -9,8 +9,7 @@* 2 of the License, or (at your option) any later version. */ #include <xen/bitops.h> - -#include <asm/byteorder.h> +#include <xen/byteorder.h> #define __ffs (x) (ffsl(x) - 1)#define ffz (x) __ffs(~(x))
@@ -164,30 +163,6 @@ EXPORT_SYMBOL(find_first_zero_bit);#ifdef __BIG_ENDIAN -/* include/linux/byteorder does not support "unsigned long" type */ -static inline unsigned long ext2_swabp (const unsigned long * x) -{ -#if BITS_PER_LONG ==64 -return (unsigned long )__swab64p ((u64 *) x); -#elif BITS_PER_LONG ==32 -return (unsigned long )__swab32p ((u32 *) x); -#else -#error BITS_PER_LONG not defined -#endif -} - -/* include/linux/byteorder doesn't support "unsigned long" type */ -static inline unsigned long ext2_swab (const unsigned long y) -{ -#if BITS_PER_LONG ==64 -return (unsigned long )__swab64 ((u64 ) y); -#elif BITS_PER_LONG ==32 -return (unsigned long )__swab32 ((u32 ) y); -#else -#error BITS_PER_LONG not defined -#endif -} -#ifndef find_next_zero_bit_leunsigned long find_next_zero_bit_le (const void *addr,unsigned long size,unsigned long offset)
@@ -202,7 +177,7 @@ unsigned long find_next_zero_bit_le(const void *addr, unsigned size -= result; offset &= (BITS_PER_LONG -1UL );if (offset) { - tmp =ext2_swabp (p++); + tmp =bswapl (*p++); tmp |= (~0UL >> (BITS_PER_LONG - offset));if (size <BITS_PER_LONG ) goto found_first;
@@ -220,7 +195,7 @@ unsigned long find_next_zero_bit_le(const void *addr, unsigned }if (!size)return result; - tmp =ext2_swabp (p); + tmp =bswapl (*p); found_first: tmp |= ~0UL << size;if (tmp == ~0UL )/* Are any bits zero? */
@@ -229,7 +204,7 @@ unsigned long find_next_zero_bit_le(const void *addr, unsignedreturn result +ffz (tmp); found_middle_swap: - return result + ffz(ext2_swab(tmp)); + return result + ffz(bswapl(tmp)); }EXPORT_SYMBOL (find_next_zero_bit_le);#endif
@@ -248,7 +223,7 @@ unsigned long find_next_bit_le(const void *addr, unsigned size -= result; offset &= (BITS_PER_LONG -1UL );if (offset) { - tmp =ext2_swabp (p++); + tmp =bswapl (*p++); tmp &= (~0UL << offset);if (size <BITS_PER_LONG ) goto found_first;
@@ -267,7 +242,7 @@ unsigned long find_next_bit_le(const void *addr, unsigned }if (!size)return result; - tmp =ext2_swabp (p); + tmp =bswapl (*p); found_first: tmp &= (~0UL >> (BITS_PER_LONG - size));if (tmp ==0UL )/* Are any bits set? */
@@ -276,7 +251,7 @@ unsigned long find_next_bit_le(const void *addr, unsignedreturn result +__ffs (tmp); found_middle_swap: - return result + __ffs(ext2_swab(tmp)); + return result + __ffs(bswapl(tmp)); }EXPORT_SYMBOL (find_next_bit_le);#endif
Signature · 1 line
2.39.5
Re: [PATCH v5 04/16] xen/lib: Switch to xen/byteorder.h
Quoted 6 lines · Andrew Cooper
From: Lin Liu <[email protected]>
In
divmod.c, additionally swapxen/lib.hforxen/macros.has onlyABS()is needed.In
find-next-bit.c, ext2 has nothing to do with this logic.
While I agree here, ...
Quoted 3 lines
Despite the
comments, it was a local modification when the logic was imported from Linux, because Xen didn't have a suitable helper.
... I certainly can see functions of these names in Linux 2.6.16. Just in the PA-RISC bitops.h, though. Yet this may be an indication that yet earlier on this was a wider thing there.
Quoted 5 lines
The new infrsatructure does have a suitable primitive, so use it.
No functional change.
Signed-off-by Lin Liu <[email protected]>
Missing your own S-o-b?
Jan
PATCH v5 5/16 xen/device-tree: Remove use of *_to_cpup() helpers
In reply to Andrew CooperFrom: Lin Liu <[email protected]>
These wrappers simply hide a deference, which adds to the cognitive complexity of reading the code. As such, they're not going to be included in the new byteswap infrastructure.
No functional change.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
v5:
* Rebase
* Split out of later patch
--- xen/common/device-tree/device-tree.c | 44 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-)
xen/common/device-tree/device-tree.c +22 -22
@@ -173,7 +173,7 @@ bool dt_property_read_u32(const struct dt_device_node *np,if ( !val || len <sizeof (*out_value) )return 0 ; - *out_value =be32_to_cpup (val); + *out_value =be32_to_cpu (*val);return 1 ; }
@@ -266,7 +266,7 @@ int dt_property_read_variable_u32_array(const struct dt_device_node *np, count = sz;while ( count-- ) - *out_values++ =be32_to_cpup (val++); + *out_values++ =be32_to_cpu (*val++);return sz; }
@@ -493,7 +493,7 @@ static int __dt_n_addr_cells(const struct dt_device_node *np, bool parent) ip =dt_get_property (np,"#address-cells" ,NULL );if ( ip ) -return be32_to_cpup (ip); +return be32_to_cpu (*ip); }while ( np->parent );/* No #address-cells property for the root node */ return DT_ROOT_NODE_ADDR_CELLS_DEFAULT ;
@@ -510,7 +510,7 @@ static int __dt_n_size_cells(const struct dt_device_node *np, bool parent) ip =dt_get_property (np,"#size-cells" ,NULL );if ( ip ) -return be32_to_cpup (ip); +return be32_to_cpu (*ip); }while ( np->parent );/* No #address-cells property for the root node */ return DT_ROOT_NODE_SIZE_CELLS_DEFAULT ;
@@ -643,7 +643,7 @@ static void dt_bus_pci_count_cells(const struct dt_device_node *np,static unsigned int dt_bus_pci_get_flags (const __be32 *addr) {unsigned int flags =0 ; -u32 w =be32_to_cpup (addr); +u32 w =be32_to_cpu (*addr);switch ((w >>24 ) &0x03 ) {case 0x01 :
@@ -1096,7 +1096,7 @@ dt_irq_find_parent(const struct dt_device_node *child)if ( parp ==NULL ) p =dt_get_parent (child);else - p =dt_find_node_by_phandle (be32_to_cpup (parp)); + p =dt_find_node_by_phandle (be32_to_cpu (*parp)); child = p; }while ( p &&dt_get_property (p,"#interrupt-cells" ,NULL ) ==NULL );
@@ -1129,7 +1129,7 @@ unsigned int dt_number_of_irq(const struct dt_device_node *device) intlen /=sizeof (*intspec);dt_dprintk (" using 'interrupts' property\n" ); -dt_dprintk (" intspec=%d intlen=%d\n" ,be32_to_cpup (intspec), intlen); +dt_dprintk (" intspec=%d intlen=%d\n" ,be32_to_cpu (*intspec), intlen);/* Look for the interrupt parent. */ p =dt_irq_find_parent (device);
@@ -1260,7 +1260,7 @@ int dt_for_each_irq_map(const struct dt_device_node *dev, imaplen -= addrsize + intsize;/* Get the interrupt parent */ - ipar =dt_find_node_by_phandle (be32_to_cpup (imap)); + ipar =dt_find_node_by_phandle (be32_to_cpu (*imap)); imap++; --imaplen;
@@ -1377,8 +1377,8 @@ static int dt_irq_map_raw(const struct dt_device_node *parent,int match, i;dt_dprintk ("dt_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n" , - parent->full_name,be32_to_cpup (intspec), -be32_to_cpup (intspec +1 ), ointsize); + parent->full_name,be32_to_cpu (*intspec), +be32_to_cpu (*(intspec+1 )), ointsize); ipar = parent;
@@ -1490,7 +1490,7 @@ static int dt_irq_map_raw(const struct dt_device_node *parent,dt_dprintk (" -> match=%d (imaplen=%d)\n" , match, imaplen);/* Get the interrupt parent */ - newpar =dt_find_node_by_phandle (be32_to_cpup (imap)); + newpar =dt_find_node_by_phandle (be32_to_cpu (*imap)); imap++; --imaplen;
@@ -1584,7 +1584,7 @@ int dt_device_get_raw_irq(const struct dt_device_node *device, intlen /=sizeof (*intspec);dt_dprintk (" using 'interrupts' property\n" ); -dt_dprintk (" intspec=%d intlen=%d\n" ,be32_to_cpup (intspec), intlen); +dt_dprintk (" intspec=%d intlen=%d\n" ,be32_to_cpu (*intspec), intlen);/* Look for the interrupt parent. */ p =dt_irq_find_parent (device);
@@ -1695,7 +1695,7 @@ static int __dt_parse_phandle_with_args(const struct dt_device_node *np,* If phandle is 0, then it is an empty entry with no * arguments. Skip forward to the next entry. * */ - phandle =be32_to_cpup (list++); + phandle =be32_to_cpu (*list++);if ( phandle ) {/*
@@ -1764,7 +1764,7 @@ static int __dt_parse_phandle_with_args(const struct dt_device_node *np, out_args->np = node; out_args->args_count = count;for ( i =0 ; i < count; i++ ) - out_args->args[i] =be32_to_cpup (list++); + out_args->args[i] =be32_to_cpu (*list++); }/* Found it! return success */
@@ -1845,7 +1845,7 @@ static unsigned long unflatten_dt_node(const void *fdt,int has_name =0 ;int new_format =0 ; - tag =be32_to_cpup ((__be32 *)(*p)); + tag =be32_to_cpu (*(__be32 *)(*p));if ( tag !=FDT_BEGIN_NODE ) {printk (XENLOG_WARNING "Weird tag at start of node: %x\n" , tag);
@@ -1938,7 +1938,7 @@ static unsigned long unflatten_dt_node(const void *fdt,u32 sz, noff;const char *pname; - tag =be32_to_cpup ((__be32 *)(*p)); + tag =be32_to_cpu (*(__be32 *)(*p));if ( tag ==FDT_NOP ) { *p +=4 ;
@@ -1947,8 +1947,8 @@ static unsigned long unflatten_dt_node(const void *fdt,if ( tag !=FDT_PROP )break ; *p +=4 ; - sz =be32_to_cpup ((__be32 *)(*p)); - noff =be32_to_cpup ((__be32 *)((*p) +4 )); + sz =be32_to_cpu (*(__be32 *)(*p)); + noff =be32_to_cpu (*(__be32 *)((*p) +4 )); *p +=8 ;if (fdt_version (fdt) <0x10 ) *p =ROUNDUP (*p, sz >=8 ?8 :4 );
@@ -1975,13 +1975,13 @@ static unsigned long unflatten_dt_node(const void *fdt, (strcmp(pname, "linux,phandle") == 0) ) {if ( np->phandle ==0 ) - np->phandle =be32_to_cpup ((__be32 *)*p); + np->phandle =be32_to_cpu (*(__be32 *)*p); }/* And we process the "ibm,phandle" property * used in pSeries dynamic device tree * stuff */ if (strcmp (pname,"ibm,phandle" ) ==0 ) - np->phandle =be32_to_cpup ((__be32 *)*p); + np->phandle =be32_to_cpu (*(__be32 *)*p); pp->name = pname; pp->length = sz; pp->value = (void *)*p;
@@ -2053,7 +2053,7 @@ static unsigned long unflatten_dt_node(const void *fdt, *p +=4 ; else mem =unflatten_dt_node (fdt, mem, p, np, allnextpp, fpsize); - tag =be32_to_cpup ((__be32 *)(*p)); + tag =be32_to_cpu (*(__be32 *)(*p)); }if ( tag !=FDT_END_NODE ) {
@@ -2099,7 +2099,7 @@ int unflatten_device_tree(const void *fdt, struct dt_device_node **mynodes)/* Second pass, do actual unflattening */ start = ((unsigned long )fdt) +fdt_off_dt_struct (fdt);unflatten_dt_node (fdt, mem, &start,NULL , &allnextp,0 ); -if (be32_to_cpup ((__be32 *)start) !=FDT_END ) +if (be32_to_cpu (*(__be32 *)start) !=FDT_END ) {printk (XENLOG_ERR "Weird tag at end of tree: %08x\n" , *((u32 *)start));
Signature · 1 line
2.39.5
PATCH v5 6/16 xen/decompressors: Remove use of *_to_cpup() helpers
In reply to Andrew CooperFrom: Lin Liu <[email protected]>
These wrappers simply hide a deference, which adds to the cognitive complexity of reading the code. As such, they're not going to be included in the new byteswap infrastructure.
No functional change.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
v5:
* Rebase
* Rearranged from other patches
--- tools/libs/guest/xg_dom_decompress_unsafe_xz.c | 13 +++++++------ xen/common/lz4/defs.h | 6 +++++- xen/common/xz/private.h | 12 +++++++++--- 3 files changed, 21 insertions(+), 10 deletions(-)
tools/libs/guest/xg_dom_decompress_unsafe_xz.c +7 -6
@@ -19,18 +19,19 @@ typedef uint32_t __le32;static inline u32 cpu_to_le32 (const u32 v) {#if BYTE_ORDER ==BIG_ENDIAN -return (((v &0x000000ffUL ) <<24 ) | - ((v &0x0000ff00UL ) <<8 ) | - ((v &0x00ff0000UL ) >>8 ) | - ((v &0xff000000UL ) >>24 )); +return __builtin_bswap32 (v);#else return v;#endif } -static inline u32 le32_to_cpup (const u32 *p) +static inline u32 le32_to_cpu (const u32 p) { -return cpu_to_le32 (*p); +#if BYTE_ORDER ==BIG_ENDIAN +return __builtin_bswap32 (v); +#else +return v; +#endif }#define __force
xen/common/lz4/defs.h +5 -1
@@ -18,7 +18,11 @@static inline u16 get_unaligned_le16 (const void *p) { -return le16_to_cpup (p); +u16 v; + +memcpy (&v, p,sizeof (v)); + +return le16_to_cpu (v); }#endif
xen/common/xz/private.h +9 -3
@@ -18,17 +18,23 @@static inline u32 get_unaligned_le32 (const void *p) { -return le32_to_cpup (p); +u32 v; + +memcpy (&v, p,sizeof (v)); + +return le32_to_cpu (v); }static inline void put_unaligned_le32 (u32 val,void *p) { - *(__force __le32 *)p =cpu_to_le32 (val); +u32 v =cpu_to_le32 (val); + +memcpy (p, &v,sizeof (v)); }#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
Signature · 1 line
2.39.5
Re: [PATCH v5 06/16] xen/decompressors: Remove use of *_to_cpup() helpers
Quoted 24 lines · Andrew Cooper
From: Lin Liu <[email protected]>
These wrappers simply hide a deference, which adds to the cognitive complexity of reading the code. As such, they're not going to be included in the new byteswap infrastructure.
No functional change.
Signed-off-by Lin Liu <[email protected]>Signed-off-by Andrew Cooper <[email protected]>---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
Quoted 7 lines
v5:
* Rebase
* Rearranged from other patches--- tools/libs/guest/xg_dom_decompress_unsafe_xz.c | 13 +++++++------ xen/common/lz4/defs.h | 6 +++++- xen/common/xz/private.h | 12 +++++++++---
CI says that there's more lz4 and lzo1x to clean up. Fixed locally, but I won't repost for now.
PATCH v5 7/16 xen/arch: Switch to new byteorder infrastructure
In reply to Andrew CooperFrom: Lin Liu <[email protected]>
This needs to be done in several steps, because of common vs arch issues. Start by using the new common infastructure inside the arch infrastructure.
libelf-private.h is awkward, and the only thing in Xen using swabXX() directly. It needs updating at the same time.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
v5:
* Rebase
* Rearange from other patches to maintain bisectability
--- xen/arch/arm/include/asm/byteorder.h | 4 +--- xen/arch/ppc/include/asm/byteorder.h | 8 +------- xen/arch/riscv/include/asm/byteorder.h | 4 +--- xen/arch/x86/include/asm/byteorder.h | 25 +------------------------ xen/common/libelf/libelf-private.h | 6 +++--- 5 files changed, 7 insertions(+), 40 deletions(-)
xen/arch/arm/include/asm/byteorder.h +1 -3
@@ -1,9 +1,7 @@#ifndef __ASM_ARM_BYTEORDER_H__#define __ASM_ARM_BYTEORDER_H__ -#define __BYTEORDER_HAS_U64__ - -#include <xen/byteorder/little_endian.h> +#include <xen/byteorder.h> #endif /* __ASM_ARM_BYTEORDER_H__ */ /*
xen/arch/ppc/include/asm/byteorder.h +1 -7
@@ -1,12 +1,6 @@#ifndef _ASM_PPC_BYTEORDER_H#define _ASM_PPC_BYTEORDER_H -#define __arch__swab16 __builtin_bswap16 -#define __arch__swab32 __builtin_bswap32 -#define __arch__swab64 __builtin_bswap64 - -#define __BYTEORDER_HAS_U64__ - -#include <xen/byteorder/little_endian.h> +#include <xen/byteorder.h> #endif /* _ASM_PPC_BYTEORDER_H */
xen/arch/riscv/include/asm/byteorder.h +1 -3
@@ -1,9 +1,7 @@#ifndef ASM__RISCV__BYTEORDER_H #define ASM__RISCV__BYTEORDER_H -#define __BYTEORDER_HAS_U64__ - -#include <xen/byteorder/little_endian.h> +#include <xen/byteorder.h> #endif /* ASM__RISCV__BYTEORDER_H */ /*
xen/arch/x86/include/asm/byteorder.h +1 -24
@@ -1,29 +1,6 @@#ifndef __ASM_X86_BYTEORDER_H__#define __ASM_X86_BYTEORDER_H__ -#include <xen/types.h> -#include <xen/compiler.h> - -static inline attr_const uint32_t ___arch__swab32(uint32_t x) -{ - asm("bswap %0" :"=r" (x) :"0" (x)); -return x; -} - -static inline attr_const uint64_t ___arch__swab64(uint64_t x) -{ - asm ("bswap %0" :"+r" (x) ); -return x; -} - -/* Do not define swab16. Gcc is smart enough to recognize "C" version and -convert it into rotation or exhange. */ - -#define __arch__swab64 (x) ___arch__swab64(x) -#define __arch__swab32 (x) ___arch__swab32(x) - -#define __BYTEORDER_HAS_U64__ - -#include <xen/byteorder/little_endian.h> +#include <xen/byteorder.h> #endif /* __ASM_X86_BYTEORDER_H__ */
xen/common/libelf/libelf-private.h +3 -3
@@ -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__ */
Signature · 1 line
2.39.5
Re: [PATCH v5 07/16] xen/arch: Switch to new byteorder infrastructure
Quoted 10 lines · Andrew Cooper
From: Lin Liu <[email protected]>
This needs to be done in several steps, because of common vs arch issues. Start by using the new common infastructure inside the arch infrastructure.
libelf-private.his awkward, and the only thing in Xen usingswabXX()directly. It needs updating at the same time.Signed-off-by Lin Liu <[email protected]>Signed-off-by Andrew Cooper <[email protected]>
PATCH v5 8/16 xen/decompressors: Use new byteorder infrastructure
In reply to Andrew CooperFrom: Lin Liu <[email protected]>
unaligned.h already inlcudes byteorder.h, so most can simply be dropped.
No functional change.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
v5:
* New
--- tools/libs/guest/xg_dom_decompress_unsafe_zstd.c | 3 +-- xen/common/lz4/defs.h | 1 - xen/common/lzo.c | 1 - xen/common/unlzo.c | 1 - xen/common/xz/private.h | 1 - 5 files changed, 1 insertion(+), 6 deletions(-)
tools/libs/guest/xg_dom_decompress_unsafe_zstd.c +1 -2
@@ -30,9 +30,8 @@ typedef uint64_t __be64;#undef ERROR -#define __BYTEORDER_HAS_U64__#define __TYPES_H__/* xen/types.h guard */ -#include "../../xen/include/xen/byteorder/little_endian.h" +#include "../../xen/include/xen/byteorder.h" #include "../../xen/include/xen/unaligned.h" #include "../../xen/include/xen/xxhash.h" #include "../../xen/lib/xxhash64.c"
xen/common/lz4/defs.h +0 -1
@@ -12,7 +12,6 @@#define COMMON_LZ4_DEFS_H #ifdef __XEN__ -#include <asm/byteorder.h> #include <xen/unaligned.h> #else
xen/common/lzo.c +0 -1
@@ -68,7 +68,6 @@#ifdef __XEN__#include <xen/lib.h> -#include <asm/byteorder.h> #include <xen/unaligned.h> #else #define get_unaligned_le16 (_p) (*(u16 *)(_p))
xen/common/unlzo.c +0 -1
@@ -33,7 +33,6 @@#include <xen/lzo.h> #ifdef __XEN__ -#include <asm/byteorder.h> #include <xen/unaligned.h> #else
xen/common/xz/private.h +0 -1
@@ -12,7 +12,6 @@#ifdef __XEN__#include <xen/kernel.h> -#include <asm/byteorder.h> #include <xen/unaligned.h> #else
Signature · 1 line
2.39.5
Re: [PATCH v5 08/16] xen/decompressors: Use new byteorder infrastructure
Quoted 7 lines · Andrew Cooper
From: Lin Liu <[email protected]>
unaligned.halready inlcudesbyteorder.h, so most can simply be dropped.No functional change.
Signed-off-by Lin Liu <[email protected]>
Nit: Again missing your own S-o-b?
Jan
PATCH v5 9/16 xen: Remove old byteorder infrastructure
In reply to Andrew CooperFrom: Lin Liu <[email protected]>
It is no longer used.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
--- xen/include/xen/byteorder/big_endian.h | 95 ------------ xen/include/xen/byteorder/generic.h | 68 -------- xen/include/xen/byteorder/little_endian.h | 95 ------------ xen/include/xen/byteorder/swab.h | 179 ---------------------- 4 files changed, 437 deletions(-) delete mode 100644 xen/include/xen/byteorder/big_endian.h delete mode 100644 xen/include/xen/byteorder/generic.h delete mode 100644 xen/include/xen/byteorder/little_endian.h delete mode 100644 xen/include/xen/byteorder/swab.h
xen/include/xen/byteorder/big_endian.h deleted +0 -95
@@ -1,95 +0,0 @@ -#ifndef __XEN_BYTEORDER_BIG_ENDIAN_H__ -#define __XEN_BYTEORDER_BIG_ENDIAN_H__ - -#include <xen/types.h> -#include <xen/byteorder/swab.h> - -#define __constant_cpu_to_le64 (x) ((__force __le64)___constant_swab64((x))) -#define __constant_le64_to_cpu (x) ___constant_swab64((__force uint64_t)(__le64)(x)) -#define __constant_cpu_to_le32 (x) ((__force __le32)___constant_swab32((x))) -#define __constant_le32_to_cpu (x) ___constant_swab32((__force uint32_t)(__le32)(x)) -#define __constant_cpu_to_le16 (x) ((__force __le16)___constant_swab16((x))) -#define __constant_le16_to_cpu (x) ___constant_swab16((__force uint16_t)(__le16)(x)) -#define __constant_cpu_to_be64 (x) ((__force __be64)(uint64_t)(x)) -#define __constant_be64_to_cpu (x) ((__force uint64_t)(__be64)(x)) -#define __constant_cpu_to_be32 (x) ((__force __be32)(uint32_t)(x)) -#define __constant_be32_to_cpu (x) ((__force uint32_t)(__be32)(x)) -#define __constant_cpu_to_be16 (x) ((__force __be16)(uint16_t)(x)) -#define __constant_be16_to_cpu (x) ((__force uint16_t)(__be16)(x)) -#define __cpu_to_le64 (x) ((__force __le64)__swab64((x))) -#define __le64_to_cpu (x) __swab64((__force uint64_t)(__le64)(x)) -#define __cpu_to_le32 (x) ((__force __le32)__swab32((x))) -#define __le32_to_cpu (x) __swab32((__force uint32_t)(__le32)(x)) -#define __cpu_to_le16 (x) ((__force __le16)__swab16((x))) -#define __le16_to_cpu (x) __swab16((__force uint16_t)(__le16)(x)) -#define __cpu_to_be64 (x) ((__force __be64)(uint64_t)(x)) -#define __be64_to_cpu (x) ((__force uint64_t)(__be64)(x)) -#define __cpu_to_be32 (x) ((__force __be32)(uint32_t)(x)) -#define __be32_to_cpu (x) ((__force uint32_t)(__be32)(x)) -#define __cpu_to_be16 (x) ((__force __be16)(uint16_t)(x)) -#define __be16_to_cpu (x) ((__force uint16_t)(__be16)(x)) - -static inline __le64 __cpu_to_le64p (const uint64_t *p) -{ -return (__force __le64 )__swab64p (p); -} -static inline uint64_t __le64_to_cpup (const __le64 *p) -{ -return __swab64p ((const uint64_t *)p); -} -static inline __le32 __cpu_to_le32p (const uint32_t *p) -{ -return (__force __le32 )__swab32p (p); -} -static inline uint32_t __le32_to_cpup (const __le32 *p) -{ -return __swab32p ((const uint32_t *)p); -} -static inline __le16 __cpu_to_le16p (const uint16_t *p) -{ -return (__force __le16 )__swab16p (p); -} -static inline uint16_t __le16_to_cpup (const __le16 *p) -{ -return __swab16p ((const uint16_t *)p); -} -static inline __be64 __cpu_to_be64p (const uint64_t *p) -{ -return (__force __be64)*p; -} -static inline uint64_t __be64_to_cpup (const __be64 *p) -{ -return (__force uint64_t )*p; -} -static inline __be32 __cpu_to_be32p (const uint32_t *p) -{ -return (__force __be32)*p; -} -static inline uint32_t __be32_to_cpup (const __be32 *p) -{ -return (__force uint32_t )*p; -} -static inline __be16 __cpu_to_be16p (const uint16_t *p) -{ -return (__force __be16)*p; -} -static inline uint16_t __be16_to_cpup (const __be16 *p) -{ -return (__force uint16_t )*p; -} -#define __cpu_to_le64s (x) __swab64s((x)) -#define __le64_to_cpus (x) __swab64s((x)) -#define __cpu_to_le32s (x) __swab32s((x)) -#define __le32_to_cpus (x) __swab32s((x)) -#define __cpu_to_le16s (x) __swab16s((x)) -#define __le16_to_cpus (x) __swab16s((x)) -#define __cpu_to_be64s (x) do {} while (0) -#define __be64_to_cpus (x) do {} while (0) -#define __cpu_to_be32s (x) do {} while (0) -#define __be32_to_cpus (x) do {} while (0) -#define __cpu_to_be16s (x) do {} while (0) -#define __be16_to_cpus (x) do {} while (0) - -#include <xen/byteorder/generic.h> - -#endif /* __XEN_BYTEORDER_BIG_ENDIAN_H__ */
xen/include/xen/byteorder/generic.h deleted +0 -68
68 lines not on this page · raw message
xen/include/xen/byteorder/little_endian.h deleted +0 -95
95 lines not on this page · raw message
xen/include/xen/byteorder/swab.h deleted +0 -179
179 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH v5 10/16 crypto/vmac: Switch to xen/byteswap.h
In reply to Andrew CooperFrom: Lin Liu <[email protected]>
This file has its own implementation of swap bytes. Clean up the code with xen/byteswap.h.
No functional change.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
--- xen/crypto/vmac.c | 76 ++--------------------------------------------- 1 file changed, 3 insertions(+), 73 deletions(-)
xen/crypto/vmac.c +3 -73
@@ -8,6 +8,7 @@/* start for Xen */ #include <xen/init.h> +#include <xen/byteswap.h> #include <xen/types.h> #include <xen/lib.h> #include <crypto/vmac.h>
@@ -50,7 +51,6 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */* MUL64: 64x64->128-bit multiplication * PMUL64: assumes top bits cleared on inputs * ADD128: 128x128->128-bit addition -* GET_REVERSED_64: load and byte-reverse 64-bit word * ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
@@ -68,22 +68,6 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */#define PMUL64 MUL64 -#define GET_REVERSED_64 (p) \ - ({uint64_t x; \ - asm ("bswapq %0" : "=r" (x) : "0"(*(uint64_t *)(p))); x;}) - -/* ----------------------------------------------------------------------- */ -#elif (__GNUC__ && __i386__) -/* ----------------------------------------------------------------------- */ - -#define GET_REVERSED_64 (p) \ - ({ uint64_t x; \ - uint32_t *tp = (uint32_t *)(p); \ - asm ("bswap %%edx\n\t" \ - "bswap %%eax" \ - : "=A"(x) \ - : "a"(tp[1]), "d"(tp[0])); \ - x; })/* ----------------------------------------------------------------------- */ #elif (__GNUC__ && __ppc64__)
@@ -103,37 +87,6 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */#define PMUL64 MUL64 -#define GET_REVERSED_64 (p) \ - ({ uint32_t hi, lo, *_p = (uint32_t *)(p); \ - asm volatile ("lwbrx %0, %1, %2" : "=r"(lo) : "b%"(0), "r"(_p) ); \ - asm volatile ("lwbrx %0, %1, %2" : "=r"(hi) : "b%"(4), "r"(_p) ); \ - ((uint64_t)hi << 32) | (uint64_t)lo; } ) - -/* ----------------------------------------------------------------------- */ -#elif (__GNUC__ && (__ppc__ || __PPC__)) -/* ----------------------------------------------------------------------- */ - -#define GET_REVERSED_64 (p) \ - ({ uint32_t hi, lo, *_p = (uint32_t *)(p); \ - asm volatile ("lwbrx %0, %1, %2" : "=r"(lo) : "b%"(0), "r"(_p) ); \ - asm volatile ("lwbrx %0, %1, %2" : "=r"(hi) : "b%"(4), "r"(_p) ); \ - ((uint64_t)hi << 32) | (uint64_t)lo; } ) - -/* ----------------------------------------------------------------------- */ -#elif (__GNUC__ && (__ARMEL__ || __ARM__)) -/* ----------------------------------------------------------------------- */ - -#define bswap32 (v) \ -({ uint32_t tmp,out; \ - asm volatile( \ - "eor %1, %2, %2, ror #16\n" \ - "bic %1, %1, #0x00ff0000\n" \ - "mov %0, %2, ror #8\n" \ - "eor %0, %0, %1, lsr #8" \ - : "=r" (out), "=&r" (tmp) \ - : "r" (v)); \ - out;}) -/* ----------------------------------------------------------------------- */ #elif _MSC_VER/* ----------------------------------------------------------------------- */
@@ -154,11 +107,6 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ (rh) += (ih) + ((rl) < (_il)); \ } -#if _MSC_VER >=1300 -#define GET_REVERSED_64 (p) _byteswap_uint64(*(uint64_t *)(p)) -#pragma intrinsic(_byteswap_uint64) -#endif -#if _MSC_VER >=1400 && \ (!defined(__INTEL_COMPILER) || __INTEL_COMPILER >=1000 )#define MUL32 (i1,i2) (__emulu((uint32_t)(i1),(uint32_t)(i2)))
@@ -219,24 +167,6 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ }#endif -#ifndef GET_REVERSED_64 -#ifndef bswap64 -#ifndef bswap32 -#define bswap32 (x) \ - ({ uint32_t bsx = (x); \ - ((((bsx) & 0xff000000u) >> 24) | (((bsx) & 0x00ff0000u) >> 8) | \ - (((bsx) & 0x0000ff00u) << 8) | (((bsx) & 0x000000ffu) << 24)); }) -#endif -#define bswap64 (x) \ - ({ union { uint64_t ll; uint32_t l[2]; } w, r; \ - w.ll = (x); \ - r.l[0] = bswap32 (w.l[1]); \ - r.l[1] = bswap32 (w.l[0]); \ - r.ll; }) -#endif -#define GET_REVERSED_64 (p) bswap64(*(uint64_t *)(p)) -#endif -/* ----------------------------------------------------------------------- */ #if (VMAC_PREFER_BIG_ENDIAN )
@@ -247,9 +177,9 @@ const uint64_t mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */#if (VMAC_ARCH_BIG_ENDIAN )# define get64BE (ptr) (*(uint64_t *)(ptr)) -# define get64LE (ptr) GET_REVERSED_64(ptr) +# define get64LE (ptr) bswap64(*(uint64_t *)(ptr))#else /* assume little-endian */ -# define get64BE (ptr) GET_REVERSED_64(ptr) +# define get64BE (ptr) bswap64(*(uint64_t *)(ptr))# define get64LE (ptr) (*(uint64_t *)(ptr))#endif
Signature · 1 line
2.39.5
PATCH v5 11/16 xsm/flask: Switch {asm -> xen}/byteorder.h
In reply to Andrew CooperSort the includes while at it.
No functional change.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
v5:
* New
--- xen/xsm/flask/ss/avtab.c | 4 ++-- xen/xsm/flask/ss/conditional.c | 9 ++++----- xen/xsm/flask/ss/ebitmap.c | 9 ++++----- xen/xsm/flask/ss/policydb.c | 7 +++---- 4 files changed, 13 insertions(+), 16 deletions(-)
xen/xsm/flask/ss/avtab.c +2 -2
@@ -19,11 +19,11 @@/* Ported to Xen 3.0, George Coker, <[email protected]> */ +#include <xen/byteorder.h> +#include <xen/errno.h> #include <xen/lib.h> -#include <asm/byteorder.h> #include <xen/types.h> #include <xen/xmalloc.h> -#include <xen/errno.h> #include "avtab.h" #include "policydb.h"
xen/xsm/flask/ss/conditional.c +4 -5
@@ -9,15 +9,14 @@/* Ported to Xen 3.0, George Coker, <[email protected]> */ -#include <xen/lib.h> -#include <xen/types.h> +#include <xen/byteorder.h> #include <xen/errno.h> -#include <xen/string.h> +#include <xen/lib.h> #include <xen/spinlock.h> +#include <xen/string.h> +#include <xen/types.h> #include <xen/xmalloc.h> -#include <asm/byteorder.h> -#include "security.h" #include "conditional.h"
xen/xsm/flask/ss/ebitmap.c +4 -5
@@ -10,13 +10,12 @@/* Ported to Xen 3.0, George Coker, <[email protected]> */ -#include <xen/lib.h> -#include <xen/xmalloc.h> +#include <xen/bitmap.h> +#include <xen/byteorder.h> #include <xen/errno.h> +#include <xen/lib.h> #include <xen/spinlock.h> -#include <xen/bitmap.h> - -#include <asm/byteorder.h> +#include <xen/xmalloc.h> #include "ebitmap.h" #include "policydb.h"
xen/xsm/flask/ss/policydb.c +3 -4
@@ -22,13 +22,12 @@/* Ported to Xen 3.0, George Coker, <[email protected]> */ +#include <xen/byteorder.h> +#include <xen/errno.h> #include <xen/lib.h> +#include <xen/string.h> #include <xen/types.h> #include <xen/xmalloc.h> -#include <xen/string.h> -#include <xen/errno.h> - -#include <asm/byteorder.h> #include <conditional.h> #include "security.h"
Signature · 1 line
2.39.5
PATCH v5 12/16 xen/common: Switch {asm -> xen}/byteorder.h
In reply to Andrew CooperSort the includes. Drop useless includes of xen/types.h
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
v5:
* New
--- xen/common/bitmap.c | 5 ++--- xen/common/libelf/libelf-private.h | 3 ++- xen/drivers/char/ehci-dbgp.c | 4 +++- xen/include/xen/bitmap.h | 2 +- xen/include/xen/device_tree.h | 3 ++- xen/include/xen/libfdt/libfdt_env.h | 3 +-- xen/include/xen/unaligned.h | 3 +-- 7 files changed, 12 insertions(+), 11 deletions(-)
xen/common/bitmap.c +2 -3
@@ -5,14 +5,13 @@* This source code is licensed under the GNU General Public License, * Version 2. See the file COPYING for more details. */ -#include <xen/types.h> -#include <xen/errno.h> #include <xen/bitmap.h> #include <xen/bitops.h> +#include <xen/byteorder.h> #include <xen/cpumask.h> +#include <xen/errno.h> #include <xen/guest_access.h> #include <xen/lib.h> -#include <asm/byteorder.h> /* * bitmaps provide an array of bits, implemented using an an
xen/common/libelf/libelf-private.h +2 -1
@@ -17,10 +17,11 @@#ifdef __XEN__ +#include <xen/byteorder.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
xen/drivers/char/ehci-dbgp.c +3 -1
@@ -5,15 +5,17 @@* Linux; see the Linux source for authorship and copyrights. */ +#include <xen/byteorder.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> /* #define DBGP_DEBUG */
xen/include/xen/bitmap.h +1 -1
@@ -230,7 +230,7 @@ static inline unsigned int bitmap_weight(const unsigned long *src,return __bitmap_weight (src, nbits); } -#include <asm/byteorder.h> +#include <xen/byteorder.h> #ifdef __LITTLE_ENDIAN#define BITMAP_MEM_ALIGNMENT 8
xen/include/xen/device_tree.h +2 -1
@@ -10,7 +10,8 @@#ifndef __XEN_DEVICE_TREE_H__#define __XEN_DEVICE_TREE_H__ -#include <asm/byteorder.h> +#include <xen/byteorder.h> +#include <asm/device.h> #include <public/xen.h> #include <public/device_tree_defs.h>
xen/include/xen/libfdt/libfdt_env.h +1 -2
@@ -7,9 +7,8 @@* Copyright 2012 Kim Phillips, Freescale Semiconductor. */ -#include <xen/types.h> +#include <xen/byteorder.h> #include <xen/string.h> -#include <asm/byteorder.h> #ifdef __CHECKER__#define FDT_FORCE __attribute__((force))
xen/include/xen/unaligned.h +1 -2
@@ -3,8 +3,7 @@#define __XEN_UNALIGNED_H__#ifdef __XEN__ -#include <xen/types.h> -#include <asm/byteorder.h> +#include <xen/byteorder.h> #endif /*
Signature · 1 line
2.39.5
Re: [PATCH v5 12/16] xen/common: Switch {asm -> xen}/byteorder.h
Quoted 3 lines · Andrew Cooper
Sort the includes. Drop useless includes of
xen/types.hSigned-off-by Andrew Cooper <[email protected]>
PATCH v5 13/16 arm: Remove asm/byteorder.h
In reply to Andrew CooperWith the common code moved fully onto xen/byteorder.h, clean up the dregs.
Sort includes in some files while swapping over to xen/byteorder.h.
No functional change.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
v5:
* New
--- xen/arch/arm/alternative.c | 6 +++--- xen/arch/arm/arm64/livepatch.c | 2 +- xen/arch/arm/include/asm/arm32/io.h | 3 ++- xen/arch/arm/include/asm/arm64/io.h | 3 ++- xen/arch/arm/include/asm/byteorder.h | 14 -------------- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/vgic/vgic-mmio.c | 3 ++- 7 files changed, 11 insertions(+), 22 deletions(-) delete mode 100644 xen/arch/arm/include/asm/byteorder.h
xen/arch/arm/alternative.c +3 -3
@@ -6,18 +6,18 @@* Copyright (C) 2014-2016 ARM Ltd. */ +#include <xen/byteorder.h> #include <xen/init.h> -#include <xen/types.h> #include <xen/kernel.h> #include <xen/llc-coloring.h> #include <xen/mm.h> -#include <xen/vmap.h> #include <xen/smp.h> #include <xen/stop_machine.h> #include <xen/virtual_region.h> +#include <xen/vmap.h> +#include <asm/alternative.h> #include <asm/atomic.h> -#include <asm/byteorder.h> #include <asm/cpufeature.h> #include <asm/insn.h> #include <asm/page.h>
xen/arch/arm/arm64/livepatch.c +1 -1
@@ -3,6 +3,7 @@*/ #include <xen/bitops.h> +#include <xen/byteorder.h> #include <xen/errno.h> #include <xen/lib.h> #include <xen/livepatch_elf.h>
@@ -11,7 +12,6 @@#include <xen/vmap.h> #include <asm/bitops.h> -#include <asm/byteorder.h> #include <asm/insn.h> #include <asm/livepatch.h>
xen/arch/arm/include/asm/arm32/io.h +2 -1
@@ -21,8 +21,9 @@#ifndef _ARM_ARM32_IO_H#define _ARM_ARM32_IO_H +#include <xen/byteorder.h> +#include <asm/system.h> -#include <asm/byteorder.h> static inline void __raw_writeb (u8 val,volatile void __iomem *addr) {
xen/arch/arm/include/asm/arm64/io.h +2 -1
@@ -20,8 +20,9 @@#ifndef _ARM_ARM64_IO_H#define _ARM_ARM64_IO_H +#include <xen/byteorder.h> +#include <asm/system.h> -#include <asm/byteorder.h> #include <asm/alternative.h> /*
xen/arch/arm/include/asm/byteorder.h deleted +0 -14
@@ -1,14 +0,0 @@ -#ifndef __ASM_ARM_BYTEORDER_H__ -#define __ASM_ARM_BYTEORDER_H__ - -#include <xen/byteorder.h> - -#endif /* __ASM_ARM_BYTEORDER_H__ */ -/* -* Local variables: -* mode: C -* c-file-style: "BSD" -* c-basic-offset: 4 -* indent-tabs-mode: nil -* End: -*/
xen/arch/arm/kernel.c +1 -1
@@ -4,6 +4,7 @@* * Copyright (C) 2011 Citrix Systems, Inc. */ +#include <xen/byteorder.h> #include <xen/domain_page.h> #include <xen/errno.h> #include <xen/guest_access.h>
@@ -15,7 +16,6 @@#include <xen/sched.h> #include <xen/vmap.h> -#include <asm/byteorder.h> #include <asm/kernel.h> #include <asm/setup.h>
xen/arch/arm/vgic/vgic-mmio.c +2 -1
@@ -14,10 +14,11 @@#include <xen/bitops.h> #include <xen/bsearch.h> +#include <xen/byteorder.h> #include <xen/lib.h> #include <xen/sched.h> +#include <asm/new_vgic.h> -#include <asm/byteorder.h> #include "vgic.h" #include "vgic-mmio.h"
Signature · 1 line
2.39.5
PATCH v5 14/16 ppc: Drop asm/byteorder.h
In reply to Andrew CooperWith the common code moved fully onto xen/byteorder.h, clean up the dregs.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
v5:
* New
--- xen/arch/ppc/include/asm/byteorder.h | 6 ------ xen/arch/ppc/include/asm/page.h | 4 +--- xen/arch/ppc/mm-radix.c | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 xen/arch/ppc/include/asm/byteorder.h
xen/arch/ppc/include/asm/byteorder.h deleted +0 -6
@@ -1,6 +0,0 @@ -#ifndef _ASM_PPC_BYTEORDER_H -#define _ASM_PPC_BYTEORDER_H - -#include <xen/byteorder.h> - -#endif /* _ASM_PPC_BYTEORDER_H */
xen/arch/ppc/include/asm/page.h +1 -3
@@ -3,9 +3,7 @@#define _ASM_PPC_PAGE_H#include <xen/bitops.h> -#include <xen/types.h> - -#include <asm/byteorder.h> +#include <xen/byteorder.h> #define PDE_VALID PPC_BIT(0)#define PDE_NLB_MASK 0x1ffffffffffffe0UL
xen/arch/ppc/mm-radix.c +1 -1
@@ -1,5 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ #include <xen/bitops.h> +#include <xen/byteorder.h> #include <xen/init.h> #include <xen/kernel.h> #include <xen/mm.h>
@@ -7,7 +8,6 @@#include <xen/types.h> #include <xen/lib.h> -#include <asm/byteorder.h> #include <asm/early_printk.h> #include <asm/page.h> #include <asm/processor.h>
Signature · 1 line
2.39.5
PATCH v5 15/16 riscv: Remove asm/byteorder.h
In reply to Andrew CooperWith the common code moved fully onto xen/byteorder.h, clean up the dregs.
The use of byteorder.h in io.h appears to have been copy&paste from ARM. It's not needed, but macros and types are.
No functional change.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
v5:
* New
--- xen/arch/riscv/include/asm/byteorder.h | 14 -------------- xen/arch/riscv/include/asm/io.h | 3 ++- 2 files changed, 2 insertions(+), 15 deletions(-) delete mode 100644 xen/arch/riscv/include/asm/byteorder.h
xen/arch/riscv/include/asm/byteorder.h deleted +0 -14
@@ -1,14 +0,0 @@ -#ifndef ASM__RISCV__BYTEORDER_H -#define ASM__RISCV__BYTEORDER_H - -#include <xen/byteorder.h> - -#endif /* ASM__RISCV__BYTEORDER_H */ -/* -* Local variables: -* mode: C -* c-file-style: "BSD" -* c-basic-offset: 4 -* indent-tabs-mode: nil -* End: -*/
xen/arch/riscv/include/asm/io.h +2 -1
@@ -38,7 +38,8 @@#ifndef ASM__RISCV__IO_H #define ASM__RISCV__IO_H -#include <asm/byteorder.h> +#include <xen/macros.h> +#include <xen/types.h> /* * The RISC-V ISA doesn't yet specify how to query or modify PMAs, so we can't
Signature · 1 line
2.39.5
Re: [PATCH v5 15/16] riscv: Remove asm/byteorder.h
Quoted 8 lines · Andrew Cooper
With the common code moved fully onto
xen/byteorder.h, clean up the dregs.The use of
byteorder.hinio.happears to have been copy&paste from ARM. It's not needed, but macros and types are.No functional change.
Signed-off-by Andrew Cooper<[email protected]>
Thanks.
~ Oleksii
Quoted 56 lines
---
CC: Anthony PERARD<[email protected]>
CC: Michal Orzel<[email protected]>
CC: Jan Beulich<[email protected]>
CC: Julien Grall<[email protected]>
CC: Roger Pau Monné<[email protected]>
CC: Stefano Stabellini<[email protected]>
CC: Volodymyr Babchuk<[email protected]>
CC: Bertrand Marquis<[email protected]>
CC: Shawn Anastasio<[email protected]>
CC: Oleksii Kurochko<[email protected]>
CC: Daniel P. Smith<[email protected]>
CC: Lin Liu<[email protected]>v5:
* New--- xen/arch/riscv/include/asm/byteorder.h | 14 -------------- xen/arch/riscv/include/asm/io.h | 3 ++- 2 files changed, 2 insertions(+), 15 deletions(-)delete mode 100644
xen/arch/riscv/include/asm/byteorder.hxen/arch/riscv/include/asm/byteorder.h deleted +0
-14@@ -1,14 +0,0 @@ -#ifndef ASM__RISCV__BYTEORDER_H -#define ASM__RISCV__BYTEORDER_H - -#include <xen/byteorder.h> - -#endif /* ASM__RISCV__BYTEORDER_H */ -/* -* Local variables: -* mode: C -* c-file-style: "BSD" -* c-basic-offset: 4 -* indent-tabs-mode: nil -* End: -*/ xen/arch/riscv/include/asm/io.h +2
-1@@ -38,7 +38,8 @@#ifndef ASM__RISCV__IO_H #define ASM__RISCV__IO_H -#include <asm/byteorder.h> +#include <xen/macros.h> +#include <xen/types.h> /* * The RISC-V ISA doesn't yet specify how to query or modify PMAs, so we can't
PATCH v5 16/16 x86: Drop asm/byteorder.h
In reply to Andrew CooperWith the common code moved fully onto xen/byteorder.h, clean up the dregs.
It turns out that msi.h has not needed byteorder.h since the use of __{BIG,LITTLE}_ENDIAN_BITFIELD was dropped in commit d58f3941ce3f ("x86/MSI:
use standard C types in structures/unions").
No functional change.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Shawn Anastasio <[email protected]>
CC: Oleksii Kurochko <[email protected]>
CC: Daniel P. Smith <[email protected]>
CC: Lin Liu <[email protected]>
v5:
* New
--- xen/arch/x86/include/asm/byteorder.h | 6 ------ xen/arch/x86/include/asm/msi.h | 1 - 2 files changed, 7 deletions(-) delete mode 100644 xen/arch/x86/include/asm/byteorder.h
xen/arch/x86/include/asm/byteorder.h deleted +0 -6
@@ -1,6 +0,0 @@ -#ifndef __ASM_X86_BYTEORDER_H__ -#define __ASM_X86_BYTEORDER_H__ - -#include <xen/byteorder.h> - -#endif /* __ASM_X86_BYTEORDER_H__ */
xen/arch/x86/include/asm/msi.h +0 -1
@@ -3,7 +3,6 @@#include <xen/cpumask.h> #include <xen/pci.h> -#include <asm/byteorder.h> #include <asm/hvm/vmx/vmcs.h> /*
Signature · 1 line
2.39.5
Re: [PATCH v5 16/16] x86: Drop asm/byteorder.h
Quoted 9 lines · Andrew Cooper
With the common code moved fully onto
xen/byteorder.h, clean up the dregs.It turns out that
msi.hhas not neededbyteorder.hsince the use of __{BIG,LITTLE}_ENDIAN_BITFIELD was dropped in commitd58f3941ce3f("x86/MSI:
use standard C types in structures/unions").No functional change.
Signed-off-by Andrew Cooper <[email protected]>