xen: have a more generic unaligned.h header (take 2)
cover xen: have a more generic unaligned.h header (take 2)
Second try for the generic unaligned.h approach.
This time including a fix for building stubdom with libxenguest, which is using a cruel hack to reuse the hypervisor's decompressing code.
Juergen Gross (2):
xen: make include/xen/unaligned.h usable on all architectures
xen: remove asm/unaligned.h
.../guest/xg_dom_decompress_unsafe_zstd.c | 2 +- xen/arch/x86/include/asm/unaligned.h | 6 --- xen/common/lz4/defs.h | 2 +- xen/common/lzo.c | 2 +- xen/common/unlzo.c | 2 +- xen/common/xz/private.h | 2 +- xen/common/zstd/mem.h | 2 +- xen/include/xen/unaligned.h | 53 +++++++++++-------- xen/lib/xxhash32.c | 2 +- xen/lib/xxhash64.c | 2 +- 10 files changed, 38 insertions(+), 37 deletions(-) delete mode 100644 xen/arch/x86/include/asm/unaligned.h
Signature · 1 line
2.35.3
PATCH 1/2 xen: make include/xen/unaligned.h usable on all architectures
Instead of defining get_unaligned() and put_unaligned() in a way that is only supporting architectures allowing unaligned accesses, use the same approach as the Linux kernel and let the compiler do the decision how to generate the code for probably unaligned data accesses.
Update include/xen/unaligned.h from include/asm-generic/unaligned.h of the Linux kernel.
The generated code has been checked to be the same on x86.
Modify the Linux variant to not use underscore prefixed identifiers, avoid unneeded parentheses and drop the 24-bit accessors.
Add the definition of __packed to xg_dom_decompress_unsafe_zstd.c in libxenguest as it is using a cruel hack to reuse the hypervisor's decompressing code for stubdom.
Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 803f4e1eab7a
--- .../guest/xg_dom_decompress_unsafe_zstd.c | 2 +- xen/include/xen/unaligned.h | 53 +++++++++++-------- 2 files changed, 31 insertions(+), 24 deletions(-)
tools/libs/guest/xg_dom_decompress_unsafe_zstd.c +1 -1
@@ -26,13 +26,13 @@ typedef uint64_t __be64;#define __force#define always_inline#define noinline +#define __packed __attribute__((__packed__))#undef ERROR#define __BYTEORDER_HAS_U64__#define __TYPES_H__/* xen/types.h guard */ #include "../../xen/include/xen/byteorder/little_endian.h" -#define __ASM_UNALIGNED_H__/* asm/unaligned.h guard */ #include "../../xen/include/xen/unaligned.h" #include "../../xen/include/xen/xxhash.h" #include "../../xen/lib/xxhash64.c"
xen/include/xen/unaligned.h +30 -23
109 lines not on this page · raw message
Signature · 1 line
2.35.3
Re: [PATCH 1/2] xen: make include/xen/unaligned.h usable on all architectures
Quoted 13 lines · Juergen Gross
Instead of defining
get_unaligned()andput_unaligned()in a way that is only supporting architectures allowing unaligned accesses, use the same approach as the Linux kernel and let the compiler do the decision how to generate the code for probably unaligned data accesses.Update
include/xen/unaligned.hfrominclude/asm-generic/unaligned.hof the Linux kernel.The generated code has been checked to be the same on x86.
Modify the Linux variant to not use underscore prefixed identifiers, avoid unneeded parentheses and drop the 24-bit accessors.
Quoted 7 lines
Add the definition of
__packedtoxg_dom_decompress_unsafe_zstd.cin libxenguest as it is using a cruel hack to reuse the hypervisor's decompressing code for stubdom.Signed-off-by Arnd Bergmann <[email protected]>Origin:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git803f4e1eab7aSigned-off-by Juergen Gross <[email protected]>
PATCH 2/2 xen: remove asm/unaligned.h
In reply to Juergen GrossWith include/xen/unaligned.h now dealing properly with unaligned accesses for all architectures, asm/unaligned.h can be removed and users can be switched to include xen/unaligned.h instead.
--- xen/arch/x86/include/asm/unaligned.h | 6 ------ xen/common/lz4/defs.h | 2 +- xen/common/lzo.c | 2 +- xen/common/unlzo.c | 2 +- xen/common/xz/private.h | 2 +- xen/common/zstd/mem.h | 2 +- xen/lib/xxhash32.c | 2 +- xen/lib/xxhash64.c | 2 +- 8 files changed, 7 insertions(+), 13 deletions(-) delete mode 100644 xen/arch/x86/include/asm/unaligned.h
xen/arch/x86/include/asm/unaligned.h deleted +0 -6
@@ -1,6 +0,0 @@ -#ifndef __ASM_UNALIGNED_H__ -#define __ASM_UNALIGNED_H__ - -#include <xen/unaligned.h> - -#endif /* __ASM_UNALIGNED_H__ */
xen/common/lz4/defs.h +1 -1
@@ -10,7 +10,7 @@#ifdef __XEN__#include <asm/byteorder.h> -#include <asm/unaligned.h> +#include <xen/unaligned.h> #else static inline u16 get_unaligned_le16 (const void *p)
xen/common/lzo.c +1 -1
@@ -97,7 +97,7 @@#ifdef __XEN__#include <xen/lib.h> #include <asm/byteorder.h> -#include <asm/unaligned.h> +#include <xen/unaligned.h> #else #define get_unaligned_le16 (_p) (*(u16 *)(_p))#endif
xen/common/unlzo.c +1 -1
@@ -34,7 +34,7 @@#ifdef __XEN__#include <asm/byteorder.h> -#include <asm/unaligned.h> +#include <xen/unaligned.h> #else static inline u16 get_unaligned_be16 (const void *p)
xen/common/xz/private.h +1 -1
@@ -13,7 +13,7 @@#ifdef __XEN__#include <xen/kernel.h> #include <asm/byteorder.h> -#include <asm/unaligned.h> +#include <xen/unaligned.h> #else static inline u32 get_unaligned_le32 (const void *p)
xen/common/zstd/mem.h +1 -1
@@ -23,7 +23,7 @@#ifdef __XEN__#include <xen/string.h> /* memcpy */ #include <xen/types.h> /* size_t, ptrdiff_t */ -#include <asm/unaligned.h> +#include <xen/unaligned.h> #endif /*-****************************************
xen/lib/xxhash32.c +1 -1
@@ -42,7 +42,7 @@#include <xen/errno.h> #include <xen/string.h> #include <xen/xxhash.h> -#include <asm/unaligned.h> +#include <xen/unaligned.h> /*-************************************* * Macros
xen/lib/xxhash64.c +1 -1
@@ -43,7 +43,7 @@#include <xen/errno.h> #include <xen/string.h> #include <xen/xxhash.h> -#include <asm/unaligned.h> +#include <xen/unaligned.h> #endif /*-*************************************
Signature · 1 line
2.35.3
Quoted 21 lines · Juergen Gross
Second try for the generic
unaligned.happroach.This time including a fix for building stubdom with libxenguest, which is using a cruel hack to reuse the hypervisor's decompressing code.
Juergen Gross (2):
xen: makeinclude/xen/unaligned.husable on all architectures
xen: removeasm/unaligned.h.../guest/xg_dom_decompress_unsafe_zstd.c | 2 +- xen/arch/x86/include/asm/unaligned.h | 6 --- xen/common/lz4/defs.h | 2 +- xen/common/lzo.c | 2 +- xen/common/unlzo.c | 2 +- xen/common/xz/private.h | 2 +- xen/common/zstd/mem.h | 2 +- xen/include/xen/unaligned.h | 53 +++++++++++-------- xen/lib/xxhash32.c | 2 +- xen/lib/xxhash64.c | 2 +- 10 files changed, 38 insertions(+), 37 deletions(-)
Quoted 2 lines
delete mode 100644
xen/arch/x86/include/asm/unaligned.h
Is anything missing for this series to go in?
Juergen
Quoted 25 lines · Juergen Gross
Quoted 20 lines · Juergen Gross
Second try for the generic
unaligned.happroach.This time including a fix for building stubdom with libxenguest, which is using a cruel hack to reuse the hypervisor's decompressing code.
Juergen Gross (2):
xen: makeinclude/xen/unaligned.husable on all architectures
xen: removeasm/unaligned.h.../guest/xg_dom_decompress_unsafe_zstd.c | 2 +- xen/arch/x86/include/asm/unaligned.h | 6 --- xen/common/lz4/defs.h | 2 +- xen/common/lzo.c | 2 +- xen/common/unlzo.c | 2 +- xen/common/xz/private.h | 2 +- xen/common/zstd/mem.h | 2 +- xen/include/xen/unaligned.h | 53 +++++++++++-------- xen/lib/xxhash32.c | 2 +- xen/lib/xxhash64.c | 2 +-
Quoted 3 lines
10 files changed, 38 insertions(+), 37 deletions(-)delete mode 100644
xen/arch/x86/include/asm/unaligned.h
Quoted 1 line
Is anything missing for this series to go in?
Oh - I'd not spotted it. Lemme throw it through a full Gitlab CI run just to be sure.
~Andrew