]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
firmware: arm_scmi: Fix xfers allocation on Rx channel
authorCristian Marussi <cristian.marussi@arm.com>
Sun, 26 Mar 2023 20:34:49 +0000 (21:34 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 7 Jul 2023 10:16:50 +0000 (12:16 +0200)
BugLink: https://bugs.launchpad.net/bugs/2025067
[ Upstream commit b2ccba9e8cdc6fb3985cc227844e7c6af309ffb1 ]

Two distinct pools of xfer descriptors are allocated at initialization
time: one (Tx) used to provide xfers to track commands and their replies
(or delayed replies) and another (Rx) to pick xfers from to be used for
processing notifications.

Such pools, though, are allocated globally to be used by the whole SCMI
instance, they are not allocated per-channel and as such the allocation of
notifications xfers cannot be simply skipped if no Rx channel was found for
the base protocol common channel, because there could be defined more
optional per-protocol dedicated channels that instead support Rx channels.

Change the conditional check to skip allocation for the notification pool
only if no Rx channel has been detected on any per-channel protocol at all.

Fixes: 4ebd8f6dea81 ("firmware: arm_scmi: Add receive buffer support for notifications")
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20230326203449.3492948-1-cristian.marussi@arm.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/firmware/arm_scmi/driver.c

index ffdad59ec81fcb5e438061aba98accede1cf7d5a..fe06dc1936896413f956834fee525bb97b235534 100644 (file)
@@ -1981,7 +1981,7 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo)
                return ret;
 
        ret = __scmi_xfer_info_init(sinfo, &sinfo->tx_minfo);
-       if (!ret && idr_find(&sinfo->rx_idr, SCMI_PROTOCOL_BASE))
+       if (!ret && !idr_is_empty(&sinfo->rx_idr))
                ret = __scmi_xfer_info_init(sinfo, &sinfo->rx_minfo);
 
        return ret;