[PATCH 2/3] firmware: arm_scmi: Add perf_opp_xlate interface
Sibi Sankar
quic_sibis at quicinc.com
Tue Jan 16 18:59:55 PST 2024
On 1/10/24 12:59, Viresh Kumar wrote:
> On 08-01-24, 19:31, Sibi Sankar wrote:
>> Add a new perf_opp_xlate interface to the existing perf_ops to translate
>> a given perf index to frequency.
>>
Hey Viresh,
Thanks for taking time to review the series!
>> 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 at quicinc.com>
>> ---
>> 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 c167bb5e3607..f26390924e1c 100644
>> --- a/drivers/firmware/arm_scmi/perf.c
>> +++ b/drivers/firmware/arm_scmi/perf.c
>> @@ -964,6 +964,26 @@ static int scmi_notify_support(const struct scmi_protocol_handle *ph, u32 domain
>> return 0;
>> }
>>
>> +static int scmi_perf_opp_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;
>> +}
>> +
>> static const struct scmi_perf_proto_ops perf_proto_ops = {
>> .num_domains_get = scmi_perf_num_domains_get,
>> .info_get = scmi_perf_info_get,
>> @@ -979,6 +999,7 @@ static const struct scmi_perf_proto_ops perf_proto_ops = {
>> .fast_switch_possible = scmi_fast_switch_possible,
>> .power_scale_get = scmi_power_scale_get,
>> .perf_notify_support = scmi_notify_support,
>> + .perf_opp_xlate = scmi_perf_opp_xlate,
>
> The use of "opp" here is a bit confusing as this doesn't have anything to do
> with the OPP framework and you are only getting the frequency out of it after
> all.
Sure will re-name it.
-Sibi
>
More information about the linux-arm-kernel
mailing list