From: David Woodhouse <dwmw2@infradead.org>
To: xen-devel <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Wei Liu" <wl@xen.org>, "Jan Beulich" <jbeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH v2 1/6] x86/boot: Remove gratuitous call back into low-memory code
Date: Fri, 09 Aug 2019 16:01:44 +0100 [thread overview]
Message-ID: <3fd9c77f1f92cec35af8691443b5ccd13dde023a.camel@infradead.org> (raw)
In-Reply-To: <cover.1565362089.git.dwmw@amazon.co.uk>
[-- Attachment #1.1: Type: text/plain, Size: 3590 bytes --]
From: David Woodhouse <dwmw@amazon.co.uk>
We appear to have implemented a memcpy() in the low-memory trampoline
which we then call into from __start_xen(), for no adequately defined
reason.
Kill it with fire.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
v2: Minor fixups from Andrew.
xen/arch/x86/boot/mem.S | 27 +++++----------------------
xen/arch/x86/setup.c | 10 ++++++++++
xen/include/asm-x86/e820.h | 5 ++---
3 files changed, 17 insertions(+), 25 deletions(-)
diff --git a/xen/arch/x86/boot/mem.S b/xen/arch/x86/boot/mem.S
index c6a9bd4d3b..2d61d28835 100644
--- a/xen/arch/x86/boot/mem.S
+++ b/xen/arch/x86/boot/mem.S
@@ -7,7 +7,7 @@ get_memory_map:
.Lmeme820:
xorl %ebx, %ebx # continuation counter
- movw $bootsym(e820map), %di # point into the whitelist
+ movw $bootsym(bios_e820map), %di # point into the whitelist
# so we can have the bios
# directly write into it.
@@ -22,8 +22,8 @@ get_memory_map:
cmpl $SMAP,%eax # check the return is `SMAP'
jne .Lmem88
- incw bootsym(e820nr)
- cmpw $E820_BIOS_MAX,bootsym(e820nr) # up to this many entries
+ incw bootsym(bios_e820nr)
+ cmpw $E820_BIOS_MAX,bootsym(bios_e820nr) # up to this many entries
jae .Lmem88
movw %di,%ax
@@ -66,27 +66,10 @@ get_memory_map:
ret
-/*
- * Copy E820 map obtained from BIOS to a buffer allocated by Xen.
- * Input: %rdi: target address of e820 entry array
- * %esi: maximum number of entries to copy
- * Output: %eax: number of entries copied
- */
- .code64
-ENTRY(e820map_copy)
- mov %esi, %eax
- lea e820map(%rip), %rsi
- mov e820nr(%rip), %ecx
- cmp %ecx, %eax
- cmova %ecx, %eax # number of entries to move
- imul $5, %eax, %ecx
- rep movsl # do the move
- ret
-
.align 4
-e820map:
+GLOBAL(bios_e820map)
.fill E820_BIOS_MAX*20,1,0
-e820nr:
+GLOBAL(bios_e820nr)
.long 0
GLOBAL(lowmem_kb)
.long 0
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index d2011910fa..decea2e77a 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -672,6 +672,16 @@ static char * __init cmdline_cook(char *p, const char *loader_name)
return p;
}
+static unsigned int __init copy_bios_e820(struct e820entry *map, unsigned int limit)
+{
+ unsigned int n = min(bootsym(bios_e820nr), limit);
+
+ if ( n )
+ memcpy(map, bootsym(bios_e820map), sizeof(*map) * n);
+
+ return n;
+}
+
void __init noreturn __start_xen(unsigned long mbi_p)
{
char *memmap_type = NULL;
diff --git a/xen/include/asm-x86/e820.h b/xen/include/asm-x86/e820.h
index ee317b17aa..52916fb75d 100644
--- a/xen/include/asm-x86/e820.h
+++ b/xen/include/asm-x86/e820.h
@@ -37,8 +37,7 @@ extern struct e820map e820_raw;
/* These symbols live in the boot trampoline. */
extern unsigned int lowmem_kb, highmem_kb;
-unsigned int e820map_copy(struct e820entry *map, unsigned int limit);
-
-#define copy_bios_e820 bootsym(e820map_copy)
+extern struct e820map bios_e820map[];
+extern unsigned int bios_e820nr;
#endif /*__E820_HEADER*/
[-- Attachment #1.2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5174 bytes --]
[-- Attachment #2: Type: text/plain, Size: 157 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next parent reply other threads:[~2019-08-09 15:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1565362089.git.dwmw@amazon.co.uk>
2019-08-09 15:01 ` David Woodhouse [this message]
2019-08-09 15:01 ` [Xen-devel] [PATCH v2 2/6] x86/boot: Only jump into low trampoline code for real-mode boot David Woodhouse
2019-08-12 9:10 ` Jan Beulich
2019-08-21 14:04 ` David Woodhouse
2019-08-27 8:43 ` Jan Beulich
2019-08-09 15:01 ` [Xen-devel] [PATCH v2 3/6] x86/boot: Split bootsym() into four types of relocations David Woodhouse
2019-08-12 9:41 ` Jan Beulich
2019-08-19 15:24 ` David Woodhouse
2019-08-09 15:02 ` [Xen-devel] [PATCH v2 4/6] x86/boot: Rename trampoline_{start, end} to boot_trampoline_{start, end} David Woodhouse
2019-08-12 9:55 ` Jan Beulich
2019-08-19 15:24 ` David Woodhouse
2019-08-27 8:51 ` Jan Beulich
2019-08-27 9:31 ` David Woodhouse
2019-08-09 15:02 ` [Xen-devel] [PATCH v2 5/6] x86/boot: Copy 16-bit boot variables back up to Xen image David Woodhouse
2019-08-12 10:24 ` Jan Beulich
2019-08-19 15:25 ` David Woodhouse
2019-08-27 8:59 ` Jan Beulich
2019-08-27 9:19 ` David Woodhouse
2019-08-09 15:02 ` [Xen-devel] [PATCH v2 6/6] x86/boot: Do not use trampoline for no-real-mode boot paths David Woodhouse
2019-08-12 10:55 ` Jan Beulich
2019-08-19 15:25 ` David Woodhouse
2019-08-27 9:07 ` Jan Beulich
2019-08-27 9:12 ` David Woodhouse
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=3fd9c77f1f92cec35af8691443b5ccd13dde023a.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.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).