mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
firmware: arm_scmi: Populate perf commands rate_limit
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. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
parent
3093fa3353
commit
ad86f7e959
2 changed files with 25 additions and 0 deletions
|
@ -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 =
|
||||
|
@ -842,6 +845,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)
|
||||
{
|
||||
|
@ -957,6 +977,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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue