Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753528AbdF1BRS (ORCPT ); Tue, 27 Jun 2017 21:17:18 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34359 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752010AbdF1BRN (ORCPT ); Tue, 27 Jun 2017 21:17:13 -0400 From: Akshay Adiga To: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: ego@linux.vnet.ibm.com, npiggin@gmail.com, mpe@ellerman.id.au, Akshay Adiga Subject: [PATCH] powernv:idle: Clear r12 on wakeup from stop lite Date: Wed, 28 Jun 2017 06:46:49 +0530 X-Mailer: git-send-email 2.5.5 X-TM-AS-MML: disable x-cbid: 17062801-1617-0000-0000-000001ED1981 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17062801-1618-0000-0000-0000483490ED Message-Id: <1498612609-13677-1-git-send-email-akshay.adiga@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-27_15:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706280019 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1890 Lines: 53 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 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