xref: /linux/arch/powerpc/include/asm/book3s/64/slice.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1a3286f05SChristophe Leroy /* SPDX-License-Identifier: GPL-2.0 */
2a3286f05SChristophe Leroy #ifndef _ASM_POWERPC_BOOK3S_64_SLICE_H
3a3286f05SChristophe Leroy #define _ASM_POWERPC_BOOK3S_64_SLICE_H
4a3286f05SChristophe Leroy 
51408fca0SChristophe Leroy #ifndef __ASSEMBLY__
61408fca0SChristophe Leroy 
7*c85ab4feSChristophe Leroy #ifdef CONFIG_PPC_64S_HASH_MMU
8ab57bd75SChristophe Leroy #ifdef CONFIG_HUGETLB_PAGE
9ab57bd75SChristophe Leroy #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
10ab57bd75SChristophe Leroy #endif
11ab57bd75SChristophe Leroy #define HAVE_ARCH_UNMAPPED_AREA
12ab57bd75SChristophe Leroy #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
13*c85ab4feSChristophe Leroy #endif
14ab57bd75SChristophe Leroy 
15a3286f05SChristophe Leroy #define SLICE_LOW_SHIFT		28
16a3286f05SChristophe Leroy #define SLICE_LOW_TOP		(0x100000000ul)
17a3286f05SChristophe Leroy #define SLICE_NUM_LOW		(SLICE_LOW_TOP >> SLICE_LOW_SHIFT)
18a3286f05SChristophe Leroy #define GET_LOW_SLICE_INDEX(addr)	((addr) >> SLICE_LOW_SHIFT)
19a3286f05SChristophe Leroy 
20a3286f05SChristophe Leroy #define SLICE_HIGH_SHIFT	40
21a3286f05SChristophe Leroy #define SLICE_NUM_HIGH		(H_PGTABLE_RANGE >> SLICE_HIGH_SHIFT)
22a3286f05SChristophe Leroy #define GET_HIGH_SLICE_INDEX(addr)	((addr) >> SLICE_HIGH_SHIFT)
23a3286f05SChristophe Leroy 
245953fb4fSChristophe Leroy #define SLB_ADDR_LIMIT_DEFAULT	DEFAULT_MAP_WINDOW_USER64
255953fb4fSChristophe Leroy 
261408fca0SChristophe Leroy struct mm_struct;
271408fca0SChristophe Leroy 
281408fca0SChristophe Leroy unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
291408fca0SChristophe Leroy 				      unsigned long flags, unsigned int psize,
301408fca0SChristophe Leroy 				      int topdown);
311408fca0SChristophe Leroy 
321408fca0SChristophe Leroy unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr);
331408fca0SChristophe Leroy 
341408fca0SChristophe Leroy void slice_set_range_psize(struct mm_struct *mm, unsigned long start,
351408fca0SChristophe Leroy 			   unsigned long len, unsigned int psize);
361408fca0SChristophe Leroy 
371408fca0SChristophe Leroy void slice_init_new_context_exec(struct mm_struct *mm);
381408fca0SChristophe Leroy void slice_setup_new_exec(void);
391408fca0SChristophe Leroy 
401408fca0SChristophe Leroy #endif /* __ASSEMBLY__ */
411408fca0SChristophe Leroy 
42a3286f05SChristophe Leroy #endif /* _ASM_POWERPC_BOOK3S_64_SLICE_H */
43