From: Daniel Kiper <daniel.kiper@oracle.com>
To: xen-devel@lists.xenproject.org
Cc: jgross@suse.com, sstabellini@kernel.org, konrad.wilk@oracle.com,
andrew.cooper3@citrix.com, cardoe@cardoe.com,
pgnet.dev@gmail.com, ning.sun@intel.com, julien.grall@arm.com,
jbeulich@suse.com, qiaowei.ren@intel.com, gang.wei@intel.com,
fu.wei@linaro.org
Subject: [PATCH v12 06/10] x86: change default load address from 1 MiB to 2 MiB
Date: Fri, 20 Jan 2017 02:34:16 +0100 [thread overview]
Message-ID: <1484876060-2236-7-git-send-email-daniel.kiper@oracle.com> (raw)
In-Reply-To: <1484876060-2236-1-git-send-email-daniel.kiper@oracle.com>
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... :-)))
Additionally, drop first 2 MiB mapping from Xen image mapping.
It is no longer needed.
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
---
v8 - suggestions/fixes:
- drop first 2 MiB mapping from Xen image mapping
(suggested by Jan Beulich),
- improve commit message.
v7 - suggestions/fixes:
- minor cleanups
(suggested by Jan Beulich).
---
xen/arch/x86/Makefile | 2 +-
xen/arch/x86/Rules.mk | 3 +++
xen/arch/x86/boot/head.S | 8 --------
xen/arch/x86/boot/x86_64.S | 5 +++--
xen/arch/x86/setup.c | 3 ++-
xen/arch/x86/xen.lds.S | 2 +-
6 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 08e9f7b..e5b840e 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/^\([^ ]*\) . __2M_rwdata_end$$/0x\1/p'`
ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
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/boot/head.S b/xen/arch/x86/boot/head.S
index b8f727a..22bd68d 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -482,14 +482,6 @@ trampoline_setup:
mov %eax,sym_phys(boot_tsc_stamp)
mov %edx,sym_phys(boot_tsc_stamp+4)
- /*
- * During boot, hook 4kB mappings of first 2MB of memory into L2.
- * This avoids mixing cachability for the legacy VGA region, and is
- * corrected when Xen relocates itself.
- */
- mov $sym_phys(l1_identmap)+__PAGE_HYPERVISOR,%edi
- mov %edi,sym_phys(l2_xenmap)
-
/* Apply relocations to bootstrap trampoline. */
mov sym_phys(trampoline_phys),%edx
mov $sym_phys(__trampoline_rel_start),%edi
diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S
index 139b2ca..7890374 100644
--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -121,8 +121,9 @@ GLOBAL(l2_identmap)
* page.
*/
GLOBAL(l2_xenmap)
- idx = 0
- .rept 8
+ .quad 0
+ idx = 1
+ .rept 7
.quad sym_phys(__image_base__) + (idx << L2_PAGETABLE_SHIFT) + (PAGE_HYPERVISOR | _PAGE_PSE)
idx = idx + 1
.endr
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index d4b7d25..e6f6ef1 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -999,7 +999,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 3a02b2b..f9cdfc1 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 */
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-01-20 1:35 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-20 1:34 [PATCH v12 00/10] x86: multiboot2 protocol support Daniel Kiper
2017-01-20 1:34 ` [PATCH v12 01/10] x86/boot: implement early command line parser in C Daniel Kiper
2017-01-20 16:37 ` Doug Goldstein
2017-01-20 16:41 ` Doug Goldstein
2017-01-20 1:34 ` [PATCH v12 02/10] x86: add multiboot2 protocol support Daniel Kiper
2017-01-20 16:52 ` Andrew Cooper
2017-01-20 17:24 ` Daniel Kiper
2017-01-20 18:07 ` Andrew Cooper
2017-01-20 19:01 ` Doug Goldstein
2017-01-20 1:34 ` [PATCH v12 03/10] efi: build xen.gz with EFI code Daniel Kiper
2017-01-20 1:34 ` [PATCH v12 04/10] efi: create new early memory allocator Daniel Kiper
2017-01-20 1:34 ` [PATCH v12 05/10] x86: add multiboot2 protocol support for EFI platforms Daniel Kiper
2017-01-20 4:37 ` Doug Goldstein
2017-01-20 9:46 ` Jan Beulich
2017-01-20 11:43 ` Daniel Kiper
2017-01-20 12:40 ` Jan Beulich
2017-01-20 13:46 ` Daniel Kiper
2017-01-20 14:10 ` Jan Beulich
2017-01-20 14:43 ` Daniel Kiper
2017-01-20 15:23 ` Jan Beulich
2017-01-20 19:04 ` Doug Goldstein
2017-01-20 19:05 ` Andrew Cooper
2017-01-20 19:34 ` Doug Goldstein
2017-01-20 21:42 ` Daniel Kiper
2017-01-20 1:34 ` Daniel Kiper [this message]
2017-01-20 4:06 ` [PATCH v12 06/10] x86: change default load address from 1 MiB to 2 MiB Doug Goldstein
2017-01-20 8:49 ` Jan Beulich
2017-01-20 10:29 ` Daniel Kiper
2017-01-20 1:34 ` [PATCH v12 07/10] x86/setup: use XEN_IMG_OFFSET instead of Daniel Kiper
2017-01-20 4:07 ` Doug Goldstein
2017-01-20 1:34 ` [PATCH v12 08/10] x86: make Xen early boot code relocatable Daniel Kiper
2017-01-20 1:34 ` [PATCH v12 09/10] x86/boot: rename sym_phys() to sym_offs() Daniel Kiper
2017-01-20 4:08 ` Doug Goldstein
2017-01-20 1:34 ` [PATCH v12 10/10] x86: add multiboot2 protocol support for relocatable images Daniel Kiper
2017-01-20 4:08 ` Doug Goldstein
2017-01-20 16:22 ` [PATCH v12 00/10] x86: multiboot2 protocol support Doug Goldstein
2017-01-20 17:21 ` Daniel Kiper
2017-01-20 18:53 ` Doug Goldstein
2017-01-20 19:28 ` Doug Goldstein
2017-01-20 19:42 ` Doug Goldstein
2017-01-20 19:52 ` Doug Goldstein
2017-01-20 20:01 ` Konrad Rzeszutek Wilk
2017-01-20 21:54 ` Daniel Kiper
2017-01-23 13:08 ` Daniel Kiper
2017-01-23 14:28 ` Konrad Rzeszutek Wilk
2017-01-23 16:03 ` Doug Goldstein
2017-01-23 18:12 ` Daniel Kiper
2017-01-23 15:35 ` Doug Goldstein
2017-01-23 15:45 ` Daniel Kiper
2017-01-23 16:07 ` Doug Goldstein
2017-01-23 18:16 ` Daniel Kiper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1484876060-2236-7-git-send-email-daniel.kiper@oracle.com \
--to=daniel.kiper@oracle.com \
--cc=andrew.cooper3@citrix.com \
--cc=cardoe@cardoe.com \
--cc=fu.wei@linaro.org \
--cc=gang.wei@intel.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=julien.grall@arm.com \
--cc=konrad.wilk@oracle.com \
--cc=ning.sun@intel.com \
--cc=pgnet.dev@gmail.com \
--cc=qiaowei.ren@intel.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).