GNU Linux-libre 4.19.245-gnu1
[releases.git] / arch / powerpc / include / asm / book3s / 64 / slice.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_BOOK3S_64_SLICE_H
3 #define _ASM_POWERPC_BOOK3S_64_SLICE_H
4
5 #ifdef CONFIG_PPC_MM_SLICES
6
7 #define SLICE_LOW_SHIFT         28
8 #define SLICE_LOW_TOP           (0x100000000ul)
9 #define SLICE_NUM_LOW           (SLICE_LOW_TOP >> SLICE_LOW_SHIFT)
10 #define GET_LOW_SLICE_INDEX(addr)       ((addr) >> SLICE_LOW_SHIFT)
11
12 #define SLICE_HIGH_SHIFT        40
13 #define SLICE_NUM_HIGH          (H_PGTABLE_RANGE >> SLICE_HIGH_SHIFT)
14 #define GET_HIGH_SLICE_INDEX(addr)      ((addr) >> SLICE_HIGH_SHIFT)
15
16 #else /* CONFIG_PPC_MM_SLICES */
17
18 #define get_slice_psize(mm, addr)       ((mm)->context.user_psize)
19 #define slice_set_user_psize(mm, psize)         \
20 do {                                            \
21         (mm)->context.user_psize = (psize);     \
22         (mm)->context.sllp = SLB_VSID_USER | mmu_psize_defs[(psize)].sllp; \
23 } while (0)
24
25 #endif /* CONFIG_PPC_MM_SLICES */
26
27 #endif /* _ASM_POWERPC_BOOK3S_64_SLICE_H */