From nobody Mon Feb 9 19:06:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1578326140; cv=none; d=zohomail.com; s=zohoarc; b=OrDTDWPxw6CjrUl7NqPS0hyOWRG1Lv4zxjQYHObXX60E3LCY9cfwdtGVkRAItTJhPY7HFBajEWsagNoL96zBBgoVlLQAO/z7jM2ztlqZHDOjmwENtGFU73CpsQzwq1Z445gJ1DyKj+T0L1CqxW/DJHiYT7A76YMnuhiC/qlK6s0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578326140; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Em5ZW5bJdRyfUHuz3iq0WeBHcTzcvcFAG9f2KoOtUas=; b=G/39eiOPiCxRBQGybdmMJ748rdHWv1fTnD46l7mSxOr+1Lhij2TO5ERuclT4KNR5BVui/1scs5npd0HF6K+fwMtwv+ztpDr9Ojk4MnD4Tl4JwCW9+YdU0eJrpUc88nOxuXHOUv26N4sqlVDblOvEMwEMQ9ZoDp1iaw88ja48OLc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1578326140628456.3755298280904; Mon, 6 Jan 2020 07:55:40 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ioUiW-0003wU-Qb; Mon, 06 Jan 2020 15:54:56 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ioUiV-0003vr-Uf for xen-devel@lists.xenproject.org; Mon, 06 Jan 2020 15:54:55 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id dcdb1204-309c-11ea-b6f1-bc764e2007e4; Mon, 06 Jan 2020 15:54:47 +0000 (UTC) X-Inumbo-ID: dcdb1204-309c-11ea-b6f1-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578326087; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CoPi2cu0FEnqJ+0mJtkSllKmwQGLHCI4qHXbgth2kPo=; b=SE6a04X+NUxNuu/GYgbx1pv4GwegiXKUUmtA21KLUmpkOfxnZTzfyb38 FokwEUgrmHlKFsgLPwV0IWlfjZBx4SXmWbaKiJ2fQ9ZDDdi21UCPrVLbP 5hskGAvo9YpG7WIKLLH2HWp2P0auhigJMX3MEwvg0rNzbiqDRavGnTg2c U=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 9sJA1sd1VP/qY3YdTOC3D6h6lSpOWTBuhkStlUMFNMLTc5QO4pLJdxvp1YiJcClOpY71WprMiz we8qh7sxEVtPgAyaAfJGkzCITbBFAPqyO6bv5eeNTaS6rHR4jxhppCWGu8+S7hptF+ORXz+hL0 QuZrv5axtBWDEwV+iBOVLZKPze5LS/ux2Ea4LEtlTL16xs//yxrCUHnEuGEe3aFjquWupV6Tkd QwS4rwzlbU/3SeJWsfFfFB2Lr9xifo5Xr0Goiiuk6VRQmhWN+WDV5YxHbZMupy7q1n3HBH+ngw txE= X-SBRS: 2.7 X-MesageID: 10655810 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,403,1571716800"; d="scan'208";a="10655810" From: Andrew Cooper To: Xen-devel Date: Mon, 6 Jan 2020 15:54:21 +0000 Message-ID: <20200106155423.9508-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200106155423.9508-1-andrew.cooper3@citrix.com> References: <20200106155423.9508-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 4/6] x86/boot: Clean up l?_bootmap[] construction 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: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The need for Xen to be identity mapped into the bootmap is not obvious, and differs between the MB and EFI boot paths. Furthermore, the EFI side is further complicated by spraying non-identity aliases into the mix. Simplify the EFI bootmap construction code to make exactly one identity-map= of Xen, which now matches the MB path. Comment both pieces of logic, explaini= ng what the mappings are needed for. Finally, leave a linker assert covering the fact that plenty of code blindly assumes that Xen is less that 16M. This wants fixing in due course. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 The MB path's dependency on Xen's identity mapping can be broken by having trampoline_boot_cpu_entry switch the alias of gdt_48 it uses. I took this approach first in an attempt to drop the bootmap entirely, but = it is incompatible with the EFI path, and would also work against other plans = to avoid using the trampoline during early boot. --- xen/arch/x86/boot/head.S | 8 ++++++-- xen/arch/x86/efi/efi-boot.h | 17 ++++++++++------- xen/arch/x86/xen.lds.S | 3 +++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 7ee4511e26..f7d273ca36 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -668,7 +668,11 @@ trampoline_setup: add %esi,sym_fs(__page_tables_start)-8(,%ecx,8) 2: loop 1b =20 - /* Initialize L2 boot-map/direct map page table entries (16MB). */ + /* + * Map Xen into the directmap (needed for early-boot pagetable + * handling/walking), and identity map Xen into bootmap (needed for + * the transition into long mode), using 2M superpages. + */ lea sym_esi(start),%ebx lea (1<> L2_PAGETABLE_SHIFT) + i; paddr_t addr =3D slot << L2_PAGETABLE_SHIFT; =20 l2_identmap[slot] =3D l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAGE_P= SE); - slot &=3D L2_PAGETABLE_ENTRIES - 1; l2_bootmap[slot] =3D l2e_from_paddr(addr, __PAGE_HYPERVISOR|_PAGE_= PSE); } - /* Initialise L3 boot-map page directory entries. */ - l3_bootmap[l3_table_offset(xen_phys_start)] =3D - l3e_from_paddr((UINTN)l2_bootmap, __PAGE_HYPERVISOR); - l3_bootmap[l3_table_offset(xen_phys_start + (8 << L2_PAGETABLE_SHIFT) = - 1)] =3D - l3e_from_paddr((UINTN)l2_bootmap, __PAGE_HYPERVISOR); + + /* Initialize L3 boot-map page directory entries. */ + for ( i =3D 0; i < 4; ++i ) + l3_bootmap[i] =3D l3e_from_paddr((UINTN)l2_bootmap + i * PAGE_SIZE, + __PAGE_HYPERVISOR); } =20 static void __init efi_arch_handle_module(struct file *file, const CHAR16 = *name, diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 111edb5360..7f82f64078 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -381,3 +381,6 @@ ASSERT((trampoline_end - trampoline_start) < TRAMPOLINE= _SPACE - MBI_SPACE_MIN, "not enough room for trampoline and mbi data") ASSERT((wakeup_stack - wakeup_stack_start) >=3D WAKEUP_STACK_MIN, "wakeup stack too small") + +/* Plenty of boot code assumes that Xen isn't larger than 16M. */ +ASSERT(_end - _start <=3D MB(16), "Xen too large for early-boot assumption= s") --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel