^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef __ASM_SH_PGALLOC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define __ASM_SH_PGALLOC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <asm/page.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define __HAVE_ARCH_PMD_ALLOC_ONE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define __HAVE_ARCH_PMD_FREE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define __HAVE_ARCH_PGD_FREE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <asm-generic/pgalloc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) extern pgd_t *pgd_alloc(struct mm_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #if PAGETABLE_LEVELS > 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) extern void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) extern void pmd_free(struct mm_struct *mm, pmd_t *pmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define __pmd_free_tlb(tlb, pmdp, addr) pmd_free((tlb)->mm, (pmdp))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) pte_t *pte)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) set_pmd(pmd, __pmd((unsigned long)pte));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) pgtable_t pte)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define pmd_pgtable(pmd) pmd_page(pmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define __pte_free_tlb(tlb,pte,addr) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) pgtable_pte_page_dtor(pte); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) tlb_remove_page((tlb), (pte)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #endif /* __ASM_SH_PGALLOC_H */