OSDN Git Service

KVM: x86/mmu: Grab shadow root level from mmu_role for shadow MMUs
authorSean Christopherson <seanjc@google.com>
Tue, 22 Jun 2021 17:57:04 +0000 (10:57 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 24 Jun 2021 22:00:39 +0000 (18:00 -0400)
commitd555f7057ebe34aae42fe2f592a3047e9b151326
tree31a2f4c1700d1a9c15c7bcddd7988bdc281b332a
parent16be1d12925305d4d20fd897632d9a6836a865c8
KVM: x86/mmu: Grab shadow root level from mmu_role for shadow MMUs

Use the mmu_role to initialize shadow root level instead of assuming the
level of KVM's shadow root (host) is the same as that of the guest root,
or in the case of 32-bit non-PAE paging where KVM forces PAE paging.
For nested NPT, the shadow root level cannot be adapted to L1's NPT root
level and is instead always the TDP root level because NPT uses the
current host CR0/CR4/EFER, e.g. 64-bit KVM can't drop into 32-bit PAE to
shadow L1's NPT.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210622175739.3610207-20-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c