aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>2014-03-11 01:26:18 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-03-23 19:16:09 -0400
commitd410ae2126481a74bc5be4a6242c4a232c19a984 (patch)
tree87e14bf51dfa65e3eac3f53528fb6036b0f46de6
parent422b9b9684db3c511e65c91842275c43f5910ae9 (diff)
powerpc/book3s: Fix CFAR clobbering issue in machine check handler.
While checking powersaving mode in machine check handler at 0x200, we clobber CFAR register. Fix it by saving and restoring it during beq/bgt. Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/include/asm/exception-64s.h8
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S5
2 files changed, 13 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 66830618cc19..aeaa56cd9b54 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -147,6 +147,14 @@ BEGIN_FTR_SECTION_NESTED(943) \
147END_FTR_SECTION_NESTED(ftr,ftr,943) 147END_FTR_SECTION_NESTED(ftr,ftr,943)
148 148
149/* 149/*
150 * Set an SPR from a register if the CPU has the given feature
151 */
152#define OPT_SET_SPR(ra, spr, ftr) \
153BEGIN_FTR_SECTION_NESTED(943) \
154 mtspr spr,ra; \
155END_FTR_SECTION_NESTED(ftr,ftr,943)
156
157/*
150 * Save a register to the PACA if the CPU has the given feature 158 * Save a register to the PACA if the CPU has the given feature
151 */ 159 */
152#define OPT_SAVE_REG_TO_PACA(offset, ra, ftr) \ 160#define OPT_SAVE_REG_TO_PACA(offset, ra, ftr) \
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 38d507306a11..4c34c3c827ad 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -164,13 +164,18 @@ BEGIN_FTR_SECTION
164 */ 164 */
165 mfspr r13,SPRN_SRR1 165 mfspr r13,SPRN_SRR1
166 rlwinm. r13,r13,47-31,30,31 166 rlwinm. r13,r13,47-31,30,31
167 OPT_GET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR)
167 beq 9f 168 beq 9f
168 169
170 mfspr r13,SPRN_SRR1
171 rlwinm. r13,r13,47-31,30,31
169 /* waking up from powersave (nap) state */ 172 /* waking up from powersave (nap) state */
170 cmpwi cr1,r13,2 173 cmpwi cr1,r13,2
171 /* Total loss of HV state is fatal. let's just stay stuck here */ 174 /* Total loss of HV state is fatal. let's just stay stuck here */
175 OPT_GET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR)
172 bgt cr1,. 176 bgt cr1,.
1739: 1779:
178 OPT_SET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR)
174END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206) 179END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
175#endif /* CONFIG_PPC_P7_NAP */ 180#endif /* CONFIG_PPC_P7_NAP */
176 EXCEPTION_PROLOG_0(PACA_EXMC) 181 EXCEPTION_PROLOG_0(PACA_EXMC)