Commit 80007a17 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/32s: Inline flush_hash_entry()

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: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/9af895be7d4b404d40e749a2659552fd138e62c4.1603348103.git.christophe.leroy@csgroup.eu
parent ef08d955
...@@ -238,8 +238,14 @@ extern void add_hash_page(unsigned context, unsigned long va, ...@@ -238,8 +238,14 @@ extern void add_hash_page(unsigned context, unsigned long va,
unsigned long pmdval); unsigned long pmdval);
/* Flush an entry from the TLB/hash table */ /* Flush an entry from the TLB/hash table */
extern void flush_hash_entry(struct mm_struct *mm, pte_t *ptep, static inline void flush_hash_entry(struct mm_struct *mm, pte_t *ptep, unsigned long addr)
unsigned long address); {
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 * 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, ...@@ -291,10 +297,9 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
{ {
unsigned long old; unsigned long old;
old = pte_update(mm, addr, ptep, _PAGE_ACCESSED, 0, 0); old = pte_update(mm, addr, ptep, _PAGE_ACCESSED, 0, 0);
if (old & _PAGE_HASHPTE) { if (old & _PAGE_HASHPTE)
unsigned long ptephys = __pa(ptep) & PAGE_MASK; flush_hash_entry(mm, ptep, addr);
flush_hash_pages(mm->context.id, addr, ptephys, 1);
}
return (old & _PAGE_ACCESSED) != 0; return (old & _PAGE_ACCESSED) != 0;
} }
#define ptep_test_and_clear_young(__vma, __addr, __ptep) \ #define ptep_test_and_clear_young(__vma, __addr, __ptep) \
......
...@@ -40,9 +40,6 @@ extern void tlb_flush(struct mmu_gather *tlb); ...@@ -40,9 +40,6 @@ extern void tlb_flush(struct mmu_gather *tlb);
/* Get the generic bits... */ /* Get the generic bits... */
#include <asm-generic/tlb.h> #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, static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep,
unsigned long address) unsigned long address)
{ {
......
...@@ -29,20 +29,6 @@ ...@@ -29,20 +29,6 @@
#include <mm/mmu_decl.h> #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: * TLB flushing:
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment