From nobody Mon Feb 9 15:46:00 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=1578598429; cv=none; d=zohomail.com; s=zohoarc; b=ZjcrZ5zX2xLd2WyWXwBQYAVZmzQAcFo4l8QCL9EkFU06GcUx5/f4CwG8DSqiLPJNVWiMm8UTltthNjqQ+yvf+nvUbeNyYiz26KnYPzEy9oEFCgs91F66Xr2yUTN9Rcibn5biucMFWB0nuLVMyr8RaH6yX+Ci6sZrPmoRUIeA9wA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578598429; 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=G2h3fmmzKLBQ2qGThdI1LY2/yVHtUGf5zqfcjRNOeOQ=; b=F+Z1N2BdoARiwTh2oAbqWTDsGax9p3XZqJh5gOzUrmrrdC8IjQ/5okQetpQzTsvBc2LcLQPUsz9YdD/E4XcRi63qGVwoENuoYkQ0pkC8JBV2HU8HsnV/a3XHlIzVg9mBZQkG1zw47ZIWhga/skPc56Fp276GwFHgD7D06k0zOJU= 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 157859842967968.28151343524837; Thu, 9 Jan 2020 11:33:49 -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 1ipdYH-0001w5-9p; Thu, 09 Jan 2020 19:33:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipdYG-0001vt-R1 for xen-devel@lists.xenproject.org; Thu, 09 Jan 2020 19:33:04 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d5386ad4-3316-11ea-b89f-bc764e2007e4; Thu, 09 Jan 2020 19:32:54 +0000 (UTC) X-Inumbo-ID: d5386ad4-3316-11ea-b89f-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578598374; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=S0PnDIRPnnivkZtzB1RPCTwe6TcOz1Y0241PkWUJgLU=; b=ZOj5qAH0Dqw/2PbpP963aA1W+jtRClbs3EQjwRIwOvmn38DsanJAIOxh v4XcrTh7qhOSzVwV3ZVZYpseIpj5DCMe1ma9I+F5YMi52fpnELUx8oEti rR2NR4Tmj9qqRnIbDasRryVhIjxsgJwskg/0hqPuPfcUjX0BJokOQ0iDI w=; Authentication-Results: esa6.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 (esa6.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=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.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=esa6.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 (esa6.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=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: AFFgm29NDEXp+EmqkD7Dewug/IH2mIPbHS9RB/3yyT6dRa2DGobrfRFypdYu4I4CRUSaTZpVOw f8c7ko4NFbGwWX4EQD5hNUNKrwBN8HviP1aZA66s4TPLI70wAS1xMbWAnE+y2/D5ygqjsogyjW Qpvs4BYtiZUtnFnKzEquZPE59yBcCsL+BkXEpHdLQKZIWWzK8/90Mfr7D+DfQIWKdLpu2cVeDL IP+osGtpvOd/QNcJusTUQoE8OPXyv14O67pD1EYxPKWXWTLRw30aykJ/NKpo6HQf3M9Pk+Ki5a lyk= X-SBRS: 2.7 X-MesageID: 11138290 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,414,1571716800"; d="scan'208";a="11138290" From: Andrew Cooper To: Xen-devel Date: Thu, 9 Jan 2020 19:32:39 +0000 Message-ID: <20200109193241.14542-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200109193241.14542-1-andrew.cooper3@citrix.com> References: <20200109193241.14542-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 2/4] 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. The EFI side is further complicated by an attempt to cope with with l2_boot= map only being 4k long. This is undocumented, confusing, only works if Xen is = the single object wanting mapping. The pageables are common to both the MB and EFI builds, so simplify the EFI bootmap construction code to make exactly one identity-map of Xen, which now makes the two paths consistent. Comment both pieces of logic, explaining w= hat 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 Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 v2: * Extra BUILD_BUG_ON()'s --- xen/arch/x86/boot/head.S | 8 ++++++-- xen/arch/x86/efi/efi-boot.h | 20 +++++++++++++------- xen/arch/x86/xen.lds.S | 3 +++ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index d152af4542..0b75d33a25 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); } =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