Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753823AbdDLLq7 (ORCPT ); Wed, 12 Apr 2017 07:46:59 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57016 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753447AbdDLLqr (ORCPT ); Wed, 12 Apr 2017 07:46:47 -0400 From: "Gautham R. Shenoy" To: Michael Ellerman , Michael Neuling , Benjamin Herrenschmidt , "Shreyas B. Prabhu" , Shilpasri G Bhat , Vaidyanathan Srinivasan , Anton Blanchard , Balbir Singh , Akshay Adiga , Nicholas Piggin , Mahesh J Salgaonkar , "Aneesh Kumar K.V" Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, "Gautham R. Shenoy" Subject: [PATCH 3/3] powernv:idle: Set LPCR_UPRT on wakeup from deep-stop Date: Wed, 12 Apr 2017 17:16:22 +0530 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: X-TM-AS-GCONF: 00 x-cbid: 17041211-0036-0000-0000-000001DB9E4E X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006922; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000208; SDB=6.00846487; UDB=6.00417537; IPR=6.00624923; BA=6.00005286; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015020; XFM=3.00000013; UTC=2017-04-12 11:46:43 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17041211-0037-0000-0000-00003FA5594A Message-Id: <9be8410e0abe5ae1afa16a6f987c53046ef51757.1491996797.git.ego@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-12_08:,, 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-1702020001 definitions=main-1704120098 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1535 Lines: 48 From: "Gautham R. Shenoy" On wakeup from a deep-stop used for CPU-Hotplug, we invoke cur_cpu_spec->cpu_restore() which would set sane default values to various SPRs including LPCR. On POWER9, the cpu_restore_power9() call would would restore LPCR to a sane value that is set at early boot time, thereby clearing LPCR_UPRT. However, LPCR_UPRT is required to be set if we are running in Radix mode. If this is not set we will end up with a crash when we enable IR,DR. To fix this, after returning from cur_cpu_spec->cpu_restore() in the idle exit path, set LPCR_UPRT if we are running in Radix mode. Cc: Aneesh Kumar K.V Signed-off-by: Gautham R. Shenoy --- arch/powerpc/kernel/idle_book3s.S | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S index 6a9bd28..39a9b63 100644 --- a/arch/powerpc/kernel/idle_book3s.S +++ b/arch/powerpc/kernel/idle_book3s.S @@ -804,6 +804,19 @@ no_segments: #endif mtctr r12 bctrl +/* + * cur_cpu_spec->cpu_restore would restore LPCR to a + * sane value that is set at early boot time, + * thereby clearing LPCR_UPRT. + * LPCR_UPRT is required if we are running in Radix mode. + * Set it here if that be the case. + */ +BEGIN_MMU_FTR_SECTION + mfspr r3, SPRN_LPCR + LOAD_REG_IMMEDIATE(r4, LPCR_UPRT) + or r3, r3, r4 + mtspr SPRN_LPCR, r3 +END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_RADIX) hypervisor_state_restored: -- 1.9.4