blob: 9c6a24fe493d59e88303647c2ed80e6a4f53c136 [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ALPHA_PGALLOC_H
3#define _ALPHA_PGALLOC_H
4
5#include <linux/mm.h>
6#include <linux/mmzone.h>
7
Olivier Deprez157378f2022-04-04 15:47:50 +02008#include <asm-generic/pgalloc.h>
David Brazdil0f672f62019-12-10 10:32:29 +00009
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010/*
11 * Allocate and free page tables. The xxx_kernel() versions are
12 * used to allocate a kernel page table - this turns on ASN bits
13 * if any.
14 */
15
16static inline void
17pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t pte)
18{
19 pmd_set(pmd, (pte_t *)(page_to_pa(pte) + PAGE_OFFSET));
20}
21#define pmd_pgtable(pmd) pmd_page(pmd)
22
23static inline void
24pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
25{
26 pmd_set(pmd, pte);
27}
28
29static inline void
Olivier Deprez157378f2022-04-04 15:47:50 +020030pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000031{
Olivier Deprez157378f2022-04-04 15:47:50 +020032 pud_set(pud, pmd);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000033}
34
35extern pgd_t *pgd_alloc(struct mm_struct *mm);
36
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000037#endif /* _ALPHA_PGALLOC_H */