From patchwork Fri Sep 23 21:47:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kiper X-Patchwork-Id: 9348903 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A4DBB6077A for ; Fri, 23 Sep 2016 21:51:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95F8A2AE26 for ; Fri, 23 Sep 2016 21:51:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89AE22AE55; Fri, 23 Sep 2016 21:51:04 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 98C222AE26 for ; Fri, 23 Sep 2016 21:51:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bnYKX-0003mn-67; Fri, 23 Sep 2016 21:48:25 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bnYKV-0003mU-RM for xen-devel@lists.xenproject.org; Fri, 23 Sep 2016 21:48:23 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id 36/41-11175-723A5E75; Fri, 23 Sep 2016 21:48:23 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRWlGSWpSXmKPExsXSO6nOVVdt8dN wg4Vz1Sy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozft/sZC47zVPx7uYW1gXESVxcjF4eQwGQm ia8rd7FDON8YJb7fPsPaxcgJ5GxglDjQJQGRmMgocajpOyNIgk1AR+Lil4fsILaIgJLEvVWTm UCKmAV2MUmcurwRrEhYwEni5e+rzCA2i4CqxJnlm8HivALuEj+2toFtkBBQlOh+NoENxOYU8J C4/mQ9C8Rmd4mtzcsYIWqMJdrfXmSbwMi3gJFhFaNGcWpRWWqRrpGBXlJRZnpGSW5iZo6uoYG ZXm5qcXFiempOYlKxXnJ+7iZGYLAwAMEOxl/LAg4xSnIwKYny8tc9DRfiS8pPqcxILM6ILyrN SS0+xCjDwaEkwXtuIVBOsCg1PbUiLTMHGLYwaQkOHiUR3sJFQGne4oLE3OLMdIjUKUZFKXHeU yB9AiCJjNI8uDZYrFxilJUS5mUEOkSIpyC1KDezBFX+FaM4B6OSMK/PXKApPJl5JXDTXwEtZg Ja/O3OE5DFJYkIKakGRutMjVW+eaYKLbNOa+6cukZunsfykLQMEbvw1Q/vsKzmiQ3xbp14cs/ HbR+Pi27PP/tIQyRJtSVpdXByyXnLZVqGCwUKYnT+mkxc77T556nGFMbK564zovoa3hiuL+o4 t0/gR8ebuV1nAp+mJB5fJ/aSw9XFZbb9WXmZTSsqjMv3HhQy6ds3S4mlOCPRUIu5qDgRAG2kr 6iQAgAA X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-15.tower-27.messagelabs.com!1474667300!8132554!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 1270 invoked from network); 23 Sep 2016 21:48:22 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-15.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 23 Sep 2016 21:48:22 -0000 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8NLmAav019622 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Sep 2016 21:48:10 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id u8NLmAmH024314 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 23 Sep 2016 21:48:10 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u8NLm53t007664; Fri, 23 Sep 2016 21:48:07 GMT Received: from olila.local.net-space.pl (/10.175.174.211) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 23 Sep 2016 14:48:05 -0700 From: Daniel Kiper To: xen-devel@lists.xenproject.org Date: Fri, 23 Sep 2016 23:47:26 +0200 Message-Id: <1474667259-27290-2-git-send-email-daniel.kiper@oracle.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1474667259-27290-1-git-send-email-daniel.kiper@oracle.com> References: <1474667259-27290-1-git-send-email-daniel.kiper@oracle.com> X-Source-IP: aserv0022.oracle.com [141.146.126.234] Cc: jgross@suse.com, sstabellini@kernel.org, andrew.cooper3@citrix.com, cardoe@cardoe.com, pgnet.dev@gmail.com, ning.sun@intel.com, julien.grall@arm.com, david.vrabel@citrix.com, jbeulich@suse.com, qiaowei.ren@intel.com, gang.wei@intel.com, fu.wei@linaro.org Subject: [Xen-devel] [PATCH v7 01/14] x86: move xen ELF end of image to 16 MiB X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP It seems that from xen ELF image POV _end symbol properly determine image end. However, taking into account that initial Xen image mapping covers 16 MiB it looks that it is not sufficient. Currently bootloader potentially may load xen ELF image at 1 MiB and let's say put Linux kernel or initrd at 8 MiB. Nothing forbids it. This means that initially Xen image mapping may cover not only Xen image but also loaded modules. So, let's move end of xen ELF image to 16 MiB. This way we avoid above mentioned issue because bootloader will be forced to allocate 15 MiB memory region for image. Then it (bootloader) would not be able to put in this place anything else because from its POV simply this memory region will be allocated and used. This patch does not change xen ELF file size. It changes memory size which should be allocated for the image during load. Signed-off-by: Daniel Kiper --- xen/arch/x86/xen.lds.S | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index d903c31..9adb2f3 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -266,14 +266,16 @@ SECTIONS .reloc : { *(.reloc) } :text - /* Trick the linker into setting the image size to exactly 16Mb. */ . = ALIGN(__section_alignment__); +#else + efi = .; +#endif + + /* Trick the linker into setting the image size to exactly 16Mb. */ .pad : { . = ALIGN(MB(16)); + __end_of_image__ = .; } :text -#else - efi = .; -#endif /* Sections to be discarded */ /DISCARD/ : {