From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9586CC4167B for ; Fri, 1 Dec 2023 16:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hGyrQzKpQbgRrq/I7FhHfeII3nCV6WvE5cY337E+f8w=; b=0ZY0RNorwjjlmO FKPZur3Qvx4HoUeobuQ9XT8i8P2HvjEti/bnRjNmfMR2bGl6ZWRm8EVpfmir5iEtFviJXl6Du9+Jv EYTg3Dm2sr8pONLcKsOSB7Cjr48k3K+xKq6Jcaesoz2hbRCbqCet9AeFxKvdhdl7LksLdjRbhchSA +j8EIJQMDvE12vm5I11fr5FVkIcv5HTW+F3itWxhXa5iy7ooDFkJ5VDKv8oPvJcuH5+TfAcvWdcdf hbQE03NDwADLp0t561jLIlZZzXEw/gMeIEYIlgcdUWg0y01NZBmTtWDec6mnevU510rMM1NaJWyA/ ZppRouRufFi99aJGuzNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r96DM-00EA9S-35; Fri, 01 Dec 2023 16:18:04 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r96DK-00EA6n-2N for linux-arm-kernel@lists.infradead.org; Fri, 01 Dec 2023 16:18:04 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6408A1007; Fri, 1 Dec 2023 08:18:46 -0800 (PST) Received: from pluto (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C4F043F6C4; Fri, 1 Dec 2023 08:17:58 -0800 (PST) Date: Fri, 1 Dec 2023 16:17:56 +0000 From: Cristian Marussi To: Sudeep Holla Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, quic_mdtipton@quicinc.com, quic_asartor@quicinc.com, quic_lingutla@quicinc.com, Sibi Sankar , linux-arm-msm@vger.kernel.org Subject: Re: [PATCH 1/2] firmware: arm_scmi: Fix frequency truncation by promoting multiplier to u64 Message-ID: References: <20231130204343.503076-1-sudeep.holla@arm.com> <20231201143935.be6wzjzxmyl5vpz6@bogus> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231201143935.be6wzjzxmyl5vpz6@bogus> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231201_081802_818280_4175451F X-CRM114-Status: GOOD ( 22.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Dec 01, 2023 at 02:39:35PM +0000, Sudeep Holla wrote: > On Thu, Nov 30, 2023 at 08:43:42PM +0000, Sudeep Holla wrote: > > Fix the frequency truncation for all values equal to or greater 4GHz by > > updating the multiplier 'mult_factor' to u64 type. It is also possible > > that the multiplier itself can be greater than or equal to 2^32. So we need > > to also fix the equation computing the value of the multiplier. > > > > Fixes: a9e3fbfaa0ff ("firmware: arm_scmi: add initial support for performance protocol") > > Reported-by: Sibi Sankar > > Closes: https://lore.kernel.org/all/20231129065748.19871-3-quic_sibis@quicinc.com/ > > Cc: Cristian Marussi > > Signed-off-by: Sudeep Holla > > --- > > drivers/firmware/arm_scmi/perf.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c > > index 81dd5c5e5533..8ce449922e55 100644 > > --- a/drivers/firmware/arm_scmi/perf.c > > +++ b/drivers/firmware/arm_scmi/perf.c > > @@ -152,7 +152,7 @@ struct perf_dom_info { > > u32 opp_count; > > u32 sustained_freq_khz; > > u32 sustained_perf_level; > > - u32 mult_factor; > > + u64 mult_factor; > > I have now changed this to unsigned long instead of u64 to fix the 32-bit > build failure[1]. Right, I was caught a few times too by this kind of failures on v7 :D ... but this 32bit issue makes me wonder what to do in such a case... ...I mean, on 32bit if the calculated freq oveflows, there is just nothing we can do on v7 without overcomplicating the code...but I suppose it is unplausible to have such high freq on a v7... as a palliative I can only think of some sort of overflow check (only on v7) that could trigger a warning ... but it is hardly worth the effort probably.. Thanks, Cristian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel