|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v6 1/3] xen: introduce Kconfig function alignment option
And use it to replace CODE_ALIGN in assembly. This allows to generalize the
way the code alignment gets set across all architectures.
No functional change intended.
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Changes since v5:
- New in this version.
---
xen/Kconfig | 17 +++++++++++++++++
xen/arch/arm/Kconfig | 1 +
xen/arch/arm/include/asm/config.h | 3 +--
xen/arch/ppc/Kconfig | 1 +
xen/arch/ppc/include/asm/config.h | 3 ---
xen/arch/riscv/Kconfig | 1 +
xen/arch/riscv/include/asm/config.h | 1 -
xen/arch/x86/Kconfig | 1 +
xen/arch/x86/include/asm/config.h | 3 +--
xen/include/xen/linkage.h | 5 +++--
10 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/xen/Kconfig b/xen/Kconfig
index 134e6e68ad84..1e1b041fd52f 100644
--- a/xen/Kconfig
+++ b/xen/Kconfig
@@ -37,6 +37,23 @@ config CC_HAS_VISIBILITY_ATTRIBUTE
config CC_SPLIT_SECTIONS
bool
+# Set code alignment.
+#
+# Allow setting on a boolean basis, and then convert such selection to an
+# integer for the build system and code to consume more easily.
+config FUNCTION_ALIGNMENT_4B
+ bool
+config FUNCTION_ALIGNMENT_8B
+ bool
+config FUNCTION_ALIGNMENT_16B
+ bool
+config FUNCTION_ALIGNMENT
+ int
+ default 16 if FUNCTION_ALIGNMENT_16B
+ default 8 if FUNCTION_ALIGNMENT_8B
+ default 4 if FUNCTION_ALIGNMENT_4B
+ default 0
+
source "arch/$(SRCARCH)/Kconfig"
config DEFCONFIG_LIST
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 50e9bfae1ac8..80fb5b14f04e 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -16,6 +16,7 @@ config ARM
select HAS_PASSTHROUGH
select HAS_UBSAN
select IOMMU_FORCE_PT_SHARE
+ select FUNCTION_ALIGNMENT_4B
config ARCH_DEFCONFIG
string
diff --git a/xen/arch/arm/include/asm/config.h
b/xen/arch/arm/include/asm/config.h
index 3b6d829197a4..a2e22b659d53 100644
--- a/xen/arch/arm/include/asm/config.h
+++ b/xen/arch/arm/include/asm/config.h
@@ -53,8 +53,7 @@
/* Linkage for ARM */
#ifdef __ASSEMBLY__
-#define CODE_ALIGN 4
-#define ALIGN .balign CODE_ALIGN
+#define ALIGN .balign CONFIG_FUNCTION_ALIGNMENT
#define ENTRY(name) \
.globl name; \
ALIGN; \
diff --git a/xen/arch/ppc/Kconfig b/xen/arch/ppc/Kconfig
index ab116ffb2a70..6b3b2bb95f56 100644
--- a/xen/arch/ppc/Kconfig
+++ b/xen/arch/ppc/Kconfig
@@ -1,6 +1,7 @@
config PPC
def_bool y
select HAS_DEVICE_TREE
+ select FUNCTION_ALIGNMENT_4B
config PPC64
def_bool y
diff --git a/xen/arch/ppc/include/asm/config.h
b/xen/arch/ppc/include/asm/config.h
index e5d201e16c50..e0a0abfeb408 100644
--- a/xen/arch/ppc/include/asm/config.h
+++ b/xen/arch/ppc/include/asm/config.h
@@ -31,9 +31,6 @@
#define INVALID_VCPU_ID MAX_VIRT_CPUS
/* Linkage for PPC */
-#ifdef __ASSEMBLY__
-#define CODE_ALIGN 4
-#endif
#define XEN_VIRT_START _AC(0xc000000000000000, UL)
diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index f382b36f6c82..b4b354a7786e 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -1,5 +1,6 @@
config RISCV
def_bool y
+ select FUNCTION_ALIGNMENT_16B
config RISCV_64
def_bool y
diff --git a/xen/arch/riscv/include/asm/config.h
b/xen/arch/riscv/include/asm/config.h
index a80cdd4f857c..99ea5635208b 100644
--- a/xen/arch/riscv/include/asm/config.h
+++ b/xen/arch/riscv/include/asm/config.h
@@ -69,7 +69,6 @@
/* Linkage for RISCV */
#ifdef __ASSEMBLY__
-#define CODE_ALIGN 16
#define CODE_FILL /* empty */
#endif
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 1acdffc51c22..3dd8f18b46ef 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -29,6 +29,7 @@ config X86
select HAS_UBSAN
select HAS_VPCI if HVM
select NEEDS_LIBELF
+ select FUNCTION_ALIGNMENT_16B
config ARCH_DEFCONFIG
string
diff --git a/xen/arch/x86/include/asm/config.h
b/xen/arch/x86/include/asm/config.h
index 660246d1dae5..ab7288cb3682 100644
--- a/xen/arch/x86/include/asm/config.h
+++ b/xen/arch/x86/include/asm/config.h
@@ -43,9 +43,8 @@
/* Linkage for x86 */
#ifdef __ASSEMBLY__
-#define CODE_ALIGN 16
#define CODE_FILL 0x90
-#define ALIGN .align CODE_ALIGN, CODE_FILL
+#define ALIGN .align CONFIG_FUNCTION_ALIGNMENT, CODE_FILL
#define ENTRY(name) \
ALIGN; \
GLOBAL(name)
diff --git a/xen/include/xen/linkage.h b/xen/include/xen/linkage.h
index 0997e16810b2..770ae49963b8 100644
--- a/xen/include/xen/linkage.h
+++ b/xen/include/xen/linkage.h
@@ -41,9 +41,10 @@
*/
#define count_args_exp(args...) count_args(args)
#if count_args_exp(CODE_FILL)
-# define DO_CODE_ALIGN(align...) LASTARG(CODE_ALIGN, ## align), CODE_FILL
+# define DO_CODE_ALIGN(align...) LASTARG(CONFIG_FUNCTION_ALIGNMENT, ## align),
\
+ CODE_FILL
#else
-# define DO_CODE_ALIGN(align...) LASTARG(CODE_ALIGN, ## align)
+# define DO_CODE_ALIGN(align...) LASTARG(CONFIG_FUNCTION_ALIGNMENT, ## align)
#endif
#define FUNC(name, align...) \
--
2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |