1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ALPHA_PGALLOC_H
3 #define _ALPHA_PGALLOC_H
6 #include <linux/mmzone.h>
9 * Allocate and free page tables. The xxx_kernel() versions are
10 * used to allocate a kernel page table - this turns on ASN bits
15 pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t pte)
17 pmd_set(pmd, (pte_t *)(page_to_pa(pte) + PAGE_OFFSET));
19 #define pmd_pgtable(pmd) pmd_page(pmd)
22 pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
28 pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
33 extern pgd_t *pgd_alloc(struct mm_struct *mm);
36 pgd_free(struct mm_struct *mm, pgd_t *pgd)
38 free_page((unsigned long)pgd);
42 pmd_alloc_one(struct mm_struct *mm, unsigned long address)
44 pmd_t *ret = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
49 pmd_free(struct mm_struct *mm, pmd_t *pmd)
51 free_page((unsigned long)pmd);
55 pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
57 pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
62 pte_free_kernel(struct mm_struct *mm, pte_t *pte)
64 free_page((unsigned long)pte);
67 static inline pgtable_t
68 pte_alloc_one(struct mm_struct *mm, unsigned long address)
70 pte_t *pte = pte_alloc_one_kernel(mm, address);
75 page = virt_to_page(pte);
76 if (!pgtable_page_ctor(page)) {
84 pte_free(struct mm_struct *mm, pgtable_t page)
86 pgtable_page_dtor(page);
90 #define check_pgt_cache() do { } while (0)
92 #endif /* _ALPHA_PGALLOC_H */