summaryrefslogtreecommitdiff
path: root/drivers/firmware
diff options
context:
space:
mode:
authorCristian Marussi <cristian.marussi@arm.com>2022-03-30 18:05:51 +0300
committerSudeep Holla <sudeep.holla@arm.com>2022-04-28 20:22:53 +0300
commit71bea05797b55d43c3cee8e2ee279ab510e0563c (patch)
treed843c1af15cb9f5a11748cdcdafe5f0c84b28799 /drivers/firmware
parent3630cd8130ce0b2a607db09a1995e5bf99053ae1 (diff)
downloadlinux-71bea05797b55d43c3cee8e2ee279ab510e0563c.tar.xz
firmware: arm_scmi: Add checks for min/max limits in PERFORMANCE_LIMITS_SET
Starting with SCMI v3.1, the PERFORMANCE_LIMITS_SET command allows a user to request only one between max and min ranges to be changed, while leaving the other untouched if set to zero in the request. Anyway SCMI v3.1 states also explicitly that you cannot leave both of those unchanged (zeroed) when issuing such command, so add a proper check for this condition. Link: https://lore.kernel.org/r/20220330150551.2573938-23-cristian.marussi@arm.com Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> [sudeep.holla: Dropped check for v3.0 and above to make the check unconditional, updated the subject accordingly] Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/arm_scmi/perf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index 65ffda5495d6..8f4051aca220 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -423,6 +423,9 @@ static int scmi_perf_limits_set(const struct scmi_protocol_handle *ph,
struct scmi_perf_info *pi = ph->get_priv(ph);
struct perf_dom_info *dom = pi->dom_info + domain;
+ if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3 && !max_perf && !min_perf)
+ return -EINVAL;
+
if (dom->fc_info && dom->fc_info->limit_set_addr) {
iowrite32(max_perf, dom->fc_info->limit_set_addr);
iowrite32(min_perf, dom->fc_info->limit_set_addr + 4);