]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: MMU: remove unnecessary argument to mmu_set_spte
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 17 Aug 2021 11:42:10 +0000 (07:42 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 1 Oct 2021 07:44:55 +0000 (03:44 -0400)
The level of the new SPTE can be found in the kvm_mmu_page struct; there
is no need to pass it down.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/paging_tmpl.h

index dcbe7df2f890873b2f1b2911deb345127cde83e4..91303006faaf628aabebca39d8ba6389288fb06d 100644 (file)
@@ -2675,11 +2675,12 @@ int mmu_try_to_unsync_pages(struct kvm_vcpu *vcpu, gfn_t gfn, bool can_unsync,
 }
 
 static int mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
-                       unsigned int pte_access, bool write_fault, int level,
+                       unsigned int pte_access, bool write_fault,
                        gfn_t gfn, kvm_pfn_t pfn, bool speculative,
                        bool host_writable)
 {
        struct kvm_mmu_page *sp = sptep_to_sp(sptep);
+       int level = sp->role.level;
        int was_rmapped = 0;
        int ret = RET_PF_FIXED;
        bool flush = false;
@@ -2777,7 +2778,7 @@ static int direct_pte_prefetch_many(struct kvm_vcpu *vcpu,
                return -1;
 
        for (i = 0; i < ret; i++, gfn++, start++) {
-               mmu_set_spte(vcpu, start, access, false, sp->role.level, gfn,
+               mmu_set_spte(vcpu, start, access, false, gfn,
                             page_to_pfn(pages[i]), true, true);
                put_page(pages[i]);
        }
@@ -2980,7 +2981,7 @@ static int __direct_map(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
                return -EFAULT;
 
        ret = mmu_set_spte(vcpu, it.sptep, ACC_ALL,
-                          fault->write, fault->goal_level, base_gfn, fault->pfn,
+                          fault->write, base_gfn, fault->pfn,
                           fault->prefault, fault->map_writable);
        if (ret == RET_PF_SPURIOUS)
                return ret;
index 500962dceda0a42da48f0a2f9f75219d2f67da5f..7f2c6eeed04fe94c602d15a8ee31c7cb27064552 100644 (file)
@@ -582,7 +582,7 @@ FNAME(prefetch_gpte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
         * we call mmu_set_spte() with host_writable = true because
         * pte_prefetch_gfn_to_pfn always gets a writable pfn.
         */
-       mmu_set_spte(vcpu, spte, pte_access, false, PG_LEVEL_4K, gfn, pfn,
+       mmu_set_spte(vcpu, spte, pte_access, false, gfn, pfn,
                     true, true);
 
        kvm_release_pfn_clean(pfn);
@@ -764,8 +764,8 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault,
                return -EFAULT;
 
        ret = mmu_set_spte(vcpu, it.sptep, gw->pte_access, fault->write,
-                          fault->goal_level, base_gfn, fault->pfn,
-                          fault->prefault, fault->map_writable);
+                          base_gfn, fault->pfn, fault->prefault,
+                          fault->map_writable);
        if (ret == RET_PF_SPURIOUS)
                return ret;