KVM: x86/mmu: Cleanup range-based flushing for given page
authorHou Wenlong <houwenlong.hwl@antgroup.com>
Mon, 10 Oct 2022 12:19:17 +0000 (20:19 +0800)
committerSean Christopherson <seanjc@google.com>
Tue, 24 Jan 2023 18:05:48 +0000 (10:05 -0800)
Use the new kvm_flush_remote_tlbs_gfn() helper to cleanup the call sites
of range-based flushing for given page, which makes the code clear.

Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
Link: https://lore.kernel.org/r/593ee1a876ece0e819191c0b23f56b940d6686db.1665214747.git.houwenlong.hwl@antgroup.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/tdp_mmu.c

index 47b15c146ba58ebb6e4938a70c3df3c66443e368..936cee46779c808c2b64e63b24fdb25d1b3591a8 100644 (file)
@@ -824,7 +824,7 @@ static void account_shadowed(struct kvm *kvm, struct kvm_mmu_page *sp)
        kvm_mmu_gfn_disallow_lpage(slot, gfn);
 
        if (kvm_mmu_slot_gfn_write_protect(kvm, slot, gfn, PG_LEVEL_4K))
-               kvm_flush_remote_tlbs_with_address(kvm, gfn, 1);
+               kvm_flush_remote_tlbs_gfn(kvm, gfn, PG_LEVEL_4K);
 }
 
 void track_possible_nx_huge_page(struct kvm *kvm, struct kvm_mmu_page *sp)
@@ -2898,8 +2898,7 @@ static int mmu_set_spte(struct kvm_vcpu *vcpu, struct kvm_memory_slot *slot,
        }
 
        if (flush)
-               kvm_flush_remote_tlbs_with_address(vcpu->kvm, gfn,
-                               KVM_PAGES_PER_HPAGE(level));
+               kvm_flush_remote_tlbs_gfn(vcpu->kvm, gfn, level);
 
        pgprintk("%s: setting spte %llx\n", __func__, *sptep);
 
index ce2f86f8a3a5fd368d667b8d61f5f3603d124983..7c25dbf32eccb5b6b22937de461b08638c2d3f03 100644 (file)
@@ -680,8 +680,7 @@ static inline int tdp_mmu_zap_spte_atomic(struct kvm *kvm,
        if (ret)
                return ret;
 
-       kvm_flush_remote_tlbs_with_address(kvm, iter->gfn,
-                                          KVM_PAGES_PER_HPAGE(iter->level));
+       kvm_flush_remote_tlbs_gfn(kvm, iter->gfn, iter->level);
 
        /*
         * No other thread can overwrite the removed SPTE as they must either