From patchwork Mon Sep 12 20:18: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: 9327987 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 9F9526077F for ; Mon, 12 Sep 2016 20:23:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9029328EAB for ; Mon, 12 Sep 2016 20:23:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84AF628EAE; Mon, 12 Sep 2016 20:23:44 +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 2B22928EAB for ; Mon, 12 Sep 2016 20:23:44 +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 1bjXjh-0006MN-Co; Mon, 12 Sep 2016 20:21:49 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjXjg-0006Jw-0g for xen-devel@lists.xenproject.org; Mon, 12 Sep 2016 20:21:48 +0000 Received: from [85.158.139.211] by server-17.bemta-5.messagelabs.com id 7A/83-03778-B5E07D75; Mon, 12 Sep 2016 20:21:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHLMWRWlGSWpSXmKPExsXSO6nOVTeK73q 4wfkjahbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8amL0vYCi6KVjSvXs/awLhesIuRi0NIYDKT xLf7pxghnN+MElNef2KHcDYySux/sIsNwpnAKLF+5hOgMk4ONgEdiYtfHrKD2CICShL3Vk1mA iliFpjDJHG1dxcTSEJYwE/i5JxONhCbRUBV4tjZa6wgNq+Ah0R/yxtmEFtCQFGi+9kEsBpOoP jzrglgcSEBd4kjqw8zQdQYS7S/vcg2gZFvASPDKkaN4tSistQiXUMTvaSizPSMktzEzBxdQwN TvdzU4uLE9NScxKRiveT83E2MwHBhAIIdjGdPex5ilORgUhLlTRK8Fi7El5SfUpmRWJwRX1Sa k1p8iFGGg0NJgpeP93q4kGBRanpqRVpmDjBwYdISHDxKIrwneYDSvMUFibnFmekQqVOMilLiv CIgfQIgiYzSPLg2WLRcYpSVEuZlBDpEiKcgtSg3swRV/hWjOAejkjDvMZDxPJl5JXDTXwEtZg Ja/HTrZZDFJYkIKakGxuocXcYbO5j+mj3c90JSimXBH5sN+3b6zDqox6AUu0KBn3dViKnDeoe 2tvT+Y9bFXrlvWXMP1r6aEa5htHLx8yyvINkbIsKZrg6Wkyz2zvvP9nfxtU2lF7023tF517wz OvSrjNzh6uLmxizueX4yN4yWpPzeyCL16/qTlHr5BlG/elGe+gfpSizFGYmGWsxFxYkA5paRc ZECAAA= X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1473711705!43124401!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 17527 invoked from network); 12 Sep 2016 20:21:46 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-2.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 12 Sep 2016 20:21:46 -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 u8CKLagI019945 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Sep 2016 20:21:37 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id u8CKLZsk030801 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Sep 2016 20:21:36 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u8CKLYaH008796; Mon, 12 Sep 2016 20:21:35 GMT Received: from olila.local.net-space.pl (/10.175.172.57) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 12 Sep 2016 13:21:34 -0700 From: Daniel Kiper To: xen-devel@lists.xenproject.org Date: Mon, 12 Sep 2016 22:18:26 +0200 Message-Id: <1473711511-11931-12-git-send-email-daniel.kiper@oracle.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1473711511-11931-1-git-send-email-daniel.kiper@oracle.com> References: <1473711511-11931-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, david.vrabel@citrix.com, jbeulich@suse.com, qiaowei.ren@intel.com, gang.wei@intel.com, fu.wei@linaro.org Subject: [Xen-devel] [PATCH v6 11/15] x86: change default load address from 1 MiB to 2 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 Subsequent patches introducing relocatable early boot code play with page tables using 2 MiB huge pages. If load address is not aligned at 2 MiB then code touching such page tables must have special cases for start and end of Xen image memory region. So, let's make life easier and move default load address from 1 MiB to 2 MiB. This way page table code will be nice and easy. Hence, there is a chance that it will be less error prone too... :-))) Signed-off-by: Daniel Kiper Acked-by: Jan Beulich --- xen/arch/x86/Makefile | 2 +- xen/arch/x86/Rules.mk | 4 ++++ xen/arch/x86/setup.c | 3 ++- xen/arch/x86/xen.lds.S | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index d8fe0f1..6dae654 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -90,7 +90,7 @@ all_symbols = endif $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32 - ./boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TARGET) 0x100000 \ + ./boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TARGET) $(XEN_IMG_OFFSET) \ `$(NM) -nr $(TARGET)-syms | awk '$$3 == "_end" {print "0x"$$1}'` .PHONY: tests diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk index 42be4bc..dd10afe 100644 --- a/xen/arch/x86/Rules.mk +++ b/xen/arch/x86/Rules.mk @@ -1,6 +1,10 @@ ######################################## # x86-specific definitions +XEN_IMG_OFFSET = 0x200000 + +CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET) + CFLAGS += -I$(BASEDIR)/include CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 5b17783..f19af6e 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -957,7 +957,8 @@ void __init noreturn __start_xen(unsigned long mbi_p) * Undo the temporary-hooking of the l1_identmap. __2M_text_start * is contained in this PTE. */ - BUG_ON(l2_table_offset((unsigned long)_erodata) == + BUG_ON(using_2M_mapping() && + l2_table_offset((unsigned long)_erodata) == l2_table_offset((unsigned long)_stext)); *pl2e++ = l2e_from_pfn(xen_phys_start >> PAGE_SHIFT, PAGE_HYPERVISOR_RX | _PAGE_PSE); diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index d7bd03e..8bfbd97 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -55,7 +55,7 @@ SECTIONS __2M_text_start = .; /* Start of 2M superpages, mapped RX. */ #endif - . = __XEN_VIRT_START + MB(1); + . = __XEN_VIRT_START + XEN_IMG_OFFSET; _start = .; .text : { _stext = .; /* Text and read-only data */