[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/2] x86: decouple xen alignment setting from EFI/non-EFI build


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Wei Liu <wei.liu2@xxxxxxxxxx>
  • Date: Mon, 18 Mar 2019 14:57:18 +0000
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wei.liu2@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 18 Mar 2019 14:57:31 +0000
  • Ironport-data: A9a23:p6xUuax99AJBWdsOZkt6t4n5zX0WlJwBZkZKjXDtlgiZGahqw2QMvo d5JOUv6r737ls0yUpREvUMlNY9CmZSUTlFNlQ26gaXhW8bvFhZHPe1L/jqZgRD9crBIzVNag mZpWL81MBCLzbQPAne+flOKVyoaH6xqhvY6q7i9EqQmkWeaRvayS8mAJNC7QNdnh7tDN0XO5 lPR+n+THxPHHEQYV86+QWdMsGIBagEDZVVEJ2PvHID75gqYrZlKyrzaWDAM7yStqM9sj1kXj A50n59ajeM2hjWOzeqZWUJ45swaPw4JeLE/rF2UVQwfOmg+da1rwqCafzpVpIFq8jBfnFsbb KbSEhfrVcIKyrc8wz/bO+pLWJeWN5f6qfAGaB/3XQo6zx32ulDWU094UxsUzL8ymz2ccM1St cQrS3xWCzAgE079XVSN8BnHpPeZp0eiXmPwdowBId/eum+3LaMFJkgRxlBmzJXl/wa6rzukd 1dHmnSzxZAvyKYBMTZ81apVAX+h2075RPyE7rpagXlCGYMLqhKdwpxkyWSr91dVUwWWDtsU3 JpYI2JsrN0eSniAcq9OEhS1YS99+H1VyJPMc55gw+n567k4dvN6KlDgxPvKDve3gGAxb6bQG EdpoOXwWMiHsOwljpnom4qEhu6WixvlcbNrbxRzVKvlxPWqzG29tNoVBCAUfaL9CkvP3V78W pW9CgpdkZTtWjhpaGcuswc7FYz53dSpYLx8a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uxvPwmRLxBpmKNLVBqqd9IfcO3ld/E=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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
non-EFI build 4K.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/arch/x86/Kconfig   | 26 ++++++++++++++++++++++++++
 xen/arch/x86/xen.lds.S | 16 ++++++++++++++--
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 5c2d1070b6..b15053cfbe 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -138,6 +138,32 @@ config TBOOT
 
          If unsure, say Y.
 
+choice
+       prompt "Alignment of Xen binary"
+       depends on X86
+       default XEN_ALIGN_DEFAULT
+       ---help---
+         Specify alignment for Xen binary.
+
+         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 non-EFI build
+         the default alignment is 4K due to syslinux failing to handle
+         2M alignment.
+
+config XEN_ALIGN_4K
+       bool "4K alignment"
+
+config XEN_ALIGN_2M
+       bool "2M alignment"
+
+endchoice
+
 config XEN_GUEST
        def_bool n
        prompt "Xen Guest"
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 6e9bda5109..163de31574 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -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,26 @@ 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
+#define SECTION_ALIGN MB(2)
+#elif defined CONFIG_XEN_ALIGN_4K
+#define SECTION_ALIGN PAGE_SIZE
+#elif defined CONFIG_XEN_ALIGN_DEFAULT
+    #ifdef EFI
+        #define SECTION_ALIGN MB(2)
+    #else
+        #define SECTION_ALIGN PAGE_SIZE
+    #endif
+#else
+#error "Section alignment undefined"
+#endif
+
 OUTPUT_FORMAT(FORMAT, FORMAT, FORMAT)
 
 OUTPUT_ARCH(i386:x86-64)
-- 
2.20.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.