[PATCH v3 01/10] mailbox: imx: Forward the timeout/ error in imx_mu_generic_tx()
Peng Fan
peng.fan at oss.nxp.com
Wed Jun 17 18:57:46 PDT 2026
On Thu, Jun 18, 2026 at 09:50:20AM +0800, Peng Fan wrote:
>Hi Sebastian,
>
>Thanks for your patch.
>
>On Wed, Jun 17, 2026 at 08:55:26AM +0200, Sebastian Andrzej Siewior wrote:
>>imx_mu_generic_tx() for the IMX_MU_TYPE_TXDB_V2 type polls on a register
>>which may timeout and is recognized as an error. This error is siltently
>>dropped and not dropped to the caller.
>>
>>Forward the error to the caller.
>>
>>Fixes: b5ef17917f3a7 ("mailbox: imx: fix TXDB_V2 channel race condition")
>>Signed-off-by: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
>>---
>> drivers/mailbox/imx-mailbox.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>>diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c
>>index 246a9a9e39520..0028073be4a71 100644
>>--- a/drivers/mailbox/imx-mailbox.c
>>+++ b/drivers/mailbox/imx-mailbox.c
>>@@ -227,6 +227,7 @@ static int imx_mu_generic_tx(struct imx_mu_priv *priv,
>> u32 val;
>> int ret, count;
>>
>>+ ret = 0;
>> switch (cp->type) {
>> case IMX_MU_TYPE_TX:
>> imx_mu_write(priv, *arg, priv->dcfg->xTR + cp->idx * 4);
>>@@ -259,7 +260,7 @@ static int imx_mu_generic_tx(struct imx_mu_priv *priv,
>> return -EINVAL;
>> }
>>
>>- return 0;
>>+ return ret;
>> }
>
>I just rethink about the logic here and rewrite the logic as below.
>error code is propogated to caller and poll timeout are removed.
>Please see whether it looks good for you or not.
Ignore this. Pushed the button too early
>
>[PATCH] mailbox: imx: make TXDB non-blocking and avoid polling in atomic context
>
>+
> imx_mu_write(priv, IMX_MU_xCR_GIRn(priv->dcfg->type, cp->idx),
> priv->dcfg->xCR[IMX_MU_GCR]);
Oh. there might be issues without waiting here. For example, Linux just writes
the doorbell to notify SCMI processor power up a power domain, but when linux
continues to write registers, the SCMI processor may not fetch the message, then
linux will crash.
Regards
Peng
>- ret = -ETIMEDOUT;
>- count = 0;
>- while (ret && (count < 10)) {
>- ret =
>- readl_poll_timeout(priv->base + priv->dcfg->xCR[IMX_MU_GCR], val,
>- !(val & IMX_MU_xCR_GIRn(priv->dcfg->type, cp->idx)),
>- 0, 10000);
>-
>- if (ret) {
>- dev_warn_ratelimited(priv->dev,
>- "channel type: %d timeout, %d times, retry\n",
>- cp->type, ++count);
>- }
>- }
> break;
> default:
> dev_warn_ratelimited(priv->dev, "Send data on wrong channel type: %d\n", cp->type);
>--
>2.50.1
>
>Thanks,
>Peng
>
>>
>> static int imx_mu_generic_rx(struct imx_mu_priv *priv,
>>
>>--
>>2.53.0
>>
>
>
More information about the linux-arm-kernel
mailing list