OSDN Git Service

KVM: VMX: Move nested EPT out of kvm_x86_ops.get_tdp_level() hook
authorSean Christopherson <sean.j.christopherson@intel.com>
Sat, 2 May 2020 04:32:33 +0000 (21:32 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 13 May 2020 16:15:13 +0000 (12:15 -0400)
commit0047fcade4cb1204cafdf62150081a39356f4dbd
tree46f9d0e157f25fcbc552bb60a17067248bc39f45
parentbd31fe495d0d1a67fe6f44f06dfef637f202241d
KVM: VMX: Move nested EPT out of kvm_x86_ops.get_tdp_level() hook

Separate the "core" TDP level handling from the nested EPT path to make
it clear that kvm_x86_ops.get_tdp_level() is used if and only if nested
EPT is not in use (kvm_init_shadow_ept_mmu() calculates the level from
the passed in vmcs12->eptp).  Add a WARN_ON() to enforce that the
kvm_x86_ops hook is not called for nested EPT.

This sets the stage for snapshotting the non-"nested EPT" TDP page level
during kvm_cpuid_update() to avoid the retpoline associated with
kvm_x86_ops.get_tdp_level() when resetting the MMU, a relatively
frequent operation when running a nested guest.

No functional change intended.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200502043234.12481-10-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmx.c