]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
powerpc/32s: Inline flush_hash_entry()
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Thu, 22 Oct 2020 06:29:40 +0000 (06:29 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 9 Dec 2020 05:46:56 +0000 (16:46 +1100)
flush_hash_entry() is a simple function calling
flush_hash_pages() if it's a hash MMU or doing nothing otherwise.

Inline it.

And use it also in __ptep_test_and_clear_young().

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/9af895be7d4b404d40e749a2659552fd138e62c4.1603348103.git.christophe.leroy@csgroup.eu
arch/powerpc/include/asm/book3s/32/pgtable.h
arch/powerpc/include/asm/tlb.h
arch/powerpc/mm/book3s32/tlb.c

index 41d8bc6db30382c5ba5be1adb04a52cb93b0bda9..1d6a7dafd3dc6c7ad7fdc2f1ccbfcafc2a5b6643 100644 (file)
@@ -238,8 +238,14 @@ extern void add_hash_page(unsigned context, unsigned long va,
                          unsigned long pmdval);
 
 /* Flush an entry from the TLB/hash table */
-extern void flush_hash_entry(struct mm_struct *mm, pte_t *ptep,
-                            unsigned long address);
+static inline void flush_hash_entry(struct mm_struct *mm, pte_t *ptep, unsigned long addr)
+{
+       if (mmu_has_feature(MMU_FTR_HPTE_TABLE)) {
+               unsigned long ptephys = __pa(ptep) & PAGE_MASK;
+
+               flush_hash_pages(mm->context.id, addr, ptephys, 1);
+       }
+}
 
 /*
  * PTE updates. This function is called whenever an existing
@@ -291,10 +297,9 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
 {
        unsigned long old;
        old = pte_update(mm, addr, ptep, _PAGE_ACCESSED, 0, 0);
-       if (old & _PAGE_HASHPTE) {
-               unsigned long ptephys = __pa(ptep) & PAGE_MASK;
-               flush_hash_pages(mm->context.id, addr, ptephys, 1);
-       }
+       if (old & _PAGE_HASHPTE)
+               flush_hash_entry(mm, ptep, addr);
+
        return (old & _PAGE_ACCESSED) != 0;
 }
 #define ptep_test_and_clear_young(__vma, __addr, __ptep) \
index d97f061fecac076715ad59023c783162d3581be8..160422a439aaac7fb42e570bcfbb2bbc80f36583 100644 (file)
@@ -40,9 +40,6 @@ extern void tlb_flush(struct mmu_gather *tlb);
 /* Get the generic bits... */
 #include <asm-generic/tlb.h>
 
-extern void flush_hash_entry(struct mm_struct *mm, pte_t *ptep,
-                            unsigned long address);
-
 static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep,
                                          unsigned long address)
 {
index e7865a3f02310dceceb5808f4731b80fa24d813a..0d412953fe58b75839968440810dbe1d8b0edbd2 100644 (file)
 
 #include <mm/mmu_decl.h>
 
-/*
- * Called when unmapping pages to flush entries from the TLB/hash table.
- */
-void flush_hash_entry(struct mm_struct *mm, pte_t *ptep, unsigned long addr)
-{
-       unsigned long ptephys;
-
-       if (mmu_has_feature(MMU_FTR_HPTE_TABLE)) {
-               ptephys = __pa(ptep) & PAGE_MASK;
-               flush_hash_pages(mm->context.id, addr, ptephys, 1);
-       }
-}
-EXPORT_SYMBOL(flush_hash_entry);
-
 /*
  * TLB flushing:
  *