From nobody Tue Apr 16 08:01:51 2024 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=1578937867; cv=none; d=zohomail.com; s=zohoarc; b=duFAVUpFJxNq53yN3EFxCZQzJQoTtOiRggT5nq6ds1Qf9hfh4XIIFFBrSFzURWKfCwtZXGuAKFzL4FmpNcJotga0vsLaCFgwhE4ZRoHjLxcJIjwbGzSaYCsNTVcisJt/rB0xAJ6E8mhiJcQk/JQp4P4ohHEa1/xGyP6vYE83cH0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578937867; 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=ZcHT2MySxhnQot3qmGhSqzOoiHplMpkZvEipqWjaQDs=; b=dqXpePXo0iC4fziY1C2lICou0hDI1MI6yc7F17J/dcT7nCD/2q4q2S0M9TSz8r+irK+oR2zE9GshSa5ZgHK8XO8mjCG38t90pPMZuchkh6TiEOPE0cUQQSZ+/uR8D40f9mNCg5XIfUQxynURKc1hrM0gSaRz2grr1j68QWBQOG4= 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 157893786765949.76329056680697; Mon, 13 Jan 2020 09:51:07 -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 1ir3rH-0004kL-Ad; Mon, 13 Jan 2020 17:50:35 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ir3rG-0004ju-GZ for xen-devel@lists.xenproject.org; Mon, 13 Jan 2020 17:50:34 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2cfdac52-362d-11ea-a985-bc764e2007e4; Mon, 13 Jan 2020 17:50:25 +0000 (UTC) X-Inumbo-ID: 2cfdac52-362d-11ea-a985-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578937826; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=117UHAYYpxTrxhKBYnsM58UNz+IWDL/UM2oG7vR7jdA=; b=bYLkpe8BLF4SOBkFRsVxLFqxf8GwqEzfJTtGCiti4GQXxxLdW1k1m3i+ DyyjamE3k+P+zh9jWRpQyG3lZGeHGE1dP60Csiz/puDjUlpRW6FKOrDRp +FTY4kb8YYbKZ15vee/SkkwmTCF2IcbKrflMH2eIliDYvMxW629/BlKfo w=; Authentication-Results: esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.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=esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 2S9euDb51kxdjx0CJCi+ML6UDIgmubAP7PBehLpLveUCEn948xU/RznBspaMoNk8BGScY7fIBc sn9eIvKxTGB2SgNmRJIUln8R/9ZwrdGGmqzv9a996142ErMkrw5P6BdUYLEJtngVjImgh8nfWV k8P+JYyyvhX9zG4nfD5738LuEVRm7+TqQCsONOYKEwzzDyhZmkc/M9jLwcnzY1rc2dUvs+83pr /IQngR0RykCqGFz17A/GeF5+HTNky9atSX4UxeDOSkA6zt0IOX+R01dzQ+iK7jcAXgVxA766ZG S7Y= X-SBRS: 2.7 X-MesageID: 10861137 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,429,1571716800"; d="scan'208";a="10861137" From: Andrew Cooper To: Xen-devel Date: Mon, 13 Jan 2020 17:50:16 +0000 Message-ID: <20200113175020.32730-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200113175020.32730-1-andrew.cooper3@citrix.com> References: <20200113175020.32730-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/4] x86/boot: Rename l?_identmap to l?_directmap 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) Since c/s faa85d4fb3 "x86/boot: Don't map 0 during boot", l1_identmap no longer has an alias mapped at 0, meaning that none of the l?_identmap[] pagetables are actually an identity map. Rename them to l?_directmap, which avoids any kind of implication that they might be mapped at 0. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/boot/head.S | 2 +- xen/arch/x86/boot/x86_64.S | 22 +++++++++++----------- xen/arch/x86/efi/efi-boot.h | 8 ++++---- xen/arch/x86/setup.c | 6 +++--- xen/include/asm-x86/page.h | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index d246e374f1..aaf0e119db 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -678,7 +678,7 @@ trampoline_setup: shr $(L2_PAGETABLE_SHIFT-3),%ebx mov $8,%ecx 1: mov %eax,sym_fs(l2_bootmap)-8(%ebx,%ecx,8) - mov %eax,sym_fs(l2_identmap)-8(%ebx,%ecx,8) + mov %eax,sym_fs(l2_directmap)-8(%ebx,%ecx,8) sub $(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); + l2_directmap[slot] =3D l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAGE_= PSE); l2_bootmap[slot] =3D l2e_from_paddr(addr, __PAGE_HYPERVISOR|_PAGE_= PSE); } } diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 1b6ca4a47d..5bdc229bd6 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1031,7 +1031,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) for ( i =3D boot_e820.nr_map-1; i >=3D 0; i-- ) { uint64_t s, e, mask =3D (1UL << L2_PAGETABLE_SHIFT) - 1; - uint64_t end, limit =3D ARRAY_SIZE(l2_identmap) << L2_PAGETABLE_SH= IFT; + uint64_t end, limit =3D ARRAY_SIZE(l2_directmap) << L2_PAGETABLE_S= HIFT; =20 if ( boot_e820.map[i].type !=3D E820_RAM ) continue; @@ -1136,7 +1136,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) /* The only data mappings to be relocated are in the Xen area.= */ pl2e =3D __va(__pa(l2_xenmap)); /* - * Undo the temporary-hooking of the l1_identmap. __2M_text_s= tart + * Undo the temporary-hooking of the l1_directmap. __2M_text_= start * is contained in this PTE. */ BUG_ON(using_2M_mapping() && @@ -1349,7 +1349,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) /* Need to create mappings above PREBUILT_MAP_LIMIT. */ map_s =3D max_t(uint64_t, s, PREBUILT_MAP_LIMIT); map_e =3D min_t(uint64_t, e, - ARRAY_SIZE(l2_identmap) << L2_PAGETABLE_SHIFT); + ARRAY_SIZE(l2_directmap) << L2_PAGETABLE_SHIFT); =20 /* Pass mapped memory to allocator /before/ creating new mappings.= */ init_boot_pages(s, min(map_s, e)); diff --git a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h index 05a8b1efa6..4b9a4fa33f 100644 --- a/xen/include/asm-x86/page.h +++ b/xen/include/asm-x86/page.h @@ -293,7 +293,7 @@ extern unsigned int m2p_compat_vstart; extern l2_pgentry_t l2_xenmap[L2_PAGETABLE_ENTRIES], l2_bootmap[4*L2_PAGETABLE_ENTRIES]; extern l3_pgentry_t l3_bootmap[L3_PAGETABLE_ENTRIES]; -extern l2_pgentry_t l2_identmap[4*L2_PAGETABLE_ENTRIES]; +extern l2_pgentry_t l2_directmap[4*L2_PAGETABLE_ENTRIES]; extern l1_pgentry_t l1_fixmap[L1_PAGETABLE_ENTRIES]; void paging_init(void); void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t); --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue Apr 16 08:01:51 2024 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=1578937865; cv=none; d=zohomail.com; s=zohoarc; b=Me+E06O0bgdO8ww58TR2v2V2ZZA5SVlPw6zcqXZ3rdpSxDB19gkukrUt4dS8syZfLNtVizp7sAj3oJNtEvaLnazZL3U+6I/Djtui25EVIQsfaSr1Sg31g1iuN/z57nvOk8b2+1NN4OP0MIE51cHv9kghb3pMa40lZ1W9fPGgWMU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578937865; 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=C36r3GOjFN7yhUOLqOo85XoeQBT28Sq3El7NMTJHmlw=; b=J4XsrU73yt6U0ofbykRlcjKhtvVdb95UYKv30veunqINwFgx+oGhStt5oZxX8IVNeuqF0T3aPon6F7HUbtM66Ye0LdEZoO36gdBMCwUQcxCKs9K3oBcEAaf1raP2fMCt9zWH79FB/20jV6N1Tlaot1BozK0+nWyRSHyTeL4zl+o= 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 1578937865135726.2479331418956; Mon, 13 Jan 2020 09:51:05 -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 1ir3rC-0004iy-M5; Mon, 13 Jan 2020 17:50:30 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ir3rB-0004ip-9P for xen-devel@lists.xenproject.org; Mon, 13 Jan 2020 17:50:29 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 2cf5c5d2-362d-11ea-82bc-12813bfff9fa; Mon, 13 Jan 2020 17:50:24 +0000 (UTC) X-Inumbo-ID: 2cf5c5d2-362d-11ea-82bc-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578937824; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Aoc5mBtdig1TgC+bnbuIyB/xaMvCbrdPEgDzzP13MIg=; b=VX6gxqfVgYtutH1octOxluMfCxhnWzUFAfgi1dI5ZJHo8LY/bBGOuz1n Gd5SH+7D/pyi1Gqb26zau87un3pM14eYq847aGSnT/tHDbxwyqcr2uWo7 hG3W+krMt8i8L9ZQA87VVpKEO63VJtvPM27ZqJKb5UpGfSf1Lo2tp0S5b E=; Authentication-Results: esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.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=esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: qmAbKmQFTHC7gZHzoZmJtNrYulNdBiWd/es2iDfaf+6wUS0cFIC1rEAgy4d3p+38GieEHrrhS0 WVx/FYl+3ASHWxmJH/7WFt3YnOcNMGeEyJG+1uUfxwLXELRVdv7qZXZTKB99NSLzInuidoBfGi vD6AtaEkVVROIGHAD12rL9GuWGoWD7p2Qf+PSfblMFkGOod4zd7mkdhNPgB3S8bhjo3EHwZ+XA q3+GPdAGzmtPa+Bn9wmdkaOX4xJE3Z+np3D8vehv9G91PweCEqCveSNQFKoyM6GrwwbHyy+uTO Ti0= X-SBRS: 2.7 X-MesageID: 11215604 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,429,1571716800"; d="scan'208";a="11215604" From: Andrew Cooper To: Xen-devel Date: Mon, 13 Jan 2020 17:50:17 +0000 Message-ID: <20200113175020.32730-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200113175020.32730-1-andrew.cooper3@citrix.com> References: <20200113175020.32730-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/4] x86/page: Remove bifrucated PAGE_HYPERVISOR constant 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) Despite being vaguely aware, the difference between PAGE_HYPERVISOR in ASM = and C code has nevertheless caused several bugs I should have known better abou= t, and contributed to review confusion. There are exactly 4 uses of these constants in asm code (and one is shortly going to disappear). Instead of creating the constants which behave differently between ASM and C code, expose all the constants and use non-ambuguous non-NX ones in ASM. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/boot/head.S | 2 +- xen/arch/x86/boot/x86_64.S | 6 +++--- xen/include/asm-x86/x86_64/page.h | 7 ------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index aaf0e119db..c5acbf56ae 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -674,7 +674,7 @@ trampoline_setup: * the transition into long mode), using 2M superpages. */ lea sym_esi(start),%ebx - lea (1<=3D 0xa0 && pfn < 0xc0 - .quad (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR_UCMINUS | MAP_SMALL_PA= GES + .quad (pfn << PAGE_SHIFT) | __PAGE_HYPERVISOR_UCMINUS | _PAGE_GLOB= AL | MAP_SMALL_PAGES .else - .quad (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR | MAP_SMALL_PAGES + .quad (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR_RWX | MAP_SMALL_PAGES .endif pfn =3D pfn + 1 .endr @@ -89,7 +89,7 @@ GLOBAL(l2_xenmap) .quad 0 idx =3D 1 .rept 7 - .quad sym_offs(__image_base__) + (idx << L2_PAGETABLE_SHIFT) + (PA= GE_HYPERVISOR | _PAGE_PSE) + .quad sym_offs(__image_base__) + (idx << L2_PAGETABLE_SHIFT) + (PA= GE_HYPERVISOR_RWX | _PAGE_PSE) idx =3D idx + 1 .endr .fill L2_PAGETABLE_ENTRIES - 8, 8, 0 diff --git a/xen/include/asm-x86/x86_64/page.h b/xen/include/asm-x86/x86_64= /page.h index 4fe0205553..1a4af85469 100644 --- a/xen/include/asm-x86/x86_64/page.h +++ b/xen/include/asm-x86/x86_64/page.h @@ -172,18 +172,11 @@ static inline intpte_t put_pte_flags(unsigned int x) #define PAGE_HYPERVISOR_RX (__PAGE_HYPERVISOR_RX | _PAGE_GLOBAL) #define PAGE_HYPERVISOR_RWX (__PAGE_HYPERVISOR | _PAGE_GLOBAL) =20 -#ifdef __ASSEMBLY__ -/* Dependency on NX being available can't be expressed. */ -# define PAGE_HYPERVISOR PAGE_HYPERVISOR_RWX -# define PAGE_HYPERVISOR_UCMINUS (__PAGE_HYPERVISOR_UCMINUS | _PAGE_GLOBAL) -# define PAGE_HYPERVISOR_UC (__PAGE_HYPERVISOR_UC | _PAGE_GLOBAL) -#else # define PAGE_HYPERVISOR PAGE_HYPERVISOR_RW # define PAGE_HYPERVISOR_UCMINUS (__PAGE_HYPERVISOR_UCMINUS | \ _PAGE_GLOBAL | _PAGE_NX) # define PAGE_HYPERVISOR_UC (__PAGE_HYPERVISOR_UC | \ _PAGE_GLOBAL | _PAGE_NX) -#endif =20 #endif /* __X86_64_PAGE_H__ */ =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue Apr 16 08:01:51 2024 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=1578937877; cv=none; d=zohomail.com; s=zohoarc; b=URLCy+p0fcHnXEG7sb/R20bvFsOQ8AiK1lDoWqQBq0Sh9QieVaRxCSCivi/EA1di5k93uAq0NYZ6dmOdeRTAxzYN/hRwGXTApsAPdjmhg+Crhwe0ZnUQg3QsYIRn+zZVbIsa3xtsWfj1mMe8eRbK2woThgFfBN+5tNEGI1dEcrI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578937877; 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=1Gb73a6QK+oqNE9WSWnFHNtn9Z1QNuR6yh4l0yacqHw=; b=ZG11CseUQTdfOUf+qs6JM+OiKF5aQc7sDYBFjoCEuOfgccRSPZhmti219qp67O5RWDYpmmIJUQUFVIxN+BKGGntyzkVxcm66cRmc2pvbc4CWodP0kEmDEwNSGBpWfoRxHO+t61Buqh10PnLHytX1gZq00zWqIDhCcbn8Bvdsjg8= 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 1578937877342884.5964541832574; Mon, 13 Jan 2020 09:51:17 -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 1ir3rM-0004mb-Mi; Mon, 13 Jan 2020 17:50:40 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ir3rL-0004m8-Dc for xen-devel@lists.xenproject.org; Mon, 13 Jan 2020 17:50:39 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2d664d98-362d-11ea-ac27-bc764e2007e4; Mon, 13 Jan 2020 17:50:25 +0000 (UTC) X-Inumbo-ID: 2d664d98-362d-11ea-ac27-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578937825; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TXNkkm1esllR1GPmBUZSnJSmYucTp7Ig+/pRyHAQEUM=; b=dWS5iSDLPXMbG9A7OSyr68tWZy/CfXepTv9Oic/YLyZidfQfGr+0DOeB iyIKt8QvA5WefaJBs9Y+GJK5n0na+SDvRPF6GC3qjXJMVp1nZebvlcGbL w9Cw1DcrEaubKmKEMaZ4RUHOiUcsBiBzypDdtxafJWoALErDVAYjVNeXa 8=; 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: Ra6P98k+YyCVslSywp59yHtvVCN9JKT3eqyIVj/kBrWf7fwoIl9ZpxluL3ofbtFktG+okUZNel eNF0uM980o2R5gjwvnatGaz70sMeDkIvpu2NVn64TE2BVT5QLDDIedrFu56UiwMreBfSkeHv6r CBrzJ42YcoaV8tfLhMSzXDPwBBWyJi1o6Cw7tTYOe/sM6WapDBvwgpWJQFiZDX/R1iPO3gPIKt cMhFBT6fIPdQmXt/iGLe/Q/qcudkb/N8l+6Ssa9ScRqsPaKARnanTrFlyEWgdtA4HKe7O7zs+m SKw= X-SBRS: 2.7 X-MesageID: 11277185 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,429,1571716800"; d="scan'208";a="11277185" From: Andrew Cooper To: Xen-devel Date: Mon, 13 Jan 2020 17:50:18 +0000 Message-ID: <20200113175020.32730-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200113175020.32730-1-andrew.cooper3@citrix.com> References: <20200113175020.32730-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/4] x86/page: Remove bifurcated PAGE_HYPERVISOR constant 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) Despite being vaguely aware, the difference between PAGE_HYPERVISOR in ASM = and C code has nevertheless caused several bugs I should have known better abou= t, and contributed to review confusion. There are exactly 4 uses of these constants in asm code (and one is shortly going to disappear). Instead of creating the constants which behave differently between ASM and C code, expose all the constants and use non-ambiguous non-NX ones in ASM. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/boot/head.S | 2 +- xen/arch/x86/boot/x86_64.S | 6 +++--- xen/include/asm-x86/x86_64/page.h | 7 ------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index aaf0e119db..c5acbf56ae 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -674,7 +674,7 @@ trampoline_setup: * the transition into long mode), using 2M superpages. */ lea sym_esi(start),%ebx - lea (1<=3D 0xa0 && pfn < 0xc0 - .quad (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR_UCMINUS | MAP_SMALL_PA= GES + .quad (pfn << PAGE_SHIFT) | __PAGE_HYPERVISOR_UCMINUS | _PAGE_GLOB= AL | MAP_SMALL_PAGES .else - .quad (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR | MAP_SMALL_PAGES + .quad (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR_RWX | MAP_SMALL_PAGES .endif pfn =3D pfn + 1 .endr @@ -89,7 +89,7 @@ GLOBAL(l2_xenmap) .quad 0 idx =3D 1 .rept 7 - .quad sym_offs(__image_base__) + (idx << L2_PAGETABLE_SHIFT) + (PA= GE_HYPERVISOR | _PAGE_PSE) + .quad sym_offs(__image_base__) + (idx << L2_PAGETABLE_SHIFT) + (PA= GE_HYPERVISOR_RWX | _PAGE_PSE) idx =3D idx + 1 .endr .fill L2_PAGETABLE_ENTRIES - 8, 8, 0 diff --git a/xen/include/asm-x86/x86_64/page.h b/xen/include/asm-x86/x86_64= /page.h index 4fe0205553..1a4af85469 100644 --- a/xen/include/asm-x86/x86_64/page.h +++ b/xen/include/asm-x86/x86_64/page.h @@ -172,18 +172,11 @@ static inline intpte_t put_pte_flags(unsigned int x) #define PAGE_HYPERVISOR_RX (__PAGE_HYPERVISOR_RX | _PAGE_GLOBAL) #define PAGE_HYPERVISOR_RWX (__PAGE_HYPERVISOR | _PAGE_GLOBAL) =20 -#ifdef __ASSEMBLY__ -/* Dependency on NX being available can't be expressed. */ -# define PAGE_HYPERVISOR PAGE_HYPERVISOR_RWX -# define PAGE_HYPERVISOR_UCMINUS (__PAGE_HYPERVISOR_UCMINUS | _PAGE_GLOBAL) -# define PAGE_HYPERVISOR_UC (__PAGE_HYPERVISOR_UC | _PAGE_GLOBAL) -#else # define PAGE_HYPERVISOR PAGE_HYPERVISOR_RW # define PAGE_HYPERVISOR_UCMINUS (__PAGE_HYPERVISOR_UCMINUS | \ _PAGE_GLOBAL | _PAGE_NX) # define PAGE_HYPERVISOR_UC (__PAGE_HYPERVISOR_UC | \ _PAGE_GLOBAL | _PAGE_NX) -#endif =20 #endif /* __X86_64_PAGE_H__ */ =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue Apr 16 08:01:51 2024 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=1578937876; cv=none; d=zohomail.com; s=zohoarc; b=daxvU3Pk0LYt4LxBpjzy8kO3ZSoRciDxY37M3HJ1p+i2bt+YDkYLvHEM+zYtIIxCTCJiWoFrUZx1i/I9Kk06Rz+z/bAqxwhN59Dr/Wapr4eoxFUoEmThk+bwhQiEmzKD0QKZg8hj66bqGJh62athetFZuzBAcjDiaQEqnxAFy38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578937876; 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=QRy9V4wTZ/7K7BQk8ZQlC/RyEBPcy5Gc95koqvD6uwo=; b=lZxC/OI/t9lOEAvNS6sOWF43LpX8IbNpYQBL+j0ZZRQdELsHelOeygGfKIJEAKIlKj8jsXdGQvEDRe24+s5UQj19y7gMU5Des+7uEd9cH3L61AJLdqQ/HEeGdsWIPql6XQ8qUPDOgjkESGQUi302tyFJGkSmOCgvhBI4aMQXvkk= 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 1578937876133350.72815414220827; Mon, 13 Jan 2020 09:51:16 -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 1ir3rR-0004p5-7B; Mon, 13 Jan 2020 17:50:45 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ir3rQ-0004om-Do for xen-devel@lists.xenproject.org; Mon, 13 Jan 2020 17:50:44 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 32ebb62c-362d-11ea-ac27-bc764e2007e4; Mon, 13 Jan 2020 17:50:34 +0000 (UTC) X-Inumbo-ID: 32ebb62c-362d-11ea-ac27-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578937834; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1hOwsR/6+sYgG8nrmY4nkY56XvJYU4Dpm0KxAXspSFc=; b=Mi00HWEKCMMh+zmKbyMC8tEl8TmFPwZh218ikpzuu8OchFtasQakj06n n25BBw2Z+v4vln9Ns+IwWf1jizDoHjuOwHtZ7U1Mg+dBtiD1UTnLfQh4r il7NT4cNNppQFXzSxBnyzxdNvQx7Iiq1ZyctUorXMAx/RjcDt5aQEdjNY 8=; 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: xeMPBf2IE/PwJvyLW245DuviZGMJVC5zlYiEo7fKTsTGf0oOgYQphe23+MmwsikKk815XXjloZ rMoTSaB36vEr/AlOfPgZldDSzLWA9m15SFYLqnBJPvVHoTuKwyGX6u6h2WxpCUT54umocU7YFl CHBNlRuZdi6dSdL55QN53lJA7FF3HxLcx8+N7+84j9ojKvH2V0jJ5rDlJObSEqxAn2NvG9g27j XdWB1dx1hw3CJRP9ESbSbvtEgn4xb8q/QK9rcuklE6F4WNTNi+n0/7ojVmCXjQYR4lAM8FmkSC iZ4= X-SBRS: 2.7 X-MesageID: 11277186 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,429,1571716800"; d="scan'208";a="11277186" From: Andrew Cooper To: Xen-devel Date: Mon, 13 Jan 2020 17:50:19 +0000 Message-ID: <20200113175020.32730-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200113175020.32730-1-andrew.cooper3@citrix.com> References: <20200113175020.32730-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 3/4] x86/boot: Create the l2_xenmap[] mappings dynamically 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 build-time construction of l2_xenmap[] imposes an arbitrary limit of 16M total, which is a limit looking to be lifted. Move l2_xenmap[] into the bss, and adjust both the BIOS and EFI paths to fi= ll it in dynamically, based on the final linked size of Xen. For current buil= ds, this reduces the number of .text/etc mappings from 7 to 4. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 In principle, the non-EFI case could be made to work by having a post-link script fill in a suitable number of _PAGE_PRESENT entries in l2_xenmap[]. This doesn't work for the EFI case, because pagetable relocation is instead triggered on the ad-hoc relocation table, which would require the _PAGE_PRESENT references to be in place before the link takes place. --- xen/arch/x86/boot/head.S | 14 ++++++++++++++ xen/arch/x86/boot/x86_64.S | 23 ++++++++--------------- xen/arch/x86/efi/efi-boot.h | 14 ++++++++++++++ xen/arch/x86/xen.lds.S | 3 +++ 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index c5acbf56ae..94bed4a2d3 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -668,6 +668,20 @@ trampoline_setup: add %esi,sym_fs(__page_tables_start)-8(,%ecx,8) 2: loop 1b =20 + /* Map Xen into the higher mappings using 2M superpages. */ + lea _PAGE_PSE + PAGE_HYPERVISOR_RWX + sym_esi(_start), %eax + mov $sym_offs(_start), %ecx /* %eax =3D PTE to write = */ + mov $sym_offs(_end - 1), %edx + shr $L2_PAGETABLE_SHIFT, %ecx /* %ecx =3D First slot to writ= e */ + shr $L2_PAGETABLE_SHIFT, %edx /* %edx =3D Final slot to writ= e */ + +1: mov %eax, sym_offs(l2_xenmap)(%esi, %ecx, 8) + add $1, %ecx + add $1 << L2_PAGETABLE_SHIFT, %eax + + cmp %edx, %ecx + jbe 1b + /* * Map Xen into the directmap (needed for early-boot pagetable * handling/walking), and identity map Xen into bootmap (needed for diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S index aabf561b23..e63bece460 100644 --- a/xen/arch/x86/boot/x86_64.S +++ b/xen/arch/x86/boot/x86_64.S @@ -43,6 +43,14 @@ multiboot_ptr: GLOBAL(stack_start) .quad cpu0_stack + STACK_SIZE - CPUINFO_sizeof =20 + .section .bss.page_aligned, "aw", @nobits + .align PAGE_SIZE, 0 + +/* L2 mapping the Xen text/data/bss region. Uses 1x 4k page. */ +GLOBAL(l2_xenmap) + .fill L2_PAGETABLE_ENTRIES, 8, 0 + .size l2_xenmap, . - l2_xenmap + .section .data.page_aligned, "aw", @progbits .align PAGE_SIZE, 0 /* @@ -80,21 +88,6 @@ GLOBAL(l2_directmap) .fill 4 * L2_PAGETABLE_ENTRIES - 1, 8, 0 .size l2_directmap, . - l2_directmap =20 -/* - * L2 mapping the 1GB Xen text/data/bss region. At boot it maps 16MB from - * __image_base__, and is modified when Xen relocates itself. Uses 1x 4k - * page. - */ -GLOBAL(l2_xenmap) - .quad 0 - idx =3D 1 - .rept 7 - .quad sym_offs(__image_base__) + (idx << L2_PAGETABLE_SHIFT) + (PA= GE_HYPERVISOR_RWX | _PAGE_PSE) - idx =3D idx + 1 - .endr - .fill L2_PAGETABLE_ENTRIES - 8, 8, 0 - .size l2_xenmap, . - l2_xenmap - /* L2 mapping the fixmap. Uses 1x 4k page. */ l2_fixmap: idx =3D 0 diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 50d1499867..e750db6f5c 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -585,6 +585,20 @@ static void __init efi_arch_memory_setup(void) if ( !efi_enabled(EFI_LOADER) ) return; =20 + /* + * Map Xen into the higher mappings, using 2M superpages. + * + * NB: We are currently in physical mode, so a RIP-relative relocation + * against _start/_end gets their position as placed by the bootloader, + * not as expected in the final build. This has arbitrary 2M alignmen= t, + * so subtract xen_phys_start to get the appropriate slots in l2_xenma= p[]. + */ + for ( i =3D l2_table_offset((UINTN)_start - xen_phys_start); + i <=3D l2_table_offset((UINTN)_end - 1 - xen_phys_start); ++i ) + l2_xenmap[i] =3D + l2e_from_paddr(xen_phys_start + (i << L2_PAGETABLE_SHIFT), + PAGE_HYPERVISOR_RWX | _PAGE_PSE); + /* Check that there is at least 4G of mapping space in l2_*map[] */ BUILD_BUG_ON((sizeof(l2_bootmap) / L2_PAGETABLE_ENTRIES) < 4); BUILD_BUG_ON((sizeof(l2_directmap) / L2_PAGETABLE_ENTRIES) < 4); diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 7f82f64078..7c351b9df3 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -359,6 +359,9 @@ ASSERT(__image_base__ > XEN_VIRT_START | ASSERT(kexec_reloc_size - kexec_reloc <=3D PAGE_SIZE, "kexec_reloc is too = large") #endif =20 +/* The Multiboot setup paths depend on this to simplify superpage PTE crea= tion. */ +ASSERT(IS_ALIGNED(_start, MB(2)), "_start misaligned") + ASSERT(IS_ALIGNED(__2M_text_end, SECTION_ALIGN), "__2M_text_end misali= gned") ASSERT(IS_ALIGNED(__2M_rodata_start, SECTION_ALIGN), "__2M_rodata_start mi= saligned") ASSERT(IS_ALIGNED(__2M_rodata_end, SECTION_ALIGN), "__2M_rodata_end misa= ligned") --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue Apr 16 08:01:51 2024 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=1578937865; cv=none; d=zohomail.com; s=zohoarc; b=YMC2ixeeWf7oa3EvznR162V1iFcpbueKayqae8KZ3y6ucWeIUG7Ab8HkeXB6PLdaTX/H+ZhpOzP/F/XjHXugqHexuoU/5nXOFe0d7sE2cfAXNgx7j9n/TfJU78PPEeGvbiyJw46Dzhu/vRH9snxL3KGSq8OhVTpK/mPD2NRk4a4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578937865; 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=2fnfghhLca77hVzDRZ7tROvtTWMnhCBfA65bXNdjf7o=; b=jYLTAj5POOu9cc6ll0OhglwXHZvLNaOyRJa2bXJp1UCUBFtDKmZ9OQKaxwe4KYPe+vGSQuh61J+wOLkfzhh9jUgJdqags0sgnNN37pOm7HJ8YG7W+/BE/oGpdgXa67sGwRn3LFyXGXx7zyAJrHM0+IEd5rs0K6PZRuark49AUrY= 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 1578937865268825.7481909281541; Mon, 13 Jan 2020 09:51:05 -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 1ir3rH-0004k8-0Z; Mon, 13 Jan 2020 17:50:35 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ir3rG-0004jo-8z for xen-devel@lists.xenproject.org; Mon, 13 Jan 2020 17:50:34 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 2dff957a-362d-11ea-82bc-12813bfff9fa; Mon, 13 Jan 2020 17:50:26 +0000 (UTC) X-Inumbo-ID: 2dff957a-362d-11ea-82bc-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578937827; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=blPvpV4Vdhr1Ml+c0tj+WRYdVJH/SlanDf9zB304Cr0=; b=PyaonYw841JkRisfDlKX0r4v8FOP2l7WZyqASw2b4m0npCwSmKISIqk/ tUR6X1MkHfuPL75Gb487Wk061DzGJ/2EMBrqnyDTA/WovMqVtxmNDm5w6 FZz1Okx8OmfujskK8uYFIsgWfZ6qewybR1yyCIm6zAe+Vjf4YCceJEsHX 4=; Authentication-Results: esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.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=esa3.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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: dEOIVgsMGXwDsFMlshuJ+GkwkUIrqqn7JqLBaDK9VMvfsCCkKOPKreqvGvxCDBGF/dHd2m14OU haMUwuxfXdahumRLvnEQAVcmC7h3MlM8kTJGPI0ZKCdCdpgkAS6566Yu7xxa+KRTQ3g/AumxW6 Ksj3+o5Xjc7cYqY8MG5Mcf0xa190JKMArCY6gCnc9KMRw6JNqAi8WdQbptmD0u1ngGBT21+lC+ k8d1g3f4xWfRAgXw2Tb2uDeZllZtMSUqkkTm8Rc6XFA5ISePVOZQgeHqnckdWvwep2NuJU0+Nu cBo= X-SBRS: 2.7 X-MesageID: 10841135 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,429,1571716800"; d="scan'208";a="10841135" From: Andrew Cooper To: Xen-devel Date: Mon, 13 Jan 2020 17:50:20 +0000 Message-ID: <20200113175020.32730-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200113175020.32730-1-andrew.cooper3@citrix.com> References: <20200113175020.32730-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 4/4] x86/boot: Size the boot/directmap mappings dynamically 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) ... rather than presuming that 16M will do. With this fixed, Xen is now capable of booting even when its compiled size is larger than 16M. On the EFI side, use l2e_add_flags() to reduce the code-generation overhead= of using l2e_from_paddr() twice. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 Can be tested by trying to boot with: diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 759827a19a..fa83a9a28f 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -52,6 +52,8 @@ #include #include +static uint8_t __used big_data[MB(16)] =3D { 42, }; + /* opt_nosmp: If true, secondary processors are ignored. */ static bool __initdata opt_nosmp; boolean_param("nosmp", opt_nosmp); Before this series, Xen will triple fault in one of two places (both on the transition to Xen's high mappings), both ultimately because of cpu0_stack[] getting shifted off the top of the mappings. --- xen/arch/x86/boot/head.S | 21 +++++++++++++-------- xen/arch/x86/efi/efi-boot.h | 23 ++++++++++++++++++----- xen/arch/x86/xen.lds.S | 3 --- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 94bed4a2d3..eda3161fb1 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -687,14 +687,19 @@ trampoline_setup: * 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) & (4 * L2_PAGETABLE_ENTRIES - 1)) + + for ( i =3D l2_4G_offset(_start); + i <=3D l2_4G_offset(_end - 1); ++i ) { - unsigned int slot =3D (xen_phys_start >> L2_PAGETABLE_SHIFT) + i; - paddr_t addr =3D slot << L2_PAGETABLE_SHIFT; + l2_pgentry_t pte =3D l2e_from_paddr(i << L2_PAGETABLE_SHIFT, + __PAGE_HYPERVISOR | _PAGE_PSE); + + l2_bootmap[i] =3D pte; + + /* Bootmap RWX/Non-global. Directmap RW/Global. */ + l2e_add_flags(pte, PAGE_HYPERVISOR); =20 - l2_directmap[slot] =3D l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAGE_= PSE); - l2_bootmap[slot] =3D l2e_from_paddr(addr, __PAGE_HYPERVISOR|_PAGE_= PSE); + l2_directmap[i] =3D pte; } +#undef l2_4G_offset } =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 7c351b9df3..a71853a856 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -384,6 +384,3 @@ 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