From patchwork Tue Mar 19 13:57:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 10859653 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26F80139A for ; Tue, 19 Mar 2019 13:58:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0ACB928B12 for ; Tue, 19 Mar 2019 13:58:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F372F296A6; Tue, 19 Mar 2019 13:58:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 978A6296A7 for ; Tue, 19 Mar 2019 13:58:53 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h6FEu-0004UM-A1; Tue, 19 Mar 2019 13:57:12 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h6FEs-0004UG-FV for xen-devel@lists.xenproject.org; Tue, 19 Mar 2019 13:57:10 +0000 X-Inumbo-ID: e32c07a0-4a4e-11e9-bc90-bc764e045a96 Received: from SMTP03.CITRIX.COM (unknown [162.221.156.55]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id e32c07a0-4a4e-11e9-bc90-bc764e045a96; Tue, 19 Mar 2019 13:57:09 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.58,498,1544486400"; d="scan'208";a="81000425" From: Wei Liu To: Date: Tue, 19 Mar 2019 13:57:06 +0000 Message-ID: <20190319135706.25212-1-wei.liu2@citrix.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v3] x86: decouple xen alignment setting from EFI/ELF build X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Wei Liu Reviewed-by: Jan Beulich --- xen/arch/x86/Kconfig | 23 +++++++++++++++++++++++ xen/arch/x86/xen.lds.S | 8 ++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 5c2d1070b6..cb068faa6a 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -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" diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 6e9bda5109..cb42dc8fda 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,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)