@@ -583,10 +583,29 @@ static void mmu_spte_set(u64 *sptep, u64 new_spte)
}
/*
- * Update the SPTE (excluding the PFN), but do not track changes in its
+ * Update the SPTE (excluding the PFN) regardless of accessed/dirty
+ * status which is used to update the upper level spte.
+ */
+static void mmu_spte_update_no_track(u64 *sptep, u64 new_spte)
+{
+ u64 old_spte = *sptep;
+
+ WARN_ON(!is_shadow_present_pte(new_spte));
+
+ if (!is_shadow_present_pte(old_spte)) {
+ mmu_spte_set(sptep, new_spte);
+ return;
+ }
+
+ __update_clear_spte_fast(sptep, new_spte);
+}
+
+/*
+ * Update the SPTE (excluding the PFN), the original value is
+ * returned, based on it, the caller can track changes of its
* accessed/dirty status.
*/
-static u64 mmu_spte_update_no_track(u64 *sptep, u64 new_spte)
+static u64 mmu_spte_update_track(u64 *sptep, u64 new_spte)
{
u64 old_spte = *sptep;
@@ -621,7 +640,7 @@ static u64 mmu_spte_update_no_track(u64 *sptep, u64 new_spte)
static bool mmu_spte_update(u64 *sptep, u64 new_spte)
{
bool flush = false;
- u64 old_spte = mmu_spte_update_no_track(sptep, new_spte);
+ u64 old_spte = mmu_spte_update_track(sptep, new_spte);
if (!is_shadow_present_pte(old_spte))
return false;