diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 18ba837738..243c41fb13 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1581,6 +1581,20 @@ static int _svm_cpu_up(bool bsp) /* Initialize OSVW bits to be used by guests */ svm_host_osvw_init(); + /* + * VMSAVE writes out the current full FS, GS, LDTR and TR segments, and + * the GS_SHADOW, SYSENTER and SYSCALL linkage MSRs. + * + * The segment data gets modified by the svm_load_segs() optimisation for + * PV context switches, but all values get reloaded at that point, as well + * as during context switch from SVM. + * + * If PV guests are available, it is critical that the SYSCALL linkage + * MSRs been configured at this juncture even in FRED mode. + */ + if ( IS_ENABLED(CONFIG_PV) ) + ASSERT(rdmsr(MSR_STAR) == XEN_MSR_STAR); + svm_vmsave_pa(per_cpu(host_vmcb, cpu)); return 0; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 27c63d1d97..675de3a649 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -2078,7 +2078,7 @@ void asmlinkage __init noreturn __start_xen(void) &this_cpu(stubs).mfn); BUG_ON(!this_cpu(stubs.addr)); - traps_init(); /* Needs stubs allocated. */ + traps_init(); /* Needs stubs allocated, must be before presmp_initcalls. */ cpu_init();