[RFC PATCH] firmware: arm_scmi: Support mailbox transports with no completion IRQ

Radu Rendec rrendec at redhat.com
Mon Jan 20 13:24:18 PST 2025


With the introduction of no_completion_irq in struct scmi_chan_info in
commit a690b7e6e774 ("firmware: arm_scmi: Add configurable polling mode
for transports") it became possible to enable polling mode by default
when the transport does not support completion interrupts.

Mailbox controllers on the other hand have a similar mechanism to
indicate if completion interrupts are available, using the txdone_irq
flag in struct mbox_controller. This is available since the introduction
of the mailbox framework in commit 2b6d83e2b8b7 ("mailbox: Introduce
framework for mailbox").

Since the mailbox framework is already aware of whether the underlying
transport supports completion interrupts or not, set the flag correctly
in mailbox_chan_setup() to propagate the information to the SCMI core
layer. Without this change, scmi_wait_for_reply() would end up taking
the second branch for a mailbox transport with no completion IRQ
support, and time out waiting for an interrupt that never comes.

Signed-off-by: Radu Rendec <rrendec at redhat.com>
---
 drivers/firmware/arm_scmi/transports/mailbox.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/firmware/arm_scmi/transports/mailbox.c b/drivers/firmware/arm_scmi/transports/mailbox.c
index b66df29814566..33722f2d82787 100644
--- a/drivers/firmware/arm_scmi/transports/mailbox.c
+++ b/drivers/firmware/arm_scmi/transports/mailbox.c
@@ -9,6 +9,7 @@
 #include <linux/err.h>
 #include <linux/device.h>
 #include <linux/mailbox_client.h>
+#include <linux/mailbox_controller.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
@@ -221,6 +222,9 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
 		return ret;
 	}
 
+	if (!smbox->chan->mbox->txdone_irq)
+		cinfo->no_completion_irq = true;
+
 	/* Additional unidirectional channel for TX if needed */
 	if (tx && a2p_rx_chan) {
 		smbox->chan_receiver = mbox_request_channel(cl, a2p_rx_chan);
-- 
2.47.1




More information about the linux-arm-kernel mailing list