pgalloc.h (1619B)
1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2#ifndef _ASM_POWERPC_PGALLOC_64_H 3#define _ASM_POWERPC_PGALLOC_64_H 4/* 5 */ 6 7#include <linux/slab.h> 8#include <linux/cpumask.h> 9#include <linux/percpu.h> 10 11struct vmemmap_backing { 12 struct vmemmap_backing *list; 13 unsigned long phys; 14 unsigned long virt_addr; 15}; 16extern struct vmemmap_backing *vmemmap_list; 17 18#define p4d_populate(MM, P4D, PUD) p4d_set(P4D, (unsigned long)PUD) 19 20static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) 21{ 22 return kmem_cache_alloc(PGT_CACHE(PUD_INDEX_SIZE), 23 pgtable_gfp_flags(mm, GFP_KERNEL)); 24} 25 26static inline void pud_free(struct mm_struct *mm, pud_t *pud) 27{ 28 kmem_cache_free(PGT_CACHE(PUD_INDEX_SIZE), pud); 29} 30 31static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) 32{ 33 pud_set(pud, (unsigned long)pmd); 34} 35 36static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, 37 pte_t *pte) 38{ 39 pmd_set(pmd, (unsigned long)pte); 40} 41 42static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, 43 pgtable_t pte_page) 44{ 45 pmd_set(pmd, (unsigned long)pte_page); 46} 47 48static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) 49{ 50 return kmem_cache_alloc(PGT_CACHE(PMD_CACHE_INDEX), 51 pgtable_gfp_flags(mm, GFP_KERNEL)); 52} 53 54static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) 55{ 56 kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd); 57} 58 59#define __pmd_free_tlb(tlb, pmd, addr) \ 60 pgtable_free_tlb(tlb, pmd, PMD_CACHE_INDEX) 61#define __pud_free_tlb(tlb, pud, addr) \ 62 pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE) 63 64#endif /* _ASM_POWERPC_PGALLOC_64_H */