x86/pv: Improve dom0_update_physmap() with CONFIG_SPECULATIVE_HARDEN_BRANCH
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 29 Oct 2020 19:53:28 +0000 (19:53 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 16 Apr 2021 13:43:28 +0000 (14:43 +0100)
commit97f9861b8f22aaa28cb1f4588f2e6fc9b173ec90
treee02d8e3d408bfea8a5a87fba1e71e5f610bd848f
parent9b47be876f2a9521bb1f247d855603c00bc99465
x86/pv: Improve dom0_update_physmap() with CONFIG_SPECULATIVE_HARDEN_BRANCH

dom0_update_physmap() is mostly called in two tight loops, where the lfences
hidden in is_pv_32bit_domain() have a substantial impact.

None of the boot time construction needs protection against malicious
speculation, so use a local variable and calculate is_pv_32bit_domain() just
once.

Reformat the some of the code for legibility, now that the volume has reduced,
and removal of some gratuitous negations.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/pv/dom0_build.c
xen/arch/x86/pv/shim.c
xen/include/asm-x86/dom0_build.h