]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/64s/exception: Fix machine check no-loss idle wakeup
authorNicholas Piggin <npiggin@gmail.com>
Fri, 8 May 2020 04:33:53 +0000 (14:33 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 18 May 2020 11:58:44 +0000 (21:58 +1000)
commit8d71460c811d21f20f2db0ff13285c06e3a8bae6
tree323e596a724c5c6d13b158c4da94271394793361
parent6776f2776d2b7e0af54684eb4034f723d9600c3c
powerpc/64s/exception: Fix machine check no-loss idle wakeup

The architecture allows for machine check exceptions to cause idle
wakeups which resume at the 0x200 address which has to return via
the idle wakeup code, but the early machine check handler is run
first.

The case of a no state-loss sleep is broken because the early
handler uses non-volatile register r1 , which is needed for the wakeup
protocol, but it is not restored.

Fix this by loading r1 from the MCE exception frame before returning
to the idle wakeup code. Also update the comment which has become
stale since the idle rewrite in C.

This crash was found and fix confirmed with a machine check injection
test in qemu powernv model (which is not upstream in qemu yet).

Fixes: dc3a25256f2e3 ("powerpc/64s: Reimplement book3s idle code in C")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200508043408.886394-2-npiggin@gmail.com
arch/powerpc/kernel/exceptions-64s.S