diff mbox

[1/2] powerpc/pasemi: do not process external or decrementer interrupts from sreset

Message ID 20170320063149.3068-2-npiggin@gmail.com (mailing list archive)
State Accepted
Commit 461e96a3374892d551fe270a975f33836c7f7d72
Headers show

Commit Message

Nicholas Piggin March 20, 2017, 6:31 a.m. UTC
PA Semi will wake from low power state at the system reset interrupt,
with the event encoded in SRR1, rather than waking at the interrupt
vector that corresponds to that event.

The system reset handler for this platform decodes SRR1 event reason
and calls the interrupt handler to process it directly from the system
reset handlre.

A subsequent change will treat the system reset interrupt as a Linux NMI
with its own per-CPU stack, and this will no longer work. Remove the
external and decrementer handlers from the system reset handler.

- The external exception remains raised and will fire again at the
  EE interrupt vector when system reset returns.

- The decrementer is set to 1 so it will be raised again and fire when
  the system reset returns.

It is possible to branch to an idle handler from the system reset
interrupt (like POWER does), then restore a normal stack and restore
this optimisation. But simplicity wins for now.

Tested-by: Christian Zigotzky <chzigotzky@xenosoft.de>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/platforms/pasemi/idle.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Michael Ellerman May 1, 2017, 2:58 a.m. UTC | #1
On Mon, 2017-03-20 at 06:31:48 UTC, Nicholas Piggin wrote:
> PA Semi will wake from low power state at the system reset interrupt,
> with the event encoded in SRR1, rather than waking at the interrupt
> vector that corresponds to that event.
> 
> The system reset handler for this platform decodes SRR1 event reason
> and calls the interrupt handler to process it directly from the system
> reset handlre.
> 
> A subsequent change will treat the system reset interrupt as a Linux NMI
> with its own per-CPU stack, and this will no longer work. Remove the
> external and decrementer handlers from the system reset handler.
> 
> - The external exception remains raised and will fire again at the
>   EE interrupt vector when system reset returns.
> 
> - The decrementer is set to 1 so it will be raised again and fire when
>   the system reset returns.
> 
> It is possible to branch to an idle handler from the system reset
> interrupt (like POWER does), then restore a normal stack and restore
> this optimisation. But simplicity wins for now.
> 
> Tested-by: Christian Zigotzky <chzigotzky@xenosoft.de>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/461e96a3374892d551fe270a975f33

cheers
diff mbox

Patch

diff --git a/arch/powerpc/platforms/pasemi/idle.c b/arch/powerpc/platforms/pasemi/idle.c
index 75b296bc51af..44e0d9226f0a 100644
--- a/arch/powerpc/platforms/pasemi/idle.c
+++ b/arch/powerpc/platforms/pasemi/idle.c
@@ -53,11 +53,14 @@  static int pasemi_system_reset_exception(struct pt_regs *regs)
 		regs->nip = regs->link;
 
 	switch (regs->msr & SRR1_WAKEMASK) {
-	case SRR1_WAKEEE:
-		do_IRQ(regs);
-		break;
 	case SRR1_WAKEDEC:
-		timer_interrupt(regs);
+		set_dec(1);
+	case SRR1_WAKEEE:
+		/*
+		 * Handle these when interrupts get re-enabled and we take
+		 * them as regular exceptions. We are in an NMI context
+		 * and can't handle these here.
+		 */
 		break;
 	default:
 		/* do system reset */