This source file includes following definitions.
- mm_ctx_user_psize
- mm_ctx_set_user_psize
- mm_ctx_low_slices
- mm_ctx_high_slices
- mm_ctx_slb_addr_limit
- mm_ctx_set_slb_addr_limit
- slice_mask_for_size
- shift_to_mmu_psize
- mmu_psize_to_shift
1
2 #ifndef _ASM_POWERPC_MMU_8XX_H_
3 #define _ASM_POWERPC_MMU_8XX_H_
4
5
6
7
8
9
10
11
12
13
14
15 #define SPRN_MI_CTR 784
16 #define MI_GPM 0x80000000
17 #define MI_PPM 0x40000000
18 #define MI_CIDEF 0x20000000
19 #define MI_RSV4I 0x08000000
20 #define MI_PPCS 0x02000000
21 #define MI_IDXMASK 0x00001f00
22 #define MI_RESETVAL 0x00000000
23
24
25
26
27 #define SPRN_MI_AP 786
28 #define MI_Ks 0x80000000
29 #define MI_Kp 0x40000000
30
31
32
33
34
35
36
37
38
39
40
41
42 #define MI_APG_INIT 0x4fffffff
43
44
45
46
47
48
49 #define MI_APG_KUEP 0x6fffffff
50
51
52
53
54
55 #define SPRN_MI_EPN 787
56 #define MI_EPNMASK 0xfffff000
57 #define MI_EVALID 0x00000200
58 #define MI_ASIDMASK 0x0000000f
59
60
61
62
63
64
65 #define SPRN_MI_TWC 789
66 #define MI_APG 0x000001e0
67 #define MI_GUARDED 0x00000010
68 #define MI_PSMASK 0x0000000c
69 #define MI_PS8MEG 0x0000000c
70 #define MI_PS512K 0x00000004
71 #define MI_PS4K_16K 0x00000000
72 #define MI_SVALID 0x00000001
73
74
75
76
77
78
79 #define SPRN_MI_RPN 790
80 #define MI_SPS16K 0x00000008
81
82
83
84
85
86
87 #define MI_BOOTINIT 0x000001fd
88
89 #define SPRN_MD_CTR 792
90 #define MD_GPM 0x80000000
91 #define MD_PPM 0x40000000
92 #define MD_CIDEF 0x20000000
93 #define MD_WTDEF 0x10000000
94 #define MD_RSV4I 0x08000000
95 #define MD_TWAM 0x04000000
96 #define MD_PPCS 0x02000000
97 #define MD_IDXMASK 0x00001f00
98 #define MD_RESETVAL 0x04000000
99
100 #define SPRN_M_CASID 793
101 #define MC_ASIDMASK 0x0000000f
102
103
104
105
106
107 #define SPRN_MD_AP 794
108 #define MD_Ks 0x80000000
109 #define MD_Kp 0x40000000
110
111
112
113
114
115
116
117
118
119
120
121
122 #define MD_APG_INIT 0x4fffffff
123
124
125
126
127
128
129 #define MD_APG_KUAP 0x6fffffff
130
131
132
133
134
135 #define SPRN_MD_EPN 795
136 #define MD_EPNMASK 0xfffff000
137 #define MD_EVALID 0x00000200
138 #define MD_ASIDMASK 0x0000000f
139
140
141
142
143
144
145 #define SPRN_M_TWB 796
146 #define M_L1TB 0xfffff000
147 #define M_L1INDX 0x00000ffc
148
149
150
151
152
153
154
155 #define SPRN_MD_TWC 797
156 #define MD_L2TB 0xfffff000
157 #define MD_L2INDX 0xfffffe00
158 #define MD_APG 0x000001e0
159 #define MD_GUARDED 0x00000010
160 #define MD_PSMASK 0x0000000c
161 #define MD_PS8MEG 0x0000000c
162 #define MD_PS512K 0x00000004
163 #define MD_PS4K_16K 0x00000000
164 #define MD_WT 0x00000002
165 #define MD_SVALID 0x00000001
166
167
168
169
170
171
172
173 #define SPRN_MD_RPN 798
174 #define MD_SPS16K 0x00000008
175
176
177
178
179 #define SPRN_M_TW 799
180
181 #ifdef CONFIG_PPC_MM_SLICES
182 #include <asm/nohash/32/slice.h>
183 #define SLICE_ARRAY_SIZE (1 << (32 - SLICE_LOW_SHIFT - 1))
184 #define LOW_SLICE_ARRAY_SZ SLICE_ARRAY_SIZE
185 #endif
186
187 #if defined(CONFIG_PPC_4K_PAGES)
188 #define mmu_virtual_psize MMU_PAGE_4K
189 #elif defined(CONFIG_PPC_16K_PAGES)
190 #define mmu_virtual_psize MMU_PAGE_16K
191 #define PTE_FRAG_NR 4
192 #define PTE_FRAG_SIZE_SHIFT 12
193 #define PTE_FRAG_SIZE (1UL << 12)
194 #else
195 #error "Unsupported PAGE_SIZE"
196 #endif
197
198 #define mmu_linear_psize MMU_PAGE_8M
199
200 #ifndef __ASSEMBLY__
201
202 #include <linux/mmdebug.h>
203
204 struct slice_mask {
205 u64 low_slices;
206 DECLARE_BITMAP(high_slices, 0);
207 };
208
209 typedef struct {
210 unsigned int id;
211 unsigned int active;
212 unsigned long vdso_base;
213 #ifdef CONFIG_PPC_MM_SLICES
214 u16 user_psize;
215 unsigned char low_slices_psize[SLICE_ARRAY_SIZE];
216 unsigned char high_slices_psize[0];
217 unsigned long slb_addr_limit;
218 struct slice_mask mask_base_psize;
219 struct slice_mask mask_512k;
220 struct slice_mask mask_8m;
221 #endif
222 void *pte_frag;
223 } mm_context_t;
224
225 #ifdef CONFIG_PPC_MM_SLICES
226 static inline u16 mm_ctx_user_psize(mm_context_t *ctx)
227 {
228 return ctx->user_psize;
229 }
230
231 static inline void mm_ctx_set_user_psize(mm_context_t *ctx, u16 user_psize)
232 {
233 ctx->user_psize = user_psize;
234 }
235
236 static inline unsigned char *mm_ctx_low_slices(mm_context_t *ctx)
237 {
238 return ctx->low_slices_psize;
239 }
240
241 static inline unsigned char *mm_ctx_high_slices(mm_context_t *ctx)
242 {
243 return ctx->high_slices_psize;
244 }
245
246 static inline unsigned long mm_ctx_slb_addr_limit(mm_context_t *ctx)
247 {
248 return ctx->slb_addr_limit;
249 }
250
251 static inline void mm_ctx_set_slb_addr_limit(mm_context_t *ctx, unsigned long limit)
252 {
253 ctx->slb_addr_limit = limit;
254 }
255
256 static inline struct slice_mask *slice_mask_for_size(mm_context_t *ctx, int psize)
257 {
258 if (psize == MMU_PAGE_512K)
259 return &ctx->mask_512k;
260 if (psize == MMU_PAGE_8M)
261 return &ctx->mask_8m;
262
263 BUG_ON(psize != mmu_virtual_psize);
264
265 return &ctx->mask_base_psize;
266 }
267 #endif
268
269 #define PHYS_IMMR_BASE (mfspr(SPRN_IMMR) & 0xfff80000)
270 #define VIRT_IMMR_BASE (__fix_to_virt(FIX_IMMR_BASE))
271
272
273
274
275
276
277
278 struct mmu_psize_def {
279 unsigned int shift;
280 unsigned int enc;
281 unsigned int ind;
282 unsigned int flags;
283 #define MMU_PAGE_SIZE_DIRECT 0x1
284 #define MMU_PAGE_SIZE_INDIRECT 0x2
285 };
286
287 extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
288
289 static inline int shift_to_mmu_psize(unsigned int shift)
290 {
291 int psize;
292
293 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize)
294 if (mmu_psize_defs[psize].shift == shift)
295 return psize;
296 return -1;
297 }
298
299 static inline unsigned int mmu_psize_to_shift(unsigned int mmu_psize)
300 {
301 if (mmu_psize_defs[mmu_psize].shift)
302 return mmu_psize_defs[mmu_psize].shift;
303 BUG();
304 }
305
306
307 extern s32 patch__itlbmiss_linmem_top, patch__itlbmiss_linmem_top8;
308 extern s32 patch__dtlbmiss_linmem_top, patch__dtlbmiss_immr_jmp;
309 extern s32 patch__fixupdar_linmem_top;
310 extern s32 patch__dtlbmiss_romem_top, patch__dtlbmiss_romem_top8;
311
312 extern s32 patch__itlbmiss_exit_1, patch__itlbmiss_exit_2;
313 extern s32 patch__dtlbmiss_exit_1, patch__dtlbmiss_exit_2, patch__dtlbmiss_exit_3;
314 extern s32 patch__itlbmiss_perf, patch__dtlbmiss_perf;
315
316 #endif
317
318 #endif