* [PATCH v2 0/2] soc: qcom: smsm: Don't log an error for hosts without a mailbox
@ 2026-12-03 10:56 Alexandre Rapaille via B4 Relay
2026-12-03 10:57 ` [PATCH v2 1/2] mailbox: Add mbox_request_channel_optional() Alexandre Rapaille via B4 Relay
2026-12-03 10:57 ` [PATCH v2 2/2] soc: qcom: smsm: Don't log an error for hosts without a mailbox Alexandre Rapaille via B4 Relay
0 siblings, 2 replies; 5+ messages in thread
From: Alexandre Rapaille via B4 Relay @ 2026-12-03 10:56 UTC (permalink / raw)
To: Jassi Brar, Bjorn Andersson, Konrad Dybcio, Abel Vesa, Luca Weiss
Cc: linux-arm-msm, linux-kernel, Konrad Dybcio, Alexandre Rapaille
On msm8974, smsm logs a mailbox error twice at every boot, once for each
host that has no mailbox. Patch 1 adds mbox_request_channel_optional()
to the mailbox core, patch 2 uses it in smsm. Patch 2 depends on
patch 1.
Tested on a Fairphone 2 with next-20261127: without the series the line
is printed twice at boot, with it not at all. The modem recovered from
3 forced crashes on both kernels. A boot-time kprobe on
mbox_request_channel_optional() shows hosts 1-3 get a channel and hosts 0
and 4 get NULL.
---
Changes in v2:
- Add mbox_request_channel_optional() to the mailbox core and use it,
instead of parsing "mboxes" in smsm (Konrad)
- Drop Fixes: from the smsm patch, it now depends on patch 1
- Link to v1: https://patch.msgid.link/20261126-smsm-null-mbox-v1-1-f6c6dcc2a3bf@atlr-engineering.com
---
Alexandre Rapaille (2):
mailbox: Add mbox_request_channel_optional()
soc: qcom: smsm: Don't log an error for hosts without a mailbox
drivers/mailbox/mailbox.c | 62 ++++++++++++++++++++++++++++++------------
drivers/soc/qcom/smsm.c | 4 ++-
include/linux/mailbox_client.h | 1 +
3 files changed, 48 insertions(+), 19 deletions(-)
---
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
* [PATCH v2 1/2] mailbox: Add mbox_request_channel_optional()
2026-12-03 10:56 [PATCH v2 0/2] soc: qcom: smsm: Don't log an error for hosts without a mailbox Alexandre Rapaille via B4 Relay
@ 2026-12-03 10:57 ` Alexandre Rapaille via B4 Relay
2026-12-03 11:37 ` Konrad Dybcio
2026-12-03 10:57 ` [PATCH v2 2/2] soc: qcom: smsm: Don't log an error for hosts without a mailbox Alexandre Rapaille via B4 Relay
1 sibling, 1 reply; 5+ messages in thread
From: Alexandre Rapaille via B4 Relay @ 2026-12-03 10:57 UTC (permalink / raw)
To: Jassi Brar, Bjorn Andersson, Konrad Dybcio, Abel Vesa, Luca Weiss
Cc: linux-arm-msm, linux-kernel, Konrad Dybcio, Alexandre Rapaille
From: Alexandre Rapaille <arapaille@atlr-engineering.com>
Some clients have mailboxes for only some of their 'mboxes' indexes and
fall back to another doorbell for the rest. mbox_request_channel() logs
an error for each missing or empty entry before the client can fall back.
Add an _optional variant that returns NULL for such an entry, like the
other *_get_optional() helpers.
Suggested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
---
drivers/mailbox/mailbox.c | 62 ++++++++++++++++++++++++++++++------------
include/linux/mailbox_client.h | 1 +
2 files changed, 45 insertions(+), 18 deletions(-)
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index efacd24a085d..2702367a34d0 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -408,24 +408,8 @@ int mbox_bind_client(struct mbox_chan *chan, struct mbox_client *cl)
}
EXPORT_SYMBOL_GPL(mbox_bind_client);
-/**
- * mbox_request_channel - Request a mailbox channel.
- * @cl: Identity of the client requesting the channel.
- * @index: Index of mailbox specifier in 'mboxes' property.
- *
- * The Client specifies its requirements and capabilities while asking for
- * a mailbox channel. It can't be called from atomic context.
- * The channel is exclusively allocated and can't be used by another
- * client before the owner calls mbox_free_channel.
- * After assignment, any packet received on this channel will be
- * handed over to the client via the 'rx_callback'.
- * The framework holds reference to the client, so the mbox_client
- * structure shouldn't be modified until the mbox_free_channel returns.
- *
- * Return: Pointer to the channel assigned to the client if successful.
- * ERR_PTR for request failure.
- */
-struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
+static struct mbox_chan *__mbox_request_channel(struct mbox_client *cl, int index,
+ bool optional)
{
struct fwnode_reference_args fwspec;
struct fwnode_handle *fwnode;
@@ -451,6 +435,8 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
ret = fwnode_property_get_reference_args(fwnode, "mboxes", "#mbox-cells",
0, index, &fwspec);
if (ret) {
+ if (optional && ret == -ENOENT)
+ return NULL;
dev_err(dev, "%s: can't parse \"%s\" property\n", __func__, "mboxes");
return ERR_PTR(ret);
}
@@ -488,8 +474,48 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
return chan;
}
+
+/**
+ * mbox_request_channel - Request a mailbox channel.
+ * @cl: Identity of the client requesting the channel.
+ * @index: Index of mailbox specifier in 'mboxes' property.
+ *
+ * The Client specifies its requirements and capabilities while asking for
+ * a mailbox channel. It can't be called from atomic context.
+ * The channel is exclusively allocated and can't be used by another
+ * client before the owner calls mbox_free_channel.
+ * After assignment, any packet received on this channel will be
+ * handed over to the client via the 'rx_callback'.
+ * The framework holds reference to the client, so the mbox_client
+ * structure shouldn't be modified until the mbox_free_channel returns.
+ *
+ * Return: Pointer to the channel assigned to the client if successful.
+ * ERR_PTR for request failure.
+ */
+struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
+{
+ return __mbox_request_channel(cl, index, false);
+}
EXPORT_SYMBOL_GPL(mbox_request_channel);
+/**
+ * mbox_request_channel_optional - Request a mailbox channel that may be absent.
+ * @cl: Identity of the client requesting the channel.
+ * @index: Index of mailbox specifier in 'mboxes' property.
+ *
+ * Like mbox_request_channel(), but a missing or empty 'mboxes' entry at
+ * @index is not an error.
+ *
+ * Return: Pointer to the channel assigned to the client if successful,
+ * NULL if there is no entry at @index,
+ * ERR_PTR for request failure.
+ */
+struct mbox_chan *mbox_request_channel_optional(struct mbox_client *cl, int index)
+{
+ return __mbox_request_channel(cl, index, true);
+}
+EXPORT_SYMBOL_GPL(mbox_request_channel_optional);
+
struct mbox_chan *mbox_request_channel_byname(struct mbox_client *cl,
const char *name)
{
diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h
index e5997120f45c..042bc0e19158 100644
--- a/include/linux/mailbox_client.h
+++ b/include/linux/mailbox_client.h
@@ -41,6 +41,7 @@ int mbox_bind_client(struct mbox_chan *chan, struct mbox_client *cl);
struct mbox_chan *mbox_request_channel_byname(struct mbox_client *cl,
const char *name);
struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index);
+struct mbox_chan *mbox_request_channel_optional(struct mbox_client *cl, int index);
int mbox_send_message(struct mbox_chan *chan, void *mssg);
int mbox_flush(struct mbox_chan *chan, unsigned long timeout);
void mbox_client_txdone(struct mbox_chan *chan, int r); /* atomic */
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] soc: qcom: smsm: Don't log an error for hosts without a mailbox
2026-12-03 10:56 [PATCH v2 0/2] soc: qcom: smsm: Don't log an error for hosts without a mailbox Alexandre Rapaille via B4 Relay
2026-12-03 10:57 ` [PATCH v2 1/2] mailbox: Add mbox_request_channel_optional() Alexandre Rapaille via B4 Relay
@ 2026-12-03 10:57 ` Alexandre Rapaille via B4 Relay
2026-12-03 11:45 ` Konrad Dybcio
1 sibling, 1 reply; 5+ messages in thread
From: Alexandre Rapaille via B4 Relay @ 2026-12-03 10:57 UTC (permalink / raw)
To: Jassi Brar, 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
Use mbox_request_channel_optional() and fall back quietly when the entry
is null or missing.
Tested on a Fairphone 2 with next-20261127: both lines are gone, hosts
1-3 still get their mailbox channel, and the modem comes back after
forced restarts.
Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
---
drivers/soc/qcom/smsm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
index f6b7266a5af0..9623146da8c7 100644
--- a/drivers/soc/qcom/smsm.c
+++ b/drivers/soc/qcom/smsm.c
@@ -370,10 +370,12 @@ static int smsm_parse_mbox(struct qcom_smsm *smsm, unsigned int host_id)
struct smsm_host *host = &smsm->hosts[host_id];
int ret = 0;
- host->mbox_chan = mbox_request_channel(&smsm->mbox_client, host_id);
+ host->mbox_chan = mbox_request_channel_optional(&smsm->mbox_client, host_id);
if (IS_ERR(host->mbox_chan)) {
ret = PTR_ERR(host->mbox_chan);
host->mbox_chan = NULL;
+ } else if (!host->mbox_chan) {
+ ret = -ENOENT;
}
return ret;
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] mailbox: Add mbox_request_channel_optional()
2026-12-03 10:57 ` [PATCH v2 1/2] mailbox: Add mbox_request_channel_optional() Alexandre Rapaille via B4 Relay
@ 2026-12-03 11:37 ` Konrad Dybcio
0 siblings, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2026-12-03 11:37 UTC (permalink / raw)
To: arapaille, Jassi Brar, Bjorn Andersson, Konrad Dybcio, Abel Vesa,
Luca Weiss
Cc: linux-arm-msm, linux-kernel
On 12/3/26 11:57 AM, Alexandre Rapaille via B4 Relay wrote:
> From: Alexandre Rapaille <arapaille@atlr-engineering.com>
>
> Some clients have mailboxes for only some of their 'mboxes' indexes and
> fall back to another doorbell for the rest. mbox_request_channel() logs
> an error for each missing or empty entry before the client can fall back.
>
> Add an _optional variant that returns NULL for such an entry, like the
> other *_get_optional() helpers.
>
> Suggested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] soc: qcom: smsm: Don't log an error for hosts without a mailbox
2026-12-03 10:57 ` [PATCH v2 2/2] soc: qcom: smsm: Don't log an error for hosts without a mailbox Alexandre Rapaille via B4 Relay
@ 2026-12-03 11:45 ` Konrad Dybcio
0 siblings, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2026-12-03 11:45 UTC (permalink / raw)
To: arapaille, Jassi Brar, Bjorn Andersson, Konrad Dybcio, Abel Vesa,
Luca Weiss
Cc: linux-arm-msm, linux-kernel
On 12/3/26 11:57 AM, 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
>
> Use mbox_request_channel_optional() and fall back quietly when the entry
> is null or missing.
>
> Tested on a Fairphone 2 with next-20261127: both lines are gone, hosts
> 1-3 still get their mailbox channel, and the modem comes back after
> forced restarts.
>
> Signed-off-by: Alexandre Rapaille <arapaille@atlr-engineering.com>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-03 11:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03 10:56 [PATCH v2 0/2] soc: qcom: smsm: Don't log an error for hosts without a mailbox Alexandre Rapaille via B4 Relay
2026-12-03 10:57 ` [PATCH v2 1/2] mailbox: Add mbox_request_channel_optional() Alexandre Rapaille via B4 Relay
2026-12-03 11:37 ` Konrad Dybcio
2026-12-03 10:57 ` [PATCH v2 2/2] soc: qcom: smsm: Don't log an error for hosts without a mailbox Alexandre Rapaille via B4 Relay
2026-12-03 11:45 ` Konrad Dybcio
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®