aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-07-16 15:36:57 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-08-19 20:12:28 -0400
commitc5a8c0c99f67ae8a784faafbaaea1529825796e2 (patch)
tree731b07d0ac0414dbeac5ce940fe59a04a8d63c3f /arch/powerpc
parentee43eb788b3a06425fffb912677e2e1c8b00dd3b (diff)
powerpc: Remove use of a second scratch SPRG in STAB code
The STAB code used on Power3 and RS/64 uses a second scratch SPRG to save a GPR in order to decide whether to go to do_stab_bolted_* or to handle a normal data access exception. This prevents our scheme of freeing SPRG3 which is user visible for user uses since we cannot use SPRG0 which, on RS/64, seems to be read-only for supervisor mode (like POWER4). This reworks the STAB exception entry to use the PACA as temporary storage instead. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/include/asm/exception-64s.h7
-rw-r--r--arch/powerpc/include/asm/reg.h3
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S38
-rw-r--r--arch/powerpc/platforms/iseries/exception.S37
4 files changed, 55 insertions, 30 deletions
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 773e380b5fe8..a98653b26231 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -66,8 +66,7 @@
66 std r9,area+EX_R13(r13); \ 66 std r9,area+EX_R13(r13); \
67 mfcr r9 67 mfcr r9
68 68
69#define EXCEPTION_PROLOG_PSERIES(area, label) \ 69#define EXCEPTION_PROLOG_PSERIES_1(label) \
70 EXCEPTION_PROLOG_1(area); \
71 ld r12,PACAKBASE(r13); /* get high part of &label */ \ 70 ld r12,PACAKBASE(r13); /* get high part of &label */ \
72 ld r10,PACAKMSR(r13); /* get MSR value for kernel */ \ 71 ld r10,PACAKMSR(r13); /* get MSR value for kernel */ \
73 mfspr r11,SPRN_SRR0; /* save SRR0 */ \ 72 mfspr r11,SPRN_SRR0; /* save SRR0 */ \
@@ -78,6 +77,10 @@
78 rfid; \ 77 rfid; \
79 b . /* prevent speculative execution */ 78 b . /* prevent speculative execution */
80 79
80#define EXCEPTION_PROLOG_PSERIES(area, label) \
81 EXCEPTION_PROLOG_1(area); \
82 EXCEPTION_PROLOG_PSERIES_1(label);
83
81/* 84/*
82 * The common exception prolog is used for all except a few exceptions 85 * The common exception prolog is used for all except a few exceptions
83 * such as a segment miss on a kernel address. We have to be prepared 86 * such as a segment miss on a kernel address. We have to be prepared
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index a8179cc99ac4..d17af2b3d4ce 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -654,7 +654,7 @@
654 * 64-bit server: 654 * 64-bit server:
655 * - SPRG0 unused (reserved for HV on Power4) 655 * - SPRG0 unused (reserved for HV on Power4)
656 * - SPRG1 scratch for exception vectors 656 * - SPRG1 scratch for exception vectors
657 * - SPRG2 scratch for exception vectors 657 * - SPRG2 unused
658 * 658 *
659 * All 32-bit: 659 * All 32-bit:
660 * - SPRG3 current thread_info pointer 660 * - SPRG3 current thread_info pointer
@@ -707,7 +707,6 @@
707 707
708#ifdef CONFIG_PPC_BOOK3S_64 708#ifdef CONFIG_PPC_BOOK3S_64
709#define SPRN_SPRG_SCRATCH0 SPRN_SPRG1 709#define SPRN_SPRG_SCRATCH0 SPRN_SPRG1
710#define SPRN_SPRG_SCRATCH1 SPRN_SPRG2
711#endif 710#endif
712 711
713#ifdef CONFIG_PPC_BOOK3S_32 712#ifdef CONFIG_PPC_BOOK3S_32
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 4e9640cc0563..50f2ad36ed09 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -50,18 +50,28 @@ data_access_pSeries:
50 HMT_MEDIUM 50 HMT_MEDIUM
51 mtspr SPRN_SPRG_SCRATCH0,r13 51 mtspr SPRN_SPRG_SCRATCH0,r13
52BEGIN_FTR_SECTION 52BEGIN_FTR_SECTION
53 mtspr SPRN_SPRG_SCRATCH1,r12 53 mfspr r13,SPRN_SPRG_PACA
54 mfspr r13,SPRN_DAR 54 std r9,PACA_EXSLB+EX_R9(r13)
55 mfspr r12,SPRN_DSISR 55 std r10,PACA_EXSLB+EX_R10(r13)
56 srdi r13,r13,60 56 mfspr r10,SPRN_DAR
57 rlwimi r13,r12,16,0x20 57 mfspr r9,SPRN_DSISR
58 mfcr r12 58 srdi r10,r10,60
59 cmpwi r13,0x2c 59 rlwimi r10,r9,16,0x20
60 mfcr r9
61 cmpwi r10,0x2c
60 beq do_stab_bolted_pSeries 62 beq do_stab_bolted_pSeries
61 mtcrf 0x80,r12 63 ld r10,PACA_EXSLB+EX_R10(r13)
62 mfspr r12,SPRN_SPRG_SCRATCH1 64 std r11,PACA_EXGEN+EX_R11(r13)
63END_FTR_SECTION_IFCLR(CPU_FTR_SLB) 65 ld r11,PACA_EXSLB+EX_R9(r13)
66 std r12,PACA_EXGEN+EX_R12(r13)
67 mfspr r12,SPRN_SPRG_SCRATCH0
68 std r10,PACA_EXGEN+EX_R10(r13)
69 std r11,PACA_EXGEN+EX_R9(r13)
70 std r12,PACA_EXGEN+EX_R13(r13)
71 EXCEPTION_PROLOG_PSERIES_1(data_access_common)
72FTR_SECTION_ELSE
64 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, data_access_common) 73 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, data_access_common)
74ALT_FTR_SECTION_END_IFCLR(CPU_FTR_SLB)
65 75
66 . = 0x380 76 . = 0x380
67 .globl data_access_slb_pSeries 77 .globl data_access_slb_pSeries
@@ -224,9 +234,11 @@ masked_interrupt:
224 234
225 .align 7 235 .align 7
226do_stab_bolted_pSeries: 236do_stab_bolted_pSeries:
227 mtcrf 0x80,r12 237 std r11,PACA_EXSLB+EX_R11(r13)
228 mfspr r12,SPRN_SPRG_SCRATCH1 238 std r12,PACA_EXSLB+EX_R12(r13)
229 EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_stab_bolted) 239 mfspr r10,SPRN_SPRG_SCRATCH0
240 std r10,PACA_EXSLB+EX_R13(r13)
241 EXCEPTION_PROLOG_PSERIES_1(.do_stab_bolted)
230 242
231#ifdef CONFIG_PPC_PSERIES 243#ifdef CONFIG_PPC_PSERIES
232/* 244/*
diff --git a/arch/powerpc/platforms/iseries/exception.S b/arch/powerpc/platforms/iseries/exception.S
index 2b8075979237..5369653dcf6a 100644
--- a/arch/powerpc/platforms/iseries/exception.S
+++ b/arch/powerpc/platforms/iseries/exception.S
@@ -128,25 +128,36 @@ iSeries_secondary_smp_loop:
128data_access_iSeries: 128data_access_iSeries:
129 mtspr SPRN_SPRG_SCRATCH0,r13 129 mtspr SPRN_SPRG_SCRATCH0,r13
130BEGIN_FTR_SECTION 130BEGIN_FTR_SECTION
131 mtspr SPRN_SPRG_SCRATCH1,r12 131 mfspr r13,SPRN_SPRG_PACA
132 mfspr r13,SPRN_DAR 132 std r9,PACA_EXSLB+EX_R9(r13)
133 mfspr r12,SPRN_DSISR 133 std r10,PACA_EXSLB+EX_R10(r13)
134 srdi r13,r13,60 134 mfspr r10,SPRN_DAR
135 rlwimi r13,r12,16,0x20 135 mfspr r9,SPRN_DSISR
136 mfcr r12 136 srdi r10,r10,60
137 cmpwi r13,0x2c 137 rlwimi r10,r9,16,0x20
138 mfcr r9
139 cmpwi r10,0x2c
138 beq .do_stab_bolted_iSeries 140 beq .do_stab_bolted_iSeries
139 mtcrf 0x80,r12 141 ld r10,PACA_EXSLB+EX_R10(r13)
140 mfspr r12,SPRN_SPRG_SCRATCH1 142 std r11,PACA_EXGEN+EX_R11(r13)
141END_FTR_SECTION_IFCLR(CPU_FTR_SLB) 143 ld r11,PACA_EXSLB+EX_R9(r13)
144 std r12,PACA_EXGEN+EX_R12(r13)
145 mfspr r12,SPRN_SPRG_SCRATCH0
146 std r10,PACA_EXGEN+EX_R10(r13)
147 std r11,PACA_EXGEN+EX_R9(r13)
148 std r12,PACA_EXGEN+EX_R13(r13)
149 EXCEPTION_PROLOG_ISERIES_1
150FTR_SECTION_ELSE
142 EXCEPTION_PROLOG_1(PACA_EXGEN) 151 EXCEPTION_PROLOG_1(PACA_EXGEN)
143 EXCEPTION_PROLOG_ISERIES_1 152 EXCEPTION_PROLOG_ISERIES_1
153ALT_FTR_SECTION_END_IFCLR(CPU_FTR_SLB)
144 b data_access_common 154 b data_access_common
145 155
146.do_stab_bolted_iSeries: 156.do_stab_bolted_iSeries:
147 mtcrf 0x80,r12 157 std r11,PACA_EXSLB+EX_R11(r13)
148 mfspr r12,SPRN_SPRG_SCRATCH1 158 std r12,PACA_EXSLB+EX_R12(r13)
149 EXCEPTION_PROLOG_1(PACA_EXSLB) 159 mfspr r10,SPRN_SPRG_SCRATCH0
160 std r10,PACA_EXSLB+EX_R13(r13)
150 EXCEPTION_PROLOG_ISERIES_1 161 EXCEPTION_PROLOG_ISERIES_1
151 b .do_stab_bolted 162 b .do_stab_bolted
152 163