diff options
-rw-r--r-- | arch/x86/kvm/vmx.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index f5e8dce8046c..f7b61687bd79 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -3622,8 +3622,16 @@ static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) | |||
3622 | 3622 | ||
3623 | static int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | 3623 | static int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) |
3624 | { | 3624 | { |
3625 | unsigned long hw_cr4 = cr4 | (to_vmx(vcpu)->rmode.vm86_active ? | 3625 | /* |
3626 | KVM_RMODE_VM_CR4_ALWAYS_ON : KVM_PMODE_VM_CR4_ALWAYS_ON); | 3626 | * Pass through host's Machine Check Enable value to hw_cr4, which |
3627 | * is in force while we are in guest mode. Do not let guests control | ||
3628 | * this bit, even if host CR4.MCE == 0. | ||
3629 | */ | ||
3630 | unsigned long hw_cr4 = | ||
3631 | (cr4_read_shadow() & X86_CR4_MCE) | | ||
3632 | (cr4 & ~X86_CR4_MCE) | | ||
3633 | (to_vmx(vcpu)->rmode.vm86_active ? | ||
3634 | KVM_RMODE_VM_CR4_ALWAYS_ON : KVM_PMODE_VM_CR4_ALWAYS_ON); | ||
3627 | 3635 | ||
3628 | if (cr4 & X86_CR4_VMXE) { | 3636 | if (cr4 & X86_CR4_VMXE) { |
3629 | /* | 3637 | /* |