diff options
author | Cristian Marussi <cristian.marussi@arm.com> | 2023-12-01 16:58:58 +0300 |
---|---|---|
committer | Sudeep Holla <sudeep.holla@arm.com> | 2023-12-01 19:46:10 +0300 |
commit | b5efc28a754d2e90b9d52ba5aaa051cc24a5c85d (patch) | |
tree | 4d8be46e4eb0b1298b8d1f85db303d53481d5cbb /drivers/firmware/arm_scmi/system.c | |
parent | c3f17d5f89fc72d7b170beaf393a8687ae938b19 (diff) | |
download | linux-b5efc28a754d2e90b9d52ba5aaa051cc24a5c85d.tar.xz |
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/system.c')
-rw-r--r-- | drivers/firmware/arm_scmi/system.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/firmware/arm_scmi/system.c b/drivers/firmware/arm_scmi/system.c index 9383d7584539..1621da97bcbb 100644 --- a/drivers/firmware/arm_scmi/system.c +++ b/drivers/firmware/arm_scmi/system.c @@ -13,6 +13,9 @@ #include "protocols.h" #include "notify.h" +/* Updated only after ALL the mandatory features for that version are merged */ +#define SCMI_PROTOCOL_SUPPORTED_VERSION 0x20000 + #define SCMI_SYSTEM_NUM_SOURCES 1 enum scmi_system_protocol_cmd { @@ -144,7 +147,7 @@ static int scmi_system_protocol_init(const struct scmi_protocol_handle *ph) if (PROTOCOL_REV_MAJOR(pinfo->version) >= 0x2) pinfo->graceful_timeout_supported = true; - return ph->set_priv(ph, pinfo); + return ph->set_priv(ph, pinfo, version); } static const struct scmi_protocol scmi_system = { @@ -153,6 +156,7 @@ static const struct scmi_protocol scmi_system = { .instance_init = &scmi_system_protocol_init, .ops = NULL, .events = &system_protocol_events, + .supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION, }; DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(system, scmi_system) |