mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] soc: qcom: smsm: Don't log an error for hosts without a mailbox
@ 2026-11-26 13:45 Alexandre Rapaille via B4 Relay
  2026-12-01 11:59 ` Konrad Dybcio
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Rapaille via B4 Relay @ 2026-11-26 13:45 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Luca Weiss
  Cc: linux-arm-msm, linux-kernel, Alexandre Rapaille

From: Alexandre Rapaille <arapaille@atlr-engineering.com>

smsm_parse_mbox() calls mbox_request_channel() for every host, so the
mailbox core logs an error for each host that has no mailbox before smsm
falls back to qcom,ipc. On msm8974 SMEM reports 5 hosts while mboxes has
4 entries, the first a null placeholder for the local host, so every
boot prints twice:

  qcom-smsm smsm: mbox_request_channel: can't parse "mboxes" property

Check the entry first and fall back quietly when it is null or missing.

Tested on a Fairphone 2: both lines are gone, hosts 1-3 still use their
mailboxes, and the modem comes back after forced restarts.

Fixes: 75287992f58a ("soc: qcom: smsm: Support using mailbox interface")
Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
---
Tested on a 6.18-based tree; smsm_parse_mbox() is identical in linux-next.
Existing DTBs keep the <0> placeholder, so this is needed even if the
binding moves to mbox-names.
---
 drivers/soc/qcom/smsm.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
index f6b7266a5af0..5cc31f1abaca 100644
--- a/drivers/soc/qcom/smsm.c
+++ b/drivers/soc/qcom/smsm.c
@@ -8,6 +8,7 @@
 #include <linux/mailbox_client.h>
 #include <linux/mfd/syscon.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
@@ -368,7 +369,15 @@ static const struct irq_domain_ops smsm_irq_ops = {
 static int smsm_parse_mbox(struct qcom_smsm *smsm, unsigned int host_id)
 {
 	struct smsm_host *host = &smsm->hosts[host_id];
-	int ret = 0;
+	struct of_phandle_args args;
+	int ret;
+
+	/* Hosts without a mailbox have a null or no entry: fall back quietly */
+	ret = of_parse_phandle_with_args(smsm->dev->of_node, "mboxes", "#mbox-cells",
+					 host_id, &args);
+	if (ret)
+		return ret;
+	of_node_put(args.np);
 
 	host->mbox_chan = mbox_request_channel(&smsm->mbox_client, host_id);
 	if (IS_ERR(host->mbox_chan)) {

---
base-commit: 20eef29b7c8465ac98d7dd6d6f2ac07a8d8056ca
change-id: 20261126-smsm-null-mbox-353ad3b8495e

Best regards,
--  
Alexandre Rapaille <arapaille@atlr-engineering.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] soc: qcom: smsm: Don't log an error for hosts without a mailbox
  2026-11-26 13:45 [PATCH] soc: qcom: smsm: Don't log an error for hosts without a mailbox Alexandre Rapaille via B4 Relay
@ 2026-12-01 11:59 ` Konrad Dybcio
  2026-12-01 17:13   ` Alexandre Rapaille
  0 siblings, 1 reply; 5+ messages in thread
From: Konrad Dybcio @ 2026-12-01 11:59 UTC (permalink / raw)
  To: arapaille, Bjorn Andersson, Konrad Dybcio, Abel Vesa, Luca Weiss
  Cc: linux-arm-msm, linux-kernel

On 11/26/26 2:45 PM, Alexandre Rapaille via B4 Relay wrote:
> From: Alexandre Rapaille <arapaille@atlr-engineering.com>
> 
> smsm_parse_mbox() calls mbox_request_channel() for every host, so the
> mailbox core logs an error for each host that has no mailbox before smsm
> falls back to qcom,ipc. On msm8974 SMEM reports 5 hosts while mboxes has
> 4 entries, the first a null placeholder for the local host, so every
> boot prints twice:
> 
>   qcom-smsm smsm: mbox_request_channel: can't parse "mboxes" property
> 
> Check the entry first and fall back quietly when it is null or missing.
> 
> Tested on a Fairphone 2: both lines are gone, hosts 1-3 still use their
> mailboxes, and the modem comes back after forced restarts.
> 
> Fixes: 75287992f58a ("soc: qcom: smsm: Support using mailbox interface")
> Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
> ---

[...]

> +	/* Hosts without a mailbox have a null or no entry: fall back quietly */
> +	ret = of_parse_phandle_with_args(smsm->dev->of_node, "mboxes", "#mbox-cells",
> +					 host_id, &args);
> +	if (ret)
> +		return ret;
> +	of_node_put(args.np);
>  
>  	host->mbox_chan = mbox_request_channel(&smsm->mbox_client, host_id);

Would the above returning -ENOENT not mean the same?

Konrad

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] soc: qcom: smsm: Don't log an error for hosts without a mailbox
  2026-12-01 11:59 ` Konrad Dybcio
@ 2026-12-01 17:13   ` Alexandre Rapaille
  2026-12-02 15:27     ` Konrad Dybcio
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Rapaille @ 2026-12-01 17:13 UTC (permalink / raw)
  To: Konrad Dybcio, Bjorn Andersson, Konrad Dybcio, Abel Vesa, Luca Weiss
  Cc: linux-arm-msm, linux-kernel

>> +    /* Hosts without a mailbox have a null or no entry: fall back quietly */
>> +    ret = of_parse_phandle_with_args(smsm->dev->of_node, "mboxes", "#mbox-cells",
>> +                                     host_id, &args);
>> +    if (ret)
>> +            return ret;
>> +    of_node_put(args.np);
>>
>>      host->mbox_chan = mbox_request_channel(&smsm->mbox_client, host_id);
>
> Would the above returning -ENOENT not mean the same?

It does, mbox_request_channel() returns the same -ENOENT. But it calls
dev_err() before returning, so by the time smsm sees the error the line
is already in the log:

        ret = fwnode_property_get_reference_args(fwnode, "mboxes", "#mbox-cells",
                                                 0, index, &fwspec);
        if (ret) {
                dev_err(dev, "%s: can't parse \"%s\" property\n", __func__, "mboxes");
                return ERR_PTR(ret);
        }

The other option is to make that dev_err() quiet for -ENOENT in the
mailbox core. That changes it for every client, so I kept the check in
smsm. I can do it in the core instead if you prefer.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] soc: qcom: smsm: Don't log an error for hosts without a mailbox
  2026-12-01 17:13   ` Alexandre Rapaille
@ 2026-12-02 15:27     ` Konrad Dybcio
  2026-12-02 15:50       ` Alexandre Rapaille
  0 siblings, 1 reply; 5+ messages in thread
From: Konrad Dybcio @ 2026-12-02 15:27 UTC (permalink / raw)
  To: Alexandre Rapaille, Bjorn Andersson, Konrad Dybcio, Abel Vesa,
	Luca Weiss
  Cc: linux-arm-msm, linux-kernel

On 12/1/26 6:13 PM, Alexandre Rapaille wrote:
>>> +    /* Hosts without a mailbox have a null or no entry: fall back quietly */
>>> +    ret = of_parse_phandle_with_args(smsm->dev->of_node, "mboxes", "#mbox-cells",
>>> +                                     host_id, &args);
>>> +    if (ret)
>>> +            return ret;
>>> +    of_node_put(args.np);
>>>
>>>      host->mbox_chan = mbox_request_channel(&smsm->mbox_client, host_id);
>>
>> Would the above returning -ENOENT not mean the same?
> 
> It does, mbox_request_channel() returns the same -ENOENT. But it calls
> dev_err() before returning, so by the time smsm sees the error the line
> is already in the log:
> 
>         ret = fwnode_property_get_reference_args(fwnode, "mboxes", "#mbox-cells",
>                                                  0, index, &fwspec);
>         if (ret) {
>                 dev_err(dev, "%s: can't parse \"%s\" property\n", __func__, "mboxes");
>                 return ERR_PTR(ret);
>         }
> 
> The other option is to make that dev_err() quiet for -ENOENT in the
> mailbox core. That changes it for every client, so I kept the check in
> smsm. I can do it in the core instead if you prefer.

I think something like an _optional variant in the mbox core
would make sense here

Konrad

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] soc: qcom: smsm: Don't log an error for hosts without a mailbox
  2026-12-02 15:27     ` Konrad Dybcio
@ 2026-12-02 15:50       ` Alexandre Rapaille
  0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Rapaille @ 2026-12-02 15:50 UTC (permalink / raw)
  To: Konrad Dybcio, Bjorn Andersson, Konrad Dybcio, Abel Vesa, Luca Weiss
  Cc: linux-arm-msm, linux-kernel

>> The other option is to make that dev_err() quiet for -ENOENT in the
>> mailbox core. That changes it for every client, so I kept the check in
>> smsm. I can do it in the core instead if you prefer.
>
> I think something like an _optional variant in the mbox core
> would make sense here

Agreed, v2 will add mbox_request_channel_optional(), returning NULL for
a missing or empty entry like the other *_optional() helpers, and smsm
will use it.

Thanks, Alexandre

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-02 15:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-26 13:45 [PATCH] soc: qcom: smsm: Don't log an error for hosts without a mailbox Alexandre Rapaille via B4 Relay
2026-12-01 11:59 ` Konrad Dybcio
2026-12-01 17:13   ` Alexandre Rapaille
2026-12-02 15:27     ` Konrad Dybcio
2026-12-02 15:50       ` Alexandre Rapaille

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®