From nobody Sun May 19 10:01:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1644405356422243.79804586911246; Wed, 9 Feb 2022 03:15:56 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.269001.462971 (Exim 4.92) (envelope-from ) id 1nHkwb-0003Mz-Ti; Wed, 09 Feb 2022 11:15:29 +0000 Received: by outflank-mailman (output) from mailman id 269001.462971; Wed, 09 Feb 2022 11:15:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nHkwb-0003Ms-Qj; Wed, 09 Feb 2022 11:15:29 +0000 Received: by outflank-mailman (input) for mailman id 269001; Wed, 09 Feb 2022 11:00:53 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nHkiT-0001on-PO for xen-devel@lists.xenproject.org; Wed, 09 Feb 2022 11:00:53 +0000 Received: from smtp1.irit.fr (smtp1.irit.fr [141.115.24.2]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8b930552-8997-11ec-8eb8-a37418f5ba1a; Wed, 09 Feb 2022 12:00:52 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8b930552-8997-11ec-8eb8-a37418f5ba1a From: To: Subject: [PATCH] x86: Use low memory size directly from Multiboot Date: Wed, 9 Feb 2022 12:00:50 +0100 Message-ID: <001301d81da4$4c993260$e5cb9720$@irit.fr> Content-Transfer-Encoding: quoted-printable Thread-Index: Adgdo3qWvijfwbqMRuiJMpwfi+U51A== Content-Language: en X-ZM-MESSAGEID: 1644405359691100001 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Previously, Xen used information from the BDA to detect the amount of available low memory. This does not work on some scenarios such as Coreboot, or when booting from Kexec on a UEFI system without CSM. Use the information directly supplied by Multiboot boot information instead. --- xen/arch/x86/boot/head.S | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index dd1bea0d10..31a0663e6d 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -524,33 +524,15 @@ trampoline_bios_setup: mov %ecx,%fs mov %ecx,%gs =20 - /* Set up trampoline segment 64k below EBDA */ - movzwl 0x40e,%ecx /* EBDA segment */ - cmp $0xa000,%ecx /* sanity check (high) */ - jae 0f - cmp $0x4000,%ecx /* sanity check (low) */ - jae 1f -0: - movzwl 0x413,%ecx /* use base memory size on failure */ - shl $10-4,%ecx -1: - /* - * Compare the value in the BDA with the information from the - * multiboot structure (if available) and use the smallest. - */ - cmp $0x100,%edx /* is the multiboot value too small? */ - jb 2f /* if so, do not use it */ - shl $10-4,%edx - cmp %ecx,%edx /* compare with BDA value */ - cmovb %edx,%ecx /* and use the smaller */ + /* Use lower memory size directly from Multiboot */ + mov %edx,%ecx + /* From arch/x86/smpboot.c: start_eip had better be page-aligned! */ + shr $2,%ecx =20 -2: /* Reserve memory for the trampoline and the low-memory stack. */ - sub $((TRAMPOLINE_SPACE+TRAMPOLINE_STACK_SPACE)>>4),%ecx + sub $((TRAMPOLINE_SPACE+TRAMPOLINE_STACK_SPACE)>>12),%ecx =20 - /* From arch/x86/smpboot.c: start_eip had better be page-aligned! */ - xor %cl, %cl - shl $4, %ecx + shl $12,%ecx mov %ecx,sym_esi(trampoline_phys) =20 trampoline_setup: --=20 2.25.1