Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1325894ybt; Thu, 9 Jul 2020 04:25:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyObuHMaOxUAFVK84JjBYTUrLT0MuG63sAZcT+FVCfO+gmdgYtC37EU1IfkUhmI9M/7kjZB X-Received: by 2002:a17:906:b888:: with SMTP id hb8mr55501373ejb.124.1594293926248; Thu, 09 Jul 2020 04:25:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594293926; cv=none; d=google.com; s=arc-20160816; b=TOFyntv00D4OmX3//SNkxhDt7wamUEwVV+RNDb6vepErk4bFr6LuXPmuzs/nHynqju ZsKX2CY33gXudS+af+nnUGIN5y3FNuXm3wEbCbXBuNqMaZSM0cUa9O3DDg0Fh06ffu1J 2VjDrxvV/YddLqqisiGz/YG7bV6AnE4K39X3kwKozV0iaquANbedZUIQ71KVOOpoeN8d tlPalv4KFIQL/lC37TLCDWHGLWCdI4jnlzdgRNkogUYe4o2u61Boo/iVgcMwIHQjMngS pVFVC3Omwjpmi1aZuz/n+x1kw7NkPK1hskClN4uyxYoOeoo+5OLWVjZt5Zztt57Gq3Xa XF1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=XfnaXvtwSXoD3Z0NaoA/VRo7vy3cCv2qxJI1zLK0b2I=; b=sA8TAROPdd1ZklwYCF88Tjtr+oY75+MwC6HBk7qJpylEUDhRdZpklcD+GKCgYWcfDi scI/YIyRvsWKD7iEZT+cQTXXshRoulZywIsF/vSc8ttuC3KcNsLD0x3zCxGcuhU6hncJ k6Lw1ZGDOuD4zziaDK5ySDxhNRgbPC0crhg1uZIDKhJ0cZYz68vpjtQ+axS4xlZTfQSt gQEdeWW+Fw1sgpbVIkzdqbEQesy5zcIMuesX4h1akdBa5wuNLFkF3tRCXrgnUbVVfrnw tYnMk0M7yTTkAjw55rUt9C6SjIx3Lg1l1AEQDwc3Ey4i61cWeaH4nAv0Ls+XQlnphTIf RsVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d1si1840976edr.113.2020.07.09.04.25.02; Thu, 09 Jul 2020 04:25:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726975AbgGILWo (ORCPT + 99 others); Thu, 9 Jul 2020 07:22:44 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:1572 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726315AbgGILWn (ORCPT ); Thu, 9 Jul 2020 07:22:43 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 069B2IdY121496; Thu, 9 Jul 2020 07:22:27 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 325kh3xw8q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Jul 2020 07:22:27 -0400 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 069B3FHs125428; Thu, 9 Jul 2020 07:22:27 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 325kh3xw7d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Jul 2020 07:22:27 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 069BKvQV015376; Thu, 9 Jul 2020 11:22:24 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma02fra.de.ibm.com with ESMTP id 325mr2rsek-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Jul 2020 11:22:24 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 069BL6Ua47579232 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Jul 2020 11:21:07 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF2D6AE053; Thu, 9 Jul 2020 11:21:06 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 67361AE055; Thu, 9 Jul 2020 11:21:05 +0000 (GMT) Received: from [9.79.211.226] (unknown [9.79.211.226]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 9 Jul 2020 11:21:05 +0000 (GMT) Subject: Re: [PATCH 2/2] powerpc/powernv/idle: save-restore DAWR0,DAWRX0 for P10 To: ego@linux.vnet.ibm.com Cc: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, benh@kernel.crashing.org, paulus@samba.org, svaidy@linux.ibm.com, pratik.r.sampat@gmail.com, Ravi Bangoria References: <20200703124640.42820-1-psampat@linux.ibm.com> <20200703124640.42820-2-psampat@linux.ibm.com> <20200709090948.GB24354@in.ibm.com> From: Pratik Sampat Message-ID: <87fdebb1-93e1-a59d-f582-784ee1c19279@linux.ibm.com> Date: Thu, 9 Jul 2020 16:51:04 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200709090948.GB24354@in.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-09_05:2020-07-09,2020-07-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 priorityscore=1501 lowpriorityscore=0 clxscore=1015 mlxscore=0 bulkscore=0 spamscore=0 suspectscore=1 adultscore=0 impostorscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007090084 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/07/20 2:39 pm, Gautham R Shenoy wrote: > On Fri, Jul 03, 2020 at 06:16:40PM +0530, Pratik Rajesh Sampat wrote: >> Additional registers DAWR0, DAWRX0 may be lost on Power 10 for >> stop levels < 4. > Adding Ravi Bangoria to the cc. > >> Therefore save the values of these SPRs before entering a "stop" >> state and restore their values on wakeup. >> >> Signed-off-by: Pratik Rajesh Sampat > > The saving and restoration looks good to me. >> --- >> arch/powerpc/platforms/powernv/idle.c | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c >> index 19d94d021357..471d4a65b1fa 100644 >> --- a/arch/powerpc/platforms/powernv/idle.c >> +++ b/arch/powerpc/platforms/powernv/idle.c >> @@ -600,6 +600,8 @@ struct p9_sprs { >> u64 iamr; >> u64 amor; >> u64 uamor; >> + u64 dawr0; >> + u64 dawrx0; >> }; >> >> static unsigned long power9_idle_stop(unsigned long psscr, bool mmu_on) >> @@ -677,6 +679,10 @@ static unsigned long power9_idle_stop(unsigned long psscr, bool mmu_on) >> sprs.tscr = mfspr(SPRN_TSCR); >> if (!firmware_has_feature(FW_FEATURE_ULTRAVISOR)) >> sprs.ldbar = mfspr(SPRN_LDBAR); >> + if (cpu_has_feature(CPU_FTR_ARCH_31)) { >> + sprs.dawr0 = mfspr(SPRN_DAWR0); >> + sprs.dawrx0 = mfspr(SPRN_DAWRX0); >> + } >> > > But this is within the if condition which says > > if ((psscr & PSSCR_RL_MASK) >= pnv_first_spr_loss_level) > > This if condition is meant for stop4 and stop5 since these are stop > levels that have OPAL_PM_LOSE_HYP_CONTEXT set. > > Since we can lose DAWR*, on states that lose limited hypervisor > context, such as stop0-2, we need to unconditionally save them > like AMR, IAMR etc. > Right, shallow states too loose DAWR/X. Thanks for pointing it out. I'll fix this and resend. >> sprs_saved = true; >> >> @@ -792,6 +798,10 @@ static unsigned long power9_idle_stop(unsigned long psscr, bool mmu_on) >> mtspr(SPRN_MMCR2, sprs.mmcr2); >> if (!firmware_has_feature(FW_FEATURE_ULTRAVISOR)) >> mtspr(SPRN_LDBAR, sprs.ldbar); >> + if (cpu_has_feature(CPU_FTR_ARCH_31)) { >> + mtspr(SPRN_DAWR0, sprs.dawr0); >> + mtspr(SPRN_DAWRX0, sprs.dawrx0); >> + } > > Likewise, we need to unconditionally restore these SPRs. > > >> mtspr(SPRN_SPRG3, local_paca->sprg_vdso); >> >> -- >> 2.25.4 >> Thanks Pratik