From patchwork Fri Sep 23 21:47:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kiper X-Patchwork-Id: 9348921 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 AD24C6077A for ; Fri, 23 Sep 2016 21:51:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E9BD2AE48 for ; Fri, 23 Sep 2016 21:51:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 931542AE50; Fri, 23 Sep 2016 21:51:19 +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 27B022AE48 for ; Fri, 23 Sep 2016 21:51:19 +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 1bnYL6-00047d-P7; Fri, 23 Sep 2016 21:49:00 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bnYL5-00045f-4A for xen-devel@lists.xenproject.org; Fri, 23 Sep 2016 21:48:59 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id 43/64-29421-A43A5E75; Fri, 23 Sep 2016 21:48:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRWlGSWpSXmKPExsUyZ7p8oK7n4qf hBt8uGFp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBkv3jQwF3wUr1gwt5OtgXGFcBcjF4eQwEQm iS9n9jFBOF8YJbau3MUO4WxglDj/+SyUM5FR4lXPLOYuRk4ONgEdiYtfHrKD2CICShL3Vk0Ga 2cW2MUkceryRkaQhLCAn8S+tk1gRSwCqhKvFn4Ba+YV8JDYfPEaWFxCQFGi+9kENhCbEyh+/c l6FhBbSMBdYmvzMkaIGkOJzxuXMk9g5FvAyLCKUb04tagstUjXWC+pKDM9oyQ3MTNH19DATC8 3tbg4MT01JzGpWC85P3cTIzBYGIBgB2PHP6dDjJIcTEqivPx1T8OF+JLyUyozEosz4otKc1KL DzHKcHAoSfDaLQTKCRalpqdWpGXmAMMWJi3BwaMkwssJkuYtLkjMLc5Mh0idYlSUEueVB0kIg CQySvPg2mCxcolRVkqYlxHoECGegtSi3MwSVPlXjOIcjErCvD5zgabwZOaVwE1/BbSYCWjxtz tPQBaXJCKkpBoYPV0e8ymqR77u2LHiqUlqac6P9N9iy34U2vY8k+X4XfLzaE6OzfYFR/X2uVy JOnPo8pLtFgXhb5/y/hVPqZpnz8G3Q6uumX3Z3wcK32W0lm0z5Mk3TYzVqYk4uW3a+k0y+0sP /HA777/naGgLF4eeudqyn82WMp9+cweLym6+avlw5z2nU6JsSizFGYmGWsxFxYkAUz1v8JACA AA= X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1474667335!61060139!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 43884 invoked from network); 23 Sep 2016 21:48:57 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-5.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 23 Sep 2016 21:48:57 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8NLmkOR023972 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Sep 2016 21:48:46 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u8NLmk2T026620 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 23 Sep 2016 21:48:46 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u8NLmjCC031301; Fri, 23 Sep 2016 21:48:45 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:44 -0700 From: Daniel Kiper To: xen-devel@lists.xenproject.org Date: Fri, 23 Sep 2016 23:47:35 +0200 Message-Id: <1474667259-27290-11-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: userv0022.oracle.com [156.151.31.74] 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 10/14] 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 --- v7 - suggestions/fixes: - minor cleanups (suggested by Jan Beulich). --- xen/arch/x86/Makefile | 2 +- xen/arch/x86/Rules.mk | 3 +++ xen/arch/x86/setup.c | 3 ++- xen/arch/x86/xen.lds.S | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 7d37728..04cc59f 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) $(TARGET)-syms | sed -ne 's/^\([^ ]*\) . __end_of_image__$$/0x\1/p'` .PHONY: tests diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk index 42be4bc..36e6386 100644 --- a/xen/arch/x86/Rules.mk +++ b/xen/arch/x86/Rules.mk @@ -1,9 +1,12 @@ ######################################## # x86-specific definitions +XEN_IMG_OFFSET := 0x200000 + CFLAGS += -I$(BASEDIR)/include CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default +CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET) CFLAGS += '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst $(BASEDIR)/,,$(CURDIR))/$@))' # Prevent floating-point variables from creeping into Xen. 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 f4b4e99..d9561e5 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 */