From: Frank Li <Frank.li@nxp.com>
To: Stanley Chu <stanley.chuys@gmail.com>
Cc: miquel.raynal@bootlin.com, alexandre.belloni@bootlin.com,
linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org,
tomer.maimon@nuvoton.com, kwliu@nuvoton.com, yschu@nuvoton.com
Subject: Re: [PATCH v1 1/1] i3c: master: svc: Prevent incomplete IBI transaction
Date: Mon, 20 Oct 2025 16:22:55 -0400 [thread overview]
Message-ID: <aPaaH1ADwU25Q4TD@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20251020094020.632545-1-yschu@nuvoton.com>
On Mon, Oct 20, 2025 at 05:40:20PM +0800, Stanley Chu wrote:
> From: Stanley Chu <yschu@nuvoton.com>
>
> If no free IBI slot is available, svc_i3c_master_handle_ibi returns
> immediately. This causes the STOP condition to be missed because the
> EmitStop request is sent when the transfer is not complete. To resolve
> this, svc_i3c_master_handle_ibi must wait for the transfer to complete
> before returning.
>
> Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
> Signed-off-by: Stanley Chu <yschu@nuvoton.com>
> ---
> drivers/i3c/master/svc-i3c-master.c | 24 +++++++++++++++---------
> 1 file changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
> index 9641e66a4e5f..9cf9fb586e92 100644
> --- a/drivers/i3c/master/svc-i3c-master.c
> +++ b/drivers/i3c/master/svc-i3c-master.c
> @@ -406,21 +406,27 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master,
> int ret, val;
> u8 *buf;
>
> - slot = i3c_generic_ibi_get_free_slot(data->ibi_pool);
> - if (!slot)
> - return -ENOSPC;
> -
> - slot->len = 0;
> - buf = slot->data;
> -
> + /*
> + * Wait for transfer to complete before returning. Otherwise, the EmitStop
> + * request might be sent when the transfer is not complete.
> + */
> ret = readl_relaxed_poll_timeout(master->regs + SVC_I3C_MSTATUS, val,
> - SVC_I3C_MSTATUS_COMPLETE(val), 0, 1000);
> + SVC_I3C_MSTATUS_COMPLETE(val), 0, 1000);
This is code style change. Don't touch this line at fixes patch.
Frank
> if (ret) {
> dev_err(master->dev, "Timeout when polling for COMPLETE\n");
> - i3c_generic_ibi_recycle_slot(data->ibi_pool, slot);
> return ret;
> }
>
> + slot = i3c_generic_ibi_get_free_slot(data->ibi_pool);
> + if (!slot) {
> + dev_dbg(master->dev, "No free ibi slot, drop the data\n");
> + writel(SVC_I3C_MDATACTRL_FLUSHRB, master->regs + SVC_I3C_MDATACTRL);
> + return -ENOSPC;
> + }
> +
> + slot->len = 0;
> + buf = slot->data;
> +
> while (SVC_I3C_MSTATUS_RXPEND(readl(master->regs + SVC_I3C_MSTATUS)) &&
> slot->len < SVC_I3C_FIFO_SIZE) {
> mdatactrl = readl(master->regs + SVC_I3C_MDATACTRL);
> --
> 2.34.1
>
>
> --
> linux-i3c mailing list
> linux-i3c@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c
prev parent reply other threads:[~2025-10-20 20:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-20 9:40 Stanley Chu
2025-10-20 20:22 ` Frank Li [this message]
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=aPaaH1ADwU25Q4TD@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=alexandre.belloni@bootlin.com \
--cc=kwliu@nuvoton.com \
--cc=linux-i3c@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=stanley.chuys@gmail.com \
--cc=tomer.maimon@nuvoton.com \
--cc=yschu@nuvoton.com \
/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
all inboxes | Powered by JetHome®