Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 #ifndef _ASM_POWERPC_PGALLOC_64_H
0003 #define _ASM_POWERPC_PGALLOC_64_H
0004 /*
0005  */
0006 
0007 #include <linux/slab.h>
0008 #include <linux/cpumask.h>
0009 #include <linux/percpu.h>
0010 
0011 struct vmemmap_backing {
0012     struct vmemmap_backing *list;
0013     unsigned long phys;
0014     unsigned long virt_addr;
0015 };
0016 extern struct vmemmap_backing *vmemmap_list;
0017 
0018 static inline void p4d_populate(struct mm_struct *mm, p4d_t *p4d, pud_t *pud)
0019 {
0020     p4d_set(p4d, (unsigned long)pud);
0021 }
0022 
0023 static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
0024 {
0025     return kmem_cache_alloc(PGT_CACHE(PUD_INDEX_SIZE),
0026             pgtable_gfp_flags(mm, GFP_KERNEL));
0027 }
0028 
0029 static inline void pud_free(struct mm_struct *mm, pud_t *pud)
0030 {
0031     kmem_cache_free(PGT_CACHE(PUD_INDEX_SIZE), pud);
0032 }
0033 
0034 static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
0035 {
0036     pud_set(pud, (unsigned long)pmd);
0037 }
0038 
0039 static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
0040                        pte_t *pte)
0041 {
0042     pmd_set(pmd, (unsigned long)pte);
0043 }
0044 
0045 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
0046                 pgtable_t pte_page)
0047 {
0048     pmd_set(pmd, (unsigned long)pte_page);
0049 }
0050 
0051 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
0052 {
0053     return kmem_cache_alloc(PGT_CACHE(PMD_CACHE_INDEX),
0054             pgtable_gfp_flags(mm, GFP_KERNEL));
0055 }
0056 
0057 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
0058 {
0059     kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd);
0060 }
0061 
0062 #define __pmd_free_tlb(tlb, pmd, addr)            \
0063     pgtable_free_tlb(tlb, pmd, PMD_CACHE_INDEX)
0064 #define __pud_free_tlb(tlb, pud, addr)            \
0065     pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE)
0066 
0067 #endif /* _ASM_POWERPC_PGALLOC_64_H */