Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is subject to the terms and conditions of the GNU General Public |
| 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. |
| 5 | * |
| 6 | * Copyright (C) 1994 - 2001, 2003 by Ralf Baechle |
| 7 | * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc. |
| 8 | */ |
| 9 | |
| 10 | #ifndef _ASM_NIOS2_PGALLOC_H |
| 11 | #define _ASM_NIOS2_PGALLOC_H |
| 12 | |
| 13 | #include <linux/mm.h> |
| 14 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 15 | #include <asm-generic/pgalloc.h> |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 16 | |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 17 | static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, |
| 18 | pte_t *pte) |
| 19 | { |
| 20 | set_pmd(pmd, __pmd((unsigned long)pte)); |
| 21 | } |
| 22 | |
| 23 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, |
| 24 | pgtable_t pte) |
| 25 | { |
| 26 | set_pmd(pmd, __pmd((unsigned long)page_address(pte))); |
| 27 | } |
| 28 | #define pmd_pgtable(pmd) pmd_page(pmd) |
| 29 | |
| 30 | /* |
| 31 | * Initialize a new pmd table with invalid pointers. |
| 32 | */ |
| 33 | extern void pmd_init(unsigned long page, unsigned long pagetable); |
| 34 | |
| 35 | extern pgd_t *pgd_alloc(struct mm_struct *mm); |
| 36 | |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 37 | #define __pte_free_tlb(tlb, pte, addr) \ |
| 38 | do { \ |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 39 | pgtable_pte_page_dtor(pte); \ |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 40 | tlb_remove_page((tlb), (pte)); \ |
| 41 | } while (0) |
| 42 | |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 43 | #endif /* _ASM_NIOS2_PGALLOC_H */ |