summaryrefslogtreecommitdiff
path: root/arch/m68k/include/asm/motorola_pgalloc.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2020-01-31 13:45:34 +0100
committerGeert Uytterhoeven <geert@linux-m68k.org>2020-02-10 10:57:48 +0100
commit13076a29d52e91d29ab6b13e7279c9eacd0b6dbb (patch)
tree0f570e991c449c46f76d9868e3c79c4a38912967 /arch/m68k/include/asm/motorola_pgalloc.h
parentfd1aa6303c4d6f3c1489eadc5cc37e581c3b41ea (diff)
m68k: mm: Unify Motorola MMU page setup
Seeing how there are 5 copies of this magic code, one of which is unexplainably different, unify and document things. Suggested-by: Will Deacon <will@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Will Deacon <will@kernel.org> Acked-by: Greg Ungerer <gerg@linux-m68k.org> Tested-by: Michael Schmitz <schmitzmic@gmail.com> Tested-by: Greg Ungerer <gerg@linux-m68k.org> Link: https://lore.kernel.org/r/20200131125403.597688427@infradead.org Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k/include/asm/motorola_pgalloc.h')
-rw-r--r--arch/m68k/include/asm/motorola_pgalloc.h23
1 files changed, 10 insertions, 13 deletions
diff --git a/arch/m68k/include/asm/motorola_pgalloc.h b/arch/m68k/include/asm/motorola_pgalloc.h
index ff9cc401ffd1..85af0c602e9f 100644
--- a/arch/m68k/include/asm/motorola_pgalloc.h
+++ b/arch/m68k/include/asm/motorola_pgalloc.h
@@ -5,6 +5,9 @@
#include <asm/tlb.h>
#include <asm/tlbflush.h>
+extern void mmu_page_ctor(void *page);
+extern void mmu_page_dtor(void *page);
+
extern pmd_t *get_pointer_table(void);
extern int free_pointer_table(pmd_t *);
@@ -13,25 +16,21 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
pte_t *pte;
pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
- if (pte) {
- __flush_page_to_ram(pte);
- flush_tlb_kernel_page(pte);
- nocache_page(pte);
- }
+ if (pte)
+ mmu_page_ctor(pte);
return pte;
}
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
{
- cache_page(pte);
+ mmu_page_dtor(pte);
free_page((unsigned long) pte);
}
static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
{
struct page *page;
- pte_t *pte;
page = alloc_pages(GFP_KERNEL|__GFP_ZERO, 0);
if(!page)
@@ -41,18 +40,16 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
return NULL;
}
- pte = kmap(page);
- __flush_page_to_ram(pte);
- flush_tlb_kernel_page(pte);
- nocache_page(pte);
+ mmu_page_ctor(kmap(page));
kunmap(page);
+
return page;
}
static inline void pte_free(struct mm_struct *mm, pgtable_t page)
{
pgtable_pte_page_dtor(page);
- cache_page(kmap(page));
+ mmu_page_dtor(kmap(page));
kunmap(page);
__free_page(page);
}
@@ -61,7 +58,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page,
unsigned long address)
{
pgtable_pte_page_dtor(page);
- cache_page(kmap(page));
+ mmu_page_dtor(kmap(page));
kunmap(page);
__free_page(page);
}