powerpc/64s/exception: machine check use correct cfar for late handler
authorNicholas Piggin <npiggin@gmail.com>
Fri, 2 Aug 2019 10:56:32 +0000 (20:56 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Oct 2019 19:01:01 +0000 (21:01 +0200)
[ Upstream commit 0b66370c61fcf5fcc1d6901013e110284da6e2bb ]

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 <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190802105709.27696-8-npiggin@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/kernel/exceptions-64s.S

index a44f1755dc4bfe9099e288fc63978dcec9c4fb1a..536718ed033fcab0c8c9f304ea0dc6aff08a0c3e 100644 (file)
@@ -1465,6 +1465,10 @@ machine_check_handle_early:
        RFI_TO_USER_OR_KERNEL
 9:
        /* Deliver the machine check to host kernel in V mode. */
+BEGIN_FTR_SECTION
+       ld      r10,ORIG_GPR3(r1)
+       mtspr   SPRN_CFAR,r10
+END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
        MACHINE_CHECK_HANDLER_WINDUP
        b       machine_check_pSeries