• Sean Christopherson's avatar
    KVM: VMX: don't force CR4.PAE/PSE for unrestricted guest · 5dc1f044
    Sean Christopherson authored
    CR4.PAE - Unrestricted guest can only be enabled when EPT is
    enabled, and vmx_set_cr4() clears hardware CR0.PAE based on
    the guest's CR4.PAE, i.e. CR4.PAE always follows the guest's
    value when unrestricted guest is enabled.
    
    CR4.PSE - Unrestricted guest no longer uses the identity mapped
    IA32 page tables since CR0.PG can be cleared in hardware, thus
    there is no need to set CR4.PSE when paging is disabled in the
    guest (and EPT is enabled).
    
    Define KVM_VM_CR4_ALWAYS_ON_UNRESTRICTED_GUEST (to X86_CR4_VMXE)
    and use it in lieu of KVM_*MODE_VM_CR4_ALWAYS_ON when unrestricted
    guest is enabled, which removes the forcing of CR4.PAE.
    
    Skip the manipulation of CR4.PAE/PSE for EPT when unrestricted
    guest is enabled, as CR4.PAE isn't forced and so doesn't need to
    be manually cleared, and CR4.PSE does not need to be set when
    paging is disabled since the identity mapped IA32 page tables
    are not used.
    Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
    Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
    5dc1f044
vmx.c 352 KB