diff mbox series

[v2,21/35] powerpc/64s/exception: soft nmi interrupt should not use ret_from_except

Message ID 407f32f4cd6c96b1bb86c076e82e0ab31edf6d24.1574798487.git.msuchanek@suse.de (mailing list archive)
State Superseded
Headers show
Series exception cleanup, syscall in C and !COMPAT | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/merge (2ec2260ce7bce5eb6a8ced0bb78d75c1b3eca306)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/next (8dcd71b45df34d9b903450fab147ee8c1e6c16b5)
snowpatch_ozlabs/apply_patch success Successfully applied on branch linus/master (2be7d348fe924f0c5583c6a805bd42cecda93104)
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 12 lines checked
snowpatch_ozlabs/needsstable success Patch has no Fixes tags

Commit Message

Michal Suchánek Nov. 26, 2019, 8:13 p.m. UTC
From: Nicholas Piggin <npiggin@gmail.com>

The soft nmi handler does not reconcile interrupt state, so it should
not return via the normal ret_from_except path. Return like other NMIs,
using the EXCEPTION_RESTORE_REGS macro.

This becomes important when the scv interrupt is implemented, which
must handle soft-masked interrupts that have r13 set to something other
than the PACA -- returning to kernel in this case must restore r13.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/exceptions-64s.S | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 38bc66b95516..af1264cd005f 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -2740,7 +2740,11 @@  EXC_COMMON_BEGIN(soft_nmi_common)
 	bl	save_nvgprs
 	addi	r3,r1,STACK_FRAME_OVERHEAD
 	bl	soft_nmi_interrupt
-	b	ret_from_except
+	/* Clear MSR_RI before setting SRR0 and SRR1. */
+	li	r9,0
+	mtmsrd	r9,1
+	EXCEPTION_RESTORE_REGS hsrr=0
+	RFI_TO_KERNEL
 
 #endif /* CONFIG_PPC_WATCHDOG */