[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] x86/shim: Simplify compat handling in write_start_info()


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Tue, 20 Apr 2021 18:41:18 +0100
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 20 Apr 2021 17:41:41 +0000
  • Ironport-hdrordr: A9a23:v9Zi4qlPQRPwOBDlDxCFe1oKDcPpDfLK3DAbvn1ZSRFFG/Gwve rGppUm/DXzjyscX2xlpMuJP7OOTWiZ2Zl+54QQOrnKZniBhEKDKoZ+4Yz+hwDxAiGWzJ876Y 5Me7VzYeeAbmRSot395GCDfOoI5Pmi3OSWifzFz3FrJDsaD51IywtiEA6UHglXaWB9dPgEPa GR7MZGuDasEE5/Bq/QaxU4dtPOusHRk9beaQMGbiRXkTWmty+i67LxDnGjvis2bjUn+9kf2F mAtwT446m52svLryPh6w==
  • Ironport-sdr: iWyu2oC31fXjV2yajVp4uFhM6DHO70oy3AsCk3j88mzQXjV8uz3KTlixV3CM8ad8mMd+oSS7WE biEQLDWIUVS+zmTwc0NUYz32vD7hWGOb7WXchSn6LGcjg8DYl6FsmTvRnBc1k082sS0S4XEBHB xxCxDjqXQ6NjYT+8DYhMW4TWiiPrCJxj+yh7vv9ltja1cg7ms3pJ+CemvbTfPnz9N508tDSWsj kw4+obTzVPK3L2XDwidpV4tn3w+hzt7IIvo+Z3zNkqmReEqoWLZmFDceilLPZ5BFsyH+YrFaBI FFM=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Factor out a compat boolean to remove the lfence overhead from multiple
is_pv_32bit_domain() calls.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>

v2:
 * Reinstate the conditional for the start info pointer, in case Intel/AMD
   can't be persuaded to adjust the architectural guarentees for upper bits in
   compatibility mode transitions.
---
 xen/arch/x86/pv/shim.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index d16c0048c0..4c6f442274 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -280,12 +280,12 @@ void __init pv_shim_setup_dom(struct domain *d, 
l4_pgentry_t *l4start,
 static void write_start_info(struct domain *d)
 {
     struct cpu_user_regs *regs = guest_cpu_user_regs();
-    start_info_t *si = map_domain_page(_mfn(is_pv_32bit_domain(d) ? regs->edx
-                                                                  : 
regs->rdx));
+    bool compat = is_pv_32bit_domain(d);
+    start_info_t *si = map_domain_page(_mfn(compat ? regs->edx : regs->rdx));
     uint64_t param;
 
     snprintf(si->magic, sizeof(si->magic), "xen-3.0-x86_%s",
-             is_pv_32bit_domain(d) ? "32p" : "64");
+             compat ? "32p" : "64");
     si->nr_pages = domain_tot_pages(d);
     si->shared_info = virt_to_maddr(d->shared_info);
     si->flags = 0;
@@ -300,7 +300,7 @@ static void write_start_info(struct domain *d)
                                           &si->console.domU.mfn) )
         BUG();
 
-    if ( is_pv_32bit_domain(d) )
+    if ( compat )
         xlat_start_info(si, XLAT_start_info_console_domU);
 
     unmap_domain_page(si);
-- 
2.11.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.