162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _ASM_POWERPC_BOOK3S_64_SLICE_H
362306a36Sopenharmony_ci#define _ASM_POWERPC_BOOK3S_64_SLICE_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#ifndef __ASSEMBLY__
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifdef CONFIG_PPC_64S_HASH_MMU
862306a36Sopenharmony_ci#ifdef CONFIG_HUGETLB_PAGE
962306a36Sopenharmony_ci#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
1062306a36Sopenharmony_ci#endif
1162306a36Sopenharmony_ci#define HAVE_ARCH_UNMAPPED_AREA
1262306a36Sopenharmony_ci#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
1362306a36Sopenharmony_ci#endif
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#define SLICE_LOW_SHIFT		28
1662306a36Sopenharmony_ci#define SLICE_LOW_TOP		(0x100000000ul)
1762306a36Sopenharmony_ci#define SLICE_NUM_LOW		(SLICE_LOW_TOP >> SLICE_LOW_SHIFT)
1862306a36Sopenharmony_ci#define GET_LOW_SLICE_INDEX(addr)	((addr) >> SLICE_LOW_SHIFT)
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define SLICE_HIGH_SHIFT	40
2162306a36Sopenharmony_ci#define SLICE_NUM_HIGH		(H_PGTABLE_RANGE >> SLICE_HIGH_SHIFT)
2262306a36Sopenharmony_ci#define GET_HIGH_SLICE_INDEX(addr)	((addr) >> SLICE_HIGH_SHIFT)
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#define SLB_ADDR_LIMIT_DEFAULT	DEFAULT_MAP_WINDOW_USER64
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_cistruct mm_struct;
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciunsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
2962306a36Sopenharmony_ci				      unsigned long flags, unsigned int psize,
3062306a36Sopenharmony_ci				      int topdown);
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciunsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr);
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_civoid slice_set_range_psize(struct mm_struct *mm, unsigned long start,
3562306a36Sopenharmony_ci			   unsigned long len, unsigned int psize);
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_civoid slice_init_new_context_exec(struct mm_struct *mm);
3862306a36Sopenharmony_civoid slice_setup_new_exec(void);
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#endif /* __ASSEMBLY__ */
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#endif /* _ASM_POWERPC_BOOK3S_64_SLICE_H */
43