diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-04-17 00:35:01 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-04-18 01:38:47 -0400 |
commit | 945feb174b14e7098cc7ecf0cf4768d35bc52f9c (patch) | |
tree | 9810b2ff0efe8edbfb1506f65834ea0d553e2848 /arch/powerpc/kernel/head_64.S | |
parent | fd3e0bbc6052ca9747a5332b382584ece83aab6d (diff) |
[POWERPC] irqtrace support for 64-bit powerpc
This adds the low level irq tracing hooks to the powerpc architecture
needed to enable full lockdep functionality.
This is partly based on Johannes Berg's initial version. I removed
the asm trampoline that isn't needed (thus improving performance) and
modified all sorts of bits and pieces, reworking most of the assembly,
etc...
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/head_64.S')
-rw-r--r-- | arch/powerpc/kernel/head_64.S | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 44229c3749ac..215973a2c8d5 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
@@ -36,8 +36,7 @@ | |||
36 | #include <asm/firmware.h> | 36 | #include <asm/firmware.h> |
37 | #include <asm/page_64.h> | 37 | #include <asm/page_64.h> |
38 | #include <asm/exception.h> | 38 | #include <asm/exception.h> |
39 | 39 | #include <asm/irqflags.h> | |
40 | #define DO_SOFT_DISABLE | ||
41 | 40 | ||
42 | /* | 41 | /* |
43 | * We layout physical memory as follows: | 42 | * We layout physical memory as follows: |
@@ -450,8 +449,8 @@ bad_stack: | |||
450 | */ | 449 | */ |
451 | fast_exc_return_irq: /* restores irq state too */ | 450 | fast_exc_return_irq: /* restores irq state too */ |
452 | ld r3,SOFTE(r1) | 451 | ld r3,SOFTE(r1) |
452 | TRACE_AND_RESTORE_IRQ(r3); | ||
453 | ld r12,_MSR(r1) | 453 | ld r12,_MSR(r1) |
454 | stb r3,PACASOFTIRQEN(r13) /* restore paca->soft_enabled */ | ||
455 | rldicl r4,r12,49,63 /* get MSR_EE to LSB */ | 454 | rldicl r4,r12,49,63 /* get MSR_EE to LSB */ |
456 | stb r4,PACAHARDIRQEN(r13) /* restore paca->hard_enabled */ | 455 | stb r4,PACAHARDIRQEN(r13) /* restore paca->hard_enabled */ |
457 | b 1f | 456 | b 1f |
@@ -824,7 +823,7 @@ _STATIC(load_up_altivec) | |||
824 | * Hash table stuff | 823 | * Hash table stuff |
825 | */ | 824 | */ |
826 | .align 7 | 825 | .align 7 |
827 | _GLOBAL(do_hash_page) | 826 | _STATIC(do_hash_page) |
828 | std r3,_DAR(r1) | 827 | std r3,_DAR(r1) |
829 | std r4,_DSISR(r1) | 828 | std r4,_DSISR(r1) |
830 | 829 | ||
@@ -836,6 +835,27 @@ BEGIN_FTR_SECTION | |||
836 | END_FTR_SECTION_IFCLR(CPU_FTR_SLB) | 835 | END_FTR_SECTION_IFCLR(CPU_FTR_SLB) |
837 | 836 | ||
838 | /* | 837 | /* |
838 | * On iSeries, we soft-disable interrupts here, then | ||
839 | * hard-enable interrupts so that the hash_page code can spin on | ||
840 | * the hash_table_lock without problems on a shared processor. | ||
841 | */ | ||
842 | DISABLE_INTS | ||
843 | |||
844 | /* | ||
845 | * Currently, trace_hardirqs_off() will be called by DISABLE_INTS | ||
846 | * and will clobber volatile registers when irq tracing is enabled | ||
847 | * so we need to reload them. It may be possible to be smarter here | ||
848 | * and move the irq tracing elsewhere but let's keep it simple for | ||
849 | * now | ||
850 | */ | ||
851 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
852 | ld r3,_DAR(r1) | ||
853 | ld r4,_DSISR(r1) | ||
854 | ld r5,_TRAP(r1) | ||
855 | ld r12,_MSR(r1) | ||
856 | clrrdi r5,r5,4 | ||
857 | #endif /* CONFIG_TRACE_IRQFLAGS */ | ||
858 | /* | ||
839 | * We need to set the _PAGE_USER bit if MSR_PR is set or if we are | 859 | * We need to set the _PAGE_USER bit if MSR_PR is set or if we are |
840 | * accessing a userspace segment (even from the kernel). We assume | 860 | * accessing a userspace segment (even from the kernel). We assume |
841 | * kernel addresses always have the high bit set. | 861 | * kernel addresses always have the high bit set. |
@@ -848,13 +868,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB) | |||
848 | rlwimi r4,r5,22+2,31-2,31-2 /* Set _PAGE_EXEC if trap is 0x400 */ | 868 | rlwimi r4,r5,22+2,31-2,31-2 /* Set _PAGE_EXEC if trap is 0x400 */ |
849 | 869 | ||
850 | /* | 870 | /* |
851 | * On iSeries, we soft-disable interrupts here, then | ||
852 | * hard-enable interrupts so that the hash_page code can spin on | ||
853 | * the hash_table_lock without problems on a shared processor. | ||
854 | */ | ||
855 | DISABLE_INTS | ||
856 | |||
857 | /* | ||
858 | * r3 contains the faulting address | 871 | * r3 contains the faulting address |
859 | * r4 contains the required access permissions | 872 | * r4 contains the required access permissions |
860 | * r5 contains the trap number | 873 | * r5 contains the trap number |
@@ -864,7 +877,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB) | |||
864 | bl .hash_page /* build HPTE if possible */ | 877 | bl .hash_page /* build HPTE if possible */ |
865 | cmpdi r3,0 /* see if hash_page succeeded */ | 878 | cmpdi r3,0 /* see if hash_page succeeded */ |
866 | 879 | ||
867 | #ifdef DO_SOFT_DISABLE | ||
868 | BEGIN_FW_FTR_SECTION | 880 | BEGIN_FW_FTR_SECTION |
869 | /* | 881 | /* |
870 | * If we had interrupts soft-enabled at the point where the | 882 | * If we had interrupts soft-enabled at the point where the |
@@ -876,7 +888,7 @@ BEGIN_FW_FTR_SECTION | |||
876 | */ | 888 | */ |
877 | beq 13f | 889 | beq 13f |
878 | END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES) | 890 | END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES) |
879 | #endif | 891 | |
880 | BEGIN_FW_FTR_SECTION | 892 | BEGIN_FW_FTR_SECTION |
881 | /* | 893 | /* |
882 | * Here we have interrupts hard-disabled, so it is sufficient | 894 | * Here we have interrupts hard-disabled, so it is sufficient |
@@ -890,11 +902,12 @@ END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISERIES) | |||
890 | 902 | ||
891 | /* | 903 | /* |
892 | * hash_page couldn't handle it, set soft interrupt enable back | 904 | * hash_page couldn't handle it, set soft interrupt enable back |
893 | * to what it was before the trap. Note that .local_irq_restore | 905 | * to what it was before the trap. Note that .raw_local_irq_restore |
894 | * handles any interrupts pending at this point. | 906 | * handles any interrupts pending at this point. |
895 | */ | 907 | */ |
896 | ld r3,SOFTE(r1) | 908 | ld r3,SOFTE(r1) |
897 | bl .local_irq_restore | 909 | TRACE_AND_RESTORE_IRQ_PARTIAL(r3, 11f) |
910 | bl .raw_local_irq_restore | ||
898 | b 11f | 911 | b 11f |
899 | 912 | ||
900 | /* Here we have a page fault that hash_page can't handle. */ | 913 | /* Here we have a page fault that hash_page can't handle. */ |
@@ -1493,6 +1506,10 @@ _INIT_STATIC(start_here_multiplatform) | |||
1493 | addi r2,r2,0x4000 | 1506 | addi r2,r2,0x4000 |
1494 | add r2,r2,r26 | 1507 | add r2,r2,r26 |
1495 | 1508 | ||
1509 | /* Set initial ptr to current */ | ||
1510 | LOAD_REG_IMMEDIATE(r4, init_task) | ||
1511 | std r4,PACACURRENT(r13) | ||
1512 | |||
1496 | /* Do very early kernel initializations, including initial hash table, | 1513 | /* Do very early kernel initializations, including initial hash table, |
1497 | * stab and slb setup before we turn on relocation. */ | 1514 | * stab and slb setup before we turn on relocation. */ |
1498 | 1515 | ||