Merge tag 'linux-kselftest-kunit-fixes-5.11-rc3' of git://git.kernel.org/pub/scm...
[linux/fpc-iii.git] / arch / m68k / include / asm / motorola_pgalloc.h
blobb4fc3b4f6bb38d661bc44759f96aee7e6f77db8f
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _MOTOROLA_PGALLOC_H
3 #define _MOTOROLA_PGALLOC_H
5 #include <asm/tlb.h>
6 #include <asm/tlbflush.h>
8 extern void mmu_page_ctor(void *page);
9 extern void mmu_page_dtor(void *page);
11 enum m68k_table_types {
12 TABLE_PGD = 0,
13 TABLE_PMD = 0, /* same size as PGD */
14 TABLE_PTE = 1,
17 extern void init_pointer_table(void *table, int type);
18 extern void *get_pointer_table(int type);
19 extern int free_pointer_table(void *table, int type);
22 * Allocate and free page tables. The xxx_kernel() versions are
23 * used to allocate a kernel page table - this turns on ASN bits
24 * if any.
27 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
29 return get_pointer_table(TABLE_PTE);
32 static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
34 free_pointer_table(pte, TABLE_PTE);
37 static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
39 return get_pointer_table(TABLE_PTE);
42 static inline void pte_free(struct mm_struct *mm, pgtable_t pgtable)
44 free_pointer_table(pgtable, TABLE_PTE);
47 static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pgtable,
48 unsigned long address)
50 free_pointer_table(pgtable, TABLE_PTE);
54 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
56 return get_pointer_table(TABLE_PMD);
59 static inline int pmd_free(struct mm_struct *mm, pmd_t *pmd)
61 return free_pointer_table(pmd, TABLE_PMD);
64 static inline int __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
65 unsigned long address)
67 return free_pointer_table(pmd, TABLE_PMD);
71 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
73 free_pointer_table(pgd, TABLE_PGD);
76 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
78 return get_pointer_table(TABLE_PGD);
82 static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
84 pmd_set(pmd, pte);
87 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t page)
89 pmd_set(pmd, page);
91 #define pmd_pgtable(pmd) ((pgtable_t)pmd_page_vaddr(pmd))
93 static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
95 pud_set(pud, pmd);
98 #endif /* _MOTOROLA_PGALLOC_H */