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