mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
Arm SCMI updates for v6.8
Few minor updates: 1. Addition of protocol versioning checks to warn if the firmware version is newer or greater than the version supported by the kernel driver 2. Increment of the maximum OPP count in the perf protocol from 16 to 32 as needed by a few recent/future qualcomm platforms 3. Optimisation of set performance operations by returning error immediately and avoiding to send the command to the platform(which would return error eventually) if the domain doesn't support perf operations. Similarly, the fastchannel handling is also optimised by avoiding to initialise the corresponding set operations fastchannels. 4. Extension of extended names helper to accomodate recently added new flags parameter to be able to properly configure the command used to query the extended name of a resource. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEunHlEgbzHrJD3ZPhAEG6vDF+4pgFAmV5mGIACgkQAEG6vDF+ 4pjgUxAAkKEp2W9nPYwxyLZl2KVyoP0a2EsAmi0W0rTUO//kM5dUH2qET3toEs8B wed80pv5Pda4jzLci7TJlho/CT0Sz0O19o+Yeg6f96wdsXHgvf3oK1YVQfnYdL3k yZ4bXfblVhSJ0qfRhTIwFt+xa/Gtao6VDdKQb240vyXN+Xf/6mk/j3pplj9nx6FL DMuZkfYamvbNWAanXOTNsCeqQkW1bf6IsYecj6tJEmFNhQUrx7eS9vgpbfU9kkuH 6Y6bsIuRqlJYHG7qk1dzCC36ORTf8taHr64G2MIw/SuxZDB/IGmseBBUTfD3fu3x cSDYTnzX0An+vhFe30rh3nWFZff+1Oz478JOsZVrHcLuXVtfp/barcb9znazlc8Q e2iigyWuwUQqM4busZEJ/N5kB12qF93SJNs/O7Y3AyTXibyxwkv0mD81iPKY5L7s P+eLxXfYTjjNFrJuytKZ46si3GTWMv+Si52IsY+Iq946dXgW+RirMO5cZjCPPj5+ FMPAtlQo+DNVwMNukVInsmyIf+o2GdUYk5W8t65ZHiiWm3BjnZW6pbSW26gmba21 49oWMoQWCd4+gXlevq/8LX7bFWfF6dBjYZfkrq7WXxQ4obUq867J5kQL4DevuFcC wSNxAsasPkmWTFRn7kuJyJ6AI9lMB95fbDrhVU4wq3nISrBM2uc= =VpGl -----END PGP SIGNATURE----- gpgsig -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmWFdEUACgkQYKtH/8kJ UifNjQ/9FWSbxGA5joIUH/JpFNPxcw8whXyxHOdVar/p8NfLrAugQhr/1qrPP/Vg OW+2rOHAnstNF9VgRVuaufpO2yhWoyQlmSeuVGYSISctgDabtTjlT1nRaljHjRGp xQvsIbYT1fwaMhLHVyR+K6qlCibdN/K2y8wSInECfgAQcQWxmOKPrUdG3c+jXCzw RB7/KJmDcOBvDPswNe65Py24XBF+4B6h/ot4RaPVhxrEn9pnGKQs2dsCep7tsq22 8MBigKW+bvGcBRzYgIVNwUTUlh+d+LFrenbk+8LStXALWp3w62syFhfnjsuEZHzj abdd7CjFXqvK4Gn+yyBevOc8JBI033V/FIsT+p+JHDXl068W8Dpadz6YRQ50OElj 3L7v12xSaKiC7EM9CxJEQIcSrHmlcVeFf3AJ3fD07YiKFg9NhlSqed34FfJKiaNR jS6NGxiHlmzN6Xpp/V6YzcFAddhRkf5YVaTEP2eLC0QG94ddJSSt6saSCovekG1c xugYDedmOjEWkrXLE5tp6VyjIGEFuOFfRuChQj+bEMi+N7xiJsoeUlZ49BaoIRvS ZxSYrq66PFNtIbis0Y2Xd8SCbMMl7yxHLWEExFtmiROsJN15vdlncLYYtTak6FdY hcdq+qIoVV/OMBNq9JS/H4wcurvV+7Qm4bkF0Ch6ApH1lIDybM4= =h4CZ -----END PGP SIGNATURE----- Merge tag 'scmi-updates-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into soc/drivers Arm SCMI updates for v6.8 Few minor updates: 1. Addition of protocol versioning checks to warn if the firmware version is newer or greater than the version supported by the kernel driver 2. Increment of the maximum OPP count in the perf protocol from 16 to 32 as needed by a few recent/future qualcomm platforms 3. Optimisation of set performance operations by returning error immediately and avoiding to send the command to the platform(which would return error eventually) if the domain doesn't support perf operations. Similarly, the fastchannel handling is also optimised by avoiding to initialise the corresponding set operations fastchannels. 4. Extension of extended names helper to accomodate recently added new flags parameter to be able to properly configure the command used to query the extended name of a resource. * tag 'scmi-updates-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux: firmware: arm_scmi: Add protocol versioning checks firmware: arm_scmi: Increase the maximum opp count in the perf protocol firmware: arm_scmi: Fix NULL pointer dereference during fastchannel init firmware: arm_scmi: Add optional flags to extended names helper firmware: arm_scmi: Populate fastchannel info only if set operations are allowed firmware: arm_scmi: Check beforehand if the perf domain set operations are allowed Link: https://lore.kernel.org/r/20231213115953.3578115-1-sudeep.holla@arm.com Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
commit
740f4bd6e4
11 changed files with 105 additions and 39 deletions
|
@ -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)
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
#include "protocols.h"
|
||||
#include "notify.h"
|
||||
|
||||
/* Updated only after ALL the mandatory features for that version are merged */
|
||||
#define SCMI_PROTOCOL_SUPPORTED_VERSION 0x20001
|
||||
|
||||
enum scmi_clock_protocol_cmd {
|
||||
CLOCK_ATTRIBUTES = 0x3,
|
||||
CLOCK_DESCRIBE_RATES = 0x4,
|
||||
|
@ -318,7 +321,7 @@ static int scmi_clock_attributes_get(const struct scmi_protocol_handle *ph,
|
|||
if (!ret && PROTOCOL_REV_MAJOR(version) >= 0x2) {
|
||||
if (SUPPORTS_EXTENDED_NAMES(attributes))
|
||||
ph->hops->extended_name_get(ph, CLOCK_NAME_GET, clk_id,
|
||||
clk->name,
|
||||
NULL, clk->name,
|
||||
SCMI_MAX_STR_SIZE);
|
||||
|
||||
if (SUPPORTS_RATE_CHANGED_NOTIF(attributes))
|
||||
|
@ -961,7 +964,7 @@ static int scmi_clock_protocol_init(const struct scmi_protocol_handle *ph)
|
|||
}
|
||||
|
||||
cinfo->version = version;
|
||||
return ph->set_priv(ph, cinfo);
|
||||
return ph->set_priv(ph, cinfo, version);
|
||||
}
|
||||
|
||||
static const struct scmi_protocol scmi_clock = {
|
||||
|
@ -970,6 +973,7 @@ static const struct scmi_protocol scmi_clock = {
|
|||
.instance_init = &scmi_clock_protocol_init,
|
||||
.ops = &clk_proto_ops,
|
||||
.events = &clk_protocol_events,
|
||||
.supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION,
|
||||
};
|
||||
|
||||
DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(clock, scmi_clock)
|
||||
|
|
|
@ -85,6 +85,7 @@ struct scmi_xfers_info {
|
|||
* @gid: A reference for per-protocol devres management.
|
||||
* @users: A refcount to track effective users of this protocol.
|
||||
* @priv: Reference for optional protocol private data.
|
||||
* @version: Protocol version supported by the platform as detected at runtime.
|
||||
* @ph: An embedded protocol handle that will be passed down to protocol
|
||||
* initialization code to identify this instance.
|
||||
*
|
||||
|
@ -97,6 +98,7 @@ struct scmi_protocol_instance {
|
|||
void *gid;
|
||||
refcount_t users;
|
||||
void *priv;
|
||||
unsigned int version;
|
||||
struct scmi_protocol_handle ph;
|
||||
};
|
||||
|
||||
|
@ -1392,15 +1394,17 @@ static int version_get(const struct scmi_protocol_handle *ph, u32 *version)
|
|||
*
|
||||
* @ph: A reference to the protocol handle.
|
||||
* @priv: The private data to set.
|
||||
* @version: The detected protocol version for the core to register.
|
||||
*
|
||||
* Return: 0 on Success
|
||||
*/
|
||||
static int scmi_set_protocol_priv(const struct scmi_protocol_handle *ph,
|
||||
void *priv)
|
||||
void *priv, u32 version)
|
||||
{
|
||||
struct scmi_protocol_instance *pi = ph_to_pi(ph);
|
||||
|
||||
pi->priv = priv;
|
||||
pi->version = version;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1438,6 +1442,7 @@ struct scmi_msg_resp_domain_name_get {
|
|||
* @ph: A protocol handle reference.
|
||||
* @cmd_id: The specific command ID to use.
|
||||
* @res_id: The specific resource ID to use.
|
||||
* @flags: A pointer to specific flags to use, if any.
|
||||
* @name: A pointer to the preallocated area where the retrieved name will be
|
||||
* stored as a NULL terminated string.
|
||||
* @len: The len in bytes of the @name char array.
|
||||
|
@ -1445,19 +1450,22 @@ struct scmi_msg_resp_domain_name_get {
|
|||
* Return: 0 on Succcess
|
||||
*/
|
||||
static int scmi_common_extended_name_get(const struct scmi_protocol_handle *ph,
|
||||
u8 cmd_id, u32 res_id, char *name,
|
||||
size_t len)
|
||||
u8 cmd_id, u32 res_id, u32 *flags,
|
||||
char *name, size_t len)
|
||||
{
|
||||
int ret;
|
||||
size_t txlen;
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_msg_resp_domain_name_get *resp;
|
||||
|
||||
ret = ph->xops->xfer_get_init(ph, cmd_id, sizeof(res_id),
|
||||
sizeof(*resp), &t);
|
||||
txlen = !flags ? sizeof(res_id) : sizeof(res_id) + sizeof(*flags);
|
||||
ret = ph->xops->xfer_get_init(ph, cmd_id, txlen, sizeof(*resp), &t);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
put_unaligned_le32(res_id, t->tx.buf);
|
||||
if (flags)
|
||||
put_unaligned_le32(*flags, t->tx.buf + sizeof(res_id));
|
||||
resp = t->rx.buf;
|
||||
|
||||
ret = ph->xops->do_xfer(ph, t);
|
||||
|
@ -1845,6 +1853,12 @@ scmi_alloc_init_protocol_instance(struct scmi_info *info,
|
|||
devres_close_group(handle->dev, pi->gid);
|
||||
dev_dbg(handle->dev, "Initialized protocol: 0x%X\n", pi->proto->id);
|
||||
|
||||
if (pi->version > proto->supported_version)
|
||||
dev_warn(handle->dev,
|
||||
"Detected UNSUPPORTED higher version 0x%X for protocol 0x%X."
|
||||
"Backward compatibility is NOT assured.\n",
|
||||
pi->version, pi->proto->id);
|
||||
|
||||
return pi;
|
||||
|
||||
clean:
|
||||
|
|
|
@ -24,7 +24,10 @@
|
|||
#include "protocols.h"
|
||||
#include "notify.h"
|
||||
|
||||
#define MAX_OPPS 16
|
||||
/* Updated only after ALL the mandatory features for that version are merged */
|
||||
#define SCMI_PROTOCOL_SUPPORTED_VERSION 0x40000
|
||||
|
||||
#define MAX_OPPS 32
|
||||
|
||||
enum scmi_performance_protocol_cmd {
|
||||
PERF_DOMAIN_ATTRIBUTES = 0x3,
|
||||
|
@ -288,7 +291,7 @@ scmi_perf_domain_attributes_get(const struct scmi_protocol_handle *ph,
|
|||
if (!ret && PROTOCOL_REV_MAJOR(version) >= 0x3 &&
|
||||
SUPPORTS_EXTENDED_NAMES(flags))
|
||||
ph->hops->extended_name_get(ph, PERF_DOMAIN_NAME_GET,
|
||||
dom_info->id, dom_info->info.name,
|
||||
dom_info->id, NULL, dom_info->info.name,
|
||||
SCMI_MAX_STR_SIZE);
|
||||
|
||||
if (dom_info->level_indexing_mode) {
|
||||
|
@ -504,6 +507,9 @@ static int scmi_perf_limits_set(const struct scmi_protocol_handle *ph,
|
|||
if (IS_ERR(dom))
|
||||
return PTR_ERR(dom);
|
||||
|
||||
if (!dom->set_limits)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3 && !max_perf && !min_perf)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -654,6 +660,9 @@ static int scmi_perf_level_set(const struct scmi_protocol_handle *ph,
|
|||
if (IS_ERR(dom))
|
||||
return PTR_ERR(dom);
|
||||
|
||||
if (!dom->info.set_perf)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (dom->level_indexing_mode) {
|
||||
struct scmi_opp *opp;
|
||||
|
||||
|
@ -753,7 +762,7 @@ static int scmi_perf_level_limits_notify(const struct scmi_protocol_handle *ph,
|
|||
}
|
||||
|
||||
static void scmi_perf_domain_init_fc(const struct scmi_protocol_handle *ph,
|
||||
u32 domain, struct scmi_fc_info **p_fc)
|
||||
struct perf_dom_info *dom)
|
||||
{
|
||||
struct scmi_fc_info *fc;
|
||||
|
||||
|
@ -762,24 +771,26 @@ static void scmi_perf_domain_init_fc(const struct scmi_protocol_handle *ph,
|
|||
return;
|
||||
|
||||
ph->hops->fastchannel_init(ph, PERF_DESCRIBE_FASTCHANNEL,
|
||||
PERF_LEVEL_SET, 4, domain,
|
||||
&fc[PERF_FC_LEVEL].set_addr,
|
||||
&fc[PERF_FC_LEVEL].set_db);
|
||||
|
||||
ph->hops->fastchannel_init(ph, PERF_DESCRIBE_FASTCHANNEL,
|
||||
PERF_LEVEL_GET, 4, domain,
|
||||
PERF_LEVEL_GET, 4, dom->id,
|
||||
&fc[PERF_FC_LEVEL].get_addr, NULL);
|
||||
|
||||
ph->hops->fastchannel_init(ph, PERF_DESCRIBE_FASTCHANNEL,
|
||||
PERF_LIMITS_SET, 8, domain,
|
||||
&fc[PERF_FC_LIMIT].set_addr,
|
||||
&fc[PERF_FC_LIMIT].set_db);
|
||||
|
||||
ph->hops->fastchannel_init(ph, PERF_DESCRIBE_FASTCHANNEL,
|
||||
PERF_LIMITS_GET, 8, domain,
|
||||
PERF_LIMITS_GET, 8, dom->id,
|
||||
&fc[PERF_FC_LIMIT].get_addr, NULL);
|
||||
|
||||
*p_fc = fc;
|
||||
if (dom->info.set_perf)
|
||||
ph->hops->fastchannel_init(ph, PERF_DESCRIBE_FASTCHANNEL,
|
||||
PERF_LEVEL_SET, 4, dom->id,
|
||||
&fc[PERF_FC_LEVEL].set_addr,
|
||||
&fc[PERF_FC_LEVEL].set_db);
|
||||
|
||||
if (dom->set_limits)
|
||||
ph->hops->fastchannel_init(ph, PERF_DESCRIBE_FASTCHANNEL,
|
||||
PERF_LIMITS_SET, 8, dom->id,
|
||||
&fc[PERF_FC_LIMIT].set_addr,
|
||||
&fc[PERF_FC_LIMIT].set_db);
|
||||
|
||||
dom->fc_info = fc;
|
||||
}
|
||||
|
||||
static int scmi_dvfs_device_opps_add(const struct scmi_protocol_handle *ph,
|
||||
|
@ -1089,14 +1100,14 @@ static int scmi_perf_protocol_init(const struct scmi_protocol_handle *ph)
|
|||
scmi_perf_describe_levels_get(ph, dom, version);
|
||||
|
||||
if (dom->perf_fastchannels)
|
||||
scmi_perf_domain_init_fc(ph, dom->id, &dom->fc_info);
|
||||
scmi_perf_domain_init_fc(ph, dom);
|
||||
}
|
||||
|
||||
ret = devm_add_action_or_reset(ph->dev, scmi_perf_xa_destroy, pinfo);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return ph->set_priv(ph, pinfo);
|
||||
return ph->set_priv(ph, pinfo, version);
|
||||
}
|
||||
|
||||
static const struct scmi_protocol scmi_perf = {
|
||||
|
@ -1105,6 +1116,7 @@ static const struct scmi_protocol scmi_perf = {
|
|||
.instance_init = &scmi_perf_protocol_init,
|
||||
.ops = &perf_proto_ops,
|
||||
.events = &perf_protocol_events,
|
||||
.supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION,
|
||||
};
|
||||
|
||||
DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(perf, scmi_perf)
|
||||
|
|
|
@ -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 0x30000
|
||||
|
||||
enum scmi_power_protocol_cmd {
|
||||
POWER_DOMAIN_ATTRIBUTES = 0x3,
|
||||
POWER_STATE_SET = 0x4,
|
||||
|
@ -133,7 +136,7 @@ scmi_power_domain_attributes_get(const struct scmi_protocol_handle *ph,
|
|||
if (!ret && PROTOCOL_REV_MAJOR(version) >= 0x3 &&
|
||||
SUPPORTS_EXTENDED_NAMES(flags)) {
|
||||
ph->hops->extended_name_get(ph, POWER_DOMAIN_NAME_GET,
|
||||
domain, dom_info->name,
|
||||
domain, NULL, dom_info->name,
|
||||
SCMI_MAX_STR_SIZE);
|
||||
}
|
||||
|
||||
|
@ -328,7 +331,7 @@ static int scmi_power_protocol_init(const struct scmi_protocol_handle *ph)
|
|||
|
||||
pinfo->version = version;
|
||||
|
||||
return ph->set_priv(ph, pinfo);
|
||||
return ph->set_priv(ph, pinfo, version);
|
||||
}
|
||||
|
||||
static const struct scmi_protocol scmi_power = {
|
||||
|
@ -337,6 +340,7 @@ static const struct scmi_protocol scmi_power = {
|
|||
.instance_init = &scmi_power_protocol_init,
|
||||
.ops = &power_proto_ops,
|
||||
.events = &power_protocol_events,
|
||||
.supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION,
|
||||
};
|
||||
|
||||
DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(power, scmi_power)
|
||||
|
|
|
@ -17,6 +17,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
|
||||
|
||||
enum scmi_powercap_protocol_cmd {
|
||||
POWERCAP_DOMAIN_ATTRIBUTES = 0x3,
|
||||
POWERCAP_CAP_GET = 0x4,
|
||||
|
@ -270,7 +273,7 @@ clean:
|
|||
*/
|
||||
if (!ret && SUPPORTS_EXTENDED_NAMES(flags))
|
||||
ph->hops->extended_name_get(ph, POWERCAP_DOMAIN_NAME_GET,
|
||||
domain, dom_info->name,
|
||||
domain, NULL, dom_info->name,
|
||||
SCMI_MAX_STR_SIZE);
|
||||
|
||||
return ret;
|
||||
|
@ -975,7 +978,7 @@ scmi_powercap_protocol_init(const struct scmi_protocol_handle *ph)
|
|||
}
|
||||
|
||||
pinfo->version = version;
|
||||
return ph->set_priv(ph, pinfo);
|
||||
return ph->set_priv(ph, pinfo, version);
|
||||
}
|
||||
|
||||
static const struct scmi_protocol scmi_powercap = {
|
||||
|
@ -984,6 +987,7 @@ static const struct scmi_protocol scmi_powercap = {
|
|||
.instance_init = &scmi_powercap_protocol_init,
|
||||
.ops = &powercap_proto_ops,
|
||||
.events = &powercap_protocol_events,
|
||||
.supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION,
|
||||
};
|
||||
|
||||
DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(powercap, scmi_powercap)
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
@ -256,7 +257,8 @@ struct scmi_fc_info {
|
|||
*/
|
||||
struct scmi_proto_helpers_ops {
|
||||
int (*extended_name_get)(const struct scmi_protocol_handle *ph,
|
||||
u8 cmd_id, u32 res_id, char *name, size_t len);
|
||||
u8 cmd_id, u32 res_id, u32 *flags, char *name,
|
||||
size_t len);
|
||||
void *(*iter_response_init)(const struct scmi_protocol_handle *ph,
|
||||
struct scmi_iterator_ops *ops,
|
||||
unsigned int max_resources, u8 msg_id,
|
||||
|
@ -310,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;
|
||||
|
@ -318,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) \
|
||||
|
|
|
@ -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 0x30000
|
||||
|
||||
enum scmi_reset_protocol_cmd {
|
||||
RESET_DOMAIN_ATTRIBUTES = 0x3,
|
||||
RESET = 0x4,
|
||||
|
@ -128,7 +131,8 @@ scmi_reset_domain_attributes_get(const struct scmi_protocol_handle *ph,
|
|||
if (!ret && PROTOCOL_REV_MAJOR(version) >= 0x3 &&
|
||||
SUPPORTS_EXTENDED_NAMES(attributes))
|
||||
ph->hops->extended_name_get(ph, RESET_DOMAIN_NAME_GET, domain,
|
||||
dom_info->name, SCMI_MAX_STR_SIZE);
|
||||
NULL, dom_info->name,
|
||||
SCMI_MAX_STR_SIZE);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -342,7 +346,7 @@ static int scmi_reset_protocol_init(const struct scmi_protocol_handle *ph)
|
|||
}
|
||||
|
||||
pinfo->version = version;
|
||||
return ph->set_priv(ph, pinfo);
|
||||
return ph->set_priv(ph, pinfo, version);
|
||||
}
|
||||
|
||||
static const struct scmi_protocol scmi_reset = {
|
||||
|
@ -351,6 +355,7 @@ static const struct scmi_protocol scmi_reset = {
|
|||
.instance_init = &scmi_reset_protocol_init,
|
||||
.ops = &reset_proto_ops,
|
||||
.events = &reset_protocol_events,
|
||||
.supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION,
|
||||
};
|
||||
|
||||
DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(reset, scmi_reset)
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
#include "protocols.h"
|
||||
#include "notify.h"
|
||||
|
||||
/* Updated only after ALL the mandatory features for that version are merged */
|
||||
#define SCMI_PROTOCOL_SUPPORTED_VERSION 0x30000
|
||||
|
||||
#define SCMI_MAX_NUM_SENSOR_AXIS 63
|
||||
#define SCMIv2_SENSOR_PROTOCOL 0x10000
|
||||
|
||||
|
@ -644,7 +647,7 @@ iter_sens_descr_process_response(const struct scmi_protocol_handle *ph,
|
|||
if (PROTOCOL_REV_MAJOR(si->version) >= 0x3 &&
|
||||
SUPPORTS_EXTENDED_NAMES(attrl))
|
||||
ph->hops->extended_name_get(ph, SENSOR_NAME_GET, s->id,
|
||||
s->name, SCMI_MAX_STR_SIZE);
|
||||
NULL, s->name, SCMI_MAX_STR_SIZE);
|
||||
|
||||
if (s->extended_scalar_attrs) {
|
||||
s->sensor_power = le32_to_cpu(sdesc->power);
|
||||
|
@ -1138,7 +1141,7 @@ static int scmi_sensors_protocol_init(const struct scmi_protocol_handle *ph)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
return ph->set_priv(ph, sinfo);
|
||||
return ph->set_priv(ph, sinfo, version);
|
||||
}
|
||||
|
||||
static const struct scmi_protocol scmi_sensors = {
|
||||
|
@ -1147,6 +1150,7 @@ static const struct scmi_protocol scmi_sensors = {
|
|||
.instance_init = &scmi_sensors_protocol_init,
|
||||
.ops = &sensor_proto_ops,
|
||||
.events = &sensor_protocol_events,
|
||||
.supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION,
|
||||
};
|
||||
|
||||
DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(sensors, scmi_sensors)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
|
||||
#include "protocols.h"
|
||||
|
||||
/* Updated only after ALL the mandatory features for that version are merged */
|
||||
#define SCMI_PROTOCOL_SUPPORTED_VERSION 0x20000
|
||||
|
||||
#define VOLTAGE_DOMS_NUM_MASK GENMASK(15, 0)
|
||||
#define REMAINING_LEVELS_MASK GENMASK(31, 16)
|
||||
#define RETURNED_LEVELS_MASK GENMASK(11, 0)
|
||||
|
@ -242,7 +245,7 @@ static int scmi_voltage_descriptors_get(const struct scmi_protocol_handle *ph,
|
|||
if (SUPPORTS_EXTENDED_NAMES(attributes))
|
||||
ph->hops->extended_name_get(ph,
|
||||
VOLTAGE_DOMAIN_NAME_GET,
|
||||
v->id, v->name,
|
||||
v->id, NULL, v->name,
|
||||
SCMI_MAX_STR_SIZE);
|
||||
if (SUPPORTS_ASYNC_LEVEL_SET(attributes))
|
||||
v->async_level_set = true;
|
||||
|
@ -432,7 +435,7 @@ static int scmi_voltage_protocol_init(const struct scmi_protocol_handle *ph)
|
|||
dev_warn(ph->dev, "No Voltage domains found.\n");
|
||||
}
|
||||
|
||||
return ph->set_priv(ph, vinfo);
|
||||
return ph->set_priv(ph, vinfo, version);
|
||||
}
|
||||
|
||||
static const struct scmi_protocol scmi_voltage = {
|
||||
|
@ -440,6 +443,7 @@ static const struct scmi_protocol scmi_voltage = {
|
|||
.owner = THIS_MODULE,
|
||||
.instance_init = &scmi_voltage_protocol_init,
|
||||
.ops = &voltage_proto_ops,
|
||||
.supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION,
|
||||
};
|
||||
|
||||
DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(voltage, scmi_voltage)
|
||||
|
|
Loading…
Add table
Reference in a new issue