>@@ -1503,6 +1503,18 @@ void vmx_vcpu_load_vmcs(struct kvm_vcpu *vcpu, int cpu, > (unsigned long)(cpu_entry_stack(cpu) + 1)); > } > >+ /* Per-CPU FRED MSRs */ >+ if (kvm_cpu_cap_has(X86_FEATURE_FRED)) { >+#ifdef CONFIG_X86_64 >+ vmcs_write64(HOST_IA32_FRED_RSP1, __this_cpu_ist_top_va(DB)); >+ vmcs_write64(HOST_IA32_FRED_RSP2, __this_cpu_ist_top_va(NMI)); >+ vmcs_write64(HOST_IA32_FRED_RSP3, __this_cpu_ist_top_va(DF)); >+#endif >+ vmcs_write64(HOST_IA32_FRED_SSP1, 0); >+ vmcs_write64(HOST_IA32_FRED_SSP2, 0); >+ vmcs_write64(HOST_IA32_FRED_SSP3, 0); Given SSP[1-3] are constant for now, how about asserting that host SSP[1-3] are all zeros when KVM is loaded and moving their writes to vmx_set_constant_host_state()? >+ } >+ > vmx->loaded_vmcs->cpu = cpu; > } > } >@@ -4366,6 +4378,12 @@ void vmx_set_constant_host_state(struct vcpu_vmx *vmx) > */ > vmcs_write16(HOST_DS_SELECTOR, 0); > vmcs_write16(HOST_ES_SELECTOR, 0); >+ >+ /* FRED CONFIG and STKLVLS are the same on all CPUs. */ >+ if (kvm_cpu_cap_has(X86_FEATURE_FRED)) { >+ vmcs_write64(HOST_IA32_FRED_CONFIG, kvm_host.fred_config); >+ vmcs_write64(HOST_IA32_FRED_STKLVLS, kvm_host.fred_stklvls); >+ } > #else > vmcs_write16(HOST_DS_SELECTOR, __KERNEL_DS); /* 22.2.4 */ > vmcs_write16(HOST_ES_SELECTOR, __KERNEL_DS); /* 22.2.4 */