Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1154770rdb; Fri, 1 Dec 2023 08:19:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IH01O7swOYlwdmnyPVHj3qm1LffgnPgFHOlmQ5zk6I+NWI1EKp3hgKZNp0BPpT+PVp0rTQO X-Received: by 2002:a05:6e02:1aae:b0:35d:3911:a724 with SMTP id l14-20020a056e021aae00b0035d3911a724mr7327260ilv.22.1701447550262; Fri, 01 Dec 2023 08:19:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701447550; cv=none; d=google.com; s=arc-20160816; b=bSaH/PTrsGKEAspchHPTsA/4xzRO11l6lHLKdVPZaBTZfW3gl0ZIXMQrppSkIYLEvD Z0kDIggVXAEpIy9Pb34jv4M+QZpg7IUSzbwb3bX8JAA4g1vViDTzOB6hpYzpNDSN0MH5 8yrRW2qPCzGWZfnMkez7rUGungR1lXriGxHzgX+0EAmPVGtjZaMUB9lYC4XfvP7l0YiV rQv4+r4bJFpKE9HAAoPWbjRXlJRG8Eka4Bd0pL+Drn4Sl5wrc5ayOMSExY14rbAzj2Ct I0AxA5h5LM2vJlVGrXafK+qbcj9bIXEt2WBAEnrAu3tBEA90bVe+J246ZSscPtzvKUND TDiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=klsT8xoHZ1BN4Pu2CzdAeBPW+rBWGJ2V37PtNgqe12M=; fh=M0L2O/dAzErEPhmdqQLe0e8L9u5AdcJ3puKPlkOLPfM=; b=VdIPC1Qeal+RRUG1adcVOcQyZ4xJRN3i8sFX0wlCXo9WlXo9/Tg8YaHOBM+yvKgUcq i/hfs9L3xAzLrRydHS2eQefeQwJKaS/ryzCouUl7w9owK9Ii3G1BEHqyPclxugdG5H/v 4lD8AwOsxdM+6vYtQJw1MyIkDvTvHg1Buf0UrOxZJqpeXXufluo4kjKGUqzm5z55Hu/8 X5/zwDYEYlPvfzoNFyT9HvbtOX0fGzEMSKys8GvqQ7lVqUPYVyG2/XNE2peo7JCVNvAa 7YqtIR3VRCbLG082mPOGJDQxOTHW1xHt+8H5D74sia9/2jeSxkd20zFPaaGmBbc0818F ktBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id e3-20020a63d943000000b005aebc9096d4si3599925pgj.150.2023.12.01.08.18.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 08:19:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 45666849FA6B; Fri, 1 Dec 2023 08:18:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235290AbjLAQSh (ORCPT + 99 others); Fri, 1 Dec 2023 11:18:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378508AbjLAQR5 (ORCPT ); Fri, 1 Dec 2023 11:17:57 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3CCF11BC5; Fri, 1 Dec 2023 08:18:00 -0800 (PST) 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231201143935.be6wzjzxmyl5vpz6@bogus> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 01 Dec 2023 08:18:57 -0800 (PST) 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