diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/include/asm/exception-64s.h | 6 | ||||
-rw-r--r-- | arch/powerpc/include/asm/reg.h | 27 | ||||
-rw-r--r-- | arch/powerpc/kernel/entry_64.S | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/exceptions-64s.S | 8 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_64.S | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/paca.c | 13 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_rmhandlers.S | 4 |
7 files changed, 50 insertions, 16 deletions
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h index 7778d6f0c878..337b6fa2f8cd 100644 --- a/arch/powerpc/include/asm/exception-64s.h +++ b/arch/powerpc/include/asm/exception-64s.h | |||
@@ -56,8 +56,8 @@ | |||
56 | #define LOAD_HANDLER(reg, label) \ | 56 | #define LOAD_HANDLER(reg, label) \ |
57 | addi reg,reg,(label)-_stext; /* virt addr of handler ... */ | 57 | addi reg,reg,(label)-_stext; /* virt addr of handler ... */ |
58 | 58 | ||
59 | #define EXCEPTION_PROLOG_1(area) \ | 59 | #define EXCEPTION_PROLOG_1(area) \ |
60 | mfspr r13,SPRN_SPRG_PACA; /* get paca address into r13 */ \ | 60 | GET_PACA(r13); \ |
61 | std r9,area+EX_R9(r13); /* save r9 - r12 */ \ | 61 | std r9,area+EX_R9(r13); /* save r9 - r12 */ \ |
62 | std r10,area+EX_R10(r13); \ | 62 | std r10,area+EX_R10(r13); \ |
63 | std r11,area+EX_R11(r13); \ | 63 | std r11,area+EX_R11(r13); \ |
@@ -174,7 +174,7 @@ label##_pSeries: \ | |||
174 | HMT_MEDIUM; \ | 174 | HMT_MEDIUM; \ |
175 | DO_KVM n; \ | 175 | DO_KVM n; \ |
176 | mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ | 176 | mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ |
177 | mfspr r13,SPRN_SPRG_PACA; /* get paca address into r13 */ \ | 177 | GET_PACA(r13); \ |
178 | std r9,PACA_EXGEN+EX_R9(r13); /* save r9, r10 */ \ | 178 | std r9,PACA_EXGEN+EX_R9(r13); /* save r9, r10 */ \ |
179 | std r10,PACA_EXGEN+EX_R10(r13); \ | 179 | std r10,PACA_EXGEN+EX_R10(r13); \ |
180 | lbz r10,PACASOFTIRQEN(r13); \ | 180 | lbz r10,PACASOFTIRQEN(r13); \ |
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index 6eb1d77edb4b..13429a0eba09 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h | |||
@@ -715,12 +715,15 @@ | |||
715 | * SPRG usage: | 715 | * SPRG usage: |
716 | * | 716 | * |
717 | * All 64-bit: | 717 | * All 64-bit: |
718 | * - SPRG1 stores PACA pointer | 718 | * - SPRG1 stores PACA pointer except 64-bit server in |
719 | * HV mode in which case it is HSPRG0 | ||
719 | * | 720 | * |
720 | * 64-bit server: | 721 | * 64-bit server: |
721 | * - SPRG0 unused (reserved for HV on Power4) | 722 | * - SPRG0 unused (reserved for HV on Power4) |
722 | * - SPRG2 scratch for exception vectors | 723 | * - SPRG2 scratch for exception vectors |
723 | * - SPRG3 unused (user visible) | 724 | * - SPRG3 unused (user visible) |
725 | * - HSPRG0 stores PACA in HV mode | ||
726 | * - HSPRG1 scratch for "HV" exceptions | ||
724 | * | 727 | * |
725 | * 64-bit embedded | 728 | * 64-bit embedded |
726 | * - SPRG0 generic exception scratch | 729 | * - SPRG0 generic exception scratch |
@@ -783,6 +786,22 @@ | |||
783 | 786 | ||
784 | #ifdef CONFIG_PPC_BOOK3S_64 | 787 | #ifdef CONFIG_PPC_BOOK3S_64 |
785 | #define SPRN_SPRG_SCRATCH0 SPRN_SPRG2 | 788 | #define SPRN_SPRG_SCRATCH0 SPRN_SPRG2 |
789 | #define SPRN_SPRG_HPACA SPRN_HSPRG0 | ||
790 | #define SPRN_SPRG_HSCRATCH0 SPRN_HSPRG1 | ||
791 | |||
792 | #define GET_PACA(rX) \ | ||
793 | BEGIN_FTR_SECTION_NESTED(66); \ | ||
794 | mfspr rX,SPRN_SPRG_PACA; \ | ||
795 | FTR_SECTION_ELSE_NESTED(66); \ | ||
796 | mfspr rX,SPRN_SPRG_HPACA; \ | ||
797 | ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE_206, 66) | ||
798 | |||
799 | #define SET_PACA(rX) \ | ||
800 | BEGIN_FTR_SECTION_NESTED(66); \ | ||
801 | mtspr SPRN_SPRG_PACA,rX; \ | ||
802 | FTR_SECTION_ELSE_NESTED(66); \ | ||
803 | mtspr SPRN_SPRG_HPACA,rX; \ | ||
804 | ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_HVMODE_206, 66) | ||
786 | #endif | 805 | #endif |
787 | 806 | ||
788 | #ifdef CONFIG_PPC_BOOK3E_64 | 807 | #ifdef CONFIG_PPC_BOOK3E_64 |
@@ -792,6 +811,10 @@ | |||
792 | #define SPRN_SPRG_TLB_EXFRAME SPRN_SPRG2 | 811 | #define SPRN_SPRG_TLB_EXFRAME SPRN_SPRG2 |
793 | #define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6 | 812 | #define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6 |
794 | #define SPRN_SPRG_GEN_SCRATCH SPRN_SPRG0 | 813 | #define SPRN_SPRG_GEN_SCRATCH SPRN_SPRG0 |
814 | |||
815 | #define SET_PACA(rX) mtspr SPRN_SPRG_PACA,rX | ||
816 | #define GET_PACA(rX) mfspr rX,SPRN_SPRG_PACA | ||
817 | |||
795 | #endif | 818 | #endif |
796 | 819 | ||
797 | #ifdef CONFIG_PPC_BOOK3S_32 | 820 | #ifdef CONFIG_PPC_BOOK3S_32 |
@@ -842,6 +865,8 @@ | |||
842 | #define SPRN_SPRG_SCRATCH1 SPRN_SPRG1 | 865 | #define SPRN_SPRG_SCRATCH1 SPRN_SPRG1 |
843 | #endif | 866 | #endif |
844 | 867 | ||
868 | |||
869 | |||
845 | /* | 870 | /* |
846 | * An mtfsf instruction with the L bit set. On CPUs that support this a | 871 | * An mtfsf instruction with the L bit set. On CPUs that support this a |
847 | * full 64bits of FPSCR is restored and on other CPUs the L bit is ignored. | 872 | * full 64bits of FPSCR is restored and on other CPUs the L bit is ignored. |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index d82878c4daa6..dbf5bfafd7bc 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -838,7 +838,7 @@ _GLOBAL(enter_rtas) | |||
838 | 838 | ||
839 | _STATIC(rtas_return_loc) | 839 | _STATIC(rtas_return_loc) |
840 | /* relocation is off at this point */ | 840 | /* relocation is off at this point */ |
841 | mfspr r4,SPRN_SPRG_PACA /* Get PACA */ | 841 | GET_PACA(r4) |
842 | clrldi r4,r4,2 /* convert to realmode address */ | 842 | clrldi r4,r4,2 /* convert to realmode address */ |
843 | 843 | ||
844 | bcl 20,31,$+4 | 844 | bcl 20,31,$+4 |
@@ -869,7 +869,7 @@ _STATIC(rtas_restore_regs) | |||
869 | REST_8GPRS(14, r1) /* Restore the non-volatiles */ | 869 | REST_8GPRS(14, r1) /* Restore the non-volatiles */ |
870 | REST_10GPRS(22, r1) /* ditto */ | 870 | REST_10GPRS(22, r1) /* ditto */ |
871 | 871 | ||
872 | mfspr r13,SPRN_SPRG_PACA | 872 | GET_PACA(r13) |
873 | 873 | ||
874 | ld r4,_CCR(r1) | 874 | ld r4,_CCR(r1) |
875 | mtcr r4 | 875 | mtcr r4 |
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index aeb739e18769..6784bf7090f6 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S | |||
@@ -53,7 +53,7 @@ data_access_pSeries: | |||
53 | DO_KVM 0x300 | 53 | DO_KVM 0x300 |
54 | mtspr SPRN_SPRG_SCRATCH0,r13 | 54 | mtspr SPRN_SPRG_SCRATCH0,r13 |
55 | BEGIN_FTR_SECTION | 55 | BEGIN_FTR_SECTION |
56 | mfspr r13,SPRN_SPRG_PACA | 56 | GET_PACA(r13) |
57 | std r9,PACA_EXSLB+EX_R9(r13) | 57 | std r9,PACA_EXSLB+EX_R9(r13) |
58 | std r10,PACA_EXSLB+EX_R10(r13) | 58 | std r10,PACA_EXSLB+EX_R10(r13) |
59 | mfspr r10,SPRN_DAR | 59 | mfspr r10,SPRN_DAR |
@@ -82,7 +82,7 @@ data_access_slb_pSeries: | |||
82 | HMT_MEDIUM | 82 | HMT_MEDIUM |
83 | DO_KVM 0x380 | 83 | DO_KVM 0x380 |
84 | mtspr SPRN_SPRG_SCRATCH0,r13 | 84 | mtspr SPRN_SPRG_SCRATCH0,r13 |
85 | mfspr r13,SPRN_SPRG_PACA /* get paca address into r13 */ | 85 | GET_PACA(r13) |
86 | std r3,PACA_EXSLB+EX_R3(r13) | 86 | std r3,PACA_EXSLB+EX_R3(r13) |
87 | mfspr r3,SPRN_DAR | 87 | mfspr r3,SPRN_DAR |
88 | std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */ | 88 | std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */ |
@@ -121,7 +121,7 @@ instruction_access_slb_pSeries: | |||
121 | HMT_MEDIUM | 121 | HMT_MEDIUM |
122 | DO_KVM 0x480 | 122 | DO_KVM 0x480 |
123 | mtspr SPRN_SPRG_SCRATCH0,r13 | 123 | mtspr SPRN_SPRG_SCRATCH0,r13 |
124 | mfspr r13,SPRN_SPRG_PACA /* get paca address into r13 */ | 124 | GET_PACA(r13) |
125 | std r3,PACA_EXSLB+EX_R3(r13) | 125 | std r3,PACA_EXSLB+EX_R3(r13) |
126 | mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */ | 126 | mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */ |
127 | std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */ | 127 | std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */ |
@@ -165,7 +165,7 @@ BEGIN_FTR_SECTION | |||
165 | beq- 1f | 165 | beq- 1f |
166 | END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) | 166 | END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) |
167 | mr r9,r13 | 167 | mr r9,r13 |
168 | mfspr r13,SPRN_SPRG_PACA | 168 | GET_PACA(r13) |
169 | mfspr r11,SPRN_SRR0 | 169 | mfspr r11,SPRN_SRR0 |
170 | ld r12,PACAKBASE(r13) | 170 | ld r12,PACAKBASE(r13) |
171 | ld r10,PACAKMSR(r13) | 171 | ld r10,PACAKMSR(r13) |
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 3a319f9c9d3e..39a40400f3f2 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
@@ -228,7 +228,7 @@ generic_secondary_common_init: | |||
228 | mr r3,r24 /* not found, copy phys to r3 */ | 228 | mr r3,r24 /* not found, copy phys to r3 */ |
229 | b .kexec_wait /* next kernel might do better */ | 229 | b .kexec_wait /* next kernel might do better */ |
230 | 230 | ||
231 | 2: mtspr SPRN_SPRG_PACA,r13 /* Save vaddr of paca in an SPRG */ | 231 | 2: SET_PACA(r13) |
232 | #ifdef CONFIG_PPC_BOOK3E | 232 | #ifdef CONFIG_PPC_BOOK3E |
233 | addi r12,r13,PACA_EXTLB /* and TLB exc frame in another */ | 233 | addi r12,r13,PACA_EXTLB /* and TLB exc frame in another */ |
234 | mtspr SPRN_SPRG_TLB_EXFRAME,r12 | 234 | mtspr SPRN_SPRG_TLB_EXFRAME,r12 |
@@ -534,7 +534,7 @@ _GLOBAL(pmac_secondary_start) | |||
534 | ld r4,0(r4) /* Get base vaddr of paca array */ | 534 | ld r4,0(r4) /* Get base vaddr of paca array */ |
535 | mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */ | 535 | mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */ |
536 | add r13,r13,r4 /* for this processor. */ | 536 | add r13,r13,r4 /* for this processor. */ |
537 | mtspr SPRN_SPRG_PACA,r13 /* Save vaddr of paca in an SPRG*/ | 537 | SET_PACA(r13) /* Save vaddr of paca in an SPRG*/ |
538 | 538 | ||
539 | /* Mark interrupts soft and hard disabled (they might be enabled | 539 | /* Mark interrupts soft and hard disabled (they might be enabled |
540 | * in the PACA when doing hotplug) | 540 | * in the PACA when doing hotplug) |
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c index 10f0aadee95b..102244edecf0 100644 --- a/arch/powerpc/kernel/paca.c +++ b/arch/powerpc/kernel/paca.c | |||
@@ -156,11 +156,22 @@ void __init initialise_paca(struct paca_struct *new_paca, int cpu) | |||
156 | /* Put the paca pointer into r13 and SPRG_PACA */ | 156 | /* Put the paca pointer into r13 and SPRG_PACA */ |
157 | void setup_paca(struct paca_struct *new_paca) | 157 | void setup_paca(struct paca_struct *new_paca) |
158 | { | 158 | { |
159 | /* Setup r13 */ | ||
159 | local_paca = new_paca; | 160 | local_paca = new_paca; |
160 | mtspr(SPRN_SPRG_PACA, local_paca); | 161 | |
161 | #ifdef CONFIG_PPC_BOOK3E | 162 | #ifdef CONFIG_PPC_BOOK3E |
163 | /* On Book3E, initialize the TLB miss exception frames */ | ||
162 | mtspr(SPRN_SPRG_TLB_EXFRAME, local_paca->extlb); | 164 | mtspr(SPRN_SPRG_TLB_EXFRAME, local_paca->extlb); |
165 | #else | ||
166 | /* In HV mode, we setup both HPACA and PACA to avoid problems | ||
167 | * if we do a GET_PACA() before the feature fixups have been | ||
168 | * applied | ||
169 | */ | ||
170 | if (cpu_has_feature(CPU_FTR_HVMODE_206)) | ||
171 | mtspr(SPRN_SPRG_HPACA, local_paca); | ||
163 | #endif | 172 | #endif |
173 | mtspr(SPRN_SPRG_PACA, local_paca); | ||
174 | |||
164 | } | 175 | } |
165 | 176 | ||
166 | static int __initdata paca_size; | 177 | static int __initdata paca_size; |
diff --git a/arch/powerpc/kvm/book3s_rmhandlers.S b/arch/powerpc/kvm/book3s_rmhandlers.S index 2b9c9088d00e..b0ff5ff76e25 100644 --- a/arch/powerpc/kvm/book3s_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_rmhandlers.S | |||
@@ -35,9 +35,7 @@ | |||
35 | 35 | ||
36 | #if defined(CONFIG_PPC_BOOK3S_64) | 36 | #if defined(CONFIG_PPC_BOOK3S_64) |
37 | 37 | ||
38 | #define LOAD_SHADOW_VCPU(reg) \ | 38 | #define LOAD_SHADOW_VCPU(reg) GET_PACA(reg) |
39 | mfspr reg, SPRN_SPRG_PACA | ||
40 | |||
41 | #define SHADOW_VCPU_OFF PACA_KVM_SVCPU | 39 | #define SHADOW_VCPU_OFF PACA_KVM_SVCPU |
42 | #define MSR_NOIRQ MSR_KERNEL & ~(MSR_IR | MSR_DR) | 40 | #define MSR_NOIRQ MSR_KERNEL & ~(MSR_IR | MSR_DR) |
43 | #define FUNC(name) GLUE(.,name) | 41 | #define FUNC(name) GLUE(.,name) |