mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
b12da0cc86
commit
d18f8153be
3 files changed
+6
-4
No files matched your search
@@ -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:
|
||||
|
||||
@@ -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) )
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||