From: Cristian Marussi <cristian.marussi@arm.com>
To: Sibi Sankar <quic_sibis@quicinc.com>
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
Date: Mon, 29 Jan 2024 15:53:43 +0000 [thread overview]
Message-ID: <ZbfKB4M8FHfma0js@pluto> (raw)
In-Reply-To: <20240117104116.2055349-3-quic_sibis@quicinc.com>
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 <quic_sibis@quicinc.com>
> ---
>
> 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
WARNING: multiple messages have this Message-ID (diff)
From: Cristian Marussi <cristian.marussi@arm.com>
To: Sibi Sankar <quic_sibis@quicinc.com>
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
Date: Mon, 29 Jan 2024 15:53:43 +0000 [thread overview]
Message-ID: <ZbfKB4M8FHfma0js@pluto> (raw)
In-Reply-To: <20240117104116.2055349-3-quic_sibis@quicinc.com>
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 <quic_sibis@quicinc.com>
> ---
>
> 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
next prev parent reply other threads:[~2024-01-29 15:53 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 10:41 [PATCH V2 0/4] firmware: arm_scmi: Register and handle limits change notification Sibi Sankar
2024-01-17 10:41 ` Sibi Sankar
2024-01-17 10:41 ` [PATCH V2 1/4] firmware: arm_scmi: Add perf_notify_support interface Sibi Sankar
2024-01-17 10:41 ` Sibi Sankar
2024-01-29 15:50 ` Cristian Marussi
2024-01-29 15:50 ` Cristian Marussi
2024-01-29 17:33 ` Cristian Marussi
2024-01-29 17:33 ` Cristian Marussi
2024-01-31 11:28 ` Sudeep Holla
2024-01-31 11:28 ` Sudeep Holla
2024-01-31 11:35 ` Cristian Marussi
2024-01-31 11:35 ` Cristian Marussi
2024-02-12 12:44 ` Cristian Marussi
2024-02-12 12:44 ` Cristian Marussi
2024-02-13 5:40 ` Sibi Sankar
2024-02-13 5:40 ` Sibi Sankar
2024-01-17 10:41 ` [PATCH V2 2/4] firmware: arm_scmi: Add perf_freq_xlate interface Sibi Sankar
2024-01-17 10:41 ` Sibi Sankar
2024-01-29 15:53 ` Cristian Marussi [this message]
2024-01-29 15:53 ` Cristian Marussi
2024-01-31 11:45 ` Cristian Marussi
2024-01-31 11:45 ` Cristian Marussi
2024-01-17 10:41 ` [PATCH V2 3/4] cpufreq: Export cpufreq_update_pressure Sibi Sankar
2024-01-17 10:41 ` Sibi Sankar
2024-01-17 10:41 ` [PATCH V2 4/4] cpufreq: scmi: Register for limit change notifications Sibi Sankar
2024-01-17 10:41 ` Sibi Sankar
2024-01-29 15:59 ` Cristian Marussi
2024-01-29 15:59 ` Cristian Marussi
2024-02-13 5:42 ` Sibi Sankar
2024-02-13 5:42 ` Sibi Sankar
2024-01-31 14:29 ` Pierre Gondois
2024-01-31 14:29 ` Pierre Gondois
2024-02-13 5:46 ` Sibi Sankar
2024-02-13 5:46 ` Sibi Sankar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZbfKB4M8FHfma0js@pluto \
--to=cristian.marussi@arm.com \
--cc=dietmar.eggemann@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=morten.rasmussen@arm.com \
--cc=quic_mdtipton@quicinc.com \
--cc=quic_sibis@quicinc.com \
--cc=rafael@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.