mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
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>
This commit is contained in:
committed by
Sudeep Holla
parent
c3f17d5f89
commit
b5efc28a75
@@ -13,6 +13,9 @@
|
||||
#include "common.h"
|
||||
#include "notify.h"
|
||||
|
||||
/* Updated only after ALL the mandatory features for that version are merged */
|
||||
#define SCMI_PROTOCOL_SUPPORTED_VERSION 0x20000
|
||||
|
||||
#define SCMI_BASE_NUM_SOURCES 1
|
||||
#define SCMI_BASE_MAX_CMD_ERR_COUNT 1024
|
||||
|
||||
@@ -385,7 +388,7 @@ static int scmi_base_protocol_init(const struct scmi_protocol_handle *ph)
|
||||
|
||||
rev->major_ver = PROTOCOL_REV_MAJOR(version),
|
||||
rev->minor_ver = PROTOCOL_REV_MINOR(version);
|
||||
ph->set_priv(ph, rev);
|
||||
ph->set_priv(ph, rev, version);
|
||||
|
||||
ret = scmi_base_attributes_get(ph);
|
||||
if (ret)
|
||||
@@ -423,6 +426,7 @@ static const struct scmi_protocol scmi_base = {
|
||||
.instance_init = &scmi_base_protocol_init,
|
||||
.ops = NULL,
|
||||
.events = &base_protocol_events,
|
||||
.supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION,
|
||||
};
|
||||
|
||||
DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(base, scmi_base)
|
||||
|
||||
Reference in New Issue
Block a user