Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758148AbdLRInm (ORCPT ); Mon, 18 Dec 2017 03:43:42 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38738 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757935AbdLRIng (ORCPT ); Mon, 18 Dec 2017 03:43:36 -0500 Date: Mon, 18 Dec 2017 14:13:29 +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 3/3] powernv-cpufreq: Treat pstates as opaque 8-bit values Reply-To: ego@linux.vnet.ibm.com References: <1513148261-21097-1-git-send-email-ego@linux.vnet.ibm.com> <1513148261-21097-4-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: 17121808-0044-0000-0000-000003C00E4F 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.00961922; UDB=6.00486537; IPR=6.00741917; 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 08:43:33 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17121808-0045-0000-0000-000007EF5357 Message-Id: <20171218084329.GB28881@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-1712180117 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1248 Lines: 35 Hi Balbir, On Sun, Dec 17, 2017 at 02:17:02PM +1100, Balbir Singh wrote: > On Wed, Dec 13, 2017 at 5:57 PM, Gautham R. Shenoy [..snip..] > > > > -static inline int extract_pstate(u64 pmsr_val, unsigned int shift) > > +static inline u8 extract_pstate(u64 pmsr_val, unsigned int shift) > > { > > - int ret = ((pmsr_val >> shift) & 0xFF); > > - > > - if (!ret) > > - return ret; > > - > > - return (pstate_sign_prefix | ret); > > + return ((pmsr_val >> shift) & 0xFF); > > } > > So we just added this and moved from an int to u8. I was going to ask > if we still need an int in patch1, but I thought the driver dealt with > just integers because of the larger framework. The larger framework is with respect to the device tree which defines pstates as 32-bit integers (I am not aware of the reasons for this choice, but perhaps device-tree doesn't have a s8/u8 type?!). The driver still knows that pstates are only 8-bits wide because of the PMSR,PMCR definitions. Before this patch, the driver was still doing the conversions from 8-bit to int and vice-versa every time. With this patch, we do it only once, i.e at the initialization. After that we treat pstates as 8-bit integers. > > Balbir Singh. >