linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powernv:idle: Clear r12 on wakeup from stop lite
@ 2017-06-28  1:16 Akshay Adiga
  2017-06-28  4:36 ` Nicholas Piggin
  2017-06-29 12:21 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Akshay Adiga @ 2017-06-28  1:16 UTC (permalink / raw)
  To: linux-kernel, linuxppc-dev; +Cc: ego, npiggin, mpe, Akshay Adiga

pnv_wakeup_noloss expects R12 to contain SRR1 value to determine if
the wakeup reason is an HMI in CHECK_HMI_INTERRUPT.

When we wakeup with ESL=0, SRR1 will not contain the wakeup reason, so
there is no point setting R12 to SRR1.

However, we don't set R12 at all and R12 contains garbage, and still
being used to check HMI assuming that it had SRR1. causing the
OPAL msglog to be filled with the following print:
	HMI: Received HMI interrupt: HMER = 0x0040000000000000

This patch clears R12 after waking up from stop with ESL=EC=0, so that
we don't accidentally enter the HMI handler in pnv_wakeup_noloss if
the R12[42:45] corresponds to HMI as wakeup reason.

Bug existed prior to "commit 9d29250136f6 ("powerpc/64s/idle: Avoid SRR
usage in idle sleep/wake paths")  but was never hit in practice

Signed-off-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
Fixes: 9d29250136f6 ("powerpc/64s/idle: Avoid SRR usage in idle
sleep/wake paths")
---
 arch/powerpc/kernel/idle_book3s.S | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
index 1ea14b9..34794fd 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -256,6 +256,21 @@ power_enter_stop:
 	bne	 .Lhandle_esl_ec_set
 	IDLE_STATE_ENTER_SEQ(PPC_STOP)
 	li	r3,0  /* Since we didn't lose state, return 0 */
+	/*
+	 * pnv_wakeup_noloss expects R12 to contain SRR1 value
+	 * to determine if the wakeup reason is an HMI in
+	 * CHECK_HMI_INTERRUPT.
+	 *
+	 * However, when we wakeup with ESL=0,
+	 * SRR1 will not contain the wakeup reason,
+	 * so there is no point setting R12 to SRR1.
+	 *
+	 * Further, we clear R12 here, so that we
+	 * don't accidentally enter the HMI
+	 * in pnv_wakeup_noloss if the
+	 * R12[42:45] == WAKE_HMI.
+	 */
+	li	r12, 0
 	b 	pnv_wakeup_noloss
 
 .Lhandle_esl_ec_set:
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-29 12:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-28  1:16 [PATCH] powernv:idle: Clear r12 on wakeup from stop lite Akshay Adiga
2017-06-28  4:36 ` Nicholas Piggin
2017-06-28 12:32   ` Michael Ellerman
2017-06-29 12:21 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).