Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751142AbdDMEAQ (ORCPT ); Thu, 13 Apr 2017 00:00:16 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48955 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750730AbdDMEAO (ORCPT ); Thu, 13 Apr 2017 00:00:14 -0400 From: "Aneesh Kumar K.V" To: "Gautham R. Shenoy" , 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 Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, "Gautham R. Shenoy" Subject: Re: [PATCH 3/3] powernv:idle: Set LPCR_UPRT on wakeup from deep-stop In-Reply-To: <9be8410e0abe5ae1afa16a6f987c53046ef51757.1491996797.git.ego@linux.vnet.ibm.com> References: <9be8410e0abe5ae1afa16a6f987c53046ef51757.1491996797.git.ego@linux.vnet.ibm.com> Date: Thu, 13 Apr 2017 09:28:33 +0530 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-MML: disable x-cbid: 17041303-0040-0000-0000-00000306AC68 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17041303-0041-0000-0000-00000C7E68C6 Message-Id: <8737ddq7py.fsf@skywalker.in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-13_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1704130030 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1711 Lines: 55 "Gautham R. Shenoy" writes: > 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) What about LPCR_HR ? > > hypervisor_state_restored: > > -- > 1.9.4 -aneesh