Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933133AbdLRJDe (ORCPT ); Mon, 18 Dec 2017 04:03:34 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:48460 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932768AbdLRJD2 (ORCPT ); Mon, 18 Dec 2017 04:03:28 -0500 Date: Mon, 18 Dec 2017 14:33:19 +0530 From: Gautham R Shenoy To: Balbir Singh Cc: "Gautham R. Shenoy" , Shilpasri G Bhat , Viresh Kumar , "Rafael J. Wysocki" , huntbag@linux.vnet.ibm.com, Akshay Adiga , Michael Ellerman , Vaidyanathan Srinivasan , linux-pm@vger.kernel.org, "linux-kernel@vger.kernel.org" , "open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)" Subject: Re: [v3 PATCH 1/3] powernv-cpufreq: Add helper to extract pstate from PMSR Reply-To: ego@linux.vnet.ibm.com References: <1513148261-21097-1-git-send-email-ego@linux.vnet.ibm.com> <1513148261-21097-2-git-send-email-ego@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-GCONF: 00 x-cbid: 17121809-0024-0000-0000-000017AB724F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008222; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000244; SDB=6.00961928; UDB=6.00486541; IPR=6.00741924; BA=6.00005747; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018598; XFM=3.00000015; UTC=2017-12-18 09:03:24 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17121809-0025-0000-0000-00004DF07CD1 Message-Id: <20171218090319.GC28881@in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-18_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712180118 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1788 Lines: 46 Hi Balbir, On Sun, Dec 17, 2017 at 02:04:03PM +1100, Balbir Singh wrote: > On Wed, Dec 13, 2017 at 5:57 PM, Gautham R. Shenoy > wrote: > > From: "Gautham R. Shenoy" > > > > On POWERNV platform, the fields for pstates in the Power Management > > Status Register (PMSR) and the Power Management Control Register > > (PMCR) are 8-bits wide. On POWER8 the pstates are negatively numbered > > while on POWER9 they are positively numbered. > > > > The device-tree exports pstates as 32-bit entries. The device-tree > > implementation sign-extends the 8-bit pstate values to obtain the > > corresponding 32-bit entry. > > > > Eg: On POWER8, a pstate value 0x82 [-126] is represented in the > > device-tree as 0xfffffff82 while on POWER9, the same value 0x82 [130] > > is represented in the device-tree as 0x00000082. > > > > The powernv-cpufreq driver implementation represents pstates using the > > integer type. In multiple places in the driver, the code interprets > > the pstates extracted from the PMSR as a signed byte and assigns it to > > a integer variable to get the sign-extention. > > > > On POWER9 platforms which have greater than 128 pstates, this results > > in the driver performing incorrect sign-extention, and thereby > > treating a legitimate pstate (say 130) as an invalid pstates (since it > > is interpreted as -126). > > > > This patch fixes the issue by implementing a helper function to > > extract Pstates from PMSR register, and correctly sign-extend it to be > > consistent with the values provided by the device-tree. > > > > Signed-off-by: Gautham R. Shenoy > > --- > > This looks better Thanks for the Review. > > Acked-by: Balbir Singh > > Balbir Singh >