xref: /linux/arch/powerpc/include/asm/nohash/hugetlb-e500.h (revision 6e7fd890f1d6ac83805409e9c346240de2705584)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_NOHASH_HUGETLB_E500_H
3 #define _ASM_POWERPC_NOHASH_HUGETLB_E500_H
4 
5 void flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
6 
7 static inline int check_and_get_huge_psize(int shift)
8 {
9 	if (shift & 1)	/* Not a power of 4 */
10 		return -EINVAL;
11 
12 	return shift_to_mmu_psize(shift);
13 }
14 
15 static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags)
16 {
17 	unsigned int tsize = shift - _PAGE_PSIZE_SHIFT_OFFSET;
18 	pte_basic_t val = (tsize << _PAGE_PSIZE_SHIFT) & _PAGE_PSIZE_MSK;
19 
20 	return __pte((pte_val(entry) & ~(pte_basic_t)_PAGE_PSIZE_MSK) | val);
21 }
22 #define arch_make_huge_pte arch_make_huge_pte
23 
24 #endif /* _ASM_POWERPC_NOHASH_HUGETLB_E500_H */
25