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 21B94C47DDB for ; Mon, 29 Jan 2024 15:54:07 +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=sihpsdXebW5t5uRN0BpS5kbpN6/FW0njs3KOUTD/laA=; b=BIlbWBZ0IDKTa/ r0A+IaIn3JEpWpRz7pHeE1XRm3eEd8fhUGuXdpPqYHXQyVbIOVtmtixEB7pQ09hPG/baNn3AvSXiA Hl4yAOMoGQBcoaxg88kgzvQc3g1U1O4LqgsxcoLoILGosxyiE1zH244yboH0MtH0HAbdE5/bI9zJd 7I7xs3WCBRjsyy5X+SxfGz5TLU2MBcCzOt5rrwMrI/Y0M5nTvJuqXJcGyzSY2y6ma+VXZ9nYZFkQU EmE3lbzeL4nqtIkGLyepJR3wlXE//FUsAh4ip0yy0Q250zJZ/wO3elJvumqxd5ljBwc6voZSB0/3o QLMqZhOAWVYkktsafL+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUTxI-0000000DOO9-3n2g; Mon, 29 Jan 2024 15:53:52 +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 1rUTxG-0000000DOMz-1AhN for linux-arm-kernel@lists.infradead.org; Mon, 29 Jan 2024 15:53:51 +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 3735ADA7; Mon, 29 Jan 2024 07:54:32 -0800 (PST) Received: from pluto (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 57C023F738; Mon, 29 Jan 2024 07:53:46 -0800 (PST) Date: Mon, 29 Jan 2024 15:53:43 +0000 From: Cristian Marussi To: Sibi Sankar Cc: sudeep.holla@arm.com, rafael@kernel.org, viresh.kumar@linaro.org, morten.rasmussen@arm.com, dietmar.eggemann@arm.com, lukasz.luba@arm.com, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, quic_mdtipton@quicinc.com, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH V2 2/4] firmware: arm_scmi: Add perf_freq_xlate interface Message-ID: References: <20240117104116.2055349-1-quic_sibis@quicinc.com> <20240117104116.2055349-3-quic_sibis@quicinc.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240117104116.2055349-3-quic_sibis@quicinc.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240129_075350_382644_27522478 X-CRM114-Status: GOOD ( 19.32 ) 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 17, 2024 at 04:11:14PM +0530, Sibi Sankar wrote: > Add a new perf_freq_xlate interface to the existing perf_ops to translate > a given perf index to frequency. > > This can be used by the cpufreq driver and framework to determine the > throttled frequency from a given perf index and apply HW pressure > accordingly. > > Signed-off-by: Sibi Sankar > --- > > v2: > * Rename opp_xlate -> freq_xlate [Viresh] > > drivers/firmware/arm_scmi/perf.c | 21 +++++++++++++++++++++ > include/linux/scmi_protocol.h | 3 +++ > 2 files changed, 24 insertions(+) > > diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c > index ae7681eda276..e286f04ee6e3 100644 > --- a/drivers/firmware/arm_scmi/perf.c > +++ b/drivers/firmware/arm_scmi/perf.c > @@ -977,6 +977,26 @@ static int scmi_notify_support(const struct scmi_protocol_handle *ph, u32 domain > return 0; > } > > +static int scmi_perf_freq_xlate(const struct scmi_protocol_handle *ph, u32 domain, > + int idx, unsigned long *freq) > +{ > + struct perf_dom_info *dom; > + > + dom = scmi_perf_domain_lookup(ph, domain); > + if (IS_ERR(dom)) > + return PTR_ERR(dom); > + > + if (idx >= dom->opp_count) > + return -ERANGE; > + > + if (!dom->level_indexing_mode) > + *freq = dom->opp[idx].perf * dom->mult_factor; > + else > + *freq = dom->opp[idx].indicative_freq * dom->mult_factor; > + > + return 0; > +} Potentially, once the dom info are exposed you can also drop this accessor and move all of these checks/calculations in the the SCMI cpufreq driver...but maybe Sudeep/Viresh prefer to keep this accessor exposed like others. Thanks, Cristian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel