* [PATCH v2] i3c: dw: Prevent premature transfer completion on IBI
@ 2026-11-12 9:05 Rui Wang
2026-11-13 21:07 ` Frank Li
0 siblings, 1 reply; 2+ messages in thread
From: Rui Wang @ 2026-11-12 9:05 UTC (permalink / raw)
To: alexandre.belloni; +Cc: Frank.Li, linux-i3c, linux-kernel
An IBI threshold interrupt can arrive while a transfer is pending and
before its command responses are ready. The IRQ handler calls
dw_i3c_master_end_xfer_locked() even for an IBI-only interrupt. If the
response queue is empty, the function completes the transfer with a
return value of zero. Later responses can remain unconsumed and keep the
response-ready interrupt asserted.
Only call the transfer completion handler when INTR_MASTER_MASK
indicates that responses are ready or a transfer error has occurred.
An IBI-only interrupt leaves the transfer pending.
The fix was tested successfully on FPGA hardware.
Fixes: e389b1d72a624 ("i3c: dw: Add support for in-band interrupts")
Signed-off-by: Rui Wang <wr574332525@163.com>
---
Changes in v2
- Use Rui Wang in the author and sign-off fields.
The possible queue stall reported by Sashiko is in the timeout recovery
path and predates this patch. If I can reproduce it, I'll send a
separate fix.
drivers/i3c/master/dw-i3c-master.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 34aa8f8..19735ec 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -1527,7 +1527,8 @@ static irqreturn_t dw_i3c_master_irq_handler(int irq, void *dev_id)
}
spin_lock(&master->xferqueue.lock);
- dw_i3c_master_end_xfer_locked(master, status);
+ if (status & INTR_MASTER_MASK)
+ dw_i3c_master_end_xfer_locked(master, status);
if (status & INTR_TRANSFER_ERR_STAT)
writel(INTR_TRANSFER_ERR_STAT, master->regs + INTR_STATUS);
spin_unlock(&master->xferqueue.lock);
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
--
2.53.0.windows.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] i3c: dw: Prevent premature transfer completion on IBI
2026-11-12 9:05 [PATCH v2] i3c: dw: Prevent premature transfer completion on IBI Rui Wang
@ 2026-11-13 21:07 ` Frank Li
0 siblings, 0 replies; 2+ messages in thread
From: Frank Li @ 2026-11-13 21:07 UTC (permalink / raw)
To: Rui Wang; +Cc: alexandre.belloni, Frank.Li, linux-i3c, linux-kernel
On Thu, Nov 12, 2026 at 05:05:38PM +0800, Rui Wang wrote:
> An IBI threshold interrupt can arrive while a transfer is pending and
> before its command responses are ready. The IRQ handler calls
> dw_i3c_master_end_xfer_locked() even for an IBI-only interrupt. If the
> response queue is empty, the function completes the transfer with a
> return value of zero. Later responses can remain unconsumed and keep the
> response-ready interrupt asserted.
>
> Only call the transfer completion handler when INTR_MASTER_MASK
> indicates that responses are ready or a transfer error has occurred.
> An IBI-only interrupt leaves the transfer pending.
>
> The fix was tested successfully on FPGA hardware.
>
> Fixes: e389b1d72a624 ("i3c: dw: Add support for in-band interrupts")
> Signed-off-by: Rui Wang <wr574332525@163.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Changes in v2
> - Use Rui Wang in the author and sign-off fields.
>
> The possible queue stall reported by Sashiko is in the timeout recovery
> path and predates this patch. If I can reproduce it, I'll send a
> separate fix.
>
> drivers/i3c/master/dw-i3c-master.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index 34aa8f8..19735ec 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -1527,7 +1527,8 @@ static irqreturn_t dw_i3c_master_irq_handler(int irq, void *dev_id)
> }
>
> spin_lock(&master->xferqueue.lock);
> - dw_i3c_master_end_xfer_locked(master, status);
> + if (status & INTR_MASTER_MASK)
> + dw_i3c_master_end_xfer_locked(master, status);
> if (status & INTR_TRANSFER_ERR_STAT)
> writel(INTR_TRANSFER_ERR_STAT, master->regs + INTR_STATUS);
> spin_unlock(&master->xferqueue.lock);
>
> base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
> --
> 2.53.0.windows.2
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-13 21:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-12 9:05 [PATCH v2] i3c: dw: Prevent premature transfer completion on IBI Rui Wang
2026-11-13 21:07 ` Frank Li
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®