xref: /openbmc/linux/arch/powerpc/include/asm/nohash/32/pgalloc.h (revision c39f2d9db0fd81ea20bb5cce9b3f082ca63753e2)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
275a9b8a6SAneesh Kumar K.V #ifndef _ASM_POWERPC_PGALLOC_32_H
375a9b8a6SAneesh Kumar K.V #define _ASM_POWERPC_PGALLOC_32_H
475a9b8a6SAneesh Kumar K.V 
575a9b8a6SAneesh Kumar K.V #include <linux/threads.h>
69b081e10SChristophe Leroy #include <linux/slab.h>
775a9b8a6SAneesh Kumar K.V 
875a9b8a6SAneesh Kumar K.V /*
975a9b8a6SAneesh Kumar K.V  * We don't have any real pmd's, and this code never triggers because
1075a9b8a6SAneesh Kumar K.V  * the pgd will always be present..
1175a9b8a6SAneesh Kumar K.V  */
1275a9b8a6SAneesh Kumar K.V /* #define pmd_alloc_one(mm,address)       ({ BUG(); ((pmd_t *)2); }) */
1375a9b8a6SAneesh Kumar K.V #define pmd_free(mm, x) 		do { } while (0)
1475a9b8a6SAneesh Kumar K.V #define __pmd_free_tlb(tlb,x,a)		do { } while (0)
1575a9b8a6SAneesh Kumar K.V /* #define pgd_populate(mm, pmd, pte)      BUG() */
1675a9b8a6SAneesh Kumar K.V 
pmd_populate_kernel(struct mm_struct * mm,pmd_t * pmdp,pte_t * pte)1775a9b8a6SAneesh Kumar K.V static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp,
1875a9b8a6SAneesh Kumar K.V 				       pte_t *pte)
1975a9b8a6SAneesh Kumar K.V {
20*bf8156c5SChristophe Leroy 	if (IS_ENABLED(CONFIG_BOOKE))
21*bf8156c5SChristophe Leroy 		*pmdp = __pmd((unsigned long)pte | _PMD_PRESENT);
22*bf8156c5SChristophe Leroy 	else
2375a9b8a6SAneesh Kumar K.V 		*pmdp = __pmd(__pa(pte) | _PMD_PRESENT);
2475a9b8a6SAneesh Kumar K.V }
2575a9b8a6SAneesh Kumar K.V 
pmd_populate(struct mm_struct * mm,pmd_t * pmdp,pgtable_t pte_page)2675a9b8a6SAneesh Kumar K.V static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmdp,
2775a9b8a6SAneesh Kumar K.V 				pgtable_t pte_page)
2875a9b8a6SAneesh Kumar K.V {
29*bf8156c5SChristophe Leroy 	if (IS_ENABLED(CONFIG_BOOKE))
30*bf8156c5SChristophe Leroy 		*pmdp = __pmd((unsigned long)pte_page | _PMD_PRESENT);
31*bf8156c5SChristophe Leroy 	else
3232ea4c14SChristophe Leroy 		*pmdp = __pmd(__pa(pte_page) | _PMD_USER | _PMD_PRESENT);
3375a9b8a6SAneesh Kumar K.V }
3475a9b8a6SAneesh Kumar K.V 
3575a9b8a6SAneesh Kumar K.V #endif /* _ASM_POWERPC_PGALLOC_32_H */
36