1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_NOHASH_32_HUGETLB_8XX_H
3 #define _ASM_POWERPC_NOHASH_32_HUGETLB_8XX_H
5 #define PAGE_SHIFT_8M 23
7 static inline pte_t *hugepd_page(hugepd_t hpd)
9 BUG_ON(!hugepd_ok(hpd));
11 return (pte_t *)__va(hpd_val(hpd) & ~HUGEPD_SHIFT_MASK);
14 static inline unsigned int hugepd_shift(hugepd_t hpd)
16 return ((hpd_val(hpd) & _PMD_PAGE_MASK) >> 1) + 17;
19 static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr,
22 unsigned long idx = (addr & ((1UL << pdshift) - 1)) >> PAGE_SHIFT;
24 return hugepd_page(hpd) + idx;
27 static inline void flush_hugetlb_page(struct vm_area_struct *vma,
30 flush_tlb_page(vma, vmaddr);
33 static inline void hugepd_populate(hugepd_t *hpdp, pte_t *new, unsigned int pshift)
35 *hpdp = __hugepd(__pa(new) | _PMD_USER | _PMD_PRESENT |
36 (pshift == PAGE_SHIFT_8M ? _PMD_PAGE_8M : _PMD_PAGE_512K));
39 static inline int check_and_get_huge_psize(int shift)
41 return shift_to_mmu_psize(shift);
44 #endif /* _ASM_POWERPC_NOHASH_32_HUGETLB_8XX_H */