Arm SCMI firmware interface fixes for v5.18

Few fixes to address assorted set of issues:
 - Erroneous clearing of Tx channel which only platform firmware must do
 - Invalid point access pass as parameter to sort() in clock support
 - Sparse build warnings in OPTEE transport driver
 - Use of deprecated zero-length arrays
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEunHlEgbzHrJD3ZPhAEG6vDF+4pgFAmJOth0ACgkQAEG6vDF+
 4pjeYRAAofhmDzCPPKHkRKU44JZNtZVmKj6jPGrNeg0s2C8pvxVrltVVBIVFsMlm
 Dd3D70KvXOxjMIMP5/2GaGT8hU8wS4rNO2S9nrHnx06CozYGukLdewQN1WMIig+v
 RPSI8WOYcne0BP/WV4TCV+fmVPtMO+V/4ecOxFIqKz9KpSSI3FaoKJTM5DunZU8I
 XJm5qlxSCYytwdAnG9864dM/flWwsGOsB0a3HWkgtw3PG9VPDjFRJQiL4m+Y1WSv
 xph6+tsaFBnOTHgS9F+oRvMJEf/bQXjRp8kfLw+YEo2ZKn19ysQldcQvxODGKMKS
 YUyxJRXNp3BZxiYO3uy/7TDSUMm23Zuf2CzVwGo1qGGd+55eDS0sVUMVsyEQm6QZ
 zQz4Hh0pa7z58CFxTRdaKzFhw3rLvSq8TNfoHAeL0FSV9QUHCuuVoFrjY/wAlz0W
 n5SLiwubhJJd6WeeKWNqHftfLOPR/d7Ep0XdGCnzY29oAjTQPwTheunbLFt/OyRq
 CmaFq2Ql97gCTWlJRr04v9pVXoiaaZSHtvqC802S+2IL1ThWbY8gMcjbP6U3Vw7C
 kCmQNuhRz+8hch/h8kUTByQrDjtZOTcU8JXPUWjJ+W7ZCZthVjAIySX4WaTd0NDO
 IHREIgrVvTvWEC0N8rbDmKrZ3YZUk+iWKhG8cHwHZJYRTTiq86Y=
 =aF1+
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmJO0ZwACgkQmmx57+YA
 GNk63RAAwICxtxTmUh505H4UBYJ43JHxDZx0vozZ9R/OGejbxEtnT+4EdL3z8PY6
 2imJ8qT1BBSBvDDdO9vMV7kNNaIPTREXYW53umCeq8x8/yHFQx0gaD6xT+3ztC4o
 ezLRhB2uEKoPH3gY551JWS+zxrlY4xXFUaTqb6S8qNkATjw7tKDAPE8ZMI+bO56D
 7gi7A8gxtlNGgTp5eiALhk6LL+MgoNFagw0Cb9N5Jj37rhWuA85vF0lgGmo3B3K5
 68mXRSN9PTzqUOFJhAW+suyNwzcTpwXJHYw5LEb/76AQxAoBGbJQTIOHI/37hR0M
 66FzaM+824jjr5G5YPovpwPBT9tgEXY5CdPqHRup3j7bfeyHu+qA2+uu/GbhfQfu
 TfniMzjeafZ5bs2M+dWLUaSvR4M5ULAgDixs7qmL0klVn8l7ApO+0aAJzeYtCqtj
 DkaXEEsWKc70562S4Je7f36Pz0Z3Ct5Fqm+E3L77V0Wns8tCL2KH0sHPi/f+V3ku
 X/p7Jez+ptrUcqKT8vrudr3QssPn6yXOfa3QpNf6IqxBHA/MRl1pp3Rzor1xmc4v
 1S+7159KAUTQ+oKEqEZJxj1LaaJQOoXQj72YIw6ukEhgu5WnPp7E6Nb3DpWRoI2n
 Lr/cZiTN7GewUHt6A7Jyon2WEbj6y4y9ybKX5sLiceiSbQV8e5w=
 =RoBs
 -----END PGP SIGNATURE-----

Merge tag 'scmi-fixes-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into arm/fixes

Arm SCMI firmware interface fixes for v5.18

Few fixes to address assorted set of issues:
- Erroneous clearing of Tx channel which only platform firmware must do
- Invalid point access pass as parameter to sort() in clock support
- Sparse build warnings in OPTEE transport driver
- Use of deprecated zero-length arrays

* tag 'scmi-fixes-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux:
  firmware: arm_scmi: Fix sparse warnings in OPTEE transport driver
  firmware: arm_scmi: Replace zero-length array with flexible-array member
  firmware: arm_scmi: Fix sorting of retrieved clock rates
  firmware: arm_scmi: Remove clear channel call on the TX channel

Link: https://lore.kernel.org/r/20220407110818.1436181-1-sudeep.holla@arm.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2022-04-07 13:57:15 +02:00
commit f455742ae2
3 changed files with 9 additions and 7 deletions

View File

@ -49,7 +49,7 @@ struct scmi_msg_resp_clock_describe_rates {
struct {
__le32 value_low;
__le32 value_high;
} rate[0];
} rate[];
#define RATE_TO_U64(X) \
({ \
typeof(X) x = (X); \
@ -210,7 +210,8 @@ scmi_clock_describe_rates_get(const struct scmi_protocol_handle *ph, u32 clk_id,
if (rate_discrete && rate) {
clk->list.num_rates = tot_rate_cnt;
sort(rate, tot_rate_cnt, sizeof(*rate), rate_cmp_func, NULL);
sort(clk->list.rates, tot_rate_cnt, sizeof(*rate),
rate_cmp_func, NULL);
}
clk->rate_discrete = rate_discrete;

View File

@ -679,7 +679,8 @@ static void scmi_handle_response(struct scmi_chan_info *cinfo,
xfer = scmi_xfer_command_acquire(cinfo, msg_hdr);
if (IS_ERR(xfer)) {
scmi_clear_channel(info, cinfo);
if (MSG_XTRACT_TYPE(msg_hdr) == MSG_TYPE_DELAYED_RESP)
scmi_clear_channel(info, cinfo);
return;
}

View File

@ -405,8 +405,8 @@ static int scmi_optee_chan_free(int id, void *p, void *data)
return 0;
}
static struct scmi_shared_mem *get_channel_shm(struct scmi_optee_channel *chan,
struct scmi_xfer *xfer)
static struct scmi_shared_mem __iomem *
get_channel_shm(struct scmi_optee_channel *chan, struct scmi_xfer *xfer)
{
if (!chan)
return NULL;
@ -419,7 +419,7 @@ static int scmi_optee_send_message(struct scmi_chan_info *cinfo,
struct scmi_xfer *xfer)
{
struct scmi_optee_channel *channel = cinfo->transport_info;
struct scmi_shared_mem *shmem = get_channel_shm(channel, xfer);
struct scmi_shared_mem __iomem *shmem = get_channel_shm(channel, xfer);
int ret;
mutex_lock(&channel->mu);
@ -436,7 +436,7 @@ static void scmi_optee_fetch_response(struct scmi_chan_info *cinfo,
struct scmi_xfer *xfer)
{
struct scmi_optee_channel *channel = cinfo->transport_info;
struct scmi_shared_mem *shmem = get_channel_shm(channel, xfer);
struct scmi_shared_mem __iomem *shmem = get_channel_shm(channel, xfer);
shmem_fetch_response(shmem, xfer);
}