From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: Sudeep Holla <sudeep.holla@arm.com>,
Cristian Marussi <cristian.marussi@arm.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>
Cc: arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Peng Fan <peng.fan@nxp.com>
Subject: [PATCH 3/3] cpufreq: scmi-cpufreq: Enable perf limits notification only supported
Date: Wed, 11 Jun 2025 15:52:45 +0800 [thread overview]
Message-ID: <20250611-scmi-perf-v1-3-df2b548ba77c@nxp.com> (raw)
In-Reply-To: <20250611-scmi-perf-v1-0-df2b548ba77c@nxp.com>
From: Peng Fan <peng.fan@nxp.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@nxp.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
next prev parent reply other threads:[~2025-06-11 8:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 7:52 [PATCH 0/3] firmware: arm_scmi: perf/cpufreq: Enable notification only if supported by platform Peng Fan (OSS)
2025-06-11 7:52 ` [PATCH 1/3] firmware: arm_scmi: Fix typo for scmi_perf_proto_ops Peng Fan (OSS)
2025-06-11 7:52 ` [PATCH 2/3] firmware: arm_scmi: perf: Add notify_supported " Peng Fan (OSS)
2025-06-11 7:52 ` Peng Fan (OSS) [this message]
2025-06-11 12:17 ` [PATCH 0/3] firmware: arm_scmi: perf/cpufreq: Enable notification only if supported by platform Sudeep Holla
2025-06-11 13:33 ` Cristian Marussi
2025-06-12 3:43 ` Peng Fan
2025-06-12 10:31 ` Cristian Marussi
2025-06-13 9:50 ` Peng Fan
2025-06-17 13:41 ` Cristian Marussi
2025-06-17 13:50 ` [PATCH] [NOT_FOR_MERGE] firmware: arm_scmi: Optimize notifiers registration Cristian Marussi
2025-06-17 13:59 ` Cristian Marussi
2025-06-20 7:38 ` Peng Fan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250611-scmi-perf-v1-3-df2b548ba77c@nxp.com \
--to=peng.fan@oss.nxp.com \
--cc=arm-scmi@vger.kernel.org \
--cc=cristian.marussi@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=rafael@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).