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 E09A3C48BF6 for ; Mon, 4 Mar 2024 07:56:16 +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=b8W+qOuc+nKK0UyofmD+CMMAuBqVWWRwE671/snUpnA=; b=O2LBWRJS0tDBaJ BrV4h4JGESMJt0TLLvYGmhHbO0WC1PqDsYBsdIqgwV1TX2zrc3sVKlknlNGHtfvHgJnm1i71LLzdF fo4stszNKQ/SK+NmnHoa+1iqPcvSfwc1L60Px0Bi2W+8mRzJBC0F0rmVuJ1jTkEOxFGXMVM/BPwYm bWxR2rjh6fQWk2QQX4pGQwlyF0UBGz4mEug8o8080RUrZCSWDAySEcxwaUEDtdp93koKZ3hy7GaXb SeUezC6PSXZHh2X2DK1psfElcAjpFQO9spAm68VPSzI7/fdrqAmBsW5sORNQkQGNb4cWNZuPleNNm 6KhKLTgjmvRjp1swVHJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rh3B6-000000081yK-0UYA; Mon, 04 Mar 2024 07:56:04 +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 1rh3B2-000000081x5-0h3f for linux-arm-kernel@lists.infradead.org; Mon, 04 Mar 2024 07:56:02 +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 8212B1FB; Sun, 3 Mar 2024 23:56:28 -0800 (PST) Received: from pluto (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4A7473F762; Sun, 3 Mar 2024 23:55:50 -0800 (PST) Date: Mon, 4 Mar 2024 07:55:47 +0000 From: Cristian Marussi To: Pierre Gondois Cc: linux-kernel@vger.kernel.org, Christian Loehle , Ionela Voinescu , Sudeep Holla , Dietmar Eggemann , "Rafael J. Wysocki" , Viresh Kumar , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: Re: [PATCH 1/3] firmware: arm_scmi: Populate perf commands rate_limit Message-ID: References: <20240222135702.2005635-1-pierre.gondois@arm.com> <20240222135702.2005635-2-pierre.gondois@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240222135702.2005635-2-pierre.gondois@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240303_235600_640535_438FAF2E X-CRM114-Status: GOOD ( 24.90 ) 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 Thu, Feb 22, 2024 at 02:56:59PM +0100, Pierre Gondois wrote: > Arm SCMI spec. v3.2, s4.5.3.4 PERFORMANCE_DOMAIN_ATTRIBUTES > defines a per-domain rate_limit for performance requests: > """ > Rate Limit in microseconds, indicating the minimum time > required between successive requests. A value of 0 > indicates that this field is not supported by the > platform. This field does not apply to FastChannels. > """" > The field is first defined in SCMI v1.0. > > Add support to fetch this value and advertise it through > a rate_limit_get() callback. > Hi, LGTM. Reviewed-by: Cristian Marussi Thanks, Cristian > Signed-off-by: Pierre Gondois > --- > drivers/firmware/arm_scmi/perf.c | 21 +++++++++++++++++++++ > include/linux/scmi_protocol.h | 4 ++++ > 2 files changed, 25 insertions(+) > > diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c > index 211e8e0aef2c..37c80376bd0a 100644 > --- a/drivers/firmware/arm_scmi/perf.c > +++ b/drivers/firmware/arm_scmi/perf.c > @@ -153,6 +153,7 @@ struct perf_dom_info { > bool perf_fastchannels; > bool level_indexing_mode; > u32 opp_count; > + u32 rate_limit_us; > u32 sustained_freq_khz; > u32 sustained_perf_level; > unsigned long mult_factor; > @@ -266,6 +267,8 @@ scmi_perf_domain_attributes_get(const struct scmi_protocol_handle *ph, > if (PROTOCOL_REV_MAJOR(version) >= 0x4) > dom_info->level_indexing_mode = > SUPPORTS_LEVEL_INDEXING(flags); > + dom_info->rate_limit_us = le32_to_cpu(attr->rate_limit_us) & > + GENMASK(19, 0); > dom_info->sustained_freq_khz = > le32_to_cpu(attr->sustained_freq_khz); > dom_info->sustained_perf_level = > @@ -855,6 +858,23 @@ scmi_dvfs_transition_latency_get(const struct scmi_protocol_handle *ph, > return dom->opp[dom->opp_count - 1].trans_latency_us * 1000; > } > > +static int > +scmi_dvfs_rate_limit_get(const struct scmi_protocol_handle *ph, > + u32 domain, u32 *rate_limit) > +{ > + struct perf_dom_info *dom; > + > + if (!rate_limit) > + return -EINVAL; > + > + dom = scmi_perf_domain_lookup(ph, domain); > + if (IS_ERR(dom)) > + return PTR_ERR(dom); > + > + *rate_limit = dom->rate_limit_us; > + return 0; > +} > + > static int scmi_dvfs_freq_set(const struct scmi_protocol_handle *ph, u32 domain, > unsigned long freq, bool poll) > { > @@ -970,6 +990,7 @@ static const struct scmi_perf_proto_ops perf_proto_ops = { > .level_set = scmi_perf_level_set, > .level_get = scmi_perf_level_get, > .transition_latency_get = scmi_dvfs_transition_latency_get, > + .rate_limit_get = scmi_dvfs_rate_limit_get, > .device_opps_add = scmi_dvfs_device_opps_add, > .freq_set = scmi_dvfs_freq_set, > .freq_get = scmi_dvfs_freq_get, > diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h > index f2f05fb42d28..acd956ffcb84 100644 > --- a/include/linux/scmi_protocol.h > +++ b/include/linux/scmi_protocol.h > @@ -128,6 +128,8 @@ struct scmi_perf_domain_info { > * @level_set: sets the performance level of a domain > * @level_get: gets the performance level of a domain > * @transition_latency_get: gets the DVFS transition latency for a given device > + * @rate_limit_get: gets the minimum time (us) required between successive > + * requests > * @device_opps_add: adds all the OPPs for a given device > * @freq_set: sets the frequency for a given device using sustained frequency > * to sustained performance level mapping > @@ -154,6 +156,8 @@ struct scmi_perf_proto_ops { > u32 *level, bool poll); > int (*transition_latency_get)(const struct scmi_protocol_handle *ph, > u32 domain); > + int (*rate_limit_get)(const struct scmi_protocol_handle *ph, > + u32 domain, u32 *rate_limit); > int (*device_opps_add)(const struct scmi_protocol_handle *ph, > struct device *dev, u32 domain); > int (*freq_set)(const struct scmi_protocol_handle *ph, u32 domain, > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel