@@ -1918,9 +1918,7 @@ void cf_check paravirt_ctxt_switch_to(struct vcpu *v)
root_pgentry_t *root_pgt = this_cpu(root_pgt);
if ( root_pgt )
- root_pgt[root_table_offset(PERDOMAIN_VIRT_START)] =
- l4e_from_page(v->domain->arch.perdomain_l3_pg,
- __PAGE_HYPERVISOR_RW);
+ setup_perdomain_slot(v, root_pgt);
if ( unlikely(v->arch.dr7 & DR7_ACTIVE_MASK) )
activate_debugregs(v);
@@ -630,4 +630,7 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
return (mfn + nr) <= (virt_to_mfn(eva - 1) + 1);
}
+/* Setup the per-domain slot in the root page table pointer. */
+void setup_perdomain_slot(const struct vcpu *v, root_pgentry_t *root_pgt);
+
#endif /* __ASM_X86_MM_H__ */
@@ -6362,6 +6362,13 @@ unsigned long get_upper_mfn_bound(void)
return min(max_mfn, 1UL << (paddr_bits - PAGE_SHIFT)) - 1;
}
+void setup_perdomain_slot(const struct vcpu *v, root_pgentry_t *root_pgt)
+{
+ l4e_write(&root_pgt[root_table_offset(PERDOMAIN_VIRT_START)],
+ l4e_from_page(v->domain->arch.perdomain_l3_pg,
+ __PAGE_HYPERVISOR_RW));
+}
+
static void __init __maybe_unused build_assertions(void)
{
/*
It's currently only used for XPTI. Move the code to a separate helper in preparation for it gaining more logic. While there switch to using l4e_write(): in the current context the L4 is not active when modified, but that could change. No functional change intended. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- xen/arch/x86/domain.c | 4 +--- xen/arch/x86/include/asm/mm.h | 3 +++ xen/arch/x86/mm.c | 7 +++++++ 3 files changed, 11 insertions(+), 3 deletions(-)