aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2011-04-04 23:59:58 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-04-19 21:03:23 -0400
commit673b189a2e3353061fa8c49515d1014dab6ad9b9 (patch)
tree71d5842f2dcfcd24370ef25f35c97f0f81ebae87 /arch/powerpc/kernel
parentb3e6b5dfcf0974069a8ddcce7dd071120d20d79c (diff)
powerpc: Always use SPRN_SPRG_HSCRATCH0 when running in HV mode
This uses feature sections to arrange that we always use HSPRG1 as the scratch register in the interrupt entry code rather than SPRG2 when we're running in hypervisor mode on POWER7. This will ensure that we don't trash the guest's SPRG2 when we are running KVM guests. To simplify the code, we define GET_SCRATCH0() and SET_SCRATCH0() macros like the GET_PACA/SET_PACA macros. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S26
1 files changed, 13 insertions, 13 deletions
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 805e20657868..e513c1d35b2a 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -43,7 +43,7 @@ __start_interrupts:
43_machine_check_pSeries: 43_machine_check_pSeries:
44 HMT_MEDIUM 44 HMT_MEDIUM
45 DO_KVM 0x200 45 DO_KVM 0x200
46 mtspr SPRN_SPRG_SCRATCH0,r13 /* save r13 */ 46 SET_SCRATCH0(r13)
47 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common, EXC_STD) 47 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common, EXC_STD)
48 48
49 . = 0x300 49 . = 0x300
@@ -51,7 +51,7 @@ _machine_check_pSeries:
51data_access_pSeries: 51data_access_pSeries:
52 HMT_MEDIUM 52 HMT_MEDIUM
53 DO_KVM 0x300 53 DO_KVM 0x300
54 mtspr SPRN_SPRG_SCRATCH0,r13 54 SET_SCRATCH0(r13)
55BEGIN_FTR_SECTION 55BEGIN_FTR_SECTION
56 GET_PACA(r13) 56 GET_PACA(r13)
57 std r9,PACA_EXSLB+EX_R9(r13) 57 std r9,PACA_EXSLB+EX_R9(r13)
@@ -67,7 +67,7 @@ BEGIN_FTR_SECTION
67 std r11,PACA_EXGEN+EX_R11(r13) 67 std r11,PACA_EXGEN+EX_R11(r13)
68 ld r11,PACA_EXSLB+EX_R9(r13) 68 ld r11,PACA_EXSLB+EX_R9(r13)
69 std r12,PACA_EXGEN+EX_R12(r13) 69 std r12,PACA_EXGEN+EX_R12(r13)
70 mfspr r12,SPRN_SPRG_SCRATCH0 70 GET_SCRATCH0(r12)
71 std r10,PACA_EXGEN+EX_R10(r13) 71 std r10,PACA_EXGEN+EX_R10(r13)
72 std r11,PACA_EXGEN+EX_R9(r13) 72 std r11,PACA_EXGEN+EX_R9(r13)
73 std r12,PACA_EXGEN+EX_R13(r13) 73 std r12,PACA_EXGEN+EX_R13(r13)
@@ -81,7 +81,7 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_SLB)
81data_access_slb_pSeries: 81data_access_slb_pSeries:
82 HMT_MEDIUM 82 HMT_MEDIUM
83 DO_KVM 0x380 83 DO_KVM 0x380
84 mtspr SPRN_SPRG_SCRATCH0,r13 84 SET_SCRATCH0(r13)
85 GET_PACA(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
@@ -95,7 +95,7 @@ data_access_slb_pSeries:
95 std r10,PACA_EXSLB+EX_R10(r13) 95 std r10,PACA_EXSLB+EX_R10(r13)
96 std r11,PACA_EXSLB+EX_R11(r13) 96 std r11,PACA_EXSLB+EX_R11(r13)
97 std r12,PACA_EXSLB+EX_R12(r13) 97 std r12,PACA_EXSLB+EX_R12(r13)
98 mfspr r10,SPRN_SPRG_SCRATCH0 98 GET_SCRATCH0(r10)
99 std r10,PACA_EXSLB+EX_R13(r13) 99 std r10,PACA_EXSLB+EX_R13(r13)
100 mfspr r12,SPRN_SRR1 /* and SRR1 */ 100 mfspr r12,SPRN_SRR1 /* and SRR1 */
101#ifndef CONFIG_RELOCATABLE 101#ifndef CONFIG_RELOCATABLE
@@ -120,7 +120,7 @@ data_access_slb_pSeries:
120instruction_access_slb_pSeries: 120instruction_access_slb_pSeries:
121 HMT_MEDIUM 121 HMT_MEDIUM
122 DO_KVM 0x480 122 DO_KVM 0x480
123 mtspr SPRN_SPRG_SCRATCH0,r13 123 SET_SCRATCH0(r13)
124 GET_PACA(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 */
@@ -134,7 +134,7 @@ instruction_access_slb_pSeries:
134 std r10,PACA_EXSLB+EX_R10(r13) 134 std r10,PACA_EXSLB+EX_R10(r13)
135 std r11,PACA_EXSLB+EX_R11(r13) 135 std r11,PACA_EXSLB+EX_R11(r13)
136 std r12,PACA_EXSLB+EX_R12(r13) 136 std r12,PACA_EXSLB+EX_R12(r13)
137 mfspr r10,SPRN_SPRG_SCRATCH0 137 GET_SCRATCH0(r10)
138 std r10,PACA_EXSLB+EX_R13(r13) 138 std r10,PACA_EXSLB+EX_R13(r13)
139 mfspr r12,SPRN_SRR1 /* and SRR1 */ 139 mfspr r12,SPRN_SRR1 /* and SRR1 */
140#ifndef CONFIG_RELOCATABLE 140#ifndef CONFIG_RELOCATABLE
@@ -272,7 +272,7 @@ masked_interrupt:
272 rotldi r10,r10,16 272 rotldi r10,r10,16
273 mtspr SPRN_SRR1,r10 273 mtspr SPRN_SRR1,r10
274 ld r10,PACA_EXGEN+EX_R10(r13) 274 ld r10,PACA_EXGEN+EX_R10(r13)
275 mfspr r13,SPRN_SPRG_SCRATCH0 275 GET_SCRATCH0(r13)
276 rfid 276 rfid
277 b . 277 b .
278 278
@@ -285,7 +285,7 @@ masked_Hinterrupt:
285 rotldi r10,r10,16 285 rotldi r10,r10,16
286 mtspr SPRN_HSRR1,r10 286 mtspr SPRN_HSRR1,r10
287 ld r10,PACA_EXGEN+EX_R10(r13) 287 ld r10,PACA_EXGEN+EX_R10(r13)
288 mfspr r13,SPRN_SPRG_HSCRATCH0 288 GET_SCRATCH0(r13)
289 hrfid 289 hrfid
290 b . 290 b .
291 291
@@ -293,7 +293,7 @@ masked_Hinterrupt:
293do_stab_bolted_pSeries: 293do_stab_bolted_pSeries:
294 std r11,PACA_EXSLB+EX_R11(r13) 294 std r11,PACA_EXSLB+EX_R11(r13)
295 std r12,PACA_EXSLB+EX_R12(r13) 295 std r12,PACA_EXSLB+EX_R12(r13)
296 mfspr r10,SPRN_SPRG_SCRATCH0 296 GET_SCRATCH0(r10)
297 std r10,PACA_EXSLB+EX_R13(r13) 297 std r10,PACA_EXSLB+EX_R13(r13)
298 EXCEPTION_PROLOG_PSERIES_1(.do_stab_bolted, EXC_STD) 298 EXCEPTION_PROLOG_PSERIES_1(.do_stab_bolted, EXC_STD)
299 299
@@ -305,14 +305,14 @@ do_stab_bolted_pSeries:
305 .align 7 305 .align 7
306system_reset_fwnmi: 306system_reset_fwnmi:
307 HMT_MEDIUM 307 HMT_MEDIUM
308 mtspr SPRN_SPRG_SCRATCH0,r13 /* save r13 */ 308 SET_SCRATCH0(r13) /* save r13 */
309 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common, EXC_STD) 309 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common, EXC_STD)
310 310
311 .globl machine_check_fwnmi 311 .globl machine_check_fwnmi
312 .align 7 312 .align 7
313machine_check_fwnmi: 313machine_check_fwnmi:
314 HMT_MEDIUM 314 HMT_MEDIUM
315 mtspr SPRN_SPRG_SCRATCH0,r13 /* save r13 */ 315 SET_SCRATCH0(r13) /* save r13 */
316 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common, EXC_STD) 316 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common, EXC_STD)
317 317
318#endif /* CONFIG_PPC_PSERIES */ 318#endif /* CONFIG_PPC_PSERIES */
@@ -327,7 +327,7 @@ slb_miss_user_pseries:
327 std r10,PACA_EXGEN+EX_R10(r13) 327 std r10,PACA_EXGEN+EX_R10(r13)
328 std r11,PACA_EXGEN+EX_R11(r13) 328 std r11,PACA_EXGEN+EX_R11(r13)
329 std r12,PACA_EXGEN+EX_R12(r13) 329 std r12,PACA_EXGEN+EX_R12(r13)
330 mfspr r10,SPRG_SCRATCH0 330 GET_SCRATCH0(r10)
331 ld r11,PACA_EXSLB+EX_R9(r13) 331 ld r11,PACA_EXSLB+EX_R9(r13)
332 ld r12,PACA_EXSLB+EX_R3(r13) 332 ld r12,PACA_EXSLB+EX_R3(r13)
333 std r10,PACA_EXGEN+EX_R13(r13) 333 std r10,PACA_EXGEN+EX_R13(r13)