aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-07-14 16:52:54 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-08-19 20:12:27 -0400
commitee43eb788b3a06425fffb912677e2e1c8b00dd3b (patch)
tree7233cb47647837ab00af81270b3a16555d88a1f1 /arch/powerpc/platforms
parent8aa34ab8b2dc96ca6c4feecfb87ed13f0d40ef98 (diff)
powerpc: Use names rather than numbers for SPRGs (v2)
The kernel uses SPRG registers for various purposes, typically in low level assembly code as scratch registers or to hold per-cpu global infos such as the PACA or the current thread_info pointer. We want to be able to easily shuffle the usage of those registers as some implementations have specific constraints realted to some of them, for example, some have userspace readable aliases, etc.. and the current choice isn't always the best. This patch should not change any code generation, and replaces the usage of SPRN_SPRGn everywhere in the kernel with a named replacement and adds documentation next to the definition of the names as to what those are used for on each processor family. The only parts that still use the original numbers are bits of KVM or suspend/resume code that just blindly needs to save/restore all the SPRGs. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/iseries/exception.S28
-rw-r--r--arch/powerpc/platforms/iseries/exception.h4
2 files changed, 16 insertions, 16 deletions
diff --git a/arch/powerpc/platforms/iseries/exception.S b/arch/powerpc/platforms/iseries/exception.S
index 2f581521eb9..2b807597923 100644
--- a/arch/powerpc/platforms/iseries/exception.S
+++ b/arch/powerpc/platforms/iseries/exception.S
@@ -47,7 +47,7 @@ system_reset_iSeries:
47 LOAD_REG_ADDR(r13, paca) 47 LOAD_REG_ADDR(r13, paca)
48 mulli r0,r23,PACA_SIZE 48 mulli r0,r23,PACA_SIZE
49 add r13,r13,r0 49 add r13,r13,r0
50 mtspr SPRN_SPRG3,r13 /* Save it away for the future */ 50 mtspr SPRN_SPRG_PACA,r13 /* Save it away for the future */
51 mfmsr r24 51 mfmsr r24
52 ori r24,r24,MSR_RI 52 ori r24,r24,MSR_RI
53 mtmsrd r24 /* RI on */ 53 mtmsrd r24 /* RI on */
@@ -116,7 +116,7 @@ iSeries_secondary_smp_loop:
116#endif /* CONFIG_SMP */ 116#endif /* CONFIG_SMP */
117 li r0,-1 /* r0=-1 indicates a Hypervisor call */ 117 li r0,-1 /* r0=-1 indicates a Hypervisor call */
118 sc /* Invoke the hypervisor via a system call */ 118 sc /* Invoke the hypervisor via a system call */
119 mfspr r13,SPRN_SPRG3 /* Put r13 back ???? */ 119 mfspr r13,SPRN_SPRG_PACA /* Put r13 back ???? */
120 b 2b /* If SMP not configured, secondaries 120 b 2b /* If SMP not configured, secondaries
121 * loop forever */ 121 * loop forever */
122 122
@@ -126,9 +126,9 @@ iSeries_secondary_smp_loop:
126 126
127 .globl data_access_iSeries 127 .globl data_access_iSeries
128data_access_iSeries: 128data_access_iSeries:
129 mtspr SPRN_SPRG1,r13 129 mtspr SPRN_SPRG_SCRATCH0,r13
130BEGIN_FTR_SECTION 130BEGIN_FTR_SECTION
131 mtspr SPRN_SPRG2,r12 131 mtspr SPRN_SPRG_SCRATCH1,r12
132 mfspr r13,SPRN_DAR 132 mfspr r13,SPRN_DAR
133 mfspr r12,SPRN_DSISR 133 mfspr r12,SPRN_DSISR
134 srdi r13,r13,60 134 srdi r13,r13,60
@@ -137,7 +137,7 @@ BEGIN_FTR_SECTION
137 cmpwi r13,0x2c 137 cmpwi r13,0x2c
138 beq .do_stab_bolted_iSeries 138 beq .do_stab_bolted_iSeries
139 mtcrf 0x80,r12 139 mtcrf 0x80,r12
140 mfspr r12,SPRN_SPRG2 140 mfspr r12,SPRN_SPRG_SCRATCH1
141END_FTR_SECTION_IFCLR(CPU_FTR_SLB) 141END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
142 EXCEPTION_PROLOG_1(PACA_EXGEN) 142 EXCEPTION_PROLOG_1(PACA_EXGEN)
143 EXCEPTION_PROLOG_ISERIES_1 143 EXCEPTION_PROLOG_ISERIES_1
@@ -145,15 +145,15 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
145 145
146.do_stab_bolted_iSeries: 146.do_stab_bolted_iSeries:
147 mtcrf 0x80,r12 147 mtcrf 0x80,r12
148 mfspr r12,SPRN_SPRG2 148 mfspr r12,SPRN_SPRG_SCRATCH1
149 EXCEPTION_PROLOG_1(PACA_EXSLB) 149 EXCEPTION_PROLOG_1(PACA_EXSLB)
150 EXCEPTION_PROLOG_ISERIES_1 150 EXCEPTION_PROLOG_ISERIES_1
151 b .do_stab_bolted 151 b .do_stab_bolted
152 152
153 .globl data_access_slb_iSeries 153 .globl data_access_slb_iSeries
154data_access_slb_iSeries: 154data_access_slb_iSeries:
155 mtspr SPRN_SPRG1,r13 /* save r13 */ 155 mtspr SPRN_SPRG_SCRATCH0,r13 /* save r13 */
156 mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ 156 mfspr r13,SPRN_SPRG_PACA /* get paca address into r13 */
157 std r3,PACA_EXSLB+EX_R3(r13) 157 std r3,PACA_EXSLB+EX_R3(r13)
158 mfspr r3,SPRN_DAR 158 mfspr r3,SPRN_DAR
159 std r9,PACA_EXSLB+EX_R9(r13) 159 std r9,PACA_EXSLB+EX_R9(r13)
@@ -165,7 +165,7 @@ data_access_slb_iSeries:
165 std r10,PACA_EXSLB+EX_R10(r13) 165 std r10,PACA_EXSLB+EX_R10(r13)
166 std r11,PACA_EXSLB+EX_R11(r13) 166 std r11,PACA_EXSLB+EX_R11(r13)
167 std r12,PACA_EXSLB+EX_R12(r13) 167 std r12,PACA_EXSLB+EX_R12(r13)
168 mfspr r10,SPRN_SPRG1 168 mfspr r10,SPRN_SPRG_SCRATCH0
169 std r10,PACA_EXSLB+EX_R13(r13) 169 std r10,PACA_EXSLB+EX_R13(r13)
170 ld r12,PACALPPACAPTR(r13) 170 ld r12,PACALPPACAPTR(r13)
171 ld r12,LPPACASRR1(r12) 171 ld r12,LPPACASRR1(r12)
@@ -175,8 +175,8 @@ data_access_slb_iSeries:
175 175
176 .globl instruction_access_slb_iSeries 176 .globl instruction_access_slb_iSeries
177instruction_access_slb_iSeries: 177instruction_access_slb_iSeries:
178 mtspr SPRN_SPRG1,r13 /* save r13 */ 178 mtspr SPRN_SPRG_SCRATCH0,r13 /* save r13 */
179 mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ 179 mfspr r13,SPRN_SPRG_PACA /* get paca address into r13 */
180 std r3,PACA_EXSLB+EX_R3(r13) 180 std r3,PACA_EXSLB+EX_R3(r13)
181 ld r3,PACALPPACAPTR(r13) 181 ld r3,PACALPPACAPTR(r13)
182 ld r3,LPPACASRR0(r3) /* get SRR0 value */ 182 ld r3,LPPACASRR0(r3) /* get SRR0 value */
@@ -189,7 +189,7 @@ instruction_access_slb_iSeries:
189 std r10,PACA_EXSLB+EX_R10(r13) 189 std r10,PACA_EXSLB+EX_R10(r13)
190 std r11,PACA_EXSLB+EX_R11(r13) 190 std r11,PACA_EXSLB+EX_R11(r13)
191 std r12,PACA_EXSLB+EX_R12(r13) 191 std r12,PACA_EXSLB+EX_R12(r13)
192 mfspr r10,SPRN_SPRG1 192 mfspr r10,SPRN_SPRG_SCRATCH0
193 std r10,PACA_EXSLB+EX_R13(r13) 193 std r10,PACA_EXSLB+EX_R13(r13)
194 ld r12,PACALPPACAPTR(r13) 194 ld r12,PACALPPACAPTR(r13)
195 ld r12,LPPACASRR1(r12) 195 ld r12,LPPACASRR1(r12)
@@ -200,7 +200,7 @@ slb_miss_user_iseries:
200 std r10,PACA_EXGEN+EX_R10(r13) 200 std r10,PACA_EXGEN+EX_R10(r13)
201 std r11,PACA_EXGEN+EX_R11(r13) 201 std r11,PACA_EXGEN+EX_R11(r13)
202 std r12,PACA_EXGEN+EX_R12(r13) 202 std r12,PACA_EXGEN+EX_R12(r13)
203 mfspr r10,SPRG1 203 mfspr r10,SPRG_SCRATCH0
204 ld r11,PACA_EXSLB+EX_R9(r13) 204 ld r11,PACA_EXSLB+EX_R9(r13)
205 ld r12,PACA_EXSLB+EX_R3(r13) 205 ld r12,PACA_EXSLB+EX_R3(r13)
206 std r10,PACA_EXGEN+EX_R13(r13) 206 std r10,PACA_EXGEN+EX_R13(r13)
@@ -221,7 +221,7 @@ slb_miss_user_iseries:
221 .globl system_call_iSeries 221 .globl system_call_iSeries
222system_call_iSeries: 222system_call_iSeries:
223 mr r9,r13 223 mr r9,r13
224 mfspr r13,SPRN_SPRG3 224 mfspr r13,SPRN_SPRG_PACA
225 EXCEPTION_PROLOG_ISERIES_1 225 EXCEPTION_PROLOG_ISERIES_1
226 b system_call_common 226 b system_call_common
227 227
diff --git a/arch/powerpc/platforms/iseries/exception.h b/arch/powerpc/platforms/iseries/exception.h
index e26eb86ac73..bae3fba5ad8 100644
--- a/arch/powerpc/platforms/iseries/exception.h
+++ b/arch/powerpc/platforms/iseries/exception.h
@@ -38,7 +38,7 @@
38 .globl label##_iSeries; \ 38 .globl label##_iSeries; \
39label##_iSeries: \ 39label##_iSeries: \
40 HMT_MEDIUM; \ 40 HMT_MEDIUM; \
41 mtspr SPRN_SPRG1,r13; /* save r13 */ \ 41 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \
42 EXCEPTION_PROLOG_1(area); \ 42 EXCEPTION_PROLOG_1(area); \
43 EXCEPTION_PROLOG_ISERIES_1; \ 43 EXCEPTION_PROLOG_ISERIES_1; \
44 b label##_common 44 b label##_common
@@ -47,7 +47,7 @@ label##_iSeries: \
47 .globl label##_iSeries; \ 47 .globl label##_iSeries; \
48label##_iSeries: \ 48label##_iSeries: \
49 HMT_MEDIUM; \ 49 HMT_MEDIUM; \
50 mtspr SPRN_SPRG1,r13; /* save r13 */ \ 50 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \
51 EXCEPTION_PROLOG_1(PACA_EXGEN); \ 51 EXCEPTION_PROLOG_1(PACA_EXGEN); \
52 lbz r10,PACASOFTIRQEN(r13); \ 52 lbz r10,PACASOFTIRQEN(r13); \
53 cmpwi 0,r10,0; \ 53 cmpwi 0,r10,0; \