[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86/spec-ctrl: initialize per-domain XPTI in spec_ctrl_init_domain()
commit d18f8153be4c57e452495f468e2e22d2b749f07f Author: Roger Pau Monné <roger.pau@xxxxxxxxxx> AuthorDate: Wed Aug 14 15:39:26 2024 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Aug 14 15:39:26 2024 +0200 x86/spec-ctrl: initialize per-domain XPTI in spec_ctrl_init_domain() XPTI being a speculation mitigation feels better to be initialized in spec_ctrl_init_domain(). No functional change intended, although the call to spec_ctrl_init_domain() in arch_domain_create() needs to be moved ahead of pv_domain_initialise() for d->->arch.pv.xpti to be correctly set. Move it ahead of most of the initialization functions, since spec_ctrl_init_domain() doesn't depend on any member in the struct domain being set. Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/domain.c | 4 ++-- xen/arch/x86/pv/domain.c | 2 -- xen/arch/x86/spec_ctrl.c | 4 ++++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index d977ec71ca..89aad7e897 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -830,6 +830,8 @@ int arch_domain_create(struct domain *d, is_pv_domain(d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u; #endif + spec_ctrl_init_domain(d); + if ( (rc = paging_domain_init(d)) != 0 ) goto fail; paging_initialised = true; @@ -896,8 +898,6 @@ int arch_domain_create(struct domain *d, d->arch.msr_relaxed = config->arch.misc_flags & XEN_X86_MSR_RELAXED; - spec_ctrl_init_domain(d); - return 0; fail: diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c index 2a445bb17b..86b74fb372 100644 --- a/xen/arch/x86/pv/domain.c +++ b/xen/arch/x86/pv/domain.c @@ -383,8 +383,6 @@ int pv_domain_initialise(struct domain *d) d->arch.ctxt_switch = &pv_csw; - d->arch.pv.xpti = is_hardware_domain(d) ? opt_xpti_hwdom : opt_xpti_domu; - if ( !is_pv_32bit_domain(d) && use_invpcid && cpu_has_pcid ) switch ( ACCESS_ONCE(opt_pcid) ) { diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c index 92405b8be7..75a4177a75 100644 --- a/xen/arch/x86/spec_ctrl.c +++ b/xen/arch/x86/spec_ctrl.c @@ -1748,6 +1748,10 @@ void spec_ctrl_init_domain(struct domain *d) (ibpb ? SCF_entry_ibpb : 0) | (bhb ? SCF_entry_bhb : 0) | 0; + + if ( pv ) + d->arch.pv.xpti = is_hardware_domain(d) ? opt_xpti_hwdom + : opt_xpti_domu; } void __init init_speculation_mitigations(void) -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |