]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - arch/powerpc/include/asm/book3s/64/mmu.h
powerpc/mm/radix: Add radix callbacks for early init routines
[mirror_ubuntu-zesty-kernel.git] / arch / powerpc / include / asm / book3s / 64 / mmu.h
CommitLineData
11a6f6ab
AK
1#ifndef _ASM_POWERPC_BOOK3S_64_MMU_H_
2#define _ASM_POWERPC_BOOK3S_64_MMU_H_
3
4#ifndef __ASSEMBLY__
5/*
6 * Page size definition
7 *
8 * shift : is the "PAGE_SHIFT" value for that page size
9 * sllp : is a bit mask with the value of SLB L || LP to be or'ed
10 * directly to a slbmte "vsid" value
11 * penc : is the HPTE encoding mask for the "LP" field:
12 *
13 */
14struct mmu_psize_def {
15 unsigned int shift; /* number of bits */
16 int penc[MMU_PAGE_COUNT]; /* HPTE encoding */
17 unsigned int tlbiel; /* tlbiel supported for that page size */
18 unsigned long avpnm; /* bits to mask out in AVPN in the HPTE */
2bfd65e4
AK
19 union {
20 unsigned long sllp; /* SLB L||LP (exact mask to use in slbmte) */
21 unsigned long ap; /* Ap encoding used by PowerISA 3.0 */
22 };
11a6f6ab
AK
23};
24extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
566ca99a
AK
25
26#define radix_enabled() (0)
11a6f6ab
AK
27#endif /* __ASSEMBLY__ */
28
11a6f6ab
AK
29/* 64-bit classic hash table MMU */
30#include <asm/book3s/64/mmu-hash.h>
11a6f6ab
AK
31
32#ifndef __ASSEMBLY__
e9983344
AK
33/*
34 * ISA 3.0 partiton and process table entry format
35 */
36struct prtb_entry {
37 __be64 prtb0;
38 __be64 prtb1;
39};
40extern struct prtb_entry *process_tb;
41
42struct patb_entry {
43 __be64 patb0;
44 __be64 patb1;
45};
46extern struct patb_entry *partition_tb;
47
48#define PATB_HR (1UL << 63)
49#define PATB_GR (1UL << 63)
50#define RPDB_MASK 0x0ffffffffffff00fUL
51#define RPDB_SHIFT (1UL << 8)
52/*
53 * Limit process table to PAGE_SIZE table. This
54 * also limit the max pid we can support.
55 * MAX_USER_CONTEXT * 16 bytes of space.
56 */
57#define PRTB_SIZE_SHIFT (CONTEXT_BITS + 4)
58/*
59 * Power9 currently only support 64K partition table size.
60 */
61#define PATB_SIZE_SHIFT 16
11a6f6ab
AK
62
63typedef unsigned long mm_context_id_t;
64struct spinlock;
65
66typedef struct {
67 mm_context_id_t id;
68 u16 user_psize; /* page size index */
69
70#ifdef CONFIG_PPC_MM_SLICES
71 u64 low_slices_psize; /* SLB page size encodings */
72 unsigned char high_slices_psize[SLICE_ARRAY_SIZE];
73#else
74 u16 sllp; /* SLB page size encoding */
75#endif
76 unsigned long vdso_base;
77#ifdef CONFIG_PPC_SUBPAGE_PROT
78 struct subpage_prot_table spt;
79#endif /* CONFIG_PPC_SUBPAGE_PROT */
80#ifdef CONFIG_PPC_ICSWX
81 struct spinlock *cop_lockp; /* guard acop and cop_pid */
82 unsigned long acop; /* mask of enabled coprocessor types */
83 unsigned int cop_pid; /* pid value used with coprocessors */
84#endif /* CONFIG_PPC_ICSWX */
85#ifdef CONFIG_PPC_64K_PAGES
86 /* for 4K PTE fragment support */
87 void *pte_frag;
88#endif
89#ifdef CONFIG_SPAPR_TCE_IOMMU
90 struct list_head iommu_group_mem_list;
91#endif
92} mm_context_t;
93
94/*
95 * The current system page and segment sizes
96 */
97extern int mmu_linear_psize;
98extern int mmu_virtual_psize;
99extern int mmu_vmalloc_psize;
100extern int mmu_vmemmap_psize;
101extern int mmu_io_psize;
102
756d08d1 103/* MMU initialization */
2bfd65e4 104extern void radix_init_native(void);
756d08d1 105extern void hash__early_init_mmu(void);
2bfd65e4 106extern void radix__early_init_mmu(void);
756d08d1
AK
107static inline void early_init_mmu(void)
108{
2bfd65e4
AK
109 if (radix_enabled())
110 return radix__early_init_mmu();
756d08d1
AK
111 return hash__early_init_mmu();
112}
113extern void hash__early_init_mmu_secondary(void);
2bfd65e4 114extern void radix__early_init_mmu_secondary(void);
756d08d1
AK
115static inline void early_init_mmu_secondary(void)
116{
2bfd65e4
AK
117 if (radix_enabled())
118 return radix__early_init_mmu_secondary();
756d08d1
AK
119 return hash__early_init_mmu_secondary();
120}
121
122extern void hash__setup_initial_memory_limit(phys_addr_t first_memblock_base,
123 phys_addr_t first_memblock_size);
2bfd65e4
AK
124extern void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base,
125 phys_addr_t first_memblock_size);
756d08d1
AK
126static inline void setup_initial_memory_limit(phys_addr_t first_memblock_base,
127 phys_addr_t first_memblock_size)
128{
2bfd65e4
AK
129 if (radix_enabled())
130 return radix__setup_initial_memory_limit(first_memblock_base,
131 first_memblock_size);
756d08d1
AK
132 return hash__setup_initial_memory_limit(first_memblock_base,
133 first_memblock_size);
134}
11a6f6ab
AK
135#endif /* __ASSEMBLY__ */
136#endif /* _ASM_POWERPC_BOOK3S_64_MMU_H_ */