]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: x86: remove nested_mmu from mmu_is_nested()
authorPaolo Bonzini <pbonzini@redhat.com>
Sat, 30 May 2026 16:55:41 +0000 (12:55 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 12 Jun 2026 08:43:52 +0000 (10:43 +0200)
nested_mmu is always stored into vcpu->arch.walk_mmu at the same time as
guest_mmu is stored into vcpu->arch.mmu.  But nested_mmu is not even
a proper MMU, it is only used for page walking; plus the fact that
walk_mmu has to be switched at all is just an implementation detail.

In the end what matters here is whether the guest is using nested
page tables; vmx/nested.c and svm/nested.c check it to see if they
are in nEPT or nNPT context respectively.  So switch to checking
root_mmu vs. guest_mmu, which is a more cogent test.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20260511150648.685374-2-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20260530165545.25599-2-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.h

index 38a905fa86de29550608b2b0d0a8577c5558466e..60ff064de12fda061f7b58b377d5aeb4da44a4b6 100644 (file)
@@ -290,7 +290,7 @@ static inline bool x86_exception_has_error_code(unsigned int vector)
 
 static inline bool mmu_is_nested(struct kvm_vcpu *vcpu)
 {
-       return vcpu->arch.walk_mmu == &vcpu->arch.nested_mmu;
+       return vcpu->arch.mmu == &vcpu->arch.guest_mmu;
 }
 
 static inline bool is_pae(struct kvm_vcpu *vcpu)