diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-15 12:51:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-15 12:51:09 -0400 |
commit | 723e9db7a46e328527cc3da2b478b831184fe828 (patch) | |
tree | cdeda255633057dcb4c84097bed27b2bbf76970f /arch/powerpc/kernel/entry_64.S | |
parent | ada3fa15057205b7d3f727bba5cd26b5912e350f (diff) | |
parent | d331d8305cba713605854aab63a000fb892353a7 (diff) |
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (134 commits)
powerpc/nvram: Enable use Generic NVRAM driver for different size chips
powerpc/iseries: Fix oops reading from /proc/iSeries/mf/*/cmdline
powerpc/ps3: Workaround for flash memory I/O error
powerpc/booke: Don't set DABR on 64-bit BookE, use DAC1 instead
powerpc/perf_counters: Reduce stack usage of power_check_constraints
powerpc: Fix bug where perf_counters breaks oprofile
powerpc/85xx: Fix SMP compile error and allow NULL for smp_ops
powerpc/irq: Improve nanodoc
powerpc: Fix some late PowerMac G5 with PCIe ATI graphics
powerpc/fsl-booke: Use HW PTE format if CONFIG_PTE_64BIT
powerpc/book3e: Add missing page sizes
powerpc/pseries: Fix to handle slb resize across migration
powerpc/powermac: Thermal control turns system off too eagerly
powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan()
powerpc/405ex: support cuImage via included dtb
powerpc/405ex: provide necessary fixup function to support cuImage
powerpc/40x: Add support for the ESTeem 195E (PPC405EP) SBC
powerpc/44x: Add Eiger AMCC (AppliedMicro) PPC460SX evaluation board support.
powerpc/44x: Update Arches defconfig
powerpc/44x: Update Arches dts
...
Fix up conflicts in drivers/char/agp/uninorth-agp.c
Diffstat (limited to 'arch/powerpc/kernel/entry_64.S')
-rw-r--r-- | arch/powerpc/kernel/entry_64.S | 102 |
1 files changed, 63 insertions, 39 deletions
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 43e073477c34..66bcda34a6bb 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -120,9 +120,15 @@ BEGIN_FW_FTR_SECTION | |||
120 | 2: | 120 | 2: |
121 | END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES) | 121 | END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES) |
122 | #endif /* CONFIG_PPC_ISERIES */ | 122 | #endif /* CONFIG_PPC_ISERIES */ |
123 | |||
124 | /* Hard enable interrupts */ | ||
125 | #ifdef CONFIG_PPC_BOOK3E | ||
126 | wrteei 1 | ||
127 | #else | ||
123 | mfmsr r11 | 128 | mfmsr r11 |
124 | ori r11,r11,MSR_EE | 129 | ori r11,r11,MSR_EE |
125 | mtmsrd r11,1 | 130 | mtmsrd r11,1 |
131 | #endif /* CONFIG_PPC_BOOK3E */ | ||
126 | 132 | ||
127 | #ifdef SHOW_SYSCALLS | 133 | #ifdef SHOW_SYSCALLS |
128 | bl .do_show_syscall | 134 | bl .do_show_syscall |
@@ -168,15 +174,25 @@ syscall_exit: | |||
168 | #endif | 174 | #endif |
169 | clrrdi r12,r1,THREAD_SHIFT | 175 | clrrdi r12,r1,THREAD_SHIFT |
170 | 176 | ||
171 | /* disable interrupts so current_thread_info()->flags can't change, | ||
172 | and so that we don't get interrupted after loading SRR0/1. */ | ||
173 | ld r8,_MSR(r1) | 177 | ld r8,_MSR(r1) |
178 | #ifdef CONFIG_PPC_BOOK3S | ||
179 | /* No MSR:RI on BookE */ | ||
174 | andi. r10,r8,MSR_RI | 180 | andi. r10,r8,MSR_RI |
175 | beq- unrecov_restore | 181 | beq- unrecov_restore |
182 | #endif | ||
183 | |||
184 | /* Disable interrupts so current_thread_info()->flags can't change, | ||
185 | * and so that we don't get interrupted after loading SRR0/1. | ||
186 | */ | ||
187 | #ifdef CONFIG_PPC_BOOK3E | ||
188 | wrteei 0 | ||
189 | #else | ||
176 | mfmsr r10 | 190 | mfmsr r10 |
177 | rldicl r10,r10,48,1 | 191 | rldicl r10,r10,48,1 |
178 | rotldi r10,r10,16 | 192 | rotldi r10,r10,16 |
179 | mtmsrd r10,1 | 193 | mtmsrd r10,1 |
194 | #endif /* CONFIG_PPC_BOOK3E */ | ||
195 | |||
180 | ld r9,TI_FLAGS(r12) | 196 | ld r9,TI_FLAGS(r12) |
181 | li r11,-_LAST_ERRNO | 197 | li r11,-_LAST_ERRNO |
182 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK) | 198 | andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK) |
@@ -194,9 +210,13 @@ syscall_error_cont: | |||
194 | * userspace and we take an exception after restoring r13, | 210 | * userspace and we take an exception after restoring r13, |
195 | * we end up corrupting the userspace r13 value. | 211 | * we end up corrupting the userspace r13 value. |
196 | */ | 212 | */ |
213 | #ifdef CONFIG_PPC_BOOK3S | ||
214 | /* No MSR:RI on BookE */ | ||
197 | li r12,MSR_RI | 215 | li r12,MSR_RI |
198 | andc r11,r10,r12 | 216 | andc r11,r10,r12 |
199 | mtmsrd r11,1 /* clear MSR.RI */ | 217 | mtmsrd r11,1 /* clear MSR.RI */ |
218 | #endif /* CONFIG_PPC_BOOK3S */ | ||
219 | |||
200 | beq- 1f | 220 | beq- 1f |
201 | ACCOUNT_CPU_USER_EXIT(r11, r12) | 221 | ACCOUNT_CPU_USER_EXIT(r11, r12) |
202 | ld r13,GPR13(r1) /* only restore r13 if returning to usermode */ | 222 | ld r13,GPR13(r1) /* only restore r13 if returning to usermode */ |
@@ -206,7 +226,7 @@ syscall_error_cont: | |||
206 | mtcr r5 | 226 | mtcr r5 |
207 | mtspr SPRN_SRR0,r7 | 227 | mtspr SPRN_SRR0,r7 |
208 | mtspr SPRN_SRR1,r8 | 228 | mtspr SPRN_SRR1,r8 |
209 | rfid | 229 | RFI |
210 | b . /* prevent speculative execution */ | 230 | b . /* prevent speculative execution */ |
211 | 231 | ||
212 | syscall_error: | 232 | syscall_error: |
@@ -276,9 +296,13 @@ syscall_exit_work: | |||
276 | beq .ret_from_except_lite | 296 | beq .ret_from_except_lite |
277 | 297 | ||
278 | /* Re-enable interrupts */ | 298 | /* Re-enable interrupts */ |
299 | #ifdef CONFIG_PPC_BOOK3E | ||
300 | wrteei 1 | ||
301 | #else | ||
279 | mfmsr r10 | 302 | mfmsr r10 |
280 | ori r10,r10,MSR_EE | 303 | ori r10,r10,MSR_EE |
281 | mtmsrd r10,1 | 304 | mtmsrd r10,1 |
305 | #endif /* CONFIG_PPC_BOOK3E */ | ||
282 | 306 | ||
283 | bl .save_nvgprs | 307 | bl .save_nvgprs |
284 | addi r3,r1,STACK_FRAME_OVERHEAD | 308 | addi r3,r1,STACK_FRAME_OVERHEAD |
@@ -380,7 +404,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) | |||
380 | and. r0,r0,r22 | 404 | and. r0,r0,r22 |
381 | beq+ 1f | 405 | beq+ 1f |
382 | andc r22,r22,r0 | 406 | andc r22,r22,r0 |
383 | mtmsrd r22 | 407 | MTMSRD(r22) |
384 | isync | 408 | isync |
385 | 1: std r20,_NIP(r1) | 409 | 1: std r20,_NIP(r1) |
386 | mfcr r23 | 410 | mfcr r23 |
@@ -399,6 +423,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) | |||
399 | std r6,PACACURRENT(r13) /* Set new 'current' */ | 423 | std r6,PACACURRENT(r13) /* Set new 'current' */ |
400 | 424 | ||
401 | ld r8,KSP(r4) /* new stack pointer */ | 425 | ld r8,KSP(r4) /* new stack pointer */ |
426 | #ifdef CONFIG_PPC_BOOK3S | ||
402 | BEGIN_FTR_SECTION | 427 | BEGIN_FTR_SECTION |
403 | BEGIN_FTR_SECTION_NESTED(95) | 428 | BEGIN_FTR_SECTION_NESTED(95) |
404 | clrrdi r6,r8,28 /* get its ESID */ | 429 | clrrdi r6,r8,28 /* get its ESID */ |
@@ -445,8 +470,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_1T_SEGMENT) | |||
445 | slbie r6 /* Workaround POWER5 < DD2.1 issue */ | 470 | slbie r6 /* Workaround POWER5 < DD2.1 issue */ |
446 | slbmte r7,r0 | 471 | slbmte r7,r0 |
447 | isync | 472 | isync |
448 | |||
449 | 2: | 473 | 2: |
474 | #endif /* !CONFIG_PPC_BOOK3S */ | ||
475 | |||
450 | clrrdi r7,r8,THREAD_SHIFT /* base of new stack */ | 476 | clrrdi r7,r8,THREAD_SHIFT /* base of new stack */ |
451 | /* Note: this uses SWITCH_FRAME_SIZE rather than INT_FRAME_SIZE | 477 | /* Note: this uses SWITCH_FRAME_SIZE rather than INT_FRAME_SIZE |
452 | because we don't need to leave the 288-byte ABI gap at the | 478 | because we don't need to leave the 288-byte ABI gap at the |
@@ -490,10 +516,14 @@ _GLOBAL(ret_from_except_lite) | |||
490 | * can't change between when we test it and when we return | 516 | * can't change between when we test it and when we return |
491 | * from the interrupt. | 517 | * from the interrupt. |
492 | */ | 518 | */ |
519 | #ifdef CONFIG_PPC_BOOK3E | ||
520 | wrteei 0 | ||
521 | #else | ||
493 | mfmsr r10 /* Get current interrupt state */ | 522 | mfmsr r10 /* Get current interrupt state */ |
494 | rldicl r9,r10,48,1 /* clear MSR_EE */ | 523 | rldicl r9,r10,48,1 /* clear MSR_EE */ |
495 | rotldi r9,r9,16 | 524 | rotldi r9,r9,16 |
496 | mtmsrd r9,1 /* Update machine state */ | 525 | mtmsrd r9,1 /* Update machine state */ |
526 | #endif /* CONFIG_PPC_BOOK3E */ | ||
497 | 527 | ||
498 | #ifdef CONFIG_PREEMPT | 528 | #ifdef CONFIG_PREEMPT |
499 | clrrdi r9,r1,THREAD_SHIFT /* current_thread_info() */ | 529 | clrrdi r9,r1,THREAD_SHIFT /* current_thread_info() */ |
@@ -540,6 +570,9 @@ ALT_FW_FTR_SECTION_END_IFCLR(FW_FEATURE_ISERIES) | |||
540 | rldicl r4,r3,49,63 /* r0 = (r3 >> 15) & 1 */ | 570 | rldicl r4,r3,49,63 /* r0 = (r3 >> 15) & 1 */ |
541 | stb r4,PACAHARDIRQEN(r13) | 571 | stb r4,PACAHARDIRQEN(r13) |
542 | 572 | ||
573 | #ifdef CONFIG_PPC_BOOK3E | ||
574 | b .exception_return_book3e | ||
575 | #else | ||
543 | ld r4,_CTR(r1) | 576 | ld r4,_CTR(r1) |
544 | ld r0,_LINK(r1) | 577 | ld r0,_LINK(r1) |
545 | mtctr r4 | 578 | mtctr r4 |
@@ -588,6 +621,8 @@ ALT_FW_FTR_SECTION_END_IFCLR(FW_FEATURE_ISERIES) | |||
588 | rfid | 621 | rfid |
589 | b . /* prevent speculative execution */ | 622 | b . /* prevent speculative execution */ |
590 | 623 | ||
624 | #endif /* CONFIG_PPC_BOOK3E */ | ||
625 | |||
591 | iseries_check_pending_irqs: | 626 | iseries_check_pending_irqs: |
592 | #ifdef CONFIG_PPC_ISERIES | 627 | #ifdef CONFIG_PPC_ISERIES |
593 | ld r5,SOFTE(r1) | 628 | ld r5,SOFTE(r1) |
@@ -638,6 +673,11 @@ do_work: | |||
638 | li r0,1 | 673 | li r0,1 |
639 | stb r0,PACASOFTIRQEN(r13) | 674 | stb r0,PACASOFTIRQEN(r13) |
640 | stb r0,PACAHARDIRQEN(r13) | 675 | stb r0,PACAHARDIRQEN(r13) |
676 | #ifdef CONFIG_PPC_BOOK3E | ||
677 | wrteei 1 | ||
678 | bl .preempt_schedule | ||
679 | wrteei 0 | ||
680 | #else | ||
641 | ori r10,r10,MSR_EE | 681 | ori r10,r10,MSR_EE |
642 | mtmsrd r10,1 /* reenable interrupts */ | 682 | mtmsrd r10,1 /* reenable interrupts */ |
643 | bl .preempt_schedule | 683 | bl .preempt_schedule |
@@ -646,6 +686,7 @@ do_work: | |||
646 | rldicl r10,r10,48,1 /* disable interrupts again */ | 686 | rldicl r10,r10,48,1 /* disable interrupts again */ |
647 | rotldi r10,r10,16 | 687 | rotldi r10,r10,16 |
648 | mtmsrd r10,1 | 688 | mtmsrd r10,1 |
689 | #endif /* CONFIG_PPC_BOOK3E */ | ||
649 | ld r4,TI_FLAGS(r9) | 690 | ld r4,TI_FLAGS(r9) |
650 | andi. r0,r4,_TIF_NEED_RESCHED | 691 | andi. r0,r4,_TIF_NEED_RESCHED |
651 | bne 1b | 692 | bne 1b |
@@ -654,8 +695,12 @@ do_work: | |||
654 | user_work: | 695 | user_work: |
655 | #endif | 696 | #endif |
656 | /* Enable interrupts */ | 697 | /* Enable interrupts */ |
698 | #ifdef CONFIG_PPC_BOOK3E | ||
699 | wrteei 1 | ||
700 | #else | ||
657 | ori r10,r10,MSR_EE | 701 | ori r10,r10,MSR_EE |
658 | mtmsrd r10,1 | 702 | mtmsrd r10,1 |
703 | #endif /* CONFIG_PPC_BOOK3E */ | ||
659 | 704 | ||
660 | andi. r0,r4,_TIF_NEED_RESCHED | 705 | andi. r0,r4,_TIF_NEED_RESCHED |
661 | beq 1f | 706 | beq 1f |
@@ -762,7 +807,7 @@ _GLOBAL(enter_rtas) | |||
762 | 807 | ||
763 | _STATIC(rtas_return_loc) | 808 | _STATIC(rtas_return_loc) |
764 | /* relocation is off at this point */ | 809 | /* relocation is off at this point */ |
765 | mfspr r4,SPRN_SPRG3 /* Get PACA */ | 810 | mfspr r4,SPRN_SPRG_PACA /* Get PACA */ |
766 | clrldi r4,r4,2 /* convert to realmode address */ | 811 | clrldi r4,r4,2 /* convert to realmode address */ |
767 | 812 | ||
768 | bcl 20,31,$+4 | 813 | bcl 20,31,$+4 |
@@ -793,7 +838,7 @@ _STATIC(rtas_restore_regs) | |||
793 | REST_8GPRS(14, r1) /* Restore the non-volatiles */ | 838 | REST_8GPRS(14, r1) /* Restore the non-volatiles */ |
794 | REST_10GPRS(22, r1) /* ditto */ | 839 | REST_10GPRS(22, r1) /* ditto */ |
795 | 840 | ||
796 | mfspr r13,SPRN_SPRG3 | 841 | mfspr r13,SPRN_SPRG_PACA |
797 | 842 | ||
798 | ld r4,_CCR(r1) | 843 | ld r4,_CCR(r1) |
799 | mtcr r4 | 844 | mtcr r4 |
@@ -823,33 +868,24 @@ _GLOBAL(enter_prom) | |||
823 | * of all registers that it saves. We therefore save those registers | 868 | * of all registers that it saves. We therefore save those registers |
824 | * PROM might touch to the stack. (r0, r3-r13 are caller saved) | 869 | * PROM might touch to the stack. (r0, r3-r13 are caller saved) |
825 | */ | 870 | */ |
826 | SAVE_8GPRS(2, r1) | 871 | SAVE_GPR(2, r1) |
827 | SAVE_GPR(13, r1) | 872 | SAVE_GPR(13, r1) |
828 | SAVE_8GPRS(14, r1) | 873 | SAVE_8GPRS(14, r1) |
829 | SAVE_10GPRS(22, r1) | 874 | SAVE_10GPRS(22, r1) |
830 | mfcr r4 | 875 | mfcr r10 |
831 | std r4,_CCR(r1) | ||
832 | mfctr r5 | ||
833 | std r5,_CTR(r1) | ||
834 | mfspr r6,SPRN_XER | ||
835 | std r6,_XER(r1) | ||
836 | mfdar r7 | ||
837 | std r7,_DAR(r1) | ||
838 | mfdsisr r8 | ||
839 | std r8,_DSISR(r1) | ||
840 | mfsrr0 r9 | ||
841 | std r9,_SRR0(r1) | ||
842 | mfsrr1 r10 | ||
843 | std r10,_SRR1(r1) | ||
844 | mfmsr r11 | 876 | mfmsr r11 |
877 | std r10,_CCR(r1) | ||
845 | std r11,_MSR(r1) | 878 | std r11,_MSR(r1) |
846 | 879 | ||
847 | /* Get the PROM entrypoint */ | 880 | /* Get the PROM entrypoint */ |
848 | ld r0,GPR4(r1) | 881 | mtlr r4 |
849 | mtlr r0 | ||
850 | 882 | ||
851 | /* Switch MSR to 32 bits mode | 883 | /* Switch MSR to 32 bits mode |
852 | */ | 884 | */ |
885 | #ifdef CONFIG_PPC_BOOK3E | ||
886 | rlwinm r11,r11,0,1,31 | ||
887 | mtmsr r11 | ||
888 | #else /* CONFIG_PPC_BOOK3E */ | ||
853 | mfmsr r11 | 889 | mfmsr r11 |
854 | li r12,1 | 890 | li r12,1 |
855 | rldicr r12,r12,MSR_SF_LG,(63-MSR_SF_LG) | 891 | rldicr r12,r12,MSR_SF_LG,(63-MSR_SF_LG) |
@@ -858,10 +894,10 @@ _GLOBAL(enter_prom) | |||
858 | rldicr r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG) | 894 | rldicr r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG) |
859 | andc r11,r11,r12 | 895 | andc r11,r11,r12 |
860 | mtmsrd r11 | 896 | mtmsrd r11 |
897 | #endif /* CONFIG_PPC_BOOK3E */ | ||
861 | isync | 898 | isync |
862 | 899 | ||
863 | /* Restore arguments & enter PROM here... */ | 900 | /* Enter PROM here... */ |
864 | ld r3,GPR3(r1) | ||
865 | blrl | 901 | blrl |
866 | 902 | ||
867 | /* Just make sure that r1 top 32 bits didn't get | 903 | /* Just make sure that r1 top 32 bits didn't get |
@@ -871,7 +907,7 @@ _GLOBAL(enter_prom) | |||
871 | 907 | ||
872 | /* Restore the MSR (back to 64 bits) */ | 908 | /* Restore the MSR (back to 64 bits) */ |
873 | ld r0,_MSR(r1) | 909 | ld r0,_MSR(r1) |
874 | mtmsrd r0 | 910 | MTMSRD(r0) |
875 | isync | 911 | isync |
876 | 912 | ||
877 | /* Restore other registers */ | 913 | /* Restore other registers */ |
@@ -881,18 +917,6 @@ _GLOBAL(enter_prom) | |||
881 | REST_10GPRS(22, r1) | 917 | REST_10GPRS(22, r1) |
882 | ld r4,_CCR(r1) | 918 | ld r4,_CCR(r1) |
883 | mtcr r4 | 919 | mtcr r4 |
884 | ld r5,_CTR(r1) | ||
885 | mtctr r5 | ||
886 | ld r6,_XER(r1) | ||
887 | mtspr SPRN_XER,r6 | ||
888 | ld r7,_DAR(r1) | ||
889 | mtdar r7 | ||
890 | ld r8,_DSISR(r1) | ||
891 | mtdsisr r8 | ||
892 | ld r9,_SRR0(r1) | ||
893 | mtsrr0 r9 | ||
894 | ld r10,_SRR1(r1) | ||
895 | mtsrr1 r10 | ||
896 | 920 | ||
897 | addi r1,r1,PROM_FRAME_SIZE | 921 | addi r1,r1,PROM_FRAME_SIZE |
898 | ld r0,16(r1) | 922 | ld r0,16(r1) |