]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: X86/SVM: Use root_level in svm_load_mmu_pgd()
authorLai Jiangshan <jiangshan.ljs@antgroup.com>
Sun, 5 Jun 2022 06:34:17 +0000 (14:34 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 15 Jun 2022 12:07:54 +0000 (08:07 -0400)
Use root_level in svm_load_mmu_pg() rather that looking up the root
level in vcpu->arch.mmu->root_role.level. svm_load_mmu_pgd() has only
one caller, kvm_mmu_load_pgd(), which always passes
vcpu->arch.mmu->root_role.level as root_level.

Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com>
Message-Id: <20220605063417.308311-7-jiangshanlai@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/svm.c

index c6cca0ce127b0075134a4ec9d38efc185805679d..2ba0c62df8fb6f6cda1d77581422f657ca2db4c9 100644 (file)
@@ -4049,7 +4049,7 @@ static void svm_load_mmu_pgd(struct kvm_vcpu *vcpu, hpa_t root_hpa,
                hv_track_root_tdp(vcpu, root_hpa);
 
                cr3 = vcpu->arch.cr3;
-       } else if (vcpu->arch.mmu->root_role.level >= PT64_ROOT_4LEVEL) {
+       } else if (root_level >= PT64_ROOT_4LEVEL) {
                cr3 = __sme_set(root_hpa) | kvm_get_active_pcid(vcpu);
        } else {
                /* PCID in the guest should be impossible with a 32-bit MMU. */