From patchwork Thu Oct 24 03:45:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 11208235 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A78D714E5 for ; Thu, 24 Oct 2019 03:47:19 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7DCB720856 for ; Thu, 24 Oct 2019 03:47:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="mBixlKnC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DCB720856 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=invisiblethingslab.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org 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 X-Inumbo-ID: b0f7560a-f610-11e9-beca-bc764e2007e4 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 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: 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) From: =?utf-8?q?Marek_Marczykowski-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_Marczykowski-G=C3=B3rec?= =?utf-8?q?ki?= , Jan Beulich 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órecki Reviewed-by: Jan Beulich --- 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 ImageHandle, EFI_SYSTEM_TABLE *Syste /* Adjust pointers into EFI. */ efi_ct = (void *)efi_ct + DIRECTMAP_VIRT_START; + efi_rs = (void *)efi_rs + DIRECTMAP_VIRT_START; efi_memmap = (void *)efi_memmap + DIRECTMAP_VIRT_START; efi_fw_vendor = (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 *info) break; case XEN_FW_EFI_RT_VERSION: { - struct efi_rs_state state = efi_rs_enter(); - - if ( !state.cr3 ) - return -EOPNOTSUPP; info->version = 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 *op) break; } + if ( (efi_rs->Hdr.Revision >> 16) < 2 ) + return -EOPNOTSUPP; state = efi_rs_enter(); - if ( !state.cr3 || (efi_rs->Hdr.Revision >> 16) < 2 ) - { - efi_rs_leave(&state); + if ( !state.cr3 ) return -EOPNOTSUPP; - } status = 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; - state = 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;