]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: VMX: don't force CR4.PAE/PSE for unrestricted guest
authorSean Christopherson <sean.j.christopherson@intel.com>
Mon, 5 Mar 2018 20:04:39 +0000 (12:04 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 16 Mar 2018 21:01:35 +0000 (22:01 +0100)
commitd7088d5a7a5a937c12398434a74dc1d49077f9c3
treea6d372391d598ffdd5b7a82af22ec2912888ecfd
parent06742af33a23cbc70001c0358141bac7cd6fc8ae
KVM: VMX: don't force CR4.PAE/PSE for unrestricted guest

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: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/kvm/vmx.c