KVM: x86: Pull the PGD's level from the MMU instead of recalculating it
authorSean Christopherson <sean.j.christopherson@intel.com>
Thu, 16 Jul 2020 03:41:18 +0000 (20:41 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 30 Jul 2020 22:16:47 +0000 (18:16 -0400)
commit2a40b9001ec210e51a2bc8647629d7906779fb0b
tree2af30b41a80d59011313d886d365bd54f9fd15a4
parent812f8058369f81be2d7e13a78e398d9425e830d8
KVM: x86: Pull the PGD's level from the MMU instead of recalculating it

Use the shadow_root_level from the current MMU as the root level for the
PGD, i.e. for VMX's EPTP.  This eliminates the weird dependency between
VMX and the MMU where both must independently calculate the same root
level for things to work correctly.  Temporarily keep VMX's calculation
of the level and use it to WARN if the incoming level diverges.

Opportunistically refactor kvm_mmu_load_pgd() to avoid indentation hell,
and rename a 'cr3' param in the load_mmu_pgd prototype that managed to
survive the cr3 purge.

No functional change intended.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200716034122.5998-6-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu.h
arch/x86/kvm/svm/svm.c
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/vmx/vmx.h