From nobody Tue May 7 09:28:47 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1571888810; cv=none; d=zoho.com; s=zohoarc; b=k2pss7E03UeLsNPeVJh+yJyqFS5D9Pe9KVPvLwjYMuqdC375Gzw+jlo+PrwI8Jhfg0GxlA1oS/KBjOGoFNAhdcXIs/y4TE8S/aI5DEcmGcfzelhzLQamQIGcDjiGQshWjba9WqyL9yGVRhSyVWJJ0EZeyU+hVjpvr0E8Jt/5o0g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571888810; 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=1ipVa2VnJa9utGq9TJslsGM16O7TmXZts12ieo8yb9U=; b=iD7SYYV4lt1x/IJ+jWP0dHUcifjjxnHzt6xtWeKGU6fz6sTWi1VIu6iWx08quCQJFTNkQIvWK/m/285m6RHyY/aXZi1OS+r1z/r6xQtQrBqFvuh80tHKkIHgFuFVT1IKo9hkoI8KoZ8aWsiu4yF1CA4cMkLAHuZN5SH9OzH7mPQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) 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 15718888099281000.0972737275799; Wed, 23 Oct 2019 20:46:49 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iNU3t-0003fe-G4; Thu, 24 Oct 2019 03:45:21 +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 1iNU3s-0003fP-Jm for xen-devel@lists.xenproject.org; Thu, 24 Oct 2019 03:45:20 +0000 Received: from out2-smtp.messagingengine.com (unknown [66.111.4.26]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id afb7c4a0-f610-11e9-9494-12813bfff9fa; Thu, 24 Oct 2019 03:45:14 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id AD6A92134B; Wed, 23 Oct 2019 23:45:13 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Wed, 23 Oct 2019 23:45:13 -0400 Received: from localhost.localdomain (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id B7B5F80065; Wed, 23 Oct 2019 23:45:12 -0400 (EDT) X-Inumbo-ID: afb7c4a0-f610-11e9-9494-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=lgZCu5yV+InqhKNSR1+N8kS9ueRzlky1xKj+fUwK+ R0=; b=EO5V3vVC/OaMQtIMjtYIomfQkQf8Y0mpYKjPkaYkL7//wIzZqG0/MeRxI JhNgFTJCwupA0PXEp2+S1lt2pu3bLhl2ArCwFMoGYbmoiGEtKYFiuJIzl1v/51VM azOdtX52aaff9F6a3MBHip5Gj0tRfLiDNR/DklzxW63/CeXoHpnwl1wF5UAf2jLz FMKfbAnA5+CXY2TSEljI+s8s/ZH7kgUk3FOfKkhnFgxtJNw4ZMCydUsgtuNGsMzv uZtVoeXQJcZvmzOmKESPZF+sLkYTAJZw0VYx/09rT4YNukqEE+riSOLiUb+Ra3Ru CbZ0bvQBP+eQrWg4w+Z03u3to4Lkg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrledtgdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucfkphepledurdeihedrfeegrdef feenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghrvghksehinhhvihhsihgslh gvthhhihhnghhslhgrsgdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Date: Thu, 24 Oct 2019 05:45:03 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v4 1/3] efi: remove old SetVirtualAddressMap() arrangement 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 , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Jan Beulich Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Remove unused (#ifdef-ed out) code. Reviving it in its current shape won't fly because: - SetVirtualAddressMap() needs to be called with 1:1 mapping, which isn't the case at this time - it uses directmap, which may go away soon - it uses directmap, which is mapped with NX, breaking EfiRuntimeServicesC= ode No functional change. Signed-off-by: Marek Marczykowski-G=C3=B3recki Acked-by: Andrew Cooper Acked-by: Jan Beulich Tested-by: Jason Andryuk Tested-by: Marek Marczykowski-G=C3=B3recki --- xen/common/efi/boot.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 7919378..cddf3de 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -29,9 +29,6 @@ #undef __ASSEMBLY__ #endif =20 -/* Using SetVirtualAddressMap() is incompatible with kexec: */ -#undef USE_SET_VIRTUAL_ADDRESS_MAP - #define EFI_REVISION(major, minor) (((major) << 16) | (minor)) =20 #define SMBIOS3_TABLE_GUID \ @@ -1099,9 +1096,6 @@ static void __init efi_exit_boot(EFI_HANDLE ImageHand= le, EFI_SYSTEM_TABLE *Syste =20 /* Adjust pointers into EFI. */ efi_ct =3D (void *)efi_ct + DIRECTMAP_VIRT_START; -#ifdef USE_SET_VIRTUAL_ADDRESS_MAP - efi_rs =3D (void *)efi_rs + DIRECTMAP_VIRT_START; -#endif efi_memmap =3D (void *)efi_memmap + DIRECTMAP_VIRT_START; efi_fw_vendor =3D (void *)efi_fw_vendor + DIRECTMAP_VIRT_START; } @@ -1422,7 +1416,6 @@ static int __init parse_efi_param(const char *s) } custom_param("efi", parse_efi_param); =20 -#ifndef USE_SET_VIRTUAL_ADDRESS_MAP static __init void copy_mapping(unsigned long mfn, unsigned long end, bool (*is_valid)(unsigned long smfn, unsigned long emfn)) @@ -1466,7 +1459,6 @@ static bool __init rt_range_valid(unsigned long smfn,= unsigned long emfn) { return true; } -#endif =20 #define INVALID_VIRTUAL_ADDRESS (0xBAAADUL << \ (EFI_PAGE_SHIFT + BITS_PER_LONG - 32)) @@ -1474,13 +1466,11 @@ static bool __init rt_range_valid(unsigned long smf= n, unsigned long emfn) void __init efi_init_memory(void) { unsigned int i; -#ifndef USE_SET_VIRTUAL_ADDRESS_MAP struct rt_extra { struct rt_extra *next; unsigned long smfn, emfn; unsigned int prot; } *extra, *extra_head =3D NULL; -#endif =20 free_ebmalloc_unused_mem(); =20 @@ -1563,7 +1553,6 @@ void __init efi_init_memory(void) printk(XENLOG_ERR "Could not map MFNs %#lx-%#lx\n", smfn, emfn - 1); } -#ifndef USE_SET_VIRTUAL_ADDRESS_MAP else if ( !((desc->PhysicalStart + len - 1) >> (VADDR_BITS - 1)) && (extra =3D xmalloc(struct rt_extra)) !=3D NULL ) { @@ -1574,12 +1563,8 @@ void __init efi_init_memory(void) extra_head =3D extra; desc->VirtualStart =3D desc->PhysicalStart; } -#endif else { -#ifdef USE_SET_VIRTUAL_ADDRESS_MAP - /* XXX allocate e.g. down from FIXADDR_START */ -#endif printk(XENLOG_ERR "No mapping for MFNs %#lx-%#lx\n", smfn, emfn - 1); } @@ -1591,10 +1576,6 @@ void __init efi_init_memory(void) return; } =20 -#ifdef USE_SET_VIRTUAL_ADDRESS_MAP - efi_rs->SetVirtualAddressMap(efi_memmap_size, efi_mdesc_size, - mdesc_ver, efi_memmap); -#else /* Set up 1:1 page tables to do runtime calls in "physical" mode. */ efi_l4_pgtable =3D alloc_xen_pagetable(); BUG_ON(!efi_l4_pgtable); @@ -1680,6 +1661,5 @@ void __init efi_init_memory(void) for ( i =3D l4_table_offset(HYPERVISOR_VIRT_START); i < l4_table_offset(DIRECTMAP_VIRT_END); ++i ) efi_l4_pgtable[i] =3D idle_pg_table[i]; -#endif } #endif --=20 git-series 0.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue May 7 09:28:47 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1571888811; cv=none; d=zoho.com; s=zohoarc; b=QUfU//0Ka8moh6C4zN4vgSyaRGtD//sxqG8iz/6j/A9ZKBmRn5jcCTvdL2+4WQ7PEO/tpROiQ/aAn2TQNbDHi7fAINze9cmbzl8x1xxWiRfVuwlVpB8wErLJmJT6LRiiH7d6PcXUns1tG1wNEz0d6onRNZ6WTeCFxC9+9fReVyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571888811; 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=6fUiaT8Xdl7x0idb6LEi6f4hGxiL0pge/AbQ3G2JX+E=; b=WtE4eTx/OjziRZv0Zr4pOuCbYiTIWHSgeStNN4gfRHjvffQUAsPH1Lfjvbnx7WM176A2oKgWKTMidX+gnyt8gKgQdDgeG5EgWKTXQigAWJe6r7rFUW0aqyToI2VQxMtSqiRnU09uuoyuAA3WdzzLKmIOfHEX6QIEpXUxwwOhRp0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) 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 1571888811678549.0040596505945; Wed, 23 Oct 2019 20:46:51 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iNU3t-0003fY-79; Thu, 24 Oct 2019 03:45:21 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iNU3s-0003fO-AJ for xen-devel@lists.xenproject.org; Thu, 24 Oct 2019 03:45:20 +0000 Received: from new2-smtp.messagingengine.com (unknown [66.111.4.224]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b07bc210-f610-11e9-beca-bc764e2007e4; Thu, 24 Oct 2019 03:45:15 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id 29D34708B; Wed, 23 Oct 2019 23:45:15 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Wed, 23 Oct 2019 23:45:15 -0400 Received: from localhost.localdomain (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id 930C880066; Wed, 23 Oct 2019 23:45:13 -0400 (EDT) X-Inumbo-ID: b07bc210-f610-11e9-beca-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=Rnf1HlA5KdCns/sgMtkx8jI7lpGa2YVdg56M8DgBw kM=; b=G9WBXuaRcqtifHlZUdiJbMKYcp39rPr89G1QUIVwDdILbf/6oxUD6UUVw CtBhz42tqDs/rJ+W0MP7Isrxd8xJmoYbseGdKpChmj+QCZihkUGBeCLoqMvoQ8pr 2koYt9sRcd2RJ9/tqInHD3IczzD0fnLSE2h/ua0s/G6I66sZ+AdmW+ZYXDd/sBx6 iruOuVCAGn2LdDSfCv9vnf5NUL2w70BRA8mDq2Oi7mtvIvnO3sa9qH9rvLm+dM8I t9esZUz3fUvQ5jP9I7CFzO3BXDjOJ2tAAZu39zX0clwSChtQQUVOcNP0RGXwpYDa IhpfTPHNgZNg2cl1e1irq/CDNeBTA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrledtgdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucfkphepledurdeihedrfeegrdef feenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghrvghksehinhhvihhsihgslh gvthhhihhnghhslhgrsgdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Date: Thu, 24 Oct 2019 05:45:04 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v4 2/3] xen/efi: optionally call SetVirtualAddressMap() 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: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Tim Deegan , Julien Grall , Jan Beulich Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Some UEFI implementations are not happy about lack of SetVirtualAddressMap() call. Likely abuse the address map change notification to do things beyond the necessary ConvertPointer() calls. Specifically, wihtout the SetVirtualAddressMap() call, some access EfiBootServices{Code,Data}, or even totally unmapped areas. Example crash of GetVariable() call on Thinkpad W540: Xen call trace: [<0000000000000080>] 0000000000000080 [<8c2b0398e0000daa>] 8c2b0398e0000daa Pagetable walk from ffffffff858483a1: L4[0x1ff] =3D 0000000000000000 ffffffffffffffff **************************************** Panic on CPU 0: FATAL PAGE FAULT [error_code=3D0002] Faulting linear address: ffffffff858483a1 **************************************** Fix this by calling SetVirtualAddressMap() runtime service, giving it 1:1 map for areas marked as needed during runtime. The address space in which EFI runtime services are called is unchanged, but UEFI view of it may be. Since it's fairly late in Xen 4.13 development cycle, disable it by default and hide behind EXPERT. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jan Beulich Tested-by: Jason Andryuk Tested-by: Marek Marczykowski-G=C3=B3recki --- Changes in v2: - call SetVirtualAddressMap() before adjusting efi pointers; especially efi_memmap at this point still needs to use physical address, not a directmap one Changes in v3: - clarify impact (or rather: lack of it) on kexec, drop !KEXEC dependency. Changes in v4: - update commit message - adjust comment - rename config option to add EFI_ prefix --- xen/common/Kconfig | 10 ++++++++++ xen/common/efi/boot.c | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 16829f6..549a7d5 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -88,6 +88,16 @@ config KEXEC =20 If unsure, say Y. =20 +config EFI_SET_VIRTUAL_ADDRESS_MAP + bool "EFI: call SetVirtualAddressMap()" if EXPERT =3D "y" + ---help--- + Call EFI SetVirtualAddressMap() runtime service to setup memory map = for + further runtime services. According to UEFI spec, it isn't strictly + necessary, but many UEFI implementations misbehave when this call is + missing. + + If unsure, say N. + config XENOPROF def_bool y prompt "Xen Oprofile Support" if EXPERT =3D "y" diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index cddf3de..9debc5b 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -1056,11 +1056,17 @@ static void __init efi_set_gop_mode(EFI_GRAPHICS_OU= TPUT_PROTOCOL *gop, UINTN gop efi_arch_video_init(gop, info_size, mode_info); } =20 +#define INVALID_VIRTUAL_ADDRESS (0xBAAADUL << \ + (EFI_PAGE_SHIFT + BITS_PER_LONG - 32)) + static void __init efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE = *SystemTable) { EFI_STATUS status; UINTN info_size =3D 0, map_key; bool retry; +#ifdef CONFIG_EFI_SET_VIRTUAL_ADDRESS_MAP + unsigned int i; +#endif =20 efi_bs->GetMemoryMap(&info_size, NULL, &map_key, &efi_mdesc_size, &mdesc_ver); @@ -1094,6 +1100,26 @@ static void __init efi_exit_boot(EFI_HANDLE ImageHan= dle, EFI_SYSTEM_TABLE *Syste if ( EFI_ERROR(status) ) PrintErrMesg(L"Cannot exit boot services", status); =20 +#ifdef CONFIG_EFI_SET_VIRTUAL_ADDRESS_MAP + for ( i =3D 0; i < efi_memmap_size; i +=3D efi_mdesc_size ) + { + EFI_MEMORY_DESCRIPTOR *desc =3D efi_memmap + i; + + if ( desc->Attribute & EFI_MEMORY_RUNTIME ) + desc->VirtualStart =3D desc->PhysicalStart; + else + desc->VirtualStart =3D INVALID_VIRTUAL_ADDRESS; + } + status =3D efi_rs->SetVirtualAddressMap(efi_memmap_size, efi_mdesc_siz= e, + mdesc_ver, efi_memmap); + if ( status !=3D EFI_SUCCESS ) + { + printk(XENLOG_ERR "EFI: SetVirtualAddressMap() failed (%#lx), disa= bling runtime services\n", + status); + __clear_bit(EFI_RS, &efi_flags); + } +#endif + /* Adjust pointers into EFI. */ efi_ct =3D (void *)efi_ct + DIRECTMAP_VIRT_START; efi_memmap =3D (void *)efi_memmap + DIRECTMAP_VIRT_START; @@ -1460,8 +1486,6 @@ static bool __init rt_range_valid(unsigned long smfn,= unsigned long emfn) return true; } =20 -#define INVALID_VIRTUAL_ADDRESS (0xBAAADUL << \ - (EFI_PAGE_SHIFT + BITS_PER_LONG - 32)) =20 void __init efi_init_memory(void) { @@ -1576,7 +1600,10 @@ void __init efi_init_memory(void) return; } =20 - /* Set up 1:1 page tables to do runtime calls in "physical" mode. */ + /* + * Set up 1:1 page tables for runtime calls. See SetVirtualAddressMap(= ) in + * efi_exit_boot(). + */ efi_l4_pgtable =3D alloc_xen_pagetable(); BUG_ON(!efi_l4_pgtable); clear_page(efi_l4_pgtable); --=20 git-series 0.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue May 7 09:28:47 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1571888809; cv=none; d=zoho.com; s=zohoarc; b=fJhxvpGUm2dmcqUesmtyKks7fI4lnUs+JPuEBtvP1kBhRyG0bLfFapu+lnNH5C0q1JdtGuQRTrVOmlBugRvJFEJwKy+Lo5lBsBCWwTtfc+sGApAk/O2vrHGDyMnYNUcJ8V9qzqJ8l14t2gfqhMzyajVMzN/GkHV0uLGAml7VM7Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571888809; 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=0ETz5UUHbVsRawbxaumVIYrZopLZfKxVwV5Og+NHJs4=; b=D3ZocT3Ze454g+okqsXAoFyQ5OA5oXgJpz1Il3Cu0rmhlQRzw/ghPWCYQ9cOzY2EBAiHmawtD9KD+aRrdpgRx8o0TjpCye61V0MHbLhyL5+SGzsYT7pwpp5a41jVSqSAbeogThygMgsjZuUg+3xlUWsxSxy2kk+MTRCVLOmJrzk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) 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 1571888809755707.9578092583773; Wed, 23 Oct 2019 20:46:49 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iNU3y-0003g6-Os; Thu, 24 Oct 2019 03:45:26 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iNU3x-0003fz-AT for xen-devel@lists.xenproject.org; Thu, 24 Oct 2019 03:45:25 +0000 Received: from out2-smtp.messagingengine.com (unknown [66.111.4.26]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b0f7560a-f610-11e9-beca-bc764e2007e4; Thu, 24 Oct 2019 03:45:16 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 03D6221A4B; Wed, 23 Oct 2019 23:45:16 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Wed, 23 Oct 2019 23:45:16 -0400 Received: from localhost.localdomain (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id 21C9280064; Wed, 23 Oct 2019 23:45:15 -0400 (EDT) X-Inumbo-ID: b0f7560a-f610-11e9-beca-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=AXNTUt0DwKKYunJg2u3lsSTDFRY/EEBhJ/qzUbLuo MA=; b=mBixlKnCFn8M12zmsrSYF4szjClVWh4uEMu7hzBd9EEx861oMV9oPceoW Z7HySF/TTe8HJsNA33L3g72idvL1WSbmT1Qyft2fz2jkgdeV3Ui/RZAK7cDD3iLU YnwPC9/UQAc+UtsU8sY/hMRIfJjcwoR4t78slvKMs+S02RZdf2b+5MxRZpS+MhfQ jmaAEPCTUgVPcdBzYTGltVC2iuI1FER3yyJCBcOuYsv1NKNHUiEecyqM/L45VVek TQbkUnSXX345Adtb9EoqON56BOMDWr8cxeMQx9oW/puDVDJwRryNigJ8D3hoHmd/ fgHmossEMJpGWy3dtlHVSiSDTo+gA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrledtgdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucfkphepledurdeihedrfeegrdef feenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghrvghksehinhhvihhsihgslh gvthhhihhnghhslhgrsgdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Date: Thu, 24 Oct 2019 05:45:05 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v4 3/3] xen/efi: use directmap to access runtime services table 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: Juergen Gross , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Jan Beulich Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Do not require switching page tables to access (static) information in the runtime services table itself, use directmap for this. This allows exiting early from XEN_EFI_query_capsule_capabilities, XEN_EFI_update_capsule and XEN_EFI_query_variable_info (in case of not supported call) without all the impact of page table switch. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jan Beulich Tested-by: Jason Andryuk Tested-by: Marek Marczykowski-G=C3=B3recki --- New patch in v4. Can be applied independently of the other two. Specifically can be defered beyond 4.13. I'm also fine with dropping it, if adding directmap users is undesired. Cc: Juergen Gross --- xen/common/efi/boot.c | 1 + xen/common/efi/runtime.c | 19 ++++--------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 9debc5b..89b1c8a 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -1122,6 +1122,7 @@ static void __init efi_exit_boot(EFI_HANDLE ImageHand= le, EFI_SYSTEM_TABLE *Syste =20 /* Adjust pointers into EFI. */ efi_ct =3D (void *)efi_ct + DIRECTMAP_VIRT_START; + efi_rs =3D (void *)efi_rs + DIRECTMAP_VIRT_START; efi_memmap =3D (void *)efi_memmap + DIRECTMAP_VIRT_START; efi_fw_vendor =3D (void *)efi_fw_vendor + DIRECTMAP_VIRT_START; } diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c index ab53ebc..22fd6c9 100644 --- a/xen/common/efi/runtime.c +++ b/xen/common/efi/runtime.c @@ -211,12 +211,7 @@ int efi_get_info(uint32_t idx, union xenpf_efi_info *i= nfo) break; case XEN_FW_EFI_RT_VERSION: { - struct efi_rs_state state =3D efi_rs_enter(); - - if ( !state.cr3 ) - return -EOPNOTSUPP; info->version =3D efi_rs->Hdr.Revision; - efi_rs_leave(&state); break; } case XEN_FW_EFI_CONFIG_TABLE: @@ -618,12 +613,11 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *o= p) break; } =20 + if ( (efi_rs->Hdr.Revision >> 16) < 2 ) + return -EOPNOTSUPP; state =3D efi_rs_enter(); - if ( !state.cr3 || (efi_rs->Hdr.Revision >> 16) < 2 ) - { - efi_rs_leave(&state); + if ( !state.cr3 ) return -EOPNOTSUPP; - } status =3D efi_rs->QueryVariableInfo( op->u.query_variable_info.attr, &op->u.query_variable_info.max_store_size, @@ -637,13 +631,8 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op) if ( op->misc ) return -EINVAL; =20 - state =3D efi_rs_enter(); - if ( !state.cr3 || (efi_rs->Hdr.Revision >> 16) < 2 ) - { - efi_rs_leave(&state); + if ( (efi_rs->Hdr.Revision >> 16) < 2 ) return -EOPNOTSUPP; - } - efi_rs_leave(&state); /* XXX fall through for now */ default: return -ENOSYS; --=20 git-series 0.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel