From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Jan Beulich" <JBeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>
Subject: [PATCH] x86/shim: Simplify compat handling in write_start_info()
Date: Mon, 19 Apr 2021 15:45:24 +0100 [thread overview]
Message-ID: <20210419144524.32608-1-andrew.cooper3@citrix.com> (raw)
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@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>
---
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
next reply other threads:[~2021-04-19 14:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-19 14:45 Andrew Cooper [this message]
2021-04-19 15:55 ` [PATCH] x86/shim: Simplify compat handling in write_start_info() Jan Beulich
2021-04-19 15:57 ` Andrew Cooper
2021-04-19 16:00 ` Jan Beulich
2021-04-20 17:37 ` Andrew Cooper
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=20210419144524.32608-1-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).