KVM: x86: Make CR4.VMXE reserved for the guest
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Jul 2020 11:02:50 +0000 (07:02 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Jul 2020 20:21:58 +0000 (16:21 -0400)
CR4.VMXE is reserved unless the VMX CPUID bit is set.  On Intel,
it is also tested by vmx_set_cr4, but AMD relies on kvm_valid_cr4,
so fix it.

Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.h

index 15276ed224d54737697beea6cfdf01c09382df51..10441fbb4073223527afb7c9b6c91fb8e77f538d 100644 (file)
@@ -391,6 +391,8 @@ bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu);
                __reserved_bits |= X86_CR4_LA57;        \
        if (!__cpu_has(__c, X86_FEATURE_UMIP))          \
                __reserved_bits |= X86_CR4_UMIP;        \
+       if (!__cpu_has(__c, X86_FEATURE_VMX))           \
+               __reserved_bits |= X86_CR4_VMXE;        \
        __reserved_bits;                                \
 })