From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Frank Li <Frank.Li@nxp.com>
Cc: alexandre.belloni@bootlin.com, conor.culhane@silvaco.com,
imx@lists.linux.dev, linux-i3c@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] i3c: master: svc: fix invalidate IBI type and miss call client IBI handler
Date: Tue, 7 May 2024 10:04:24 +0200 [thread overview]
Message-ID: <20240507100424.611181f1@xps-13> (raw)
In-Reply-To: <20240506164009.21375-3-Frank.Li@nxp.com>
Hi Frank,
Frank.Li@nxp.com wrote on Mon, 6 May 2024 12:40:09 -0400:
> In an In-Band Interrupt (IBI) handle, the code logic is as follows:
>
> 1: writel(SVC_I3C_MCTRL_REQUEST_AUTO_IBI | SVC_I3C_MCTRL_IBIRESP_AUTO,
> master->regs + SVC_I3C_MCTRL);
>
> 2: ret = readl_relaxed_poll_timeout(master->regs + SVC_I3C_MSTATUS, val,
> SVC_I3C_MSTATUS_IBIWON(val), 0, 1000);
> ...
> 3: ibitype = SVC_I3C_MSTATUS_IBITYPE(status);
> ibiaddr = SVC_I3C_MSTATUS_IBIADDR(status);
>
> SVC_I3C_MSTATUS_IBIWON may be set before step 1. Thus, step 2 will return
> immediately, and the I3C controller has not sent out the 9th SCL yet.
> Consequently, ibitype and ibiaddr are 0, resulting in an unknown IBI type
> occurrence and missing call I3C client driver's IBI handler.
>
> A typical case is that SVC_I3C_MSTATUS_IBIWON is set when an IBI occurs
> during the controller send start frame in svc_i3c_master_xfer().
>
> Clear SVC_I3C_MSTATUS_IBIWON before issue SVC_I3C_MCTRL_REQUEST_AUTO_IBI
> to fix this issue.
>
> Cc: stable@vger.kernel.org
> Fixes: 5e5e3c92e748 ("i3c: master: svc: fix wrong data return when IBI happen during start frame")
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
>
> Notes:
> Change from v1 to v2
> - improve comments.
>
> drivers/i3c/master/svc-i3c-master.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
> index 94e4954509558..032fe032ec433 100644
> --- a/drivers/i3c/master/svc-i3c-master.c
> +++ b/drivers/i3c/master/svc-i3c-master.c
> @@ -415,6 +415,19 @@ static void svc_i3c_master_ibi_work(struct work_struct *work)
> int ret;
>
> mutex_lock(&master->lock);
> + /*
> + * IBIWON may be set before SVC_I3C_MCTRL_REQUEST_AUTO_IBI, causing
> + * readl_relaxed_poll_timeout() to return immediately. Consequently,
> + * ibitype will be 0 since it was last updated only after the 8th SCL
> + * cycle, leading to missed client IBI handlers.
> + *
> + * A typical scenario is when IBIWON occurs and bus arbitration is lost
> + * at svc_i3c_master_priv_xfers().
> + *
> + * Clear SVC_I3C_MINT_IBIWON before sending SVC_I3C_MCTRL_REQUEST_AUTO_IBI.
> + */
Thanks a lot.
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Thanks,
Miquèl
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
next prev parent reply other threads:[~2024-05-07 8:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-06 16:40 [PATCH v2 1/3] i3c: Add comment for -EAGAIN in i3c_device_do_priv_xfers() Frank Li
2024-05-06 16:40 ` [PATCH v2 2/3] i3c: master: svc: change ENXIO to EAGAIN when IBI occurs during start frame Frank Li
2024-05-07 8:03 ` Miquel Raynal
2024-05-06 16:40 ` [PATCH v2 3/3] i3c: master: svc: fix invalidate IBI type and miss call client IBI handler Frank Li
2024-05-07 8:04 ` Miquel Raynal [this message]
2024-05-07 8:03 ` [PATCH v2 1/3] i3c: Add comment for -EAGAIN in i3c_device_do_priv_xfers() Miquel Raynal
2024-05-07 20:27 ` Alexandre Belloni
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=20240507100424.611181f1@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=Frank.Li@nxp.com \
--cc=alexandre.belloni@bootlin.com \
--cc=conor.culhane@silvaco.com \
--cc=imx@lists.linux.dev \
--cc=linux-i3c@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).