Skip to content

Commit 189df98

Browse files
xinglong.yangsudeep-holla
authored andcommitted
firmware: arm_scmi: Check beforehand if the perf domain set operations are allowed
Certain SCMI performance domains may have restrictions on the set level and/or limits operation. If the set level/limits are performed by an agent who is not allowed to do so may get SCMI_ERR_SUPPORT. However, since this information about the domain is already known to the agent(OSPM here) obtained via PERF_DOMAIN_ATTRIBUTES, the agent(OSPM) can avoid making PERF_LEVEL_SET and PERF_LIMITS_SET calls to the firmware. Add those checks and return -ENOTSUPP to the caller without interacting with the firmware based on the information collected during the domain enumeration stage. Signed-off-by: xinglong.yang <xinglong.yang@cixtech.com> Link: https://lore.kernel.org/r/20231109082855.472681-1-xinglong.yang@cixtech.com Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
1 parent b85ea95 commit 189df98

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • drivers/firmware/arm_scmi

drivers/firmware/arm_scmi/perf.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,9 @@ static int scmi_perf_limits_set(const struct scmi_protocol_handle *ph,
504504
if (IS_ERR(dom))
505505
return PTR_ERR(dom);
506506

507+
if (!dom->set_limits)
508+
return -EOPNOTSUPP;
509+
507510
if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3 && !max_perf && !min_perf)
508511
return -EINVAL;
509512

@@ -654,6 +657,9 @@ static int scmi_perf_level_set(const struct scmi_protocol_handle *ph,
654657
if (IS_ERR(dom))
655658
return PTR_ERR(dom);
656659

660+
if (!dom->info.set_perf)
661+
return -EOPNOTSUPP;
662+
657663
if (dom->level_indexing_mode) {
658664
struct scmi_opp *opp;
659665

0 commit comments

Comments
 (0)