From: sashiko-bot@kernel.org
To: "Anup Patel" <anup.patel@oss.qualcomm.com>
Cc: linux-clk@vger.kernel.org
Subject: Re: [PATCH v2 4/5] mailbox: document direct synchronous transmit
Date: Mon, 16 Nov 2026 04:07:35 +0000 [thread overview]
Message-ID: <sashiko-outbox-216161@kernel.org> (raw)
In-Reply-To: <20261116040049.1795610-5-anup.patel@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] mailbox: doc: reference to missing
drivers/mailbox/mailbox-sync-test.c
- [Low] mailbox: doc: unreachable busy check in my_send_data_sync()
example
--
commit 4b8cb40412b27f0da57b15f1c45c7531d427eab2
Author: Jassi Brar <jassisinghbrar@gmail.com>
mailbox: document direct synchronous transmit
This commit documents the non-blocking queued, blocking queued, and direct
synchronous transmit models in the mailbox framework, along with controller
and client contracts and examples.
> diff --git a/Documentation/driver-api/mailbox.rst b/Documentation/driver-api/mailbox.rst
> index d46c60bd5df64..81d4710275391 100644
> --- a/Documentation/driver-api/mailbox.rst
> +++ b/Documentation/driver-api/mailbox.rst
[ ... ]
> @@ -35,14 +49,197 @@ The method in order of preference is IRQ -> Poll -> None, which
> the controller driver should set via 'txdone_irq' or 'txdone_poll'
> or neither.
[ ... ]
> + static int my_send_data_sync(struct mbox_chan *chan, void *data)
> + {
> + struct my_chan *c = chan->con_priv;
> + unsigned long flags;
> + u32 status;
> + int ret = 0;
> +
> + /*
> + * The framework does not serialize direct callers and does not
> + * disable IRQs. This controller shares one register block across
> + * all CPUs, so it uses its own IRQ-safe lock.
> + */
> + spin_lock_irqsave(&c->lock, flags);
> + if (c->busy) {
> + ret = -EBUSY;
> + goto out;
> + }
> +
> + c->busy = true;
> + writel(*(u32 *)data, c->tx_reg);
> + if (readl_poll_timeout_atomic(c->tx_reg + MY_STATUS, status,
> + status & MY_DONE, 1, 1000))
> + ret = -ETIMEDOUT;
> + c->busy = false;
> + out:
> + spin_unlock_irqrestore(&c->lock, flags);
> + return ret;
> + }
[Severity: Low]
Can the c->busy check in my_send_data_sync() ever be true? c->busy is only
set and cleared while c->lock is held with local IRQs disabled, so every
other CPU waits at spin_lock_irqsave() until c->busy is false again.
Either c->busy can be dropped because c->lock already serializes the entire
transfer, or the example could use spin_trylock_irqsave() to return -EBUSY
on contention.
[ ... ]
> @@ -116,14 +313,125 @@ a message and a callback function to the API and return immediately).
[ ... ]
> +The KUnit suite in ``drivers/mailbox/mailbox-sync-test.c`` exercises the
> +capability matrix, registration validation, per-call results, multi-CPU
> +concurrency, hardirq context, queued compatibility, and free/rebind.
[Severity: Low]
Does drivers/mailbox/mailbox-sync-test.c exist in the tree? Referencing a
nonexistent file here will trip scripts/documentation-file-ref-check.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116040049.1795610-1-anup.patel@oss.qualcomm.com?part=4
next prev parent reply other threads:[~2026-11-16 4:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 4:00 [PATCH v2 0/5] Parallel message send using SBI MPXY Anup Patel
2026-11-16 4:00 ` [PATCH v2 1/5] RISC-V: Move common MPXY helper routines to arch/riscv Anup Patel
2026-11-16 4:00 ` [PATCH v2 2/5] RISC-V: Use irqsave to prevent interrupt when accessing MPXY shared memory Anup Patel
2026-11-16 4:00 ` [PATCH v2 3/5] mailbox: add direct synchronous transmit API Anup Patel
2026-11-16 4:00 ` [PATCH v2 4/5] mailbox: document direct synchronous transmit Anup Patel
2026-11-16 4:07 ` sashiko-bot [this message]
2026-11-16 4:00 ` [PATCH v2 5/5] mailbox: convert RISC-V SBI MPXY to direct transmit Anup Patel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-216161@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=anup.patel@oss.qualcomm.com \
--cc=linux-clk@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox