diff mbox series

[v2,1/2] i3c: master: svc: fix IBIWON not set if IBI follow a hot join

Message ID 20240603151527.52235-1-Frank.Li@nxp.com (mailing list archive)
State In Next, archived
Headers show
Series [v2,1/2] i3c: master: svc: fix IBIWON not set if IBI follow a hot join | expand

Commit Message

Frank Li June 3, 2024, 3:15 p.m. UTC
When an In-Band Interrupt(IBI) occurs after svc_i3c_master_do_daa_locked(),
typically triggered during a Hot Join (HJ) event, the IBIWON flag fails to
be set when issuing an auto IBI command.

The issue stems from the omission of emitting STOP upon successful
execution of svc_i3c_master_do_daa_locked(). Consequently, the controller
interprets it as a repeat start when emitting the auto IBI command. Per the
I3C specification, an IBI should never occur during a repeat start, thus
preventing the IBIWON flag from being set.

Emit STOP regardless of the success or failure of
svc_i3c_master_do_daa_locked() to match I3C spec requirement.

Cc: <stable@vger.kernel.org>
Fixes: 05b26c31a485 ("i3c: master: svc: add hot join support")
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---

Notes:
    Change from v1 to v2
    - update fixes tag

 drivers/i3c/master/svc-i3c-master.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Miquel Raynal June 3, 2024, 3:19 p.m. UTC | #1
Hi Frank,

Frank.Li@nxp.com wrote on Mon,  3 Jun 2024 11:15:26 -0400:

> When an In-Band Interrupt(IBI) occurs after svc_i3c_master_do_daa_locked(),
> typically triggered during a Hot Join (HJ) event, the IBIWON flag fails to
> be set when issuing an auto IBI command.
> 
> The issue stems from the omission of emitting STOP upon successful
> execution of svc_i3c_master_do_daa_locked(). Consequently, the controller
> interprets it as a repeat start when emitting the auto IBI command. Per the
> I3C specification, an IBI should never occur during a repeat start, thus
> preventing the IBIWON flag from being set.
> 
> Emit STOP regardless of the success or failure of
> svc_i3c_master_do_daa_locked() to match I3C spec requirement.
> 
> Cc: <stable@vger.kernel.org>
> Fixes: 05b26c31a485 ("i3c: master: svc: add hot join support")
> Signed-off-by: Frank Li <Frank.Li@nxp.com>

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl
Frank Li June 13, 2024, 4:06 p.m. UTC | #2
On Mon, Jun 03, 2024 at 05:19:19PM +0200, Miquel Raynal wrote:
> Hi Frank,
> 
> Frank.Li@nxp.com wrote on Mon,  3 Jun 2024 11:15:26 -0400:
> 
> > When an In-Band Interrupt(IBI) occurs after svc_i3c_master_do_daa_locked(),
> > typically triggered during a Hot Join (HJ) event, the IBIWON flag fails to
> > be set when issuing an auto IBI command.
> > 
> > The issue stems from the omission of emitting STOP upon successful
> > execution of svc_i3c_master_do_daa_locked(). Consequently, the controller
> > interprets it as a repeat start when emitting the auto IBI command. Per the
> > I3C specification, an IBI should never occur during a repeat start, thus
> > preventing the IBIWON flag from being set.
> > 
> > Emit STOP regardless of the success or failure of
> > svc_i3c_master_do_daa_locked() to match I3C spec requirement.
> > 
> > Cc: <stable@vger.kernel.org>
> > Fixes: 05b26c31a485 ("i3c: master: svc: add hot join support")
> > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> 
> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Please hold on this patch. Hardware can emit stop automatically. It need
better fix.  Let me work on new version for this one.

> 
> Thanks,
> Miquèl
diff mbox series

Patch

diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index bb299ce02cccb..032fe032ec433 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -961,11 +961,11 @@  static int svc_i3c_master_do_daa(struct i3c_master_controller *m)
 	spin_lock_irqsave(&master->xferqueue.lock, flags);
 	ret = svc_i3c_master_do_daa_locked(master, addrs, &dev_nb);
 	spin_unlock_irqrestore(&master->xferqueue.lock, flags);
-	if (ret) {
-		svc_i3c_master_emit_stop(master);
-		svc_i3c_master_clear_merrwarn(master);
+
+	svc_i3c_master_emit_stop(master);
+	svc_i3c_master_clear_merrwarn(master);
+	if (ret)
 		goto rpm_out;
-	}
 
 	/* Register all devices who participated to the core */
 	for (i = 0; i < dev_nb; i++) {