1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2f15cbe6fSPaul Mundt #ifndef __ASM_SH_PGALLOC_H 3f15cbe6fSPaul Mundt #define __ASM_SH_PGALLOC_H 4f15cbe6fSPaul Mundt 5f15cbe6fSPaul Mundt #include <asm/page.h> 61355c31eSMike Rapoport 71355c31eSMike Rapoport #define __HAVE_ARCH_PMD_ALLOC_ONE 81355c31eSMike Rapoport #define __HAVE_ARCH_PMD_FREE 9*f9cb654cSMike Rapoport #define __HAVE_ARCH_PGD_FREE 106fb12766SMike Rapoport #include <asm-generic/pgalloc.h> 11f15cbe6fSPaul Mundt 122a5eaccaSMatt Fleming extern pgd_t *pgd_alloc(struct mm_struct *); 132a5eaccaSMatt Fleming extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); 142a5eaccaSMatt Fleming 15782bb5a5SPaul Mundt #if PAGETABLE_LEVELS > 2 162a5eaccaSMatt Fleming extern void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd); 172a5eaccaSMatt Fleming extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address); 182a5eaccaSMatt Fleming extern void pmd_free(struct mm_struct *mm, pmd_t *pmd); 19c7bcbc8aSPeter Zijlstra #define __pmd_free_tlb(tlb, pmdp, addr) pmd_free((tlb)->mm, (pmdp)) 205d9b4b19SMatt Fleming #endif 21b73c8063SMatt Fleming 22f15cbe6fSPaul Mundt static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, 23f15cbe6fSPaul Mundt pte_t *pte) 24f15cbe6fSPaul Mundt { 25f15cbe6fSPaul Mundt set_pmd(pmd, __pmd((unsigned long)pte)); 26f15cbe6fSPaul Mundt } 27f15cbe6fSPaul Mundt 28f15cbe6fSPaul Mundt static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, 29f15cbe6fSPaul Mundt pgtable_t pte) 30f15cbe6fSPaul Mundt { 31f15cbe6fSPaul Mundt set_pmd(pmd, __pmd((unsigned long)page_address(pte))); 32f15cbe6fSPaul Mundt } 33f15cbe6fSPaul Mundt #define pmd_pgtable(pmd) pmd_page(pmd) 34f15cbe6fSPaul Mundt 359e1b32caSBenjamin Herrenschmidt #define __pte_free_tlb(tlb,pte,addr) \ 36f15cbe6fSPaul Mundt do { \ 37b4ed71f5SMark Rutland pgtable_pte_page_dtor(pte); \ 38f15cbe6fSPaul Mundt tlb_remove_page((tlb), (pte)); \ 39f15cbe6fSPaul Mundt } while (0) 40f15cbe6fSPaul Mundt 41f15cbe6fSPaul Mundt #endif /* __ASM_SH_PGALLOC_H */ 42