From patchwork Wed May 1 11:17:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 10924969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0BF2A14DB for ; Wed, 1 May 2019 11:19:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC9AB28A93 for ; Wed, 1 May 2019 11:19:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0E8828DC2; Wed, 1 May 2019 11:19:10 +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=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7E7C628A93 for ; Wed, 1 May 2019 11:19:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLnEf-0001S1-9u; Wed, 01 May 2019 11:17:13 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLnEe-0001RV-QF for xen-devel@lists.xenproject.org; Wed, 01 May 2019 11:17:12 +0000 X-Inumbo-ID: a8accd02-6c02-11e9-843c-bc764e045a96 Received: from merlin.infradead.org (unknown [2001:8b0:10b:1231::1]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id a8accd02-6c02-11e9-843c-bc764e045a96; Wed, 01 May 2019 11:17:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Sender:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Ccpbk33Kh2sU+iShNHwwwyNtiYF4GnNFpbcwF0XKD94=; b=LNal1Vpod2AphmkSZQm8GiPu2 0mKFzkyWiMsTkf0WV+hlOQTkUIvLYvI1v6WZZ9SqY9Bc5e/HU5KXcmWoVEnTcjJWm5W8L/oLz9B19 bVLpdZojlVmznRrXn4yh2Uct7FBNaB0N9llrcy+nvA0MMUeYkP226Hnm+T1eFazSP893V5+LIZpdI Eq9lOKQR8e/FokpzGmFsKmbUtfR65u+rlcO/o935Jzhw83i6LDZX589SfKXsu8RbU/aGTz4JyM+0F 7W46mJq3Sdbc/TQo7EPm+MqDSNc+L88Evyj0J4I35sykqL9HeHOlrYD/DlZOn4L8TMANrNnwtIa/B 2vNEhSsrg==; Received: from [2001:8b0:10b:1::425] (helo=i7.infradead.org) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLnEZ-0008RR-60; Wed, 01 May 2019 11:17:07 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hLnEY-0030MH-54; Wed, 01 May 2019 12:17:06 +0100 From: David Woodhouse To: dwmw2@infradead.org, xen-devel@lists.xenproject.org Date: Wed, 1 May 2019 12:17:01 +0100 Message-Id: X-Mailer: git-send-email 2.17.2 In-Reply-To: References: In-Reply-To: References: X-SRS-Rewrite: SMTP reverse-path rewritten from by merlin.infradead.org. See http://www.infradead.org/rpr.html Subject: [Xen-devel] [RFC PATCH 2/7] x86/boot: Remove gratuitous call back into low-memory code X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 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.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: David Woodhouse 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 Acked-by: Andrew Cooper --- xen/arch/x86/boot/mem.S | 27 +++++---------------------- xen/arch/x86/setup.c | 12 ++++++++++++ xen/include/asm-x86/e820.h | 5 ++--- 3 files changed, 19 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 a353d76f9a..5fa7d3b79c 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -664,6 +664,18 @@ static char * __init cmdline_cook(char *p, const char *loader_name) return p; } +static int copy_bios_e820(struct e820entry *map, unsigned int limit) +{ + unsigned int n = bootsym(bios_e820nr); + if (n > limit) + n = 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*/