1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef _ASM_POWERPC_PGALLOC_64_H
3 #define _ASM_POWERPC_PGALLOC_64_H
7 #include <linux/slab.h>
8 #include <linux/cpumask.h>
9 #include <linux/percpu.h>
11 struct vmemmap_backing {
12 struct vmemmap_backing *list;
14 unsigned long virt_addr;
16 extern struct vmemmap_backing *vmemmap_list;
18 #define pgd_populate(MM, PGD, PUD) pgd_set(PGD, (unsigned long)PUD)
20 static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
22 return kmem_cache_alloc(PGT_CACHE(PUD_INDEX_SIZE),
23 pgtable_gfp_flags(mm, GFP_KERNEL));
26 static inline void pud_free(struct mm_struct *mm, pud_t *pud)
28 kmem_cache_free(PGT_CACHE(PUD_INDEX_SIZE), pud);
31 static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
33 pud_set(pud, (unsigned long)pmd);
36 static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
39 pmd_set(pmd, (unsigned long)pte);
42 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
45 pmd_set(pmd, (unsigned long)pte_page);
48 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
50 return kmem_cache_alloc(PGT_CACHE(PMD_CACHE_INDEX),
51 pgtable_gfp_flags(mm, GFP_KERNEL));
54 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
56 kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd);
59 #define __pmd_free_tlb(tlb, pmd, addr) \
60 pgtable_free_tlb(tlb, pmd, PMD_CACHE_INDEX)
61 #define __pud_free_tlb(tlb, pud, addr) \
62 pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE)
64 #endif /* _ASM_POWERPC_PGALLOC_64_H */