aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/vmx.c2
-rw-r--r--arch/x86/kvm/x86.c22
2 files changed, 24 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ffea07ede222..cbd7afa53bd0 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -5581,6 +5581,8 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
5581 vmcs_write32(GUEST_ACTIVITY_STATE, GUEST_ACTIVITY_ACTIVE); 5581 vmcs_write32(GUEST_ACTIVITY_STATE, GUEST_ACTIVITY_ACTIVE);
5582 vmcs_write32(GUEST_INTERRUPTIBILITY_INFO, 0); 5582 vmcs_write32(GUEST_INTERRUPTIBILITY_INFO, 0);
5583 vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS, 0); 5583 vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS, 0);
5584 if (kvm_mpx_supported())
5585 vmcs_write64(GUEST_BNDCFGS, 0);
5584 5586
5585 setup_msrs(vmx); 5587 setup_msrs(vmx);
5586 5588
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index b0d291518e88..4ac261000e7e 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7804,18 +7804,40 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
7804 kvm_async_pf_hash_reset(vcpu); 7804 kvm_async_pf_hash_reset(vcpu);
7805 vcpu->arch.apf.halted = false; 7805 vcpu->arch.apf.halted = false;
7806 7806
7807 if (kvm_mpx_supported()) {
7808 void *mpx_state_buffer;
7809
7810 /*
7811 * To avoid have the INIT path from kvm_apic_has_events() that be
7812 * called with loaded FPU and does not let userspace fix the state.
7813 */
7814 kvm_put_guest_fpu(vcpu);
7815 mpx_state_buffer = get_xsave_addr(&vcpu->arch.guest_fpu.state.xsave,
7816 XFEATURE_MASK_BNDREGS);
7817 if (mpx_state_buffer)
7818 memset(mpx_state_buffer, 0, sizeof(struct mpx_bndreg_state));
7819 mpx_state_buffer = get_xsave_addr(&vcpu->arch.guest_fpu.state.xsave,
7820 XFEATURE_MASK_BNDCSR);
7821 if (mpx_state_buffer)
7822 memset(mpx_state_buffer, 0, sizeof(struct mpx_bndcsr));
7823 }
7824
7807 if (!init_event) { 7825 if (!init_event) {
7808 kvm_pmu_reset(vcpu); 7826 kvm_pmu_reset(vcpu);
7809 vcpu->arch.smbase = 0x30000; 7827 vcpu->arch.smbase = 0x30000;
7810 7828
7811 vcpu->arch.msr_platform_info = MSR_PLATFORM_INFO_CPUID_FAULT; 7829 vcpu->arch.msr_platform_info = MSR_PLATFORM_INFO_CPUID_FAULT;
7812 vcpu->arch.msr_misc_features_enables = 0; 7830 vcpu->arch.msr_misc_features_enables = 0;
7831
7832 vcpu->arch.xcr0 = XFEATURE_MASK_FP;
7813 } 7833 }
7814 7834
7815 memset(vcpu->arch.regs, 0, sizeof(vcpu->arch.regs)); 7835 memset(vcpu->arch.regs, 0, sizeof(vcpu->arch.regs));
7816 vcpu->arch.regs_avail = ~0; 7836 vcpu->arch.regs_avail = ~0;
7817 vcpu->arch.regs_dirty = ~0; 7837 vcpu->arch.regs_dirty = ~0;
7818 7838
7839 vcpu->arch.ia32_xss = 0;
7840
7819 kvm_x86_ops->vcpu_reset(vcpu, init_event); 7841 kvm_x86_ops->vcpu_reset(vcpu, init_event);
7820} 7842}
7821 7843