aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLEROY Christophe <christophe.leroy@c-s.fr>2014-09-19 04:36:10 -0400
committerScott Wood <scottwood@freescale.com>2014-11-07 19:10:45 -0500
commit83c17ba35e0306e671b5c9ab622535f23a9a3e78 (patch)
tree4405a996b06488e310470cf917a2202056e4e3c1
parentb0168eb97b8b02594f47ce44faf1502f79e540df (diff)
powerpc/8xx: Use DAR to save r3 for CPU6 ERRATA
As we are not using anymore DAR to save registers, it is now available for saving the r3 register used for CPU6 ERRATA handling. Therefore we can remove the major hack which was to use memory location 0 to save r3. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Scott Wood <scottwood@freescale.com>
-rw-r--r--arch/powerpc/kernel/head_8xx.S33
1 files changed, 15 insertions, 18 deletions
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index 330d54418494..acf6d7eab6d5 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -83,13 +83,6 @@ _ENTRY(_start);
83 * 8M 1:1. I also mapped an additional I/O space 1:1 so we can get to 83 * 8M 1:1. I also mapped an additional I/O space 1:1 so we can get to
84 * the "internal" processor registers before MMU_init is called. 84 * the "internal" processor registers before MMU_init is called.
85 * 85 *
86 * The TLB code currently contains a major hack. Since I use the condition
87 * code register, I have to save and restore it. I am out of registers, so
88 * I just store it in memory location 0 (the TLB handlers are not reentrant).
89 * To avoid making any decisions, I need to use the "segment" valid bit
90 * in the first level table, but that would require many changes to the
91 * Linux page directory/table functions that I don't want to do right now.
92 *
93 * -- Dan 86 * -- Dan
94 */ 87 */
95 .globl __start 88 .globl __start
@@ -306,7 +299,7 @@ SystemCall:
306 */ 299 */
307InstructionTLBMiss: 300InstructionTLBMiss:
308#ifdef CONFIG_8xx_CPU6 301#ifdef CONFIG_8xx_CPU6
309 stw r3, 8(r0) 302 mtspr SPRN_DAR, r3
310#endif 303#endif
311 EXCEPTION_PROLOG_0 304 EXCEPTION_PROLOG_0
312 mtspr SPRN_SPRG_SCRATCH2, r10 305 mtspr SPRN_SPRG_SCRATCH2, r10
@@ -351,7 +344,10 @@ InstructionTLBMiss:
351#ifdef CONFIG_SWAP 344#ifdef CONFIG_SWAP
352 andi. r11, r10, _PAGE_ACCESSED | _PAGE_PRESENT 345 andi. r11, r10, _PAGE_ACCESSED | _PAGE_PRESENT
353 cmpwi cr0, r11, _PAGE_ACCESSED | _PAGE_PRESENT 346 cmpwi cr0, r11, _PAGE_ACCESSED | _PAGE_PRESENT
347 li r11, RPN_PATTERN
354 bne- cr0, 2f 348 bne- cr0, 2f
349#else
350 li r11, RPN_PATTERN
355#endif 351#endif
356 /* The Linux PTE won't go exactly into the MMU TLB. 352 /* The Linux PTE won't go exactly into the MMU TLB.
357 * Software indicator bits 21 and 28 must be clear. 353 * Software indicator bits 21 and 28 must be clear.
@@ -359,28 +355,29 @@ InstructionTLBMiss:
359 * set. All other Linux PTE bits control the behavior 355 * set. All other Linux PTE bits control the behavior
360 * of the MMU. 356 * of the MMU.
361 */ 357 */
362 li r11, RPN_PATTERN
363 rlwimi r10, r11, 0, 0x07f8 /* Set 24-27, clear 21-23,28 */ 358 rlwimi r10, r11, 0, 0x07f8 /* Set 24-27, clear 21-23,28 */
364 MTSPR_CPU6(SPRN_MI_RPN, r10, r3) /* Update TLB entry */ 359 MTSPR_CPU6(SPRN_MI_RPN, r10, r3) /* Update TLB entry */
365 360
366 /* Restore registers */ 361 /* Restore registers */
367#ifdef CONFIG_8xx_CPU6 362#ifdef CONFIG_8xx_CPU6
368 lwz r3, 8(r0) 363 mfspr r3, SPRN_DAR
364 mtspr SPRN_DAR, r11 /* Tag DAR */
369#endif 365#endif
370 mfspr r10, SPRN_SPRG_SCRATCH2 366 mfspr r10, SPRN_SPRG_SCRATCH2
371 EXCEPTION_EPILOG_0 367 EXCEPTION_EPILOG_0
372 rfi 368 rfi
3732: 3692:
374 mfspr r11, SPRN_SRR1 370 mfspr r10, SPRN_SRR1
375 /* clear all error bits as TLB Miss 371 /* clear all error bits as TLB Miss
376 * sets a few unconditionally 372 * sets a few unconditionally
377 */ 373 */
378 rlwinm r11, r11, 0, 0xffff 374 rlwinm r10, r10, 0, 0xffff
379 mtspr SPRN_SRR1, r11 375 mtspr SPRN_SRR1, r10
380 376
381 /* Restore registers */ 377 /* Restore registers */
382#ifdef CONFIG_8xx_CPU6 378#ifdef CONFIG_8xx_CPU6
383 lwz r3, 8(r0) 379 mfspr r3, SPRN_DAR
380 mtspr SPRN_DAR, r11 /* Tag DAR */
384#endif 381#endif
385 mfspr r10, SPRN_SPRG_SCRATCH2 382 mfspr r10, SPRN_SPRG_SCRATCH2
386 b InstructionTLBError1 383 b InstructionTLBError1
@@ -388,7 +385,7 @@ InstructionTLBMiss:
388 . = 0x1200 385 . = 0x1200
389DataStoreTLBMiss: 386DataStoreTLBMiss:
390#ifdef CONFIG_8xx_CPU6 387#ifdef CONFIG_8xx_CPU6
391 stw r3, 8(r0) 388 mtspr SPRN_DAR, r3
392#endif 389#endif
393 EXCEPTION_PROLOG_0 390 EXCEPTION_PROLOG_0
394 mtspr SPRN_SPRG_SCRATCH2, r10 391 mtspr SPRN_SPRG_SCRATCH2, r10
@@ -459,7 +456,7 @@ DataStoreTLBMiss:
459 456
460 /* Restore registers */ 457 /* Restore registers */
461#ifdef CONFIG_8xx_CPU6 458#ifdef CONFIG_8xx_CPU6
462 lwz r3, 8(r0) 459 mfspr r3, SPRN_DAR
463#endif 460#endif
464 mtspr SPRN_DAR, r11 /* Tag DAR */ 461 mtspr SPRN_DAR, r11 /* Tag DAR */
465 mfspr r10, SPRN_SPRG_SCRATCH2 462 mfspr r10, SPRN_SPRG_SCRATCH2
@@ -531,7 +528,7 @@ DARFixed:/* Return from dcbx instruction bug workaround */
531#define NO_SELF_MODIFYING_CODE 528#define NO_SELF_MODIFYING_CODE
532FixupDAR:/* Entry point for dcbx workaround. */ 529FixupDAR:/* Entry point for dcbx workaround. */
533#ifdef CONFIG_8xx_CPU6 530#ifdef CONFIG_8xx_CPU6
534 stw r3, 8(r0) 531 mtspr SPRN_DAR, r3
535#endif 532#endif
536 mtspr SPRN_SPRG_SCRATCH2, r10 533 mtspr SPRN_SPRG_SCRATCH2, r10
537 /* fetch instruction from memory. */ 534 /* fetch instruction from memory. */
@@ -550,7 +547,7 @@ FixupDAR:/* Entry point for dcbx workaround. */
550 rlwinm r11, r11, 32 - (PAGE_SHIFT - 2), 32 - PAGE_SHIFT, 29 547 rlwinm r11, r11, 32 - (PAGE_SHIFT - 2), 32 - PAGE_SHIFT, 29
551 lwzx r11, r10, r11 /* Get the pte */ 548 lwzx r11, r10, r11 /* Get the pte */
552#ifdef CONFIG_8xx_CPU6 549#ifdef CONFIG_8xx_CPU6
553 lwz r3, 8(r0) /* restore r3 from memory */ 550 mfspr r3, SPRN_DAR
554#endif 551#endif
555 /* concat physical page address(r11) and page offset(r10) */ 552 /* concat physical page address(r11) and page offset(r10) */
556 mfspr r10, SPRN_SRR0 553 mfspr r10, SPRN_SRR0