1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _ASM_POWERPC_PGALLOC_32_H 3 #define _ASM_POWERPC_PGALLOC_32_H 4 5 #include <linux/threads.h> 6 #include <linux/slab.h> 7 8 /* 9 * We don't have any real pmd's, and this code never triggers because 10 * the pgd will always be present.. 11 */ 12 /* #define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) */ 13 #define pmd_free(mm, x) do { } while (0) 14 #define __pmd_free_tlb(tlb,x,a) do { } while (0) 15 /* #define pgd_populate(mm, pmd, pte) BUG() */ 16 17 static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, 18 pte_t *pte) 19 { 20 if (IS_ENABLED(CONFIG_BOOKE)) 21 *pmdp = __pmd((unsigned long)pte | _PMD_PRESENT); 22 else 23 *pmdp = __pmd(__pa(pte) | _PMD_PRESENT); 24 } 25 26 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmdp, 27 pgtable_t pte_page) 28 { 29 if (IS_ENABLED(CONFIG_BOOKE)) 30 *pmdp = __pmd((unsigned long)pte_page | _PMD_PRESENT); 31 else 32 *pmdp = __pmd(__pa(pte_page) | _PMD_USER | _PMD_PRESENT); 33 } 34 35 #endif /* _ASM_POWERPC_PGALLOC_32_H */ 36