aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-02-08 01:13:05 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-03-20 04:11:56 -0500
commit8b11bd12aff76e02cdc2cbc9e439bba88d281223 (patch)
tree903ab8830616bfbe5a821e4359f642842c8060a4 /arch
parent481295f982b21b1dbe71cbf41d3a93028fee30d1 (diff)
[SPARC64]: Patch up mmu context register writes for sun4v.
sun4v uses ASI_MMU instead of ASI_DMMU Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc64/kernel/entry.S80
-rw-r--r--arch/sparc64/kernel/etrap.S8
-rw-r--r--arch/sparc64/kernel/head.S33
-rw-r--r--arch/sparc64/kernel/rtrap.S24
-rw-r--r--arch/sparc64/kernel/setup.c30
-rw-r--r--arch/sparc64/kernel/trampoline.S32
-rw-r--r--arch/sparc64/mm/init.c9
-rw-r--r--arch/sparc64/prom/p1275.c11
8 files changed, 166 insertions, 61 deletions
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index 4ca3ea0beaf9..f51b66a1687a 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -97,10 +97,22 @@ do_fpdis:
97 add %g6, TI_FPREGS + 0x80, %g1 97 add %g6, TI_FPREGS + 0x80, %g1
98 faddd %f0, %f2, %f4 98 faddd %f0, %f2, %f4
99 fmuld %f0, %f2, %f6 99 fmuld %f0, %f2, %f6
100 ldxa [%g3] ASI_DMMU, %g5 100
101661: ldxa [%g3] ASI_DMMU, %g5
102 .section .sun4v_1insn_patch, "ax"
103 .word 661b
104 ldxa [%g3] ASI_MMU, %g5
105 .previous
106
101 sethi %hi(sparc64_kern_sec_context), %g2 107 sethi %hi(sparc64_kern_sec_context), %g2
102 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2 108 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
103 stxa %g2, [%g3] ASI_DMMU 109
110661: stxa %g2, [%g3] ASI_DMMU
111 .section .sun4v_1insn_patch, "ax"
112 .word 661b
113 stxa %g2, [%g3] ASI_MMU
114 .previous
115
104 membar #Sync 116 membar #Sync
105 add %g6, TI_FPREGS + 0xc0, %g2 117 add %g6, TI_FPREGS + 0xc0, %g2
106 faddd %f0, %f2, %f8 118 faddd %f0, %f2, %f8
@@ -126,11 +138,23 @@ do_fpdis:
126 fzero %f32 138 fzero %f32
127 mov SECONDARY_CONTEXT, %g3 139 mov SECONDARY_CONTEXT, %g3
128 fzero %f34 140 fzero %f34
129 ldxa [%g3] ASI_DMMU, %g5 141
142661: ldxa [%g3] ASI_DMMU, %g5
143 .section .sun4v_1insn_patch, "ax"
144 .word 661b
145 ldxa [%g3] ASI_MMU, %g5
146 .previous
147
130 add %g6, TI_FPREGS, %g1 148 add %g6, TI_FPREGS, %g1
131 sethi %hi(sparc64_kern_sec_context), %g2 149 sethi %hi(sparc64_kern_sec_context), %g2
132 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2 150 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
133 stxa %g2, [%g3] ASI_DMMU 151
152661: stxa %g2, [%g3] ASI_DMMU
153 .section .sun4v_1insn_patch, "ax"
154 .word 661b
155 stxa %g2, [%g3] ASI_MMU
156 .previous
157
134 membar #Sync 158 membar #Sync
135 add %g6, TI_FPREGS + 0x40, %g2 159 add %g6, TI_FPREGS + 0x40, %g2
136 faddd %f32, %f34, %f36 160 faddd %f32, %f34, %f36
@@ -155,10 +179,22 @@ do_fpdis:
155 nop 179 nop
1563: mov SECONDARY_CONTEXT, %g3 1803: mov SECONDARY_CONTEXT, %g3
157 add %g6, TI_FPREGS, %g1 181 add %g6, TI_FPREGS, %g1
158 ldxa [%g3] ASI_DMMU, %g5 182
183661: ldxa [%g3] ASI_DMMU, %g5
184 .section .sun4v_1insn_patch, "ax"
185 .word 661b
186 ldxa [%g3] ASI_MMU, %g5
187 .previous
188
159 sethi %hi(sparc64_kern_sec_context), %g2 189 sethi %hi(sparc64_kern_sec_context), %g2
160 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2 190 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
161 stxa %g2, [%g3] ASI_DMMU 191
192661: stxa %g2, [%g3] ASI_DMMU
193 .section .sun4v_1insn_patch, "ax"
194 .word 661b
195 stxa %g2, [%g3] ASI_MMU
196 .previous
197
162 membar #Sync 198 membar #Sync
163 mov 0x40, %g2 199 mov 0x40, %g2
164 membar #Sync 200 membar #Sync
@@ -169,7 +205,13 @@ do_fpdis:
169 ldda [%g1 + %g2] ASI_BLK_S, %f48 205 ldda [%g1 + %g2] ASI_BLK_S, %f48
170 membar #Sync 206 membar #Sync
171fpdis_exit: 207fpdis_exit:
172 stxa %g5, [%g3] ASI_DMMU 208
209661: stxa %g5, [%g3] ASI_DMMU
210 .section .sun4v_1insn_patch, "ax"
211 .word 661b
212 stxa %g5, [%g3] ASI_MMU
213 .previous
214
173 membar #Sync 215 membar #Sync
174fpdis_exit2: 216fpdis_exit2:
175 wr %g7, 0, %gsr 217 wr %g7, 0, %gsr
@@ -323,10 +365,22 @@ do_fptrap_after_fsr:
323 rd %gsr, %g3 365 rd %gsr, %g3
324 stx %g3, [%g6 + TI_GSR] 366 stx %g3, [%g6 + TI_GSR]
325 mov SECONDARY_CONTEXT, %g3 367 mov SECONDARY_CONTEXT, %g3
326 ldxa [%g3] ASI_DMMU, %g5 368
369661: ldxa [%g3] ASI_DMMU, %g5
370 .section .sun4v_1insn_patch, "ax"
371 .word 661b
372 ldxa [%g3] ASI_MMU, %g5
373 .previous
374
327 sethi %hi(sparc64_kern_sec_context), %g2 375 sethi %hi(sparc64_kern_sec_context), %g2
328 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2 376 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
329 stxa %g2, [%g3] ASI_DMMU 377
378661: stxa %g2, [%g3] ASI_DMMU
379 .section .sun4v_1insn_patch, "ax"
380 .word 661b
381 stxa %g2, [%g3] ASI_MMU
382 .previous
383
330 membar #Sync 384 membar #Sync
331 add %g6, TI_FPREGS, %g2 385 add %g6, TI_FPREGS, %g2
332 andcc %g1, FPRS_DL, %g0 386 andcc %g1, FPRS_DL, %g0
@@ -341,7 +395,13 @@ do_fptrap_after_fsr:
341 stda %f48, [%g2 + %g3] ASI_BLK_S 395 stda %f48, [%g2 + %g3] ASI_BLK_S
3425: mov SECONDARY_CONTEXT, %g1 3965: mov SECONDARY_CONTEXT, %g1
343 membar #Sync 397 membar #Sync
344 stxa %g5, [%g1] ASI_DMMU 398
399661: stxa %g5, [%g1] ASI_DMMU
400 .section .sun4v_1insn_patch, "ax"
401 .word 661b
402 stxa %g5, [%g1] ASI_MMU
403 .previous
404
345 membar #Sync 405 membar #Sync
346 ba,pt %xcc, etrap 406 ba,pt %xcc, etrap
347 wr %g0, 0, %fprs 407 wr %g0, 0, %fprs
diff --git a/arch/sparc64/kernel/etrap.S b/arch/sparc64/kernel/etrap.S
index d8c062a1700c..a0e7d480e5dc 100644
--- a/arch/sparc64/kernel/etrap.S
+++ b/arch/sparc64/kernel/etrap.S
@@ -95,7 +95,13 @@ etrap_save: save %g2, -STACK_BIAS, %sp
95 wrpr %g2, 0, %wstate 95 wrpr %g2, 0, %wstate
96 sethi %hi(sparc64_kern_pri_context), %g2 96 sethi %hi(sparc64_kern_pri_context), %g2
97 ldx [%g2 + %lo(sparc64_kern_pri_context)], %g3 97 ldx [%g2 + %lo(sparc64_kern_pri_context)], %g3
98 stxa %g3, [%l4] ASI_DMMU 98
99661: stxa %g3, [%l4] ASI_DMMU
100 .section .sun4v_1insn_patch, "ax"
101 .word 661b
102 stxa %g3, [%l4] ASI_MMU
103 .previous
104
99 sethi %hi(KERNBASE), %l4 105 sethi %hi(KERNBASE), %l4
100 flush %l4 106 flush %l4
101 mov ASI_AIUS, %l7 107 mov ASI_AIUS, %l7
diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S
index f04f7391f236..a304845f8c56 100644
--- a/arch/sparc64/kernel/head.S
+++ b/arch/sparc64/kernel/head.S
@@ -303,12 +303,24 @@ jump_to_sun4u_init:
303 303
304sun4u_init: 304sun4u_init:
305 /* Set ctx 0 */ 305 /* Set ctx 0 */
306 mov PRIMARY_CONTEXT, %g7 306 mov PRIMARY_CONTEXT, %g7
307 stxa %g0, [%g7] ASI_DMMU 307
308 membar #Sync 308661: stxa %g0, [%g7] ASI_DMMU
309 .section .sun4v_1insn_patch, "ax"
310 .word 661b
311 stxa %g0, [%g7] ASI_MMU
312 .previous
313
314 membar #Sync
315
316 mov SECONDARY_CONTEXT, %g7
317
318661: stxa %g0, [%g7] ASI_DMMU
319 .section .sun4v_1insn_patch, "ax"
320 .word 661b
321 stxa %g0, [%g7] ASI_MMU
322 .previous
309 323
310 mov SECONDARY_CONTEXT, %g7
311 stxa %g0, [%g7] ASI_DMMU
312 membar #Sync 324 membar #Sync
313 325
314 BRANCH_IF_ANY_CHEETAH(g1,g7,cheetah_tlb_fixup) 326 BRANCH_IF_ANY_CHEETAH(g1,g7,cheetah_tlb_fixup)
@@ -436,8 +448,15 @@ setup_trap_table:
436 /* Start using proper page size encodings in ctx register. */ 448 /* Start using proper page size encodings in ctx register. */
437 sethi %hi(sparc64_kern_pri_context), %g3 449 sethi %hi(sparc64_kern_pri_context), %g3
438 ldx [%g3 + %lo(sparc64_kern_pri_context)], %g2 450 ldx [%g3 + %lo(sparc64_kern_pri_context)], %g2
439 mov PRIMARY_CONTEXT, %g1 451
440 stxa %g2, [%g1] ASI_DMMU 452 mov PRIMARY_CONTEXT, %g1
453
454661: stxa %g2, [%g1] ASI_DMMU
455 .section .sun4v_1insn_patch, "ax"
456 .word 661b
457 stxa %g2, [%g1] ASI_MMU
458 .previous
459
441 membar #Sync 460 membar #Sync
442 461
443 /* Kill PROM timer */ 462 /* Kill PROM timer */
diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S
index a55d517e76aa..551f71982008 100644
--- a/arch/sparc64/kernel/rtrap.S
+++ b/arch/sparc64/kernel/rtrap.S
@@ -264,11 +264,23 @@ rt_continue: ldx [%sp + PTREGS_OFF + PT_V9_G1], %g1
264 264
265 brnz,pn %l3, kern_rtt 265 brnz,pn %l3, kern_rtt
266 mov PRIMARY_CONTEXT, %l7 266 mov PRIMARY_CONTEXT, %l7
267 ldxa [%l7 + %l7] ASI_DMMU, %l0 267
268661: ldxa [%l7 + %l7] ASI_DMMU, %l0
269 .section .sun4v_1insn_patch, "ax"
270 .word 661b
271 ldxa [%l7 + %l7] ASI_MMU, %l0
272 .previous
273
268 sethi %hi(sparc64_kern_pri_nuc_bits), %l1 274 sethi %hi(sparc64_kern_pri_nuc_bits), %l1
269 ldx [%l1 + %lo(sparc64_kern_pri_nuc_bits)], %l1 275 ldx [%l1 + %lo(sparc64_kern_pri_nuc_bits)], %l1
270 or %l0, %l1, %l0 276 or %l0, %l1, %l0
271 stxa %l0, [%l7] ASI_DMMU 277
278661: stxa %l0, [%l7] ASI_DMMU
279 .section .sun4v_1insn_patch, "ax"
280 .word 661b
281 stxa %l0, [%l7] ASI_MMU
282 .previous
283
272 sethi %hi(KERNBASE), %l7 284 sethi %hi(KERNBASE), %l7
273 flush %l7 285 flush %l7
274 rdpr %wstate, %l1 286 rdpr %wstate, %l1
@@ -303,7 +315,13 @@ user_rtt_fill_fixup:
303 sethi %hi(sparc64_kern_pri_context), %g2 315 sethi %hi(sparc64_kern_pri_context), %g2
304 ldx [%g2 + %lo(sparc64_kern_pri_context)], %g2 316 ldx [%g2 + %lo(sparc64_kern_pri_context)], %g2
305 mov PRIMARY_CONTEXT, %g1 317 mov PRIMARY_CONTEXT, %g1
306 stxa %g2, [%g1] ASI_DMMU 318
319661: stxa %g2, [%g1] ASI_DMMU
320 .section .sun4v_1insn_patch, "ax"
321 .word 661b
322 stxa %g2, [%g1] ASI_MMU
323 .previous
324
307 sethi %hi(KERNBASE), %g1 325 sethi %hi(KERNBASE), %g1
308 flush %g1 326 flush %g1
309 327
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index 6d6178efd587..2d64320d3a4d 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -189,26 +189,30 @@ int prom_callback(long *args)
189 } 189 }
190 190
191 if ((va >= KERNBASE) && (va < (KERNBASE + (4 * 1024 * 1024)))) { 191 if ((va >= KERNBASE) && (va < (KERNBASE + (4 * 1024 * 1024)))) {
192 extern unsigned long sparc64_kern_pri_context; 192 if (tlb_type == spitfire) {
193 193 extern unsigned long sparc64_kern_pri_context;
194 /* Spitfire Errata #32 workaround */ 194
195 __asm__ __volatile__("stxa %0, [%1] %2\n\t" 195 /* Spitfire Errata #32 workaround */
196 "flush %%g6" 196 __asm__ __volatile__(
197 : /* No outputs */ 197 "stxa %0, [%1] %2\n\t"
198 : "r" (sparc64_kern_pri_context), 198 "flush %%g6"
199 "r" (PRIMARY_CONTEXT), 199 : /* No outputs */
200 "i" (ASI_DMMU)); 200 : "r" (sparc64_kern_pri_context),
201 "r" (PRIMARY_CONTEXT),
202 "i" (ASI_DMMU));
203 }
201 204
202 /* 205 /*
203 * Locked down tlb entry. 206 * Locked down tlb entry.
204 */ 207 */
205 208
206 if (tlb_type == spitfire) 209 if (tlb_type == spitfire) {
207 tte = spitfire_get_dtlb_data(SPITFIRE_HIGHEST_LOCKED_TLBENT); 210 tte = spitfire_get_dtlb_data(SPITFIRE_HIGHEST_LOCKED_TLBENT);
208 else if (tlb_type == cheetah || tlb_type == cheetah_plus) 211 res = PROM_TRUE;
212 } else if (tlb_type == cheetah || tlb_type == cheetah_plus) {
209 tte = cheetah_get_ldtlb_data(CHEETAH_HIGHEST_LOCKED_TLBENT); 213 tte = cheetah_get_ldtlb_data(CHEETAH_HIGHEST_LOCKED_TLBENT);
210 214 res = PROM_TRUE;
211 res = PROM_TRUE; 215 }
212 goto done; 216 goto done;
213 } 217 }
214 218
diff --git a/arch/sparc64/kernel/trampoline.S b/arch/sparc64/kernel/trampoline.S
index 18c333f841e3..d9e2af35158d 100644
--- a/arch/sparc64/kernel/trampoline.S
+++ b/arch/sparc64/kernel/trampoline.S
@@ -272,10 +272,22 @@ do_unlock:
272 wr %g0, ASI_P, %asi 272 wr %g0, ASI_P, %asi
273 273
274 mov PRIMARY_CONTEXT, %g7 274 mov PRIMARY_CONTEXT, %g7
275 stxa %g0, [%g7] ASI_DMMU 275
276661: stxa %g0, [%g7] ASI_DMMU
277 .section .sun4v_1insn_patch, "ax"
278 .word 661b
279 stxa %g0, [%g7] ASI_MMU
280 .previous
281
276 membar #Sync 282 membar #Sync
277 mov SECONDARY_CONTEXT, %g7 283 mov SECONDARY_CONTEXT, %g7
278 stxa %g0, [%g7] ASI_DMMU 284
285661: stxa %g0, [%g7] ASI_DMMU
286 .section .sun4v_1insn_patch, "ax"
287 .word 661b
288 stxa %g0, [%g7] ASI_MMU
289 .previous
290
279 membar #Sync 291 membar #Sync
280 292
281 mov 1, %g5 293 mov 1, %g5
@@ -301,11 +313,17 @@ do_unlock:
301 nop 313 nop
302 314
303 /* Start using proper page size encodings in ctx register. */ 315 /* Start using proper page size encodings in ctx register. */
304 sethi %hi(sparc64_kern_pri_context), %g3 316 sethi %hi(sparc64_kern_pri_context), %g3
305 ldx [%g3 + %lo(sparc64_kern_pri_context)], %g2 317 ldx [%g3 + %lo(sparc64_kern_pri_context)], %g2
306 mov PRIMARY_CONTEXT, %g1 318 mov PRIMARY_CONTEXT, %g1
307 stxa %g2, [%g1] ASI_DMMU 319
308 membar #Sync 320661: stxa %g2, [%g1] ASI_DMMU
321 .section .sun4v_1insn_patch, "ax"
322 .word 661b
323 stxa %g2, [%g1] ASI_MMU
324 .previous
325
326 membar #Sync
309 327
310 rdpr %pstate, %o1 328 rdpr %pstate, %o1
311 or %o1, PSTATE_IE, %o1 329 or %o1, PSTATE_IE, %o1
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 4c95cf34075b..6504d6eb5372 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -792,15 +792,6 @@ void sparc_ultra_dump_dtlb(void)
792 } 792 }
793} 793}
794 794
795static inline void spitfire_errata32(void)
796{
797 __asm__ __volatile__("stxa %0, [%1] %2\n\t"
798 "flush %%g6"
799 : /* No outputs */
800 : "r" (0),
801 "r" (PRIMARY_CONTEXT), "i" (ASI_DMMU));
802}
803
804extern unsigned long cmdline_memory_size; 795extern unsigned long cmdline_memory_size;
805 796
806unsigned long __init bootmem_init(unsigned long *pages_avail) 797unsigned long __init bootmem_init(unsigned long *pages_avail)
diff --git a/arch/sparc64/prom/p1275.c b/arch/sparc64/prom/p1275.c
index a5a7c5712028..2b32c489860c 100644
--- a/arch/sparc64/prom/p1275.c
+++ b/arch/sparc64/prom/p1275.c
@@ -30,16 +30,6 @@ extern void prom_world(int);
30extern void prom_cif_interface(void); 30extern void prom_cif_interface(void);
31extern void prom_cif_callback(void); 31extern void prom_cif_callback(void);
32 32
33static inline unsigned long spitfire_get_primary_context(void)
34{
35 unsigned long ctx;
36
37 __asm__ __volatile__("ldxa [%1] %2, %0"
38 : "=r" (ctx)
39 : "r" (PRIMARY_CONTEXT), "i" (ASI_DMMU));
40 return ctx;
41}
42
43/* 33/*
44 * This provides SMP safety on the p1275buf. prom_callback() drops this lock 34 * This provides SMP safety on the p1275buf. prom_callback() drops this lock
45 * to allow recursuve acquisition. 35 * to allow recursuve acquisition.
@@ -55,7 +45,6 @@ long p1275_cmd(const char *service, long fmt, ...)
55 long attrs, x; 45 long attrs, x;
56 46
57 p = p1275buf.prom_buffer; 47 p = p1275buf.prom_buffer;
58 BUG_ON((spitfire_get_primary_context() & CTX_NR_MASK) != 0);
59 48
60 spin_lock_irqsave(&prom_entry_lock, flags); 49 spin_lock_irqsave(&prom_entry_lock, flags);
61 50