Skip to contentSkip to conversation

x86: decouple xen alignment setting from EFI/ELF build

PATCH In review Wei Liu 2 participants 2 messages Mar 19, 2019

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH v3 1/1 x86: decouple xen alignment setting from EFI/ELF build

Introduce a new Kconfig option to pick the alignment for xen binary. To retain original behaviour, the default pick for EFI build is 2M and ELF build 4K.

Make the PVHSHIM build use 2M alignment for potentially better performance.

---
 xen/arch/x86/Kconfig   | 23 +++++++++++++++++++++++
 xen/arch/x86/xen.lds.S |  8 ++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)
xen/arch/x86/Kconfig +23 -0
index 5c2d1070b6..cb068faa6a 100644
@@ -138,6 +138,29 @@ config TBOOT
 
 	  If unsure, say Y.
 
+choice
+	prompt "Alignment of Xen image"
+	default XEN_ALIGN_2M if PV_SHIM_EXCLUSIVE
+	default XEN_ALIGN_DEFAULT
+	---help---
+	  Specify alignment for Xen image.
+
+	  If unsure, choose "default".
+
+config XEN_ALIGN_DEFAULT
+	bool "Default alignment"
+	---help---
+	  Pick alignment according to build variants.
+
+	  For EFI build the default alignment is 2M. For ELF build
+	  the default alignment is 4K due to syslinux failing to handle
+	  the increment of image size induced by 2M alignment.
+
+config XEN_ALIGN_2M
+	bool "2M alignment"
+
+endchoice
+
 config XEN_GUEST
 	def_bool n
 	prompt "Xen Guest"
xen/arch/x86/xen.lds.S +6 -2
index 6e9bda5109..cb42dc8fda 100644
@@ -12,7 +12,6 @@
 #define FORMAT "pei-x86-64"
 #undef __XEN_VIRT_START
 #define __XEN_VIRT_START __image_base__
-#define SECTION_ALIGN MB(2)
 #define DECL_SECTION(x) x :
 
 ENTRY(efi_start)
@@ -20,13 +19,18 @@ ENTRY(efi_start)
 #else /* !EFI */
 
 #define FORMAT "elf64-x86-64"
-#define SECTION_ALIGN PAGE_SIZE
 #define DECL_SECTION(x) x : AT(ADDR(x) - __XEN_VIRT_START)
 
 ENTRY(start_pa)
 
 #endif /* EFI */
 
+#if defined(CONFIG_XEN_ALIGN_2M) || defined(EFI)
+# define SECTION_ALIGN MB(2)
+#else
+# define SECTION_ALIGN PAGE_SIZE
+#endif
+
 OUTPUT_FORMAT(FORMAT, FORMAT, FORMAT)
 
 OUTPUT_ARCH(i386:x86-64)
Signature · 7 lines
2.20.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v3 1/1
#1 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 19.03.19 at 14:57, <[email protected]> wrote:

Introduce a new Kconfig option to pick the alignment for xen binary. To retain original behaviour, the default pick for EFI build is 2M and ELF build 4K.

Make the PVHSHIM build use 2M alignment for potentially better performance.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel