Skip to content

Commit 0b66370

Browse files
npigginmpe
authored andcommitted
powerpc/64s/exception: machine check use correct cfar for late handler
Bare metal machine checks run an "early" handler in real mode before running the main handler which reports the event. The main handler runs exactly as a normal interrupt handler, after the "windup" which sets registers back as they were at interrupt entry. CFAR does not get restored by the windup code, so that will be wrong when the handler is run. Restore the CFAR to the saved value before running the late handler. Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent fa2760e commit 0b66370

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/powerpc/kernel/exceptions-64s.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,10 @@ FTR_SECTION_ELSE
11861186
ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
11871187
9:
11881188
/* Deliver the machine check to host kernel in V mode. */
1189+
BEGIN_FTR_SECTION
1190+
ld r10,ORIG_GPR3(r1)
1191+
mtspr SPRN_CFAR,r10
1192+
END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
11891193
MACHINE_CHECK_HANDLER_WINDUP
11901194
EXCEPTION_PROLOG_0 PACA_EXMC
11911195
EXCEPTION_PROLOG_1 EXC_STD, PACA_EXMC, 1, 0x200, 1, 1, 0

0 commit comments

Comments
 (0)