]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Revert "KVM: PPC: e500: Mark "struct page" dirty in kvmppc_e500_shadow_map()"
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Mar 2025 15:52:25 +0000 (16:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 12:02:19 +0000 (13:02 +0100)
This reverts commit dec857329fb9a66a5bce4f9db14c97ef64725a32 which is
commit c9be85dabb376299504e0d391d15662c0edf8273 upstream.

It should not have been applied.

Link: https://lore.kernel.org/r/CABgObfb5U9zwTQBPkPB=mKu-vMrRspPCm4wfxoQpB+SyAnb5WQ@mail.gmail.com
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kvm/e500_mmu_host.c

index 5c2adfd19e123018bb7b549a3b8e765330a72e8a..c664fdec75b1ab586eb94699bd72ba7b85192082 100644 (file)
@@ -242,7 +242,7 @@ static inline int tlbe_is_writable(struct kvm_book3e_206_tlb_entry *tlbe)
        return tlbe->mas7_3 & (MAS3_SW|MAS3_UW);
 }
 
-static inline bool kvmppc_e500_ref_setup(struct tlbe_ref *ref,
+static inline void kvmppc_e500_ref_setup(struct tlbe_ref *ref,
                                         struct kvm_book3e_206_tlb_entry *gtlbe,
                                         kvm_pfn_t pfn, unsigned int wimg)
 {
@@ -252,7 +252,11 @@ static inline bool kvmppc_e500_ref_setup(struct tlbe_ref *ref,
        /* Use guest supplied MAS2_G and MAS2_E */
        ref->flags |= (gtlbe->mas2 & MAS2_ATTRIB_MASK) | wimg;
 
-       return tlbe_is_writable(gtlbe);
+       /* Mark the page accessed */
+       kvm_set_pfn_accessed(pfn);
+
+       if (tlbe_is_writable(gtlbe))
+               kvm_set_pfn_dirty(pfn);
 }
 
 static inline void kvmppc_e500_ref_release(struct tlbe_ref *ref)
@@ -333,7 +337,6 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
        unsigned int wimg = 0;
        pgd_t *pgdir;
        unsigned long flags;
-       bool writable = false;
 
        /* used to check for invalidations in progress */
        mmu_seq = kvm->mmu_invalidate_seq;
@@ -487,9 +490,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
                        goto out;
                }
        }
-       writable = kvmppc_e500_ref_setup(ref, gtlbe, pfn, wimg);
-       if (writable)
-               kvm_set_pfn_dirty(pfn);
+       kvmppc_e500_ref_setup(ref, gtlbe, pfn, wimg);
 
        kvmppc_e500_setup_stlbe(&vcpu_e500->vcpu, gtlbe, tsize,
                                ref, gvaddr, stlbe);