linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
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 2/3] firmware: arm_scmi: perf: Add notify_supported for scmi_perf_proto_ops
Date: Wed, 11 Jun 2025 15:52:44 +0800	[thread overview]
Message-ID: <20250611-scmi-perf-v1-2-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 and PERFORMANCE_NOTIFY_LEVEL are optional
commands which are not implemented in i.MX95 SCMI firmware. Provide
a hook to query whether they are supported, before invoke
event_notifier_register.

scmi_perf_notify_supported could be directly used here, so just
move scmi_perf_notify_supported above perf_proto_ops and use it
in perf_proto_ops.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/firmware/arm_scmi/perf.c | 37 +++++++++++++++++++------------------
 include/linux/scmi_protocol.h    |  3 +++
 2 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index c7e5a34b254bf4e9c51c7be56803b6d851f0e1d6..ba990643edf0bcb5fc25253b4f52a5dc93b62a77 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -1068,24 +1068,6 @@ scmi_power_scale_get(const struct scmi_protocol_handle *ph)
 	return pi->power_scale;
 }
 
-static const struct scmi_perf_proto_ops perf_proto_ops = {
-	.num_domains_get = scmi_perf_num_domains_get,
-	.info_get = scmi_perf_info_get,
-	.limits_set = scmi_perf_limits_set,
-	.limits_get = scmi_perf_limits_get,
-	.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,
-	.est_power_get = scmi_dvfs_est_power_get,
-	.fast_switch_possible = scmi_fast_switch_possible,
-	.fast_switch_rate_limit = scmi_fast_switch_rate_limit,
-	.power_scale_get = scmi_power_scale_get,
-};
-
 static bool scmi_perf_notify_supported(const struct scmi_protocol_handle *ph,
 				       u8 evt_id, u32 src_id)
 {
@@ -1107,6 +1089,25 @@ static bool scmi_perf_notify_supported(const struct scmi_protocol_handle *ph,
 	return supported;
 }
 
+static const struct scmi_perf_proto_ops perf_proto_ops = {
+	.num_domains_get = scmi_perf_num_domains_get,
+	.info_get = scmi_perf_info_get,
+	.limits_set = scmi_perf_limits_set,
+	.limits_get = scmi_perf_limits_get,
+	.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,
+	.est_power_get = scmi_dvfs_est_power_get,
+	.fast_switch_possible = scmi_fast_switch_possible,
+	.fast_switch_rate_limit = scmi_fast_switch_rate_limit,
+	.power_scale_get = scmi_power_scale_get,
+	.notify_supported = scmi_perf_notify_supported,
+};
+
 static int scmi_perf_set_notify_enabled(const struct scmi_protocol_handle *ph,
 					u8 evt_id, u32 src_id, bool enable)
 {
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index aafaac1496b06a6e4f0ca32eee58a9edf7d4a70f..91865f0ebcbd4b15b55afd8c1a0d0614d6985daf 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -155,6 +155,7 @@ struct scmi_perf_domain_info {
  *	successive fast_switching requests
  * @power_scale_get: indicates if the power values provided are in milliWatts
  *	or in some other (abstract) scale
+ * @notify_supported: indicates if the event is supported
  */
 struct scmi_perf_proto_ops {
 	int (*num_domains_get)(const struct scmi_protocol_handle *ph);
@@ -185,6 +186,8 @@ struct scmi_perf_proto_ops {
 	int (*fast_switch_rate_limit)(const struct scmi_protocol_handle *ph,
 				      u32 domain, u32 *rate_limit);
 	enum scmi_power_scale (*power_scale_get)(const struct scmi_protocol_handle *ph);
+	bool (*notify_supported)(const struct scmi_protocol_handle *ph, u8 evt_id,
+				 u32 src_id);
 };
 
 /**

-- 
2.37.1



  parent reply	other threads:[~2025-06-11  9:24 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 ` Peng Fan (OSS) [this message]
2025-06-11  7:52 ` [PATCH 3/3] cpufreq: scmi-cpufreq: Enable perf limits notification only supported Peng Fan (OSS)
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-2-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).