@@ -695,26 +695,20 @@ static inline int tdp_mmu_zap_spte_atomic(struct kvm *kvm,
695695
696696
697697/*
698- * __tdp_mmu_set_spte - Set a TDP MMU SPTE and handle the associated bookkeeping
698+ * tdp_mmu_set_spte - Set a TDP MMU SPTE and handle the associated bookkeeping
699699 * @kvm: KVM instance
700700 * @as_id: Address space ID, i.e. regular vs. SMM
701701 * @sptep: Pointer to the SPTE
702702 * @old_spte: The current value of the SPTE
703703 * @new_spte: The new value that will be set for the SPTE
704704 * @gfn: The base GFN that was (or will be) mapped by the SPTE
705705 * @level: The level _containing_ the SPTE (its parent PT's level)
706- * @record_acc_track: Notify the MM subsystem of changes to the accessed state
707- * of the page. Should be set unless handling an MMU
708- * notifier for access tracking. Leaving record_acc_track
709- * unset in that case prevents page accesses from being
710- * double counted.
711706 *
712707 * Returns the old SPTE value, which _may_ be different than @old_spte if the
713708 * SPTE had voldatile bits.
714709 */
715- static u64 __tdp_mmu_set_spte (struct kvm * kvm , int as_id , tdp_ptep_t sptep ,
716- u64 old_spte , u64 new_spte , gfn_t gfn , int level ,
717- bool record_acc_track )
710+ static u64 tdp_mmu_set_spte (struct kvm * kvm , int as_id , tdp_ptep_t sptep ,
711+ u64 old_spte , u64 new_spte , gfn_t gfn , int level )
718712{
719713 lockdep_assert_held_write (& kvm -> mmu_lock );
720714
@@ -730,30 +724,19 @@ static u64 __tdp_mmu_set_spte(struct kvm *kvm, int as_id, tdp_ptep_t sptep,
730724 old_spte = kvm_tdp_mmu_write_spte (sptep , old_spte , new_spte , level );
731725
732726 __handle_changed_spte (kvm , as_id , gfn , old_spte , new_spte , level , false);
733-
734- if (record_acc_track )
735- handle_changed_spte_acc_track (old_spte , new_spte , level );
736-
727+ handle_changed_spte_acc_track (old_spte , new_spte , level );
737728 handle_changed_spte_dirty_log (kvm , as_id , gfn , old_spte , new_spte ,
738729 level );
739730 return old_spte ;
740731}
741732
742- static inline void _tdp_mmu_set_spte (struct kvm * kvm , struct tdp_iter * iter ,
743- u64 new_spte , bool record_acc_track )
733+ static inline void tdp_mmu_iter_set_spte (struct kvm * kvm , struct tdp_iter * iter ,
734+ u64 new_spte )
744735{
745736 WARN_ON_ONCE (iter -> yielded );
746-
747- iter -> old_spte = __tdp_mmu_set_spte (kvm , iter -> as_id , iter -> sptep ,
748- iter -> old_spte , new_spte ,
749- iter -> gfn , iter -> level ,
750- record_acc_track );
751- }
752-
753- static inline void tdp_mmu_set_spte (struct kvm * kvm , struct tdp_iter * iter ,
754- u64 new_spte )
755- {
756- _tdp_mmu_set_spte (kvm , iter , new_spte , true);
737+ iter -> old_spte = tdp_mmu_set_spte (kvm , iter -> as_id , iter -> sptep ,
738+ iter -> old_spte , new_spte ,
739+ iter -> gfn , iter -> level );
757740}
758741
759742#define tdp_root_for_each_pte (_iter , _root , _start , _end ) \
@@ -845,7 +828,7 @@ static void __tdp_mmu_zap_root(struct kvm *kvm, struct kvm_mmu_page *root,
845828 continue ;
846829
847830 if (!shared )
848- tdp_mmu_set_spte (kvm , & iter , 0 );
831+ tdp_mmu_iter_set_spte (kvm , & iter , 0 );
849832 else if (tdp_mmu_set_spte_atomic (kvm , & iter , 0 ))
850833 goto retry ;
851834 }
@@ -902,8 +885,8 @@ bool kvm_tdp_mmu_zap_sp(struct kvm *kvm, struct kvm_mmu_page *sp)
902885 if (WARN_ON_ONCE (!is_shadow_present_pte (old_spte )))
903886 return false;
904887
905- __tdp_mmu_set_spte (kvm , kvm_mmu_page_as_id (sp ), sp -> ptep , old_spte , 0 ,
906- sp -> gfn , sp -> role .level + 1 , true );
888+ tdp_mmu_set_spte (kvm , kvm_mmu_page_as_id (sp ), sp -> ptep , old_spte , 0 ,
889+ sp -> gfn , sp -> role .level + 1 );
907890
908891 return true;
909892}
@@ -937,7 +920,7 @@ static bool tdp_mmu_zap_leafs(struct kvm *kvm, struct kvm_mmu_page *root,
937920 !is_last_spte (iter .old_spte , iter .level ))
938921 continue ;
939922
940- tdp_mmu_set_spte (kvm , & iter , 0 );
923+ tdp_mmu_iter_set_spte (kvm , & iter , 0 );
941924 flush = true;
942925 }
943926
@@ -1107,7 +1090,7 @@ static int tdp_mmu_link_sp(struct kvm *kvm, struct tdp_iter *iter,
11071090 if (ret )
11081091 return ret ;
11091092 } else {
1110- tdp_mmu_set_spte (kvm , iter , spte );
1093+ tdp_mmu_iter_set_spte (kvm , iter , spte );
11111094 }
11121095
11131096 tdp_account_mmu_page (kvm , sp );
@@ -1314,13 +1297,13 @@ static bool set_spte_gfn(struct kvm *kvm, struct tdp_iter *iter,
13141297 * invariant that the PFN of a present * leaf SPTE can never change.
13151298 * See __handle_changed_spte().
13161299 */
1317- tdp_mmu_set_spte (kvm , iter , 0 );
1300+ tdp_mmu_iter_set_spte (kvm , iter , 0 );
13181301
13191302 if (!pte_write (range -> pte )) {
13201303 new_spte = kvm_mmu_changed_pte_notifier_make_spte (iter -> old_spte ,
13211304 pte_pfn (range -> pte ));
13221305
1323- tdp_mmu_set_spte (kvm , iter , new_spte );
1306+ tdp_mmu_iter_set_spte (kvm , iter , new_spte );
13241307 }
13251308
13261309 return true;
@@ -1805,7 +1788,7 @@ static bool write_protect_gfn(struct kvm *kvm, struct kvm_mmu_page *root,
18051788 if (new_spte == iter .old_spte )
18061789 break ;
18071790
1808- tdp_mmu_set_spte (kvm , & iter , new_spte );
1791+ tdp_mmu_iter_set_spte (kvm , & iter , new_spte );
18091792 spte_set = true;
18101793 }
18111794
0 commit comments