Path: blob/master/arch/powerpc/include/asm/book3s/32/pgalloc.h
26519 views
/* SPDX-License-Identifier: GPL-2.0 */1#ifndef _ASM_POWERPC_BOOK3S_32_PGALLOC_H2#define _ASM_POWERPC_BOOK3S_32_PGALLOC_H34#include <linux/threads.h>5#include <linux/slab.h>67static inline pgd_t *pgd_alloc(struct mm_struct *mm)8{9return kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE),10pgtable_gfp_flags(mm, GFP_KERNEL));11}1213static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)14{15kmem_cache_free(PGT_CACHE(PGD_INDEX_SIZE), pgd);16}1718/*19* We don't have any real pmd's, and this code never triggers because20* the pgd will always be present..21*/22/* #define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) */23#define pmd_free(mm, x) do { } while (0)24#define __pmd_free_tlb(tlb,x,a) do { } while (0)25/* #define pgd_populate(mm, pmd, pte) BUG() */2627static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp,28pte_t *pte)29{30*pmdp = __pmd(__pa(pte) | _PMD_PRESENT);31}3233static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmdp,34pgtable_t pte_page)35{36*pmdp = __pmd(__pa(pte_page) | _PMD_PRESENT);37}3839static inline void pgtable_free(void *table, unsigned index_size)40{41if (!index_size) {42pte_fragment_free((unsigned long *)table, 0);43} else {44BUG_ON(index_size > MAX_PGTABLE_INDEX_SIZE);45kmem_cache_free(PGT_CACHE(index_size), table);46}47}4849static inline void pgtable_free_tlb(struct mmu_gather *tlb,50void *table, int shift)51{52unsigned long pgf = (unsigned long)table;53BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE);54pgf |= shift;55tlb_remove_table(tlb, (void *)pgf);56}5758static inline void __tlb_remove_table(void *_table)59{60void *table = (void *)((unsigned long)_table & ~MAX_PGTABLE_INDEX_SIZE);61unsigned shift = (unsigned long)_table & MAX_PGTABLE_INDEX_SIZE;6263pgtable_free(table, shift);64}6566static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,67unsigned long address)68{69pgtable_free_tlb(tlb, table, 0);70}71#endif /* _ASM_POWERPC_BOOK3S_32_PGALLOC_H */727374