* [PATCH 01/11] firmware: arm_scmi: Check for notification support
2024-02-12 12:32 [PATCH 00/11] Add SCMI core checks for notification support Cristian Marussi
@ 2024-02-12 12:32 ` Cristian Marussi
2024-02-12 12:32 ` [PATCH 02/11] firmware: arm_scmi: Add a common helper to check if a message is supported Cristian Marussi
` (10 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Cristian Marussi @ 2024-02-12 12:32 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel
Cc: sudeep.holla, vincent.guittot, peng.fan, michal.simek,
quic_sibis, quic_nkela, souvik.chakravarty, Cristian Marussi
When registering protocol events, use the optional .is_notify_supported
callback provided by the protocol to check if that specific notification
type is available for that particular resource on the running system,
marking it as unsupported otherwise.
Then, when a notification enable request is received, return an error if
it was previously marked as unsuppported, so avoiding to send a needless
notification enable command and check the returned value for failure.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
drivers/firmware/arm_scmi/notify.c | 17 ++++++++++++++++-
drivers/firmware/arm_scmi/notify.h | 4 ++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c
index 0efd20cd9d69..27c52531194d 100644
--- a/drivers/firmware/arm_scmi/notify.c
+++ b/drivers/firmware/arm_scmi/notify.c
@@ -99,6 +99,7 @@
#define PROTO_ID_MASK GENMASK(31, 24)
#define EVT_ID_MASK GENMASK(23, 16)
#define SRC_ID_MASK GENMASK(15, 0)
+#define NOTIF_UNSUPP -1
/*
* Builds an unsigned 32bit key from the given input tuple to be used
@@ -788,6 +789,7 @@ int scmi_register_protocol_events(const struct scmi_handle *handle, u8 proto_id,
pd->ph = ph;
for (i = 0; i < ee->num_events; i++, evt++) {
+ int id;
struct scmi_registered_event *r_evt;
r_evt = devm_kzalloc(ni->handle->dev, sizeof(*r_evt),
@@ -809,6 +811,11 @@ int scmi_register_protocol_events(const struct scmi_handle *handle, u8 proto_id,
if (!r_evt->report)
return -ENOMEM;
+ for (id = 0; id < r_evt->num_sources; id++)
+ if (ee->ops->is_notify_supported &&
+ !ee->ops->is_notify_supported(ph, r_evt->evt->id, id))
+ refcount_set(&r_evt->sources[id], NOTIF_UNSUPP);
+
pd->registered_events[i] = r_evt;
/* Ensure events are updated */
smp_wmb();
@@ -1166,7 +1173,13 @@ static inline int __scmi_enable_evt(struct scmi_registered_event *r_evt,
int ret = 0;
sid = &r_evt->sources[src_id];
- if (refcount_read(sid) == 0) {
+ if (refcount_read(sid) == NOTIF_UNSUPP) {
+ dev_dbg(r_evt->proto->ph->dev,
+ "Notification NOT supported - proto_id:%d evt_id:%d src_id:%d",
+ r_evt->proto->id, r_evt->evt->id,
+ src_id);
+ ret = -EOPNOTSUPP;
+ } else if (refcount_read(sid) == 0) {
ret = REVT_NOTIFY_ENABLE(r_evt, r_evt->evt->id,
src_id);
if (!ret)
@@ -1179,6 +1192,8 @@ static inline int __scmi_enable_evt(struct scmi_registered_event *r_evt,
} else {
for (; num_sources; src_id++, num_sources--) {
sid = &r_evt->sources[src_id];
+ if (refcount_read(sid) == NOTIF_UNSUPP)
+ continue;
if (refcount_dec_and_test(sid))
REVT_NOTIFY_DISABLE(r_evt,
r_evt->evt->id, src_id);
diff --git a/drivers/firmware/arm_scmi/notify.h b/drivers/firmware/arm_scmi/notify.h
index 4e9b627edfef..76758a736cf4 100644
--- a/drivers/firmware/arm_scmi/notify.h
+++ b/drivers/firmware/arm_scmi/notify.h
@@ -35,6 +35,8 @@ struct scmi_protocol_handle;
/**
* struct scmi_event_ops - Protocol helpers called by the notification core.
+ * @is_notify_supported: Return 0 if the specified notification for the
+ * specified resource (src_id) is supported.
* @get_num_sources: Returns the number of possible events' sources for this
* protocol
* @set_notify_enabled: Enable/disable the required evt_id/src_id notifications
@@ -50,6 +52,8 @@ struct scmi_protocol_handle;
* process context.
*/
struct scmi_event_ops {
+ bool (*is_notify_supported)(const struct scmi_protocol_handle *ph,
+ u8 evt_id, u32 src_id);
int (*get_num_sources)(const struct scmi_protocol_handle *ph);
int (*set_notify_enabled)(const struct scmi_protocol_handle *ph,
u8 evt_id, u32 src_id, bool enabled);
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 02/11] firmware: arm_scmi: Add a common helper to check if a message is supported
2024-02-12 12:32 [PATCH 00/11] Add SCMI core checks for notification support Cristian Marussi
2024-02-12 12:32 ` [PATCH 01/11] firmware: arm_scmi: Check " Cristian Marussi
@ 2024-02-12 12:32 ` Cristian Marussi
2024-02-12 12:32 ` [PATCH 03/11] firmware: arm_scmi: Implement Perf .is_notify_supported callback Cristian Marussi
` (9 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Cristian Marussi @ 2024-02-12 12:32 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel
Cc: sudeep.holla, vincent.guittot, peng.fan, michal.simek,
quic_sibis, quic_nkela, souvik.chakravarty, Cristian Marussi
A common helper is provided to check if a specific protocol message is
supported or not.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
drivers/firmware/arm_scmi/driver.c | 34 +++++++++++++++++++++++++++
drivers/firmware/arm_scmi/protocols.h | 4 ++++
2 files changed, 38 insertions(+)
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 3ea64b22cf0d..4a64ad5c21ee 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -1754,10 +1754,44 @@ static void scmi_common_fastchannel_db_ring(struct scmi_fc_db_info *db)
#endif
}
+/**
+ * scmi_protocol_msg_check - Check protocol message attributes
+ *
+ * @ph: A reference to the protocol handle.
+ * @message_id: The ID of the message to check.
+ * @attributes: A parameter to optionally return the retrieved message
+ * attributes, in case of Success.
+ *
+ * An helper to check protocol message attributes for a specific protocol
+ * and message pair.
+ *
+ * Return: 0 on SUCCESS
+ */
+static int scmi_protocol_msg_check(const struct scmi_protocol_handle *ph,
+ u32 message_id, u32 *attributes)
+{
+ int ret;
+ struct scmi_xfer *t;
+
+ ret = xfer_get_init(ph, PROTOCOL_MESSAGE_ATTRIBUTES,
+ sizeof(__le32), 0, &t);
+ if (ret)
+ return ret;
+
+ put_unaligned_le32(message_id, t->tx.buf);
+ ret = do_xfer(ph, t);
+ if (!ret && attributes)
+ *attributes = get_unaligned_le32(t->rx.buf);
+ xfer_put(ph, t);
+
+ return ret;
+}
+
static const struct scmi_proto_helpers_ops helpers_ops = {
.extended_name_get = scmi_common_extended_name_get,
.iter_response_init = scmi_iterator_init,
.iter_response_run = scmi_iterator_run,
+ .protocol_msg_check = scmi_protocol_msg_check,
.fastchannel_init = scmi_common_fastchannel_init,
.fastchannel_db_ring = scmi_common_fastchannel_db_ring,
};
diff --git a/drivers/firmware/arm_scmi/protocols.h b/drivers/firmware/arm_scmi/protocols.h
index e683c26f24eb..26a3edd49fea 100644
--- a/drivers/firmware/arm_scmi/protocols.h
+++ b/drivers/firmware/arm_scmi/protocols.h
@@ -251,6 +251,8 @@ struct scmi_fc_info {
* provided in @ops.
* @iter_response_run: A common helper to trigger the run of a previously
* initialized iterator.
+ * @protocol_msg_check: A common helper to check is a specific protocol message
+ * is supported.
* @fastchannel_init: A common helper used to initialize FC descriptors by
* gathering FC descriptions from the SCMI platform server.
* @fastchannel_db_ring: A common helper to ring a FC doorbell.
@@ -264,6 +266,8 @@ struct scmi_proto_helpers_ops {
unsigned int max_resources, u8 msg_id,
size_t tx_size, void *priv);
int (*iter_response_run)(void *iter);
+ int (*protocol_msg_check)(const struct scmi_protocol_handle *ph,
+ u32 message_id, u32 *attributes);
void (*fastchannel_init)(const struct scmi_protocol_handle *ph,
u8 describe_id, u32 message_id,
u32 valid_size, u32 domain,
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 03/11] firmware: arm_scmi: Implement Perf .is_notify_supported callback
2024-02-12 12:32 [PATCH 00/11] Add SCMI core checks for notification support Cristian Marussi
2024-02-12 12:32 ` [PATCH 01/11] firmware: arm_scmi: Check " Cristian Marussi
2024-02-12 12:32 ` [PATCH 02/11] firmware: arm_scmi: Add a common helper to check if a message is supported Cristian Marussi
@ 2024-02-12 12:32 ` Cristian Marussi
2024-02-12 12:32 ` [PATCH 04/11] firmware: arm_scmi: Implement Power " Cristian Marussi
` (8 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Cristian Marussi @ 2024-02-12 12:32 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel
Cc: sudeep.holla, vincent.guittot, peng.fan, michal.simek,
quic_sibis, quic_nkela, souvik.chakravarty, Cristian Marussi
Add a preliminary check to verify if Perf-related notify enable commands
are supported at all by the running platform, and then provide the callback
needed to allow the core SCMI notification subsytem to fine-grain check if
a specific resource domain supports notifications.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
drivers/firmware/arm_scmi/perf.c | 45 +++++++++++++++++++++++++++++---
1 file changed, 42 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index 9e7b1ee94940..2627ace5b07f 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -182,6 +182,8 @@ struct scmi_perf_info {
enum scmi_power_scale power_scale;
u64 stats_addr;
u32 stats_size;
+ bool notify_lvl_cmd;
+ bool notify_lim_cmd;
struct perf_dom_info *dom_info;
};
@@ -222,6 +224,15 @@ static int scmi_perf_attributes_get(const struct scmi_protocol_handle *ph,
}
ph->xops->xfer_put(ph, t);
+
+ if (!ret) {
+ if (!ph->hops->protocol_msg_check(ph, PERF_NOTIFY_LEVEL, NULL))
+ pi->notify_lvl_cmd = true;
+
+ if (!ph->hops->protocol_msg_check(ph, PERF_NOTIFY_LIMITS, NULL))
+ pi->notify_lim_cmd = true;
+ }
+
return ret;
}
@@ -239,6 +250,7 @@ static void scmi_perf_xa_destroy(void *data)
static int
scmi_perf_domain_attributes_get(const struct scmi_protocol_handle *ph,
struct perf_dom_info *dom_info,
+ bool notify_lim_cmd, bool notify_lvl_cmd,
u32 version)
{
int ret;
@@ -260,8 +272,12 @@ scmi_perf_domain_attributes_get(const struct scmi_protocol_handle *ph,
dom_info->set_limits = SUPPORTS_SET_LIMITS(flags);
dom_info->info.set_perf = SUPPORTS_SET_PERF_LVL(flags);
- dom_info->perf_limit_notify = SUPPORTS_PERF_LIMIT_NOTIFY(flags);
- dom_info->perf_level_notify = SUPPORTS_PERF_LEVEL_NOTIFY(flags);
+ if (notify_lim_cmd)
+ dom_info->perf_limit_notify =
+ SUPPORTS_PERF_LIMIT_NOTIFY(flags);
+ if (notify_lvl_cmd)
+ dom_info->perf_level_notify =
+ SUPPORTS_PERF_LEVEL_NOTIFY(flags);
dom_info->perf_fastchannels = SUPPORTS_PERF_FASTCHANNELS(flags);
if (PROTOCOL_REV_MAJOR(version) >= 0x4)
dom_info->level_indexing_mode =
@@ -993,6 +1009,27 @@ static const struct scmi_perf_proto_ops perf_proto_ops = {
.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)
+{
+ bool supported;
+ struct perf_dom_info *dom;
+
+ if (evt_id >= ARRAY_SIZE(evt_2_cmd))
+ return false;
+
+ dom = scmi_perf_domain_lookup(ph, src_id);
+ if (IS_ERR(dom))
+ return false;
+
+ if (evt_id == SCMI_EVENT_PERFORMANCE_LIMITS_CHANGED)
+ supported = dom->perf_limit_notify;
+ else
+ supported = dom->perf_level_notify;
+
+ return supported;
+}
+
static int scmi_perf_set_notify_enabled(const struct scmi_protocol_handle *ph,
u8 evt_id, u32 src_id, bool enable)
{
@@ -1082,6 +1119,7 @@ static const struct scmi_event perf_events[] = {
};
static const struct scmi_event_ops perf_event_ops = {
+ .is_notify_supported = scmi_perf_notify_supported,
.get_num_sources = scmi_perf_get_num_sources,
.set_notify_enabled = scmi_perf_set_notify_enabled,
.fill_custom_report = scmi_perf_fill_custom_report,
@@ -1126,7 +1164,8 @@ static int scmi_perf_protocol_init(const struct scmi_protocol_handle *ph)
struct perf_dom_info *dom = pinfo->dom_info + domain;
dom->id = domain;
- scmi_perf_domain_attributes_get(ph, dom, version);
+ scmi_perf_domain_attributes_get(ph, dom, pinfo->notify_lim_cmd,
+ pinfo->notify_lvl_cmd, version);
scmi_perf_describe_levels_get(ph, dom, version);
if (dom->perf_fastchannels)
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 04/11] firmware: arm_scmi: Implement Power .is_notify_supported callback
2024-02-12 12:32 [PATCH 00/11] Add SCMI core checks for notification support Cristian Marussi
` (2 preceding siblings ...)
2024-02-12 12:32 ` [PATCH 03/11] firmware: arm_scmi: Implement Perf .is_notify_supported callback Cristian Marussi
@ 2024-02-12 12:32 ` Cristian Marussi
2024-02-12 12:32 ` [PATCH 05/11] firmware: arm_scmi: Implement SysPower " Cristian Marussi
` (7 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Cristian Marussi @ 2024-02-12 12:32 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel
Cc: sudeep.holla, vincent.guittot, peng.fan, michal.simek,
quic_sibis, quic_nkela, souvik.chakravarty, Cristian Marussi
Add a preliminary check to verify if Power-related notify enable commands
are supported at all by the running platform, and then provide the callback
needed to allow the core SCMI notification subsytem to fine-grain check if
a specific resource domain supports notifications.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
drivers/firmware/arm_scmi/power.c | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/arm_scmi/power.c b/drivers/firmware/arm_scmi/power.c
index c2e6b9b4d941..49666bd1d8ac 100644
--- a/drivers/firmware/arm_scmi/power.c
+++ b/drivers/firmware/arm_scmi/power.c
@@ -68,6 +68,7 @@ struct power_dom_info {
struct scmi_power_info {
u32 version;
+ bool notify_state_change_cmd;
int num_domains;
u64 stats_addr;
u32 stats_size;
@@ -97,13 +98,18 @@ static int scmi_power_attributes_get(const struct scmi_protocol_handle *ph,
}
ph->xops->xfer_put(ph, t);
+
+ if (!ret)
+ if (!ph->hops->protocol_msg_check(ph, POWER_STATE_NOTIFY, NULL))
+ pi->notify_state_change_cmd = true;
+
return ret;
}
static int
scmi_power_domain_attributes_get(const struct scmi_protocol_handle *ph,
u32 domain, struct power_dom_info *dom_info,
- u32 version)
+ u32 version, bool notify_state_change_cmd)
{
int ret;
u32 flags;
@@ -122,7 +128,9 @@ scmi_power_domain_attributes_get(const struct scmi_protocol_handle *ph,
if (!ret) {
flags = le32_to_cpu(attr->flags);
- dom_info->state_set_notify = SUPPORTS_STATE_SET_NOTIFY(flags);
+ if (notify_state_change_cmd)
+ dom_info->state_set_notify =
+ SUPPORTS_STATE_SET_NOTIFY(flags);
dom_info->state_set_async = SUPPORTS_STATE_SET_ASYNC(flags);
dom_info->state_set_sync = SUPPORTS_STATE_SET_SYNC(flags);
strscpy(dom_info->name, attr->name, SCMI_SHORT_NAME_MAX_SIZE);
@@ -231,6 +239,20 @@ static int scmi_power_request_notify(const struct scmi_protocol_handle *ph,
return ret;
}
+static bool scmi_power_notify_supported(const struct scmi_protocol_handle *ph,
+ u8 evt_id, u32 src_id)
+{
+ struct power_dom_info *dom;
+ struct scmi_power_info *pinfo = ph->get_priv(ph);
+
+ if (evt_id != SCMI_EVENT_POWER_STATE_CHANGED ||
+ src_id >= pinfo->num_domains)
+ return false;
+
+ dom = pinfo->dom_info + src_id;
+ return dom->state_set_notify;
+}
+
static int scmi_power_set_notify_enabled(const struct scmi_protocol_handle *ph,
u8 evt_id, u32 src_id, bool enable)
{
@@ -285,6 +307,7 @@ static const struct scmi_event power_events[] = {
};
static const struct scmi_event_ops power_event_ops = {
+ .is_notify_supported = scmi_power_notify_supported,
.get_num_sources = scmi_power_get_num_sources,
.set_notify_enabled = scmi_power_set_notify_enabled,
.fill_custom_report = scmi_power_fill_custom_report,
@@ -326,7 +349,8 @@ static int scmi_power_protocol_init(const struct scmi_protocol_handle *ph)
for (domain = 0; domain < pinfo->num_domains; domain++) {
struct power_dom_info *dom = pinfo->dom_info + domain;
- scmi_power_domain_attributes_get(ph, domain, dom, version);
+ scmi_power_domain_attributes_get(ph, domain, dom, version,
+ pinfo->notify_state_change_cmd);
}
pinfo->version = version;
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 05/11] firmware: arm_scmi: Implement SysPower .is_notify_supported callback
2024-02-12 12:32 [PATCH 00/11] Add SCMI core checks for notification support Cristian Marussi
` (3 preceding siblings ...)
2024-02-12 12:32 ` [PATCH 04/11] firmware: arm_scmi: Implement Power " Cristian Marussi
@ 2024-02-12 12:32 ` Cristian Marussi
2024-02-12 12:32 ` [PATCH 06/11] firmware: arm_scmi: Implement Clock " Cristian Marussi
` (6 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Cristian Marussi @ 2024-02-12 12:32 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel
Cc: sudeep.holla, vincent.guittot, peng.fan, michal.simek,
quic_sibis, quic_nkela, souvik.chakravarty, Cristian Marussi
Add a preliminary check to verify if SysPower-related notify enable
commands are supported at all by the running platform, and then provide the
callback needed to allow the core SCMI notification subsytem to fine-grain
check if a specific resource domain supports notifications.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
drivers/firmware/arm_scmi/system.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/firmware/arm_scmi/system.c b/drivers/firmware/arm_scmi/system.c
index 1621da97bcbb..b6358c155f7f 100644
--- a/drivers/firmware/arm_scmi/system.c
+++ b/drivers/firmware/arm_scmi/system.c
@@ -36,8 +36,20 @@ struct scmi_system_power_state_notifier_payld {
struct scmi_system_info {
u32 version;
bool graceful_timeout_supported;
+ bool power_state_notify_cmd;
};
+static bool scmi_system_notify_supported(const struct scmi_protocol_handle *ph,
+ u8 evt_id, u32 src_id)
+{
+ struct scmi_system_info *pinfo = ph->get_priv(ph);
+
+ if (evt_id != SCMI_EVENT_SYSTEM_POWER_STATE_NOTIFIER)
+ return false;
+
+ return pinfo->power_state_notify_cmd;
+}
+
static int scmi_system_request_notify(const struct scmi_protocol_handle *ph,
bool enable)
{
@@ -114,6 +126,7 @@ static const struct scmi_event system_events[] = {
};
static const struct scmi_event_ops system_event_ops = {
+ .is_notify_supported = scmi_system_notify_supported,
.set_notify_enabled = scmi_system_set_notify_enabled,
.fill_custom_report = scmi_system_fill_custom_report,
};
@@ -147,6 +160,9 @@ static int scmi_system_protocol_init(const struct scmi_protocol_handle *ph)
if (PROTOCOL_REV_MAJOR(pinfo->version) >= 0x2)
pinfo->graceful_timeout_supported = true;
+ if (!ph->hops->protocol_msg_check(ph, SYSTEM_POWER_STATE_NOTIFY, NULL))
+ pinfo->power_state_notify_cmd = true;
+
return ph->set_priv(ph, pinfo, version);
}
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 06/11] firmware: arm_scmi: Implement Clock .is_notify_supported callback
2024-02-12 12:32 [PATCH 00/11] Add SCMI core checks for notification support Cristian Marussi
` (4 preceding siblings ...)
2024-02-12 12:32 ` [PATCH 05/11] firmware: arm_scmi: Implement SysPower " Cristian Marussi
@ 2024-02-12 12:32 ` Cristian Marussi
2024-02-12 23:00 ` kernel test robot
` (2 more replies)
2024-02-12 12:32 ` [PATCH 07/11] firmware: arm_scmi: Implement Sensor " Cristian Marussi
` (5 subsequent siblings)
11 siblings, 3 replies; 19+ messages in thread
From: Cristian Marussi @ 2024-02-12 12:32 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel
Cc: sudeep.holla, vincent.guittot, peng.fan, michal.simek,
quic_sibis, quic_nkela, souvik.chakravarty, Cristian Marussi
Add a preliminary check to verify if Clock-related notify enable commands
are supported at all by the running platform, and then provide the callback
needed to allow the core SCMI notification subsytem to fine-grain check if
a specific resource domain supports notifications.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
drivers/firmware/arm_scmi/clock.c | 47 ++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c
index 959e48aba1b5..85eda5db40ba 100644
--- a/drivers/firmware/arm_scmi/clock.c
+++ b/drivers/firmware/arm_scmi/clock.c
@@ -158,6 +158,8 @@ struct clock_info {
u32 version;
int num_clocks;
int max_async_req;
+ bool notify_rate_changed_cmd;
+ bool notify_rate_change_requested_cmd;
atomic_t cur_async_req;
struct scmi_clock_info *clk;
int (*clock_config_set)(const struct scmi_protocol_handle *ph,
@@ -204,6 +206,17 @@ scmi_clock_protocol_attributes_get(const struct scmi_protocol_handle *ph,
}
ph->xops->xfer_put(ph, t);
+
+ if (!ret) {
+ if (!ph->hops->protocol_msg_check(ph, CLOCK_RATE_NOTIFY, NULL))
+ ci->notify_rate_changed_cmd = true;
+
+ if (!ph->hops->protocol_msg_check(ph,
+ CLOCK_RATE_CHANGE_REQUESTED_NOTIFY,
+ NULL))
+ ci->notify_rate_change_requested_cmd = true;
+ }
+
return ret;
}
@@ -329,13 +342,14 @@ scmi_clock_get_permissions(const struct scmi_protocol_handle *ph, u32 clk_id,
}
static int scmi_clock_attributes_get(const struct scmi_protocol_handle *ph,
- u32 clk_id, struct scmi_clock_info *clk,
+ u32 clk_id, struct clock_info *cinfo,
u32 version)
{
int ret;
u32 attributes;
struct scmi_xfer *t;
struct scmi_msg_resp_clock_attributes *attr;
+ struct scmi_clock_info *clk = cinfo->clk + clk_id;
ret = ph->xops->xfer_get_init(ph, CLOCK_ATTRIBUTES,
sizeof(clk_id), sizeof(*attr), &t);
@@ -368,9 +382,11 @@ static int scmi_clock_attributes_get(const struct scmi_protocol_handle *ph,
NULL, clk->name,
SCMI_MAX_STR_SIZE);
- if (SUPPORTS_RATE_CHANGED_NOTIF(attributes))
+ if (cinfo->notify_rate_changed_cmd &&
+ SUPPORTS_RATE_CHANGED_NOTIF(attributes))
clk->rate_changed_notifications = true;
- if (SUPPORTS_RATE_CHANGE_REQUESTED_NOTIF(attributes))
+ if (cinfo->notify_rate_change_requested_cmd &&
+ SUPPORTS_RATE_CHANGE_REQUESTED_NOTIF(attributes))
clk->rate_change_requested_notifications = true;
if (SUPPORTS_PARENT_CLOCK(attributes))
scmi_clock_possible_parents(ph, clk_id, clk);
@@ -896,6 +912,28 @@ static const struct scmi_clk_proto_ops clk_proto_ops = {
.parent_get = scmi_clock_get_parent,
};
+static bool scmi_clk_notify_supported(const struct scmi_protocol_handle *ph,
+ u8 evt_id, u32 src_id)
+{
+ bool supported;
+ struct scmi_clock_info *clk;
+ struct clock_info *ci = ph->get_priv(ph);
+
+ if (evt_id >= ARRAY_SIZE(evt_2_cmd))
+ return false;
+
+ clk = scmi_clock_domain_lookup(ci, src_id);
+ if (IS_ERR(clk))
+ return false;
+
+ if (evt_id == SCMI_EVENT_CLOCK_RATE_CHANGED)
+ supported = clk->rate_changed_notifications;
+ else
+ supported = clk->rate_change_requested_notifications;
+
+ return supported;
+}
+
static int scmi_clk_rate_notify(const struct scmi_protocol_handle *ph,
u32 clk_id, int message_id, bool enable)
{
@@ -980,6 +1018,7 @@ static const struct scmi_event clk_events[] = {
};
static const struct scmi_event_ops clk_event_ops = {
+ .is_notify_supported = scmi_clk_notify_supported,
.get_num_sources = scmi_clk_get_num_sources,
.set_notify_enabled = scmi_clk_set_notify_enabled,
.fill_custom_report = scmi_clk_fill_custom_report,
@@ -1021,7 +1060,7 @@ static int scmi_clock_protocol_init(const struct scmi_protocol_handle *ph)
for (clkid = 0; clkid < cinfo->num_clocks; clkid++) {
struct scmi_clock_info *clk = cinfo->clk + clkid;
- ret = scmi_clock_attributes_get(ph, clkid, clk, version);
+ ret = scmi_clock_attributes_get(ph, clkid, cinfo, version);
if (!ret)
scmi_clock_describe_rates_get(ph, clkid, clk);
}
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 06/11] firmware: arm_scmi: Implement Clock .is_notify_supported callback
2024-02-12 12:32 ` [PATCH 06/11] firmware: arm_scmi: Implement Clock " Cristian Marussi
@ 2024-02-12 23:00 ` kernel test robot
2024-02-12 23:20 ` kernel test robot
2024-02-13 2:58 ` kernel test robot
2 siblings, 0 replies; 19+ messages in thread
From: kernel test robot @ 2024-02-12 23:00 UTC (permalink / raw)
To: Cristian Marussi, linux-kernel, linux-arm-kernel
Cc: oe-kbuild-all, sudeep.holla, vincent.guittot, peng.fan,
michal.simek, quic_sibis, quic_nkela, souvik.chakravarty,
Cristian Marussi
Hi Cristian,
kernel test robot noticed the following build errors:
[auto build test ERROR on soc/for-next]
[also build test ERROR on linus/master v6.8-rc4 next-20240212]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Cristian-Marussi/firmware-arm_scmi-Check-for-notification-support/20240212-203727
base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
patch link: https://lore.kernel.org/r/20240212123233.1230090-7-cristian.marussi%40arm.com
patch subject: [PATCH 06/11] firmware: arm_scmi: Implement Clock .is_notify_supported callback
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240213/202402130607.H0A5KJ1C-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240213/202402130607.H0A5KJ1C-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402130607.H0A5KJ1C-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
drivers/firmware/arm_scmi/clock.c: In function 'scmi_clk_notify_supported':
>> drivers/firmware/arm_scmi/clock.c:853:15: error: implicit declaration of function 'scmi_clock_domain_lookup' [-Werror=implicit-function-declaration]
853 | clk = scmi_clock_domain_lookup(ci, src_id);
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/firmware/arm_scmi/clock.c:853:13: warning: assignment to 'struct scmi_clock_info *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
853 | clk = scmi_clock_domain_lookup(ci, src_id);
| ^
cc1: some warnings being treated as errors
vim +/scmi_clock_domain_lookup +853 drivers/firmware/arm_scmi/clock.c
842
843 static bool scmi_clk_notify_supported(const struct scmi_protocol_handle *ph,
844 u8 evt_id, u32 src_id)
845 {
846 bool supported;
847 struct scmi_clock_info *clk;
848 struct clock_info *ci = ph->get_priv(ph);
849
850 if (evt_id >= ARRAY_SIZE(evt_2_cmd))
851 return false;
852
> 853 clk = scmi_clock_domain_lookup(ci, src_id);
854 if (IS_ERR(clk))
855 return false;
856
857 if (evt_id == SCMI_EVENT_CLOCK_RATE_CHANGED)
858 supported = clk->rate_changed_notifications;
859 else
860 supported = clk->rate_change_requested_notifications;
861
862 return supported;
863 }
864
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 06/11] firmware: arm_scmi: Implement Clock .is_notify_supported callback
2024-02-12 12:32 ` [PATCH 06/11] firmware: arm_scmi: Implement Clock " Cristian Marussi
2024-02-12 23:00 ` kernel test robot
@ 2024-02-12 23:20 ` kernel test robot
2024-02-13 2:58 ` kernel test robot
2 siblings, 0 replies; 19+ messages in thread
From: kernel test robot @ 2024-02-12 23:20 UTC (permalink / raw)
To: Cristian Marussi, linux-kernel, linux-arm-kernel
Cc: llvm, oe-kbuild-all, sudeep.holla, vincent.guittot, peng.fan,
michal.simek, quic_sibis, quic_nkela, souvik.chakravarty,
Cristian Marussi
Hi Cristian,
kernel test robot noticed the following build warnings:
[auto build test WARNING on soc/for-next]
[also build test WARNING on linus/master v6.8-rc4 next-20240212]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Cristian-Marussi/firmware-arm_scmi-Check-for-notification-support/20240212-203727
base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
patch link: https://lore.kernel.org/r/20240212123233.1230090-7-cristian.marussi%40arm.com
patch subject: [PATCH 06/11] firmware: arm_scmi: Implement Clock .is_notify_supported callback
config: arm-defconfig (https://download.01.org/0day-ci/archive/20240213/202402130758.vkfAqrx0-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240213/202402130758.vkfAqrx0-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402130758.vkfAqrx0-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/firmware/arm_scmi/clock.c:853:8: error: implicit declaration of function 'scmi_clock_domain_lookup' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
clk = scmi_clock_domain_lookup(ci, src_id);
^
>> drivers/firmware/arm_scmi/clock.c:853:6: warning: incompatible integer to pointer conversion assigning to 'struct scmi_clock_info *' from 'int' [-Wint-conversion]
clk = scmi_clock_domain_lookup(ci, src_id);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
vim +853 drivers/firmware/arm_scmi/clock.c
842
843 static bool scmi_clk_notify_supported(const struct scmi_protocol_handle *ph,
844 u8 evt_id, u32 src_id)
845 {
846 bool supported;
847 struct scmi_clock_info *clk;
848 struct clock_info *ci = ph->get_priv(ph);
849
850 if (evt_id >= ARRAY_SIZE(evt_2_cmd))
851 return false;
852
> 853 clk = scmi_clock_domain_lookup(ci, src_id);
854 if (IS_ERR(clk))
855 return false;
856
857 if (evt_id == SCMI_EVENT_CLOCK_RATE_CHANGED)
858 supported = clk->rate_changed_notifications;
859 else
860 supported = clk->rate_change_requested_notifications;
861
862 return supported;
863 }
864
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 06/11] firmware: arm_scmi: Implement Clock .is_notify_supported callback
2024-02-12 12:32 ` [PATCH 06/11] firmware: arm_scmi: Implement Clock " Cristian Marussi
2024-02-12 23:00 ` kernel test robot
2024-02-12 23:20 ` kernel test robot
@ 2024-02-13 2:58 ` kernel test robot
2024-02-13 8:49 ` Cristian Marussi
2 siblings, 1 reply; 19+ messages in thread
From: kernel test robot @ 2024-02-13 2:58 UTC (permalink / raw)
To: Cristian Marussi, linux-kernel, linux-arm-kernel
Cc: llvm, oe-kbuild-all, sudeep.holla, vincent.guittot, peng.fan,
michal.simek, quic_sibis, quic_nkela, souvik.chakravarty,
Cristian Marussi
Hi Cristian,
kernel test robot noticed the following build errors:
[auto build test ERROR on soc/for-next]
[also build test ERROR on linus/master v6.8-rc4 next-20240212]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Cristian-Marussi/firmware-arm_scmi-Check-for-notification-support/20240212-203727
base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
patch link: https://lore.kernel.org/r/20240212123233.1230090-7-cristian.marussi%40arm.com
patch subject: [PATCH 06/11] firmware: arm_scmi: Implement Clock .is_notify_supported callback
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20240213/202402131047.2NVZWHma-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project c08b90c50bcac9f3f563c79491c8dbcbe7c3b574)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240213/202402131047.2NVZWHma-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402131047.2NVZWHma-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/firmware/arm_scmi/clock.c:853:8: error: call to undeclared function 'scmi_clock_domain_lookup'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
853 | clk = scmi_clock_domain_lookup(ci, src_id);
| ^
>> drivers/firmware/arm_scmi/clock.c:853:6: error: incompatible integer to pointer conversion assigning to 'struct scmi_clock_info *' from 'int' [-Wint-conversion]
853 | clk = scmi_clock_domain_lookup(ci, src_id);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
vim +/scmi_clock_domain_lookup +853 drivers/firmware/arm_scmi/clock.c
842
843 static bool scmi_clk_notify_supported(const struct scmi_protocol_handle *ph,
844 u8 evt_id, u32 src_id)
845 {
846 bool supported;
847 struct scmi_clock_info *clk;
848 struct clock_info *ci = ph->get_priv(ph);
849
850 if (evt_id >= ARRAY_SIZE(evt_2_cmd))
851 return false;
852
> 853 clk = scmi_clock_domain_lookup(ci, src_id);
854 if (IS_ERR(clk))
855 return false;
856
857 if (evt_id == SCMI_EVENT_CLOCK_RATE_CHANGED)
858 supported = clk->rate_changed_notifications;
859 else
860 supported = clk->rate_change_requested_notifications;
861
862 return supported;
863 }
864
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 06/11] firmware: arm_scmi: Implement Clock .is_notify_supported callback
2024-02-13 2:58 ` kernel test robot
@ 2024-02-13 8:49 ` Cristian Marussi
2024-02-13 18:24 ` Nikunj Kela
0 siblings, 1 reply; 19+ messages in thread
From: Cristian Marussi @ 2024-02-13 8:49 UTC (permalink / raw)
To: kernel test robot
Cc: linux-kernel, linux-arm-kernel, llvm, oe-kbuild-all,
sudeep.holla, vincent.guittot, peng.fan, michal.simek,
quic_sibis, quic_nkela, souvik.chakravarty
On Tue, Feb 13, 2024 at 10:58:23AM +0800, kernel test robot wrote:
> Hi Cristian,
>
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on soc/for-next]
> [also build test ERROR on linus/master v6.8-rc4 next-20240212]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
Hi,
this series, as stated in the cover-letter, is based off the current tip of
sudeep/for-next/scmi/updates
and particularly needs commit:
9c5bc650031e firmware: arm_scmi: Rework clock domain info lookups
from there, since it contains the missing scmi_clock_domain_lookup().
Not_sure/dont_known if there is any way to convey this "based-on-branch"
info to your/any CI at the moment.
Thanks,
Cristian
> url: https://github.com/intel-lab-lkp/linux/commits/Cristian-Marussi/firmware-arm_scmi-Check-for-notification-support/20240212-203727
> base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
> patch link: https://lore.kernel.org/r/20240212123233.1230090-7-cristian.marussi%40arm.com
> patch subject: [PATCH 06/11] firmware: arm_scmi: Implement Clock .is_notify_supported callback
> config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20240213/202402131047.2NVZWHma-lkp@intel.com/config)
> compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project c08b90c50bcac9f3f563c79491c8dbcbe7c3b574)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240213/202402131047.2NVZWHma-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202402131047.2NVZWHma-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> >> drivers/firmware/arm_scmi/clock.c:853:8: error: call to undeclared function 'scmi_clock_domain_lookup'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> 853 | clk = scmi_clock_domain_lookup(ci, src_id);
> | ^
> >> drivers/firmware/arm_scmi/clock.c:853:6: error: incompatible integer to pointer conversion assigning to 'struct scmi_clock_info *' from 'int' [-Wint-conversion]
> 853 | clk = scmi_clock_domain_lookup(ci, src_id);
> | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 2 errors generated.
>
>
> vim +/scmi_clock_domain_lookup +853 drivers/firmware/arm_scmi/clock.c
>
> 842
> 843 static bool scmi_clk_notify_supported(const struct scmi_protocol_handle *ph,
> 844 u8 evt_id, u32 src_id)
> 845 {
> 846 bool supported;
> 847 struct scmi_clock_info *clk;
> 848 struct clock_info *ci = ph->get_priv(ph);
> 849
> 850 if (evt_id >= ARRAY_SIZE(evt_2_cmd))
> 851 return false;
> 852
> > 853 clk = scmi_clock_domain_lookup(ci, src_id);
> 854 if (IS_ERR(clk))
> 855 return false;
> 856
> 857 if (evt_id == SCMI_EVENT_CLOCK_RATE_CHANGED)
> 858 supported = clk->rate_changed_notifications;
> 859 else
> 860 supported = clk->rate_change_requested_notifications;
> 861
> 862 return supported;
> 863 }
> 864
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 06/11] firmware: arm_scmi: Implement Clock .is_notify_supported callback
2024-02-13 8:49 ` Cristian Marussi
@ 2024-02-13 18:24 ` Nikunj Kela
2024-02-14 18:21 ` Cristian Marussi
0 siblings, 1 reply; 19+ messages in thread
From: Nikunj Kela @ 2024-02-13 18:24 UTC (permalink / raw)
To: Cristian Marussi, kernel test robot
Cc: linux-kernel, linux-arm-kernel, llvm, oe-kbuild-all,
sudeep.holla, vincent.guittot, peng.fan, michal.simek,
quic_sibis, souvik.chakravarty
On 2/13/2024 12:49 AM, Cristian Marussi wrote:
> On Tue, Feb 13, 2024 at 10:58:23AM +0800, kernel test robot wrote:
>> Hi Cristian,
>>
>> kernel test robot noticed the following build errors:
>>
>> [auto build test ERROR on soc/for-next]
>> [also build test ERROR on linus/master v6.8-rc4 next-20240212]
>> [If your patch is applied to the wrong git tree, kindly drop us a note.
>> And when submitting patch, we suggest to use '--base' as documented in
>> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>>
> Hi,
>
> this series, as stated in the cover-letter, is based off the current tip of
>
> sudeep/for-next/scmi/updates
>
> and particularly needs commit:
>
> 9c5bc650031e firmware: arm_scmi: Rework clock domain info lookups
>
> from there, since it contains the missing scmi_clock_domain_lookup().
>
> Not_sure/dont_known if there is any way to convey this "based-on-branch"
> info to your/any CI at the moment.
>
> Thanks,
> Cristian
Maybe add supdeep's tree in MAINTAINERS and use 'base-commit'.
>> url: https://github.com/intel-lab-lkp/linux/commits/Cristian-Marussi/firmware-arm_scmi-Check-for-notification-support/20240212-203727
>> base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
>> patch link: https://lore.kernel.org/r/20240212123233.1230090-7-cristian.marussi%40arm.com
>> patch subject: [PATCH 06/11] firmware: arm_scmi: Implement Clock .is_notify_supported callback
>> config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20240213/202402131047.2NVZWHma-lkp@intel.com/config)
>> compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project c08b90c50bcac9f3f563c79491c8dbcbe7c3b574)
>> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240213/202402131047.2NVZWHma-lkp@intel.com/reproduce)
>>
>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>> the same patch/commit), kindly add following tags
>> | Reported-by: kernel test robot <lkp@intel.com>
>> | Closes: https://lore.kernel.org/oe-kbuild-all/202402131047.2NVZWHma-lkp@intel.com/
>>
>> All errors (new ones prefixed by >>):
>>
>>>> drivers/firmware/arm_scmi/clock.c:853:8: error: call to undeclared function 'scmi_clock_domain_lookup'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>> 853 | clk = scmi_clock_domain_lookup(ci, src_id);
>> | ^
>>>> drivers/firmware/arm_scmi/clock.c:853:6: error: incompatible integer to pointer conversion assigning to 'struct scmi_clock_info *' from 'int' [-Wint-conversion]
>> 853 | clk = scmi_clock_domain_lookup(ci, src_id);
>> | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> 2 errors generated.
>>
>>
>> vim +/scmi_clock_domain_lookup +853 drivers/firmware/arm_scmi/clock.c
>>
>> 842
>> 843 static bool scmi_clk_notify_supported(const struct scmi_protocol_handle *ph,
>> 844 u8 evt_id, u32 src_id)
>> 845 {
>> 846 bool supported;
>> 847 struct scmi_clock_info *clk;
>> 848 struct clock_info *ci = ph->get_priv(ph);
>> 849
>> 850 if (evt_id >= ARRAY_SIZE(evt_2_cmd))
>> 851 return false;
>> 852
>> > 853 clk = scmi_clock_domain_lookup(ci, src_id);
>> 854 if (IS_ERR(clk))
>> 855 return false;
>> 856
>> 857 if (evt_id == SCMI_EVENT_CLOCK_RATE_CHANGED)
>> 858 supported = clk->rate_changed_notifications;
>> 859 else
>> 860 supported = clk->rate_change_requested_notifications;
>> 861
>> 862 return supported;
>> 863 }
>> 864
>>
>> --
>> 0-DAY CI Kernel Test Service
>> https://github.com/intel/lkp-tests/wiki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 06/11] firmware: arm_scmi: Implement Clock .is_notify_supported callback
2024-02-13 18:24 ` Nikunj Kela
@ 2024-02-14 18:21 ` Cristian Marussi
0 siblings, 0 replies; 19+ messages in thread
From: Cristian Marussi @ 2024-02-14 18:21 UTC (permalink / raw)
To: Nikunj Kela
Cc: kernel test robot, linux-kernel, linux-arm-kernel, llvm,
oe-kbuild-all, sudeep.holla, vincent.guittot, peng.fan,
michal.simek, quic_sibis, souvik.chakravarty
On Tue, Feb 13, 2024 at 10:24:48AM -0800, Nikunj Kela wrote:
>
> On 2/13/2024 12:49 AM, Cristian Marussi wrote:
> > On Tue, Feb 13, 2024 at 10:58:23AM +0800, kernel test robot wrote:
> > > Hi Cristian,
> > >
> > > kernel test robot noticed the following build errors:
> > >
> > > [auto build test ERROR on soc/for-next]
> > > [also build test ERROR on linus/master v6.8-rc4 next-20240212]
> > > [If your patch is applied to the wrong git tree, kindly drop us a note.
> > > And when submitting patch, we suggest to use '--base' as documented in
> > > https://git-scm.com/docs/git-format-patch#_base_tree_information]
> > >
> > Hi,
> >
> > this series, as stated in the cover-letter, is based off the current tip of
> >
> > sudeep/for-next/scmi/updates
> >
> > and particularly needs commit:
> >
> > 9c5bc650031e firmware: arm_scmi: Rework clock domain info lookups
> >
> > from there, since it contains the missing scmi_clock_domain_lookup().
> >
> > Not_sure/dont_known if there is any way to convey this "based-on-branch"
> > info to your/any CI at the moment.
> >
> > Thanks,
> > Cristian
> Maybe add supdeep's tree in MAINTAINERS and use 'base-commit'.
Thanks Nikunj, I'll try with base-commit.
Cristian
> > > url: https://github.com/intel-lab-lkp/linux/commits/Cristian-Marussi/firmware-arm_scmi-Check-for-notification-support/20240212-203727
> > > base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
> > > patch link: https://lore.kernel.org/r/20240212123233.1230090-7-cristian.marussi%40arm.com
> > > patch subject: [PATCH 06/11] firmware: arm_scmi: Implement Clock .is_notify_supported callback
> > > config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20240213/202402131047.2NVZWHma-lkp@intel.com/config)
> > > compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project c08b90c50bcac9f3f563c79491c8dbcbe7c3b574)
> > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240213/202402131047.2NVZWHma-lkp@intel.com/reproduce)
> > >
> > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > the same patch/commit), kindly add following tags
> > > | Reported-by: kernel test robot <lkp@intel.com>
> > > | Closes: https://lore.kernel.org/oe-kbuild-all/202402131047.2NVZWHma-lkp@intel.com/
> > >
> > > All errors (new ones prefixed by >>):
> > >
> > > > > drivers/firmware/arm_scmi/clock.c:853:8: error: call to undeclared function 'scmi_clock_domain_lookup'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> > > 853 | clk = scmi_clock_domain_lookup(ci, src_id);
> > > | ^
> > > > > drivers/firmware/arm_scmi/clock.c:853:6: error: incompatible integer to pointer conversion assigning to 'struct scmi_clock_info *' from 'int' [-Wint-conversion]
> > > 853 | clk = scmi_clock_domain_lookup(ci, src_id);
> > > | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > 2 errors generated.
> > >
> > >
> > > vim +/scmi_clock_domain_lookup +853 drivers/firmware/arm_scmi/clock.c
> > >
> > > 842
> > > 843 static bool scmi_clk_notify_supported(const struct scmi_protocol_handle *ph,
> > > 844 u8 evt_id, u32 src_id)
> > > 845 {
> > > 846 bool supported;
> > > 847 struct scmi_clock_info *clk;
> > > 848 struct clock_info *ci = ph->get_priv(ph);
> > > 849
> > > 850 if (evt_id >= ARRAY_SIZE(evt_2_cmd))
> > > 851 return false;
> > > 852
> > > > 853 clk = scmi_clock_domain_lookup(ci, src_id);
> > > 854 if (IS_ERR(clk))
> > > 855 return false;
> > > 856
> > > 857 if (evt_id == SCMI_EVENT_CLOCK_RATE_CHANGED)
> > > 858 supported = clk->rate_changed_notifications;
> > > 859 else
> > > 860 supported = clk->rate_change_requested_notifications;
> > > 861
> > > 862 return supported;
> > > 863 }
> > > 864
> > >
> > > --
> > > 0-DAY CI Kernel Test Service
> > > https://github.com/intel/lkp-tests/wiki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 07/11] firmware: arm_scmi: Implement Sensor .is_notify_supported callback
2024-02-12 12:32 [PATCH 00/11] Add SCMI core checks for notification support Cristian Marussi
` (5 preceding siblings ...)
2024-02-12 12:32 ` [PATCH 06/11] firmware: arm_scmi: Implement Clock " Cristian Marussi
@ 2024-02-12 12:32 ` Cristian Marussi
2024-02-12 12:32 ` [PATCH 08/11] firmware: arm_scmi: Implement Reset " Cristian Marussi
` (4 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Cristian Marussi @ 2024-02-12 12:32 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel
Cc: sudeep.holla, vincent.guittot, peng.fan, michal.simek,
quic_sibis, quic_nkela, souvik.chakravarty, Cristian Marussi
Add a preliminary check to verify if Sensor-related notify enable commands
are supported at all by the running platform, and then provide the callback
needed to allow the core SCMI notification subsytem to fine-grain check if
a specific resource domain supports notifications.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
drivers/firmware/arm_scmi/sensors.c | 37 ++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c
index 311149965370..7fc5535ca34c 100644
--- a/drivers/firmware/arm_scmi/sensors.c
+++ b/drivers/firmware/arm_scmi/sensors.c
@@ -215,6 +215,8 @@ struct scmi_sensor_update_notify_payld {
struct sensors_info {
u32 version;
+ bool notify_trip_point_cmd;
+ bool notify_continuos_update_cmd;
int num_sensors;
int max_requests;
u64 reg_addr;
@@ -246,6 +248,18 @@ static int scmi_sensor_attributes_get(const struct scmi_protocol_handle *ph,
}
ph->xops->xfer_put(ph, t);
+
+ if (!ret) {
+ if (!ph->hops->protocol_msg_check(ph,
+ SENSOR_TRIP_POINT_NOTIFY, NULL))
+ si->notify_trip_point_cmd = true;
+
+ if (!ph->hops->protocol_msg_check(ph,
+ SENSOR_CONTINUOUS_UPDATE_NOTIFY,
+ NULL))
+ si->notify_continuos_update_cmd = true;
+ }
+
return ret;
}
@@ -594,7 +608,8 @@ iter_sens_descr_process_response(const struct scmi_protocol_handle *ph,
* Such bitfields are assumed to be zeroed on non
* relevant fw versions...assuming fw not buggy !
*/
- s->update = SUPPORTS_UPDATE_NOTIFY(attrl);
+ if (si->notify_continuos_update_cmd)
+ s->update = SUPPORTS_UPDATE_NOTIFY(attrl);
s->timestamped = SUPPORTS_TIMESTAMP(attrl);
if (s->timestamped)
s->tstamp_scale = S32_EXT(SENSOR_TSTAMP_EXP(attrl));
@@ -988,6 +1003,25 @@ static const struct scmi_sensor_proto_ops sensor_proto_ops = {
.config_set = scmi_sensor_config_set,
};
+static bool scmi_sensor_notify_supported(const struct scmi_protocol_handle *ph,
+ u8 evt_id, u32 src_id)
+{
+ bool supported = false;
+ const struct scmi_sensor_info *s;
+ struct sensors_info *sinfo = ph->get_priv(ph);
+
+ s = scmi_sensor_info_get(ph, src_id);
+ if (!s)
+ return false;
+
+ if (evt_id == SCMI_EVENT_SENSOR_TRIP_POINT_EVENT)
+ supported = sinfo->notify_trip_point_cmd;
+ else if (evt_id == SCMI_EVENT_SENSOR_UPDATE)
+ supported = s->update;
+
+ return supported;
+}
+
static int scmi_sensor_set_notify_enabled(const struct scmi_protocol_handle *ph,
u8 evt_id, u32 src_id, bool enable)
{
@@ -1099,6 +1133,7 @@ static const struct scmi_event sensor_events[] = {
};
static const struct scmi_event_ops sensor_event_ops = {
+ .is_notify_supported = scmi_sensor_notify_supported,
.get_num_sources = scmi_sensor_get_num_sources,
.set_notify_enabled = scmi_sensor_set_notify_enabled,
.fill_custom_report = scmi_sensor_fill_custom_report,
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 08/11] firmware: arm_scmi: Implement Reset .is_notify_supported callback
2024-02-12 12:32 [PATCH 00/11] Add SCMI core checks for notification support Cristian Marussi
` (6 preceding siblings ...)
2024-02-12 12:32 ` [PATCH 07/11] firmware: arm_scmi: Implement Sensor " Cristian Marussi
@ 2024-02-12 12:32 ` Cristian Marussi
2024-02-12 12:32 ` [PATCH 09/11] firmware: arm_scmi: Implement Powercap " Cristian Marussi
` (3 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Cristian Marussi @ 2024-02-12 12:32 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel
Cc: sudeep.holla, vincent.guittot, peng.fan, michal.simek,
quic_sibis, quic_nkela, souvik.chakravarty, Cristian Marussi
Add a preliminary check to verify if Reset-related notify enable commands
are supported at all by the running platform, and then provide the callback
needed to allow the core SCMI notification subsytem to fine-grain check if
a specific resource domain supports notifications.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
drivers/firmware/arm_scmi/reset.c | 37 ++++++++++++++++++++++++-------
1 file changed, 29 insertions(+), 8 deletions(-)
diff --git a/drivers/firmware/arm_scmi/reset.c b/drivers/firmware/arm_scmi/reset.c
index 19970d9f9e36..1b318316535e 100644
--- a/drivers/firmware/arm_scmi/reset.c
+++ b/drivers/firmware/arm_scmi/reset.c
@@ -67,6 +67,7 @@ struct reset_dom_info {
struct scmi_reset_info {
u32 version;
int num_domains;
+ bool notify_reset_cmd;
struct reset_dom_info *dom_info;
};
@@ -89,18 +90,24 @@ static int scmi_reset_attributes_get(const struct scmi_protocol_handle *ph,
}
ph->xops->xfer_put(ph, t);
+
+ if (!ret)
+ if (!ph->hops->protocol_msg_check(ph, RESET_NOTIFY, NULL))
+ pi->notify_reset_cmd = true;
+
return ret;
}
static int
scmi_reset_domain_attributes_get(const struct scmi_protocol_handle *ph,
- u32 domain, struct reset_dom_info *dom_info,
- u32 version)
+ struct scmi_reset_info *pinfo,
+ u32 domain, u32 version)
{
int ret;
u32 attributes;
struct scmi_xfer *t;
struct scmi_msg_resp_reset_domain_attributes *attr;
+ struct reset_dom_info *dom_info = pinfo->dom_info + domain;
ret = ph->xops->xfer_get_init(ph, RESET_DOMAIN_ATTRIBUTES,
sizeof(domain), sizeof(*attr), &t);
@@ -115,7 +122,9 @@ scmi_reset_domain_attributes_get(const struct scmi_protocol_handle *ph,
attributes = le32_to_cpu(attr->attributes);
dom_info->async_reset = SUPPORTS_ASYNC_RESET(attributes);
- dom_info->reset_notify = SUPPORTS_NOTIFY_RESET(attributes);
+ if (pinfo->notify_reset_cmd)
+ dom_info->reset_notify =
+ SUPPORTS_NOTIFY_RESET(attributes);
dom_info->latency_us = le32_to_cpu(attr->latency);
if (dom_info->latency_us == U32_MAX)
dom_info->latency_us = 0;
@@ -226,6 +235,20 @@ static const struct scmi_reset_proto_ops reset_proto_ops = {
.deassert = scmi_reset_domain_deassert,
};
+static bool scmi_reset_notify_supported(const struct scmi_protocol_handle *ph,
+ u8 evt_id, u32 src_id)
+{
+ struct reset_dom_info *dom;
+ struct scmi_reset_info *pi = ph->get_priv(ph);
+
+ if (evt_id != SCMI_EVENT_RESET_ISSUED || src_id >= pi->num_domains)
+ return false;
+
+ dom = pi->dom_info + src_id;
+
+ return dom->reset_notify;
+}
+
static int scmi_reset_notify(const struct scmi_protocol_handle *ph,
u32 domain_id, bool enable)
{
@@ -301,6 +324,7 @@ static const struct scmi_event reset_events[] = {
};
static const struct scmi_event_ops reset_event_ops = {
+ .is_notify_supported = scmi_reset_notify_supported,
.get_num_sources = scmi_reset_get_num_sources,
.set_notify_enabled = scmi_reset_set_notify_enabled,
.fill_custom_report = scmi_reset_fill_custom_report,
@@ -339,11 +363,8 @@ static int scmi_reset_protocol_init(const struct scmi_protocol_handle *ph)
if (!pinfo->dom_info)
return -ENOMEM;
- for (domain = 0; domain < pinfo->num_domains; domain++) {
- struct reset_dom_info *dom = pinfo->dom_info + domain;
-
- scmi_reset_domain_attributes_get(ph, domain, dom, version);
- }
+ for (domain = 0; domain < pinfo->num_domains; domain++)
+ scmi_reset_domain_attributes_get(ph, pinfo, domain, version);
pinfo->version = version;
return ph->set_priv(ph, pinfo, version);
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 09/11] firmware: arm_scmi: Implement Powercap .is_notify_supported callback
2024-02-12 12:32 [PATCH 00/11] Add SCMI core checks for notification support Cristian Marussi
` (7 preceding siblings ...)
2024-02-12 12:32 ` [PATCH 08/11] firmware: arm_scmi: Implement Reset " Cristian Marussi
@ 2024-02-12 12:32 ` Cristian Marussi
2024-02-12 12:32 ` [PATCH 10/11] firmware: arm_scmi: Use opps_by_lvl to store opps Cristian Marussi
` (2 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Cristian Marussi @ 2024-02-12 12:32 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel
Cc: sudeep.holla, vincent.guittot, peng.fan, michal.simek,
quic_sibis, quic_nkela, souvik.chakravarty, Cristian Marussi
Add a preliminary check to verify if Powercap-related notify enable
commands are supported at all by the running platform, and then provide the
callback needed to allow the core SCMI notification subsytem to fine-grain
check if a specific resource domain supports notifications.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
drivers/firmware/arm_scmi/powercap.c | 45 +++++++++++++++++++++++++---
1 file changed, 41 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/arm_scmi/powercap.c b/drivers/firmware/arm_scmi/powercap.c
index a4c6cd4716fe..aae91f47303e 100644
--- a/drivers/firmware/arm_scmi/powercap.c
+++ b/drivers/firmware/arm_scmi/powercap.c
@@ -124,6 +124,8 @@ struct scmi_powercap_state {
struct powercap_info {
u32 version;
int num_domains;
+ bool notify_cap_cmd;
+ bool notify_measurements_cmd;
struct scmi_powercap_state *states;
struct scmi_powercap_info *powercaps;
};
@@ -157,6 +159,18 @@ scmi_powercap_attributes_get(const struct scmi_protocol_handle *ph,
}
ph->xops->xfer_put(ph, t);
+
+ if (!ret) {
+ if (!ph->hops->protocol_msg_check(ph,
+ POWERCAP_CAP_NOTIFY, NULL))
+ pi->notify_cap_cmd = true;
+
+ if (!ph->hops->protocol_msg_check(ph,
+ POWERCAP_MEASUREMENTS_NOTIFY,
+ NULL))
+ pi->notify_measurements_cmd = true;
+ }
+
return ret;
}
@@ -200,10 +214,12 @@ scmi_powercap_domain_attributes_get(const struct scmi_protocol_handle *ph,
flags = le32_to_cpu(resp->attributes);
dom_info->id = domain;
- dom_info->notify_powercap_cap_change =
- SUPPORTS_POWERCAP_CAP_CHANGE_NOTIFY(flags);
- dom_info->notify_powercap_measurement_change =
- SUPPORTS_POWERCAP_MEASUREMENTS_CHANGE_NOTIFY(flags);
+ if (pinfo->notify_cap_cmd)
+ dom_info->notify_powercap_cap_change =
+ SUPPORTS_POWERCAP_CAP_CHANGE_NOTIFY(flags);
+ if (pinfo->notify_measurements_cmd)
+ dom_info->notify_powercap_measurement_change =
+ SUPPORTS_POWERCAP_MEASUREMENTS_CHANGE_NOTIFY(flags);
dom_info->async_powercap_cap_set =
SUPPORTS_ASYNC_POWERCAP_CAP_SET(flags);
dom_info->powercap_cap_config =
@@ -788,6 +804,26 @@ static int scmi_powercap_notify(const struct scmi_protocol_handle *ph,
return ret;
}
+static bool
+scmi_powercap_notify_supported(const struct scmi_protocol_handle *ph,
+ u8 evt_id, u32 src_id)
+{
+ bool supported;
+ const struct scmi_powercap_info *dom_info;
+ struct powercap_info *pi = ph->get_priv(ph);
+
+ if (evt_id >= ARRAY_SIZE(evt_2_cmd) || src_id >= pi->num_domains)
+ return false;
+
+ dom_info = pi->powercaps + src_id;
+ if (evt_id == SCMI_EVENT_POWERCAP_CAP_CHANGED)
+ supported = dom_info->notify_powercap_cap_change;
+ else if (evt_id == SCMI_EVENT_POWERCAP_MEASUREMENTS_CHANGED)
+ supported = dom_info->notify_powercap_measurement_change;
+
+ return supported;
+}
+
static int
scmi_powercap_set_notify_enabled(const struct scmi_protocol_handle *ph,
u8 evt_id, u32 src_id, bool enable)
@@ -904,6 +940,7 @@ static const struct scmi_event powercap_events[] = {
};
static const struct scmi_event_ops powercap_event_ops = {
+ .is_notify_supported = scmi_powercap_notify_supported,
.get_num_sources = scmi_powercap_get_num_sources,
.set_notify_enabled = scmi_powercap_set_notify_enabled,
.fill_custom_report = scmi_powercap_fill_custom_report,
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 10/11] firmware: arm_scmi: Use opps_by_lvl to store opps
2024-02-12 12:32 [PATCH 00/11] Add SCMI core checks for notification support Cristian Marussi
` (8 preceding siblings ...)
2024-02-12 12:32 ` [PATCH 09/11] firmware: arm_scmi: Implement Powercap " Cristian Marussi
@ 2024-02-12 12:32 ` Cristian Marussi
2024-02-12 12:32 ` [PATCH 11/11] firmware: arm_scmi: Report frequencies in Perf notifications Cristian Marussi
2024-02-22 9:09 ` [PATCH 00/11] Add SCMI core checks for notification support Sudeep Holla
11 siblings, 0 replies; 19+ messages in thread
From: Cristian Marussi @ 2024-02-12 12:32 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel
Cc: sudeep.holla, vincent.guittot, peng.fan, michal.simek,
quic_sibis, quic_nkela, souvik.chakravarty, Cristian Marussi
Store all the discovered OPPs into the XArray opps_by_lvl even when
level_indexing mode is not used, since it comes handy to easily retrieve
OPPs by level.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
drivers/firmware/arm_scmi/perf.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index 2627ace5b07f..e20d137a92f6 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -326,9 +326,9 @@ scmi_perf_domain_attributes_get(const struct scmi_protocol_handle *ph,
dom_info->id, NULL, dom_info->info.name,
SCMI_MAX_STR_SIZE);
+ xa_init(&dom_info->opps_by_lvl);
if (dom_info->level_indexing_mode) {
xa_init(&dom_info->opps_by_idx);
- xa_init(&dom_info->opps_by_lvl);
hash_init(dom_info->opps_by_freq);
}
@@ -371,13 +371,21 @@ static int iter_perf_levels_update_state(struct scmi_iterator_state *st,
}
static inline void
-process_response_opp(struct scmi_opp *opp, unsigned int loop_idx,
+process_response_opp(struct device *dev, struct perf_dom_info *dom,
+ struct scmi_opp *opp, unsigned int loop_idx,
const struct scmi_msg_resp_perf_describe_levels *r)
{
+ int ret;
+
opp->perf = le32_to_cpu(r->opp[loop_idx].perf_val);
opp->power = le32_to_cpu(r->opp[loop_idx].power);
opp->trans_latency_us =
le16_to_cpu(r->opp[loop_idx].transition_latency_us);
+
+ ret = xa_insert(&dom->opps_by_lvl, opp->perf, opp, GFP_KERNEL);
+ if (ret)
+ dev_warn(dev, "Failed to add opps_by_lvl at %d - ret:%d\n",
+ opp->perf, ret);
}
static inline void
@@ -385,16 +393,21 @@ process_response_opp_v4(struct device *dev, struct perf_dom_info *dom,
struct scmi_opp *opp, unsigned int loop_idx,
const struct scmi_msg_resp_perf_describe_levels_v4 *r)
{
+ int ret;
+
opp->perf = le32_to_cpu(r->opp[loop_idx].perf_val);
opp->power = le32_to_cpu(r->opp[loop_idx].power);
opp->trans_latency_us =
le16_to_cpu(r->opp[loop_idx].transition_latency_us);
+ ret = xa_insert(&dom->opps_by_lvl, opp->perf, opp, GFP_KERNEL);
+ if (ret)
+ dev_warn(dev, "Failed to add opps_by_lvl at %d - ret:%d\n",
+ opp->perf, ret);
+
/* Note that PERF v4 reports always five 32-bit words */
opp->indicative_freq = le32_to_cpu(r->opp[loop_idx].indicative_freq);
if (dom->level_indexing_mode) {
- int ret;
-
opp->level_index = le32_to_cpu(r->opp[loop_idx].level_index);
ret = xa_insert(&dom->opps_by_idx, opp->level_index, opp,
@@ -404,12 +417,6 @@ process_response_opp_v4(struct device *dev, struct perf_dom_info *dom,
"Failed to add opps_by_idx at %d - ret:%d\n",
opp->level_index, ret);
- ret = xa_insert(&dom->opps_by_lvl, opp->perf, opp, GFP_KERNEL);
- if (ret)
- dev_warn(dev,
- "Failed to add opps_by_lvl at %d - ret:%d\n",
- opp->perf, ret);
-
hash_add(dom->opps_by_freq, &opp->hash, opp->indicative_freq);
}
}
@@ -424,7 +431,8 @@ iter_perf_levels_process_response(const struct scmi_protocol_handle *ph,
opp = &p->perf_dom->opp[st->desc_index + st->loop_idx];
if (PROTOCOL_REV_MAJOR(p->version) <= 0x3)
- process_response_opp(opp, st->loop_idx, response);
+ process_response_opp(ph->dev, p->perf_dom, opp, st->loop_idx,
+ response);
else
process_response_opp_v4(ph->dev, p->perf_dom, opp, st->loop_idx,
response);
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 11/11] firmware: arm_scmi: Report frequencies in Perf notifications
2024-02-12 12:32 [PATCH 00/11] Add SCMI core checks for notification support Cristian Marussi
` (9 preceding siblings ...)
2024-02-12 12:32 ` [PATCH 10/11] firmware: arm_scmi: Use opps_by_lvl to store opps Cristian Marussi
@ 2024-02-12 12:32 ` Cristian Marussi
2024-02-22 9:09 ` [PATCH 00/11] Add SCMI core checks for notification support Sudeep Holla
11 siblings, 0 replies; 19+ messages in thread
From: Cristian Marussi @ 2024-02-12 12:32 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel
Cc: sudeep.holla, vincent.guittot, peng.fan, michal.simek,
quic_sibis, quic_nkela, souvik.chakravarty, Cristian Marussi
Extend the Perf notification report to include pre-calculated frequencies
corresponding to the reported limits/levels event; such frequencies are
properly computed based on the stored known OPPs information taking into
consideration if the current operating mode is level indexed or not.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
drivers/firmware/arm_scmi/perf.c | 69 ++++++++++++++++++++++++++++++++
include/linux/scmi_protocol.h | 3 ++
2 files changed, 72 insertions(+)
diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index e20d137a92f6..981e327e63e3 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -1055,18 +1055,47 @@ static int scmi_perf_set_notify_enabled(const struct scmi_protocol_handle *ph,
return ret;
}
+static int
+scmi_perf_xlate_opp_to_freq(struct perf_dom_info *dom,
+ unsigned int index, unsigned long *freq)
+{
+ struct scmi_opp *opp;
+
+ if (!dom || !freq)
+ return -EINVAL;
+
+ if (!dom->level_indexing_mode) {
+ opp = xa_load(&dom->opps_by_lvl, index);
+ if (!opp)
+ return -ENODEV;
+
+ *freq = opp->perf * dom->mult_factor;
+ } else {
+ opp = xa_load(&dom->opps_by_idx, index);
+ if (!opp)
+ return -ENODEV;
+
+ *freq = opp->indicative_freq * dom->mult_factor;
+ }
+
+ return 0;
+}
+
static void *scmi_perf_fill_custom_report(const struct scmi_protocol_handle *ph,
u8 evt_id, ktime_t timestamp,
const void *payld, size_t payld_sz,
void *report, u32 *src_id)
{
+ int ret;
void *rep = NULL;
+ struct perf_dom_info *dom;
switch (evt_id) {
case SCMI_EVENT_PERFORMANCE_LIMITS_CHANGED:
{
const struct scmi_perf_limits_notify_payld *p = payld;
struct scmi_perf_limits_report *r = report;
+ unsigned long freq_min, freq_max;
if (sizeof(*p) != payld_sz)
break;
@@ -1076,14 +1105,36 @@ static void *scmi_perf_fill_custom_report(const struct scmi_protocol_handle *ph,
r->domain_id = le32_to_cpu(p->domain_id);
r->range_max = le32_to_cpu(p->range_max);
r->range_min = le32_to_cpu(p->range_min);
+ /* Check if the reported domain exist at all */
+ dom = scmi_perf_domain_lookup(ph, r->domain_id);
+ if (IS_ERR(dom))
+ break;
+ /*
+ * Event will be reported from this point on...
+ * ...even if, later, xlated frequencies were not retrieved.
+ */
*src_id = r->domain_id;
rep = r;
+
+ ret = scmi_perf_xlate_opp_to_freq(dom, r->range_max, &freq_max);
+ if (ret)
+ break;
+
+ ret = scmi_perf_xlate_opp_to_freq(dom, r->range_min, &freq_min);
+ if (ret)
+ break;
+
+ /* Report translated freqs ONLY if both available */
+ r->range_max_freq = freq_max;
+ r->range_min_freq = freq_min;
+
break;
}
case SCMI_EVENT_PERFORMANCE_LEVEL_CHANGED:
{
const struct scmi_perf_level_notify_payld *p = payld;
struct scmi_perf_level_report *r = report;
+ unsigned long freq;
if (sizeof(*p) != payld_sz)
break;
@@ -1091,9 +1142,27 @@ static void *scmi_perf_fill_custom_report(const struct scmi_protocol_handle *ph,
r->timestamp = timestamp;
r->agent_id = le32_to_cpu(p->agent_id);
r->domain_id = le32_to_cpu(p->domain_id);
+ /* Report translated freqs ONLY if available */
r->performance_level = le32_to_cpu(p->performance_level);
+ /* Check if the reported domain exist at all */
+ dom = scmi_perf_domain_lookup(ph, r->domain_id);
+ if (IS_ERR(dom))
+ break;
+ /*
+ * Event will be reported from this point on...
+ * ...even if, later, xlated frequencies were not retrieved.
+ */
*src_id = r->domain_id;
rep = r;
+
+ /* Report translated freqs ONLY if available */
+ ret = scmi_perf_xlate_opp_to_freq(dom, r->performance_level,
+ &freq);
+ if (ret)
+ break;
+
+ r->performance_level_freq = freq;
+
break;
}
default:
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index 0cc40af5519a..9b9351e07a11 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -956,6 +956,8 @@ struct scmi_perf_limits_report {
unsigned int domain_id;
unsigned int range_max;
unsigned int range_min;
+ unsigned long range_max_freq;
+ unsigned long range_min_freq;
};
struct scmi_perf_level_report {
@@ -963,6 +965,7 @@ struct scmi_perf_level_report {
unsigned int agent_id;
unsigned int domain_id;
unsigned int performance_level;
+ unsigned long performance_level_freq;
};
struct scmi_sensor_trip_point_report {
--
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 00/11] Add SCMI core checks for notification support.
2024-02-12 12:32 [PATCH 00/11] Add SCMI core checks for notification support Cristian Marussi
` (10 preceding siblings ...)
2024-02-12 12:32 ` [PATCH 11/11] firmware: arm_scmi: Report frequencies in Perf notifications Cristian Marussi
@ 2024-02-22 9:09 ` Sudeep Holla
11 siblings, 0 replies; 19+ messages in thread
From: Sudeep Holla @ 2024-02-22 9:09 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, Cristian Marussi
Cc: Sudeep Holla, vincent.guittot, peng.fan, michal.simek,
quic_sibis, quic_nkela, souvik.chakravarty
On Mon, 12 Feb 2024 12:32:22 +0000, Cristian Marussi wrote:
> this small series adds a new logic into the SCMI core to implicitly check
> for notification support when some SCMI driver attempts to register for
> notifications.
>
> Till now, trying to register a notifier for an unsuppported notification
> returned an error and this behaviour generated unneeded message exchanges:
> the only way to avoid this was to lookup in advance the specific protocol
> and resources available in order to avoid registering at all any notifier
> where not supported.
>
> [...]
Applied to sudeep.holla/linux (for-next/scmi/updates), thanks!
[01/11] firmware: arm_scmi: Check for notification support
https://git.kernel.org/sudeep.holla/c/8733e86a80f5
[02/11] firmware: arm_scmi: Add a common helper to check if a message is supported
https://git.kernel.org/sudeep.holla/c/637b6d6cae9c
[03/11] firmware: arm_scmi: Implement Perf .is_notify_supported callback
https://git.kernel.org/sudeep.holla/c/120d26312abc
[04/11] firmware: arm_scmi: Implement Power .is_notify_supported callback
https://git.kernel.org/sudeep.holla/c/b7e400bc2e2d
[05/11] firmware: arm_scmi: Implement SysPower .is_notify_supported callback
https://git.kernel.org/sudeep.holla/c/9f5ddbc22225
[06/11] firmware: arm_scmi: Implement Clock .is_notify_supported callback
https://git.kernel.org/sudeep.holla/c/cf1bba2775ec
[07/11] firmware: arm_scmi: Implement Sensor .is_notify_supported callback
https://git.kernel.org/sudeep.holla/c/7ac7932df247
[08/11] firmware: arm_scmi: Implement Reset .is_notify_supported callback
https://git.kernel.org/sudeep.holla/c/12d6a03f3224
[09/11] firmware: arm_scmi: Implement Powercap .is_notify_supported callback
https://git.kernel.org/sudeep.holla/c/e85beaf76080
[10/11] firmware: arm_scmi: Use opps_by_lvl to store opps
https://git.kernel.org/sudeep.holla/c/23443a3c7c0c
[11/11] firmware: arm_scmi: Report frequencies in Perf notifications
https://git.kernel.org/sudeep.holla/c/22ffc748a647
--
Regards,
Sudeep
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 19+ messages in thread