diff mbox series

firmware: arm_scmi: Fix xfers allocation on RX channel

Message ID 20230326203449.3492948-1-cristian.marussi@arm.com (mailing list archive)
State New, archived
Headers show
Series firmware: arm_scmi: Fix xfers allocation on RX channel | expand

Commit Message

Cristian Marussi March 26, 2023, 8:34 p.m. UTC
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>
---
 drivers/firmware/arm_scmi/driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sudeep Holla April 17, 2023, 12:43 p.m. UTC | #1
On Sun, 26 Mar 2023 21:34:49 +0100, Cristian Marussi wrote:
> 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.
> 
> [...]

Applied to sudeep.holla/linux (for-next/scmi/fixes), thanks!

[1/1] firmware: arm_scmi: Fix xfers allocation on RX channel
	https://git.kernel.org/sudeep.holla/c/b2ccba9e8cdc
--
Regards,
Sudeep
diff mbox series

Patch

diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 06c56109df38..005e40c3eb32 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -2343,7 +2343,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;