[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250611-scmi-perf-v1-3-df2b548ba77c@nxp.com>
Date: Wed, 11 Jun 2025 15:52:45 +0800
From: "Peng Fan (OSS)" <peng.fan@....nxp.com>
To: Sudeep Holla <sudeep.holla@....com>,
Cristian Marussi <cristian.marussi@....com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>
Cc: arm-scmi@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
Peng Fan <peng.fan@....com>
Subject: [PATCH 3/3] cpufreq: scmi-cpufreq: Enable perf limits notification
only supported
From: Peng Fan <peng.fan@....com>
PERFORMANCE_NOTIFY_LIMITS is optional, so enable perf limits
notification event only when the platform supports it.
Signed-off-by: Peng Fan <peng.fan@....com>
---
drivers/cpufreq/scmi-cpufreq.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
index ef078426bfd51af6a8a4b803278dfae5d323db48..8999960574a2fc427e934553198584d2aeb14a58 100644
--- a/drivers/cpufreq/scmi-cpufreq.c
+++ b/drivers/cpufreq/scmi-cpufreq.c
@@ -29,6 +29,7 @@ struct scmi_data {
cpumask_var_t opp_shared_cpus;
struct notifier_block limit_notify_nb;
struct freq_qos_request limits_freq_req;
+ bool perf_limit_notify;
};
static struct scmi_protocol_handle *ph;
@@ -310,15 +311,22 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
goto out_free_table;
}
- priv->limit_notify_nb.notifier_call = scmi_limit_notify_cb;
- ret = sdev->handle->notify_ops->event_notifier_register(sdev->handle, SCMI_PROTOCOL_PERF,
+ priv->perf_limit_notify =
+ perf_ops->notify_supported(ph, SCMI_EVENT_PERFORMANCE_LIMITS_CHANGED,
+ priv->domain_id);
+
+ if (priv->perf_limit_notify) {
+ priv->limit_notify_nb.notifier_call = scmi_limit_notify_cb;
+ ret = sdev->handle->notify_ops->event_notifier_register(sdev->handle,
+ SCMI_PROTOCOL_PERF,
SCMI_EVENT_PERFORMANCE_LIMITS_CHANGED,
&priv->domain_id,
&priv->limit_notify_nb);
- if (ret)
- dev_warn(&sdev->dev,
- "failed to register for limits change notifier for domain %d\n",
- priv->domain_id);
+ if (ret)
+ dev_warn(&sdev->dev,
+ "failed to register for limits change notifier for domain %d\n",
+ priv->domain_id);
+ }
return 0;
@@ -341,10 +349,13 @@ static void scmi_cpufreq_exit(struct cpufreq_policy *policy)
struct scmi_data *priv = policy->driver_data;
struct scmi_device *sdev = cpufreq_get_driver_data();
- sdev->handle->notify_ops->event_notifier_unregister(sdev->handle, SCMI_PROTOCOL_PERF,
+ if (priv->perf_limit_notify) {
+ sdev->handle->notify_ops->event_notifier_unregister(sdev->handle,
+ SCMI_PROTOCOL_PERF,
SCMI_EVENT_PERFORMANCE_LIMITS_CHANGED,
&priv->domain_id,
&priv->limit_notify_nb);
+ }
freq_qos_remove_request(&priv->limits_freq_req);
dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table);
dev_pm_opp_remove_all_dynamic(priv->cpu_dev);
--
2.37.1
Powered by blists - more mailing lists