All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: xen-devel@lists.xenproject.org
Cc: "Juergen Gross" <jgross@suse.com>,
	"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
	"Jan Beulich" <jbeulich@suse.com>
Subject: [Xen-devel] [PATCH v4 3/3] xen/efi: use directmap to access runtime services table
Date: Thu, 24 Oct 2019 05:45:05 +0200	[thread overview]
Message-ID: <d9e965c0e19759f7be398044945b7be9eff41f3d.1571888583.git-series.marmarek@invisiblethingslab.com> (raw)
In-Reply-To: <cover.d9b2d7d69cc351a30963d653b1d459c878356e4e.1571888583.git-series.marmarek@invisiblethingslab.com>

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 <marmarek@invisiblethingslab.com>
---
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 <jgross@suse.com>
---
 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;
-- 
git-series 0.9.1

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-10-24  3:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24  3:45 [Xen-devel] [PATCH v4 0/3] Optionally call EFI SetVirtualAddressMap() Marek Marczykowski-Górecki
2019-10-24  3:45 ` [Xen-devel] [PATCH v4 1/3] efi: remove old SetVirtualAddressMap() arrangement Marek Marczykowski-Górecki
2019-10-25 14:26   ` Jan Beulich
2019-10-24  3:45 ` [Xen-devel] [PATCH v4 2/3] xen/efi: optionally call SetVirtualAddressMap() Marek Marczykowski-Górecki
2019-10-25 14:27   ` Jan Beulich
2019-10-24  3:45 ` Marek Marczykowski-Górecki [this message]
2019-10-24 13:11   ` [Xen-devel] [PATCH v4 3/3] xen/efi: use directmap to access runtime services table Xia, Hongyan
2019-10-24 13:52     ` marmarek
2019-10-25 14:12   ` Jan Beulich
2019-10-25 14:48 ` [Xen-devel] [PATCH v4 0/3] Optionally call EFI SetVirtualAddressMap() Jürgen Groß

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d9e965c0e19759f7be398044945b7be9eff41f3d.1571888583.git-series.marmarek@invisiblethingslab.com \
    --to=marmarek@invisiblethingslab.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.