Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | #ifndef __ASM_SH_PGALLOC_H |
| 3 | #define __ASM_SH_PGALLOC_H |
| 4 | |
Paul Mundt | 5f8c990 | 2007-05-08 11:55:21 +0900 | [diff] [blame] | 5 | #include <asm/page.h> |
Mike Rapoport | 1355c31 | 2020-08-06 23:22:39 -0700 | [diff] [blame] | 6 | |
| 7 | #define __HAVE_ARCH_PMD_ALLOC_ONE |
| 8 | #define __HAVE_ARCH_PMD_FREE |
Mike Rapoport | f9cb654 | 2020-08-06 23:22:47 -0700 | [diff] [blame] | 9 | #define __HAVE_ARCH_PGD_FREE |
Mike Rapoport | 6fb1276 | 2019-09-23 15:35:25 -0700 | [diff] [blame] | 10 | #include <asm-generic/pgalloc.h> |
Paul Mundt | 5f8c990 | 2007-05-08 11:55:21 +0900 | [diff] [blame] | 11 | |
Matt Fleming | 2a5eacc | 2009-12-31 12:19:24 +0000 | [diff] [blame] | 12 | extern pgd_t *pgd_alloc(struct mm_struct *); |
| 13 | extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); |
| 14 | |
Paul Mundt | 782bb5a | 2010-01-13 19:11:14 +0900 | [diff] [blame] | 15 | #if PAGETABLE_LEVELS > 2 |
Matt Fleming | 2a5eacc | 2009-12-31 12:19:24 +0000 | [diff] [blame] | 16 | extern void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd); |
| 17 | extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address); |
| 18 | extern void pmd_free(struct mm_struct *mm, pmd_t *pmd); |
Peter Zijlstra | c7bcbc8 | 2020-07-17 13:10:07 +0200 | [diff] [blame] | 19 | #define __pmd_free_tlb(tlb, pmdp, addr) pmd_free((tlb)->mm, (pmdp)) |
Matt Fleming | 5d9b4b1 | 2009-12-13 14:38:50 +0000 | [diff] [blame] | 20 | #endif |
Matt Fleming | b73c806 | 2009-11-25 22:00:08 +0000 | [diff] [blame] | 21 | |
Stuart Menefy | 99a596f | 2006-11-21 15:38:05 +0900 | [diff] [blame] | 22 | static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, |
| 23 | pte_t *pte) |
| 24 | { |
| 25 | set_pmd(pmd, __pmd((unsigned long)pte)); |
| 26 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | |
| 28 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, |
Martin Schwidefsky | 2f569af | 2008-02-08 04:22:04 -0800 | [diff] [blame] | 29 | pgtable_t pte) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | { |
Stuart Menefy | 99a596f | 2006-11-21 15:38:05 +0900 | [diff] [blame] | 31 | set_pmd(pmd, __pmd((unsigned long)page_address(pte))); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | } |
| 33 | |
Benjamin Herrenschmidt | 9e1b32c | 2009-07-22 15:44:28 +1000 | [diff] [blame] | 34 | #define __pte_free_tlb(tlb,pte,addr) \ |
Martin Schwidefsky | 2f569af | 2008-02-08 04:22:04 -0800 | [diff] [blame] | 35 | do { \ |
Mark Rutland | b4ed71f | 2019-09-25 16:49:46 -0700 | [diff] [blame] | 36 | pgtable_pte_page_dtor(pte); \ |
Martin Schwidefsky | 2f569af | 2008-02-08 04:22:04 -0800 | [diff] [blame] | 37 | tlb_remove_page((tlb), (pte)); \ |
| 38 | } while (0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | #endif /* __ASM_SH_PGALLOC_H */ |