summaryrefslogtreecommitdiffstats
path: root/drivers/firmware/arm_scmi/protocols.h
diff options
context:
space:
mode:
authorCristian Marussi <cristian.marussi@arm.com>2023-12-01 13:58:58 +0000
committerSudeep Holla <sudeep.holla@arm.com>2023-12-01 16:46:10 +0000
commitb5efc28a754d2e90b9d52ba5aaa051cc24a5c85d (patch)
tree4d8be46e4eb0b1298b8d1f85db303d53481d5cbb /drivers/firmware/arm_scmi/protocols.h
parentc3f17d5f89fc72d7b170beaf393a8687ae938b19 (diff)
downloadlinux-b5efc28a754d2e90b9d52ba5aaa051cc24a5c85d.tar.gz
linux-b5efc28a754d2e90b9d52ba5aaa051cc24a5c85d.tar.bz2
linux-b5efc28a754d2e90b9d52ba5aaa051cc24a5c85d.zip
firmware: arm_scmi: Add protocol versioning checks
Platform and agent supported protocols versions do not necessarily match. When talking to an older SCMI platform, supporting only older protocol versions, the kernel SCMI agent will downgrade the version of the used protocol to match the platform and avoid compatibility issues. In the case where the kernel/OSPM agent happens to communicate with a newer platform which can support newer protocol versions unknown to the agent, and potentially backward incompatible, the agent currently carries on, silently, in a best-effort approach. Note that the SCMI specification doesn't provide means to explicitly detect the protocol versions used by the agents, neither it is required to support multiple, older, protocol versions. Add an explicit protocol version check to let the agent detect when this version mismatch happens and warn the user about this condition. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Link: https://lore.kernel.org/r/20231201135858.2367651-1-cristian.marussi@arm.com Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Diffstat (limited to 'drivers/firmware/arm_scmi/protocols.h')
-rw-r--r--drivers/firmware/arm_scmi/protocols.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/firmware/arm_scmi/protocols.h b/drivers/firmware/arm_scmi/protocols.h
index b3c6314bb4b8..e683c26f24eb 100644
--- a/drivers/firmware/arm_scmi/protocols.h
+++ b/drivers/firmware/arm_scmi/protocols.h
@@ -174,7 +174,8 @@ struct scmi_protocol_handle {
struct device *dev;
const struct scmi_xfer_ops *xops;
const struct scmi_proto_helpers_ops *hops;
- int (*set_priv)(const struct scmi_protocol_handle *ph, void *priv);
+ int (*set_priv)(const struct scmi_protocol_handle *ph, void *priv,
+ u32 version);
void *(*get_priv)(const struct scmi_protocol_handle *ph);
};
@@ -311,6 +312,10 @@ typedef int (*scmi_prot_init_ph_fn_t)(const struct scmi_protocol_handle *);
* @ops: Optional reference to the operations provided by the protocol and
* exposed in scmi_protocol.h.
* @events: An optional reference to the events supported by this protocol.
+ * @supported_version: The highest version currently supported for this
+ * protocol by the agent. Each protocol implementation
+ * in the agent is supposed to downgrade to match the
+ * protocol version supported by the platform.
*/
struct scmi_protocol {
const u8 id;
@@ -319,6 +324,7 @@ struct scmi_protocol {
const scmi_prot_init_ph_fn_t instance_deinit;
const void *ops;
const struct scmi_protocol_events *events;
+ unsigned int supported_version;
};
#define DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(name, proto) \