From patchwork Mon Nov 21 18:37:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gautham R Shenoy X-Patchwork-Id: 698074 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tNttQ4qrVz9t0H for ; Wed, 23 Nov 2016 18:16:30 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3tNttQ4520zDw5N for ; Wed, 23 Nov 2016 18:16:30 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tMy6j2VQmzDw28 for ; Tue, 22 Nov 2016 05:38:53 +1100 (AEDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uALIcOG2034557 for ; Mon, 21 Nov 2016 13:38:51 -0500 Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) by mx0a-001b2d01.pphosted.com with ESMTP id 26v5j4jgf9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 21 Nov 2016 13:38:51 -0500 Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 Nov 2016 11:38:49 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 21 Nov 2016 11:38:46 -0700 Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 3C98419D803F; Mon, 21 Nov 2016 11:38:07 -0700 (MST) Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uALIcjku15598034; Mon, 21 Nov 2016 11:38:45 -0700 Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 425866A047; Mon, 21 Nov 2016 11:38:45 -0700 (MST) Received: from sofia.ibm.com (unknown [9.79.188.90]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP id BE9586A041; Mon, 21 Nov 2016 11:38:44 -0700 (MST) Received: by sofia.ibm.com (Postfix, from userid 1000) id 396AB2E2D80; Tue, 22 Nov 2016 00:08:41 +0530 (IST) From: "Gautham R. Shenoy" To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Michael Neuling , Vaidyanathan Srinivasan , "Shreyas B. Prabhu" Date: Tue, 22 Nov 2016 00:07:49 +0530 X-Mailer: git-send-email 1.8.3.1 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112118-8235-0000-0000-000009A72F93 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006118; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000189; SDB=6.00783523; UDB=6.00378388; IPR=6.00561142; BA=6.00004898; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013396; XFM=3.00000011; UTC=2016-11-21 18:38:48 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112118-8236-0000-0000-000036A3D4A3 Message-Id: <1479753469-10625-1-git-send-email-ego@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-21_13:, , 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-1609300000 definitions=main-1611210314 X-Mailman-Approved-At: Wed, 23 Nov 2016 18:14:45 +1100 Subject: [Skiboot] [RFC/PATCH] powernv: Handle wakeup from stop due to SRESET X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Gautham R. Shenoy" , "linuxppc-dev@lists.ozlabs.org>, linux-kernel@vger.kernel.org>, skiboot"@lists.ozlabs.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: "Gautham R. Shenoy" The existing code doesn't handle the case when CPU which was in a hardware-idle state (nap,sleep,winkle on POWER8 and various stop states on POWER9) gets woken up due to a System Reset interrupt. This patch checks if the CPU was woken up due to System Reset, in which case, after restoring the required hardware state, it jumps to the system reset handler. Signed-off-by: Gautham R. Shenoy --- arch/powerpc/kernel/idle_book3s.S | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S index 72dac0b..0098879 100644 --- a/arch/powerpc/kernel/idle_book3s.S +++ b/arch/powerpc/kernel/idle_book3s.S @@ -353,6 +353,18 @@ ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_ARCH_207S, 66); \ ld r3,ORIG_GPR3(r1); /* Restore original r3 */ \ 20: nop; +#define CHECK_SRESET_INTERRUPT \ +BEGIN_FTR_SECTION_NESTED(67); \ + mfspr r0,SPRN_SRR1; \ + rlwinm r0,r0,45-31,0xf; /* Extract wake reason field (P8,9) */ \ + cmpwi r0,0x4; /* System Reset ? */ \ + bne 21f; \ + b system_reset_common; \ + b .; /* We shouldn't return here */ \ +FTR_SECTION_ELSE_NESTED(67); \ + nop ; \ +ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_ARCH_207S, 67); \ +21: nop; /* * r3 - requested stop state @@ -644,6 +656,7 @@ _GLOBAL(pnv_wakeup_loss) ld r1,PACAR1(r13) BEGIN_FTR_SECTION CHECK_HMI_INTERRUPT + CHECK_SRESET_INTERRUPT END_FTR_SECTION_IFSET(CPU_FTR_HVMODE) REST_NVGPRS(r1) REST_GPR(2, r1) @@ -666,6 +679,7 @@ _GLOBAL(pnv_wakeup_noloss) bne pnv_wakeup_loss BEGIN_FTR_SECTION CHECK_HMI_INTERRUPT + CHECK_SRESET_INTERRUPT END_FTR_SECTION_IFSET(CPU_FTR_HVMODE) ld r1,PACAR1(r13) ld r6,_CCR(r1)