Commit b44fc96d authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

powerpc/64s/exception: Reconcile interrupts in system_reset

This adds IRQ_HARD_DIS to irq_happened. Although it doesn't seem to
matter much because we're not allowed to enable irqs in an NMI
handler, the soft-irq debugging code is becoming more strict about
ensuring IRQ_HARD_DIS is in sync with MSR[EE], this may help avoid
asserts or other issues.

Add a comment explaining why MCE does not have this. Early machine
check is generally much smaller and more contained code which will
explode if you look at it wrong anyway as it runs in real mode, though
there's an argument that we should do similar reconciling for the MCE
as well.
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200225173541.1549955-22-npiggin@gmail.com
parent 2284ffea
...@@ -934,18 +934,19 @@ EXC_COMMON_BEGIN(system_reset_common) ...@@ -934,18 +934,19 @@ EXC_COMMON_BEGIN(system_reset_common)
__GEN_COMMON_BODY system_reset __GEN_COMMON_BODY system_reset
bl save_nvgprs bl save_nvgprs
/* /*
* Set IRQS_ALL_DISABLED unconditionally so arch_irqs_disabled does * Set IRQS_ALL_DISABLED unconditionally so irqs_disabled() does
* the right thing. We do not want to reconcile because that goes * the right thing. We do not want to reconcile because that goes
* through irq tracing which we don't want in NMI. * through irq tracing which we don't want in NMI.
* *
* Save PACAIRQHAPPENED because some code will do a hard disable * Save PACAIRQHAPPENED to _DAR (otherwise unused), and set HARD_DIS
* (e.g., xmon). So we want to restore this back to where it was * as we are running with MSR[EE]=0.
* when we return. DAR is unused in the stack, so save it there.
*/ */
li r10,IRQS_ALL_DISABLED li r10,IRQS_ALL_DISABLED
stb r10,PACAIRQSOFTMASK(r13) stb r10,PACAIRQSOFTMASK(r13)
lbz r10,PACAIRQHAPPENED(r13) lbz r10,PACAIRQHAPPENED(r13)
std r10,_DAR(r1) std r10,_DAR(r1)
ori r10,r10,PACA_IRQ_HARD_DIS
stb r10,PACAIRQHAPPENED(r13)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_FRAME_OVERHEAD
bl system_reset_exception bl system_reset_exception
...@@ -990,6 +991,11 @@ EXC_COMMON_BEGIN(system_reset_common) ...@@ -990,6 +991,11 @@ EXC_COMMON_BEGIN(system_reset_common)
* error detected there), determines if it was recoverable and logs the * error detected there), determines if it was recoverable and logs the
* event. * event.
* *
* This early code does not "reconcile" irq soft-mask state like SRESET or
* regular interrupts do, so irqs_disabled() among other things may not work
* properly (irq disable/enable already doesn't work because irq tracing can
* not work in real mode).
*
* Then, depending on the execution context when the interrupt is taken, there * Then, depending on the execution context when the interrupt is taken, there
* are 3 main actions: * are 3 main actions:
* - Executing in kernel mode. The event is queued with irq_work, which means * - Executing in kernel mode. The event is queued with irq_work, which means
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment