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 710CDC47258 for ; Wed, 31 Jan 2024 16:09:11 +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=uOTy0cang2niU2UhGteLtbf3RTDVzgti+wl2ZANgPaw=; b=kB0+0ypjcMu7yT Ow7lNOK9xZ/YKd86TfKvQsP3jeQBIAWukkGQIqtpsSVwvqFhMXynE8iy6rDRgFCvgSsiPAExunJyg IQgWoNNp+c3jNmSYv8C1PqHS/PDD9QuUfos36A1Tn1FMGrJBsvUdCGONPtCc3Tn9MhgROa/UWN7ea f5isR4sKFe5X4sg12VmnAZCCeNIxdTOC5jISsv0/6ghzvZyGJt8kvmvy0bOqAF9vVCDRBpxptZ4KW LwZyopOZU9PsZuDHQh6lji7L20ypsm1q4aSEewWQ3LmQmIgYBopX7Qt5R8LSernE/0Zkd2QIe+hcr Qp0OGZ/RaLKjogdS3nhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVD90-00000004Q1W-1u1o; Wed, 31 Jan 2024 16:08:58 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVD8x-00000004Q0T-2TPa for linux-arm-kernel@lists.infradead.org; Wed, 31 Jan 2024 16:08:56 +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 16949DA7; Wed, 31 Jan 2024 08:09:37 -0800 (PST) Received: from bogus (unknown [10.57.78.35]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DD4A03F762; Wed, 31 Jan 2024 08:08:50 -0800 (PST) Date: Wed, 31 Jan 2024 16:08:48 +0000 From: Sudeep Holla To: Pierre Gondois Cc: Sibi Sankar , cristian.marussi@arm.com, Sudeep Holla , linux-arm-kernel@lists.infradead.org, sboyd@kernel.org, lukasz.luba@arm.com, dietmar.eggemann@arm.com, morten.rasmussen@arm.com, viresh.kumar@linaro.org, rafael@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, quic_mdtipton@quicinc.com, linux-arm-msm@vger.kernel.org, nm@ti.com Subject: Re: [PATCH 2/3] firmware: arm_scmi: Add support for marking certain frequencies as boost Message-ID: <20240131160848.662dhaoiov3trt4i@bogus> References: <20240117110443.2060704-1-quic_sibis@quicinc.com> <20240117110443.2060704-3-quic_sibis@quicinc.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240131_080855_701215_345BC55E X-CRM114-Status: GOOD ( 21.12 ) 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 Wed, Jan 31, 2024 at 03:29:43PM +0100, Pierre Gondois wrote: > Hello Sibi, > > On 1/17/24 12:04, Sibi Sankar wrote: > > All opps above the sustained level/frequency are treated as boost, so mark > > them accordingly. > > > > Suggested-by: Sudeep Holla > > Signed-off-by: Sibi Sankar > > --- > > drivers/firmware/arm_scmi/perf.c | 11 ++++++++++- > > 1 file changed, 10 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c > > index e286f04ee6e3..d3fb8c804b3d 100644 > > --- a/drivers/firmware/arm_scmi/perf.c > > +++ b/drivers/firmware/arm_scmi/perf.c > > @@ -811,7 +811,7 @@ static int scmi_dvfs_device_opps_add(const struct scmi_protocol_handle *ph, > > struct device *dev, u32 domain) > > { > > int idx, ret; > > - unsigned long freq; > > + unsigned long freq, sustained_freq; > > struct dev_pm_opp_data data = {}; > > struct perf_dom_info *dom; > > @@ -819,12 +819,21 @@ static int scmi_dvfs_device_opps_add(const struct scmi_protocol_handle *ph, > > if (IS_ERR(dom)) > > return PTR_ERR(dom); > > + if (!dom->level_indexing_mode) > > + sustained_freq = dom->sustained_perf_level * dom->mult_factor; > > + else > > + sustained_freq = dom->sustained_freq_khz * dom->mult_factor; > > + > > for (idx = 0; idx < dom->opp_count; idx++) { > > if (!dom->level_indexing_mode) > > freq = dom->opp[idx].perf * dom->mult_factor; > > else > > freq = dom->opp[idx].indicative_freq * dom->mult_factor; > > + /* All opps above the sustained level/frequency are treated as boost */ > > + if (sustained_freq && freq > sustained_freq) > > It seems the sustained_freq is not optional since SCMI v1.0, > is it necessary to check that (sustained_freq != 0) ? > Technically correct, we don't have to. But since day 1, we checked and handled 0 for perf_level specifically to avoid division by zero. I am just worried if there are any platforms in the wild with these values as 0. We can start without the check and add it if someone complains perhaps ? -- Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel