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

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


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 19 Apr 2021 15:45:24 +0100
  • Authentication-results: esa3.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: Mon, 19 Apr 2021 14:45:57 +0000
  • Ironport-hdrordr: A9a23:3JbJnaCImuQccivlHeh2sceALOonbusQ8zAX/mhsVB1YddGZnc iynPIdkST5kioVRWtIo729EYOHRm7R8oMw3JkJMd6ZLWzbkUaLDKUn14vtxDX8Bzbzn9Q26Y 5Me7VzYeeeMXFUlsD/iTPXL/8F4P2qtJ+lnv3fyXAFd3AJV4hF4x1iAgiWVm1aLTMnObMDGJ CR5tVKqlObEBx6Uu2BCmQYRO+GntXXlfvdCiIuPQIt6wWFkFqTmd3HOiWfty1+bxp/hY0M3E KAuAz/66WlvZiAu2Xh/l6W1bt6sp/MztNCAeaFl8QaLC794zzYGbhJavm5kx0e5M2p9VY2gP nAyi1QQ/hb2jfqUUye5TvrxgX63z4l5xbZuCClqEqmm+PVbnYeKaN69OZkWyqc0WUMlpVA9Z gO+GSju59eHXr77VzAzumNbT5GvA6Ju3Y4+NRj6EB3YM8lR5J6i5cQx09RGIdoJlOA1KkXVN NjC8zR/59tADWnRkGcumFuxeqlVWgoEiGHRVAfuteU3yI+pgEB83cl
  • Ironport-sdr: JqQVed7TemJvuZL8HoVTxIOoU/YNzr5MICt/7gf1H5ciFYPibWlSQ6LNLLpqJI0p+r4H5lLFqb 6im0kdC4CldH0N5lXBtYXLW5sELPW6hEE5c9P1Hn1KFdnWQV517et94x/M61FPLTOaq9+PYF2C iMTfXg7OzpjIrRg+CgO3K2W3ZYZZ9+hW8yHZg4Udk2/MilaW7c8f8EosTf2OW1hUzfIpFX0/qU iwgYRBaWL2EoxVABJnS3z6RQziNEnEaIdnmfowAeoxrdJdpgy8lVAzbMSKq69lJsn2pTuxgcpC fDY=
  • 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.

For a compat guest, the upper 32 bits of rdx are zero, so there is no need to
have any conditional logic at all when mapping the start info page.

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>
---
 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..533c194eef 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(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®.