mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] i3c: renesas: Don't register devices when ENTDAA times out
@ 2026-07-31  7:01 Tommaso Merciai
  2026-07-31 16:12 ` Claudiu Beznea
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Tommaso Merciai @ 2026-07-31  7:01 UTC (permalink / raw)
  To: tomm.merciai
  Cc: linux-renesas-soc, claudiu.beznea.uj, biju.das.jz,
	Tommaso Merciai, Wolfram Sang, Alexandre Belloni, Frank Li,
	linux-i3c, linux-kernel

renesas_i3c_daa() derives the number of newly assigned dynamic addresses
from cmd->rx_count, which the response ISR sets to the number of address
slots ENTDAA left unassigned. It starts out as zero, which already means
"every address was assigned", so a timed out transfer leaves that value
in place and it gets used as a result.

On a bus with no target connected the ENTDAA times out and the driver
registers RENESAS_I3C_MAX_DEVS devices that are not there, each costing
the core two seconds on a GETPID that can only time out:

  i3c i3c-0: Failed to add I3C device at address 9, error -110
  ...
  i3c i3c-0: Failed to add I3C device at address 16, error -110

Start from maxdevs instead: no address is assigned before ENTDAA runs,
and the existing rx_count >= maxdevs check then reports an empty bus.

Fixes: d028219a9f14 ("i3c: master: Add basic driver for the Renesas I3C controller")
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
 drivers/i3c/master/renesas-i3c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/renesas-i3c.c
index 2b501f31e874..f4d9608978a9 100644
--- a/drivers/i3c/master/renesas-i3c.c
+++ b/drivers/i3c/master/renesas-i3c.c
@@ -685,7 +685,7 @@ static int renesas_i3c_daa(struct i3c_master_controller *m)
 
 	init_completion(&xfer->comp);
 	cmd = xfer->cmds;
-	cmd->rx_count = 0;
+	cmd->rx_count = i3c->maxdevs;
 
 	PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND(i3c->dev, pm);
 	ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
-- 
2.54.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] i3c: renesas: Don't register devices when ENTDAA times out
  2026-07-31  7:01 [PATCH] i3c: renesas: Don't register devices when ENTDAA times out Tommaso Merciai
@ 2026-07-31 16:12 ` Claudiu Beznea
  2026-08-05 20:28 ` Frank Li
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Claudiu Beznea @ 2026-07-31 16:12 UTC (permalink / raw)
  To: Tommaso Merciai, tomm.merciai
  Cc: linux-renesas-soc, claudiu.beznea.uj, biju.das.jz, Wolfram Sang,
	Alexandre Belloni, Frank Li, linux-i3c, linux-kernel



On 7/31/26 10:01, Tommaso Merciai wrote:
> renesas_i3c_daa() derives the number of newly assigned dynamic addresses
> from cmd->rx_count, which the response ISR sets to the number of address
> slots ENTDAA left unassigned. It starts out as zero, which already means
> "every address was assigned", so a timed out transfer leaves that value
> in place and it gets used as a result.
> 
> On a bus with no target connected the ENTDAA times out and the driver
> registers RENESAS_I3C_MAX_DEVS devices that are not there, each costing
> the core two seconds on a GETPID that can only time out:
> 
>    i3c i3c-0: Failed to add I3C device at address 9, error -110
>    ...
>    i3c i3c-0: Failed to add I3C device at address 16, error -110
> 
> Start from maxdevs instead: no address is assigned before ENTDAA runs,
> and the existing rx_count >= maxdevs check then reports an empty bus.
> 
> Fixes: d028219a9f14 ("i3c: master: Add basic driver for the Renesas I3C controller")
> Signed-off-by: Tommaso Merciai<tommaso.merciai.xr@bp.renesas.com>

Reviewed-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> # on RZ/G3S

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] i3c: renesas: Don't register devices when ENTDAA times out
  2026-07-31  7:01 [PATCH] i3c: renesas: Don't register devices when ENTDAA times out Tommaso Merciai
  2026-07-31 16:12 ` Claudiu Beznea
@ 2026-08-05 20:28 ` Frank Li
  2026-08-06  9:30   ` Tommaso Merciai
  2026-08-06 18:48 ` Frank Li
  2026-08-08 13:12 ` Alexandre Belloni
  3 siblings, 1 reply; 6+ messages in thread
From: Frank Li @ 2026-08-05 20:28 UTC (permalink / raw)
  To: Tommaso Merciai
  Cc: tomm.merciai, linux-renesas-soc, claudiu.beznea.uj, biju.das.jz,
	Wolfram Sang, Alexandre Belloni, Frank Li, linux-i3c,
	linux-kernel

On Fri, Jul 31, 2026 at 09:01:46AM +0200, Tommaso Merciai wrote:
> renesas_i3c_daa() derives the number of newly assigned dynamic addresses
> from cmd->rx_count, which the response ISR sets to the number of address
> slots ENTDAA left unassigned. It starts out as zero, which already means
> "every address was assigned", so a timed out transfer leaves that value
> in place and it gets used as a result.
>
> On a bus with no target connected the ENTDAA times out and the driver
> registers RENESAS_I3C_MAX_DEVS devices that are not there, each costing
> the core two seconds on a GETPID that can only time out:
>
>   i3c i3c-0: Failed to add I3C device at address 9, error -110
>   ...
>   i3c i3c-0: Failed to add I3C device at address 16, error -110
>
> Start from maxdevs instead: no address is assigned before ENTDAA runs,
> and the existing rx_count >= maxdevs check then reports an empty bus.
>
> Fixes: d028219a9f14 ("i3c: master: Add basic driver for the Renesas I3C controller")
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> ---

Does https://lore.kernel.org/linux-i3c/alUZ_N9VdxkhcpqM@lizhi-Precision-Tower-5810/

fix the same problem?

Frank

>  drivers/i3c/master/renesas-i3c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/renesas-i3c.c
> index 2b501f31e874..f4d9608978a9 100644
> --- a/drivers/i3c/master/renesas-i3c.c
> +++ b/drivers/i3c/master/renesas-i3c.c
> @@ -685,7 +685,7 @@ static int renesas_i3c_daa(struct i3c_master_controller *m)
>
>  	init_completion(&xfer->comp);
>  	cmd = xfer->cmds;
> -	cmd->rx_count = 0;
> +	cmd->rx_count = i3c->maxdevs;
>
>  	PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND(i3c->dev, pm);
>  	ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
> --
> 2.54.0
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] i3c: renesas: Don't register devices when ENTDAA times out
  2026-08-05 20:28 ` Frank Li
@ 2026-08-06  9:30   ` Tommaso Merciai
  0 siblings, 0 replies; 6+ messages in thread
From: Tommaso Merciai @ 2026-08-06  9:30 UTC (permalink / raw)
  To: Frank Li
  Cc: tomm.merciai, linux-renesas-soc, claudiu.beznea.uj, biju.das.jz,
	Wolfram Sang, Alexandre Belloni, Frank Li, linux-i3c,
	linux-kernel

Hi Frank,
Thanks for your review.

On Wed, Aug 05, 2026 at 04:28:15PM -0400, Frank Li wrote:
> On Fri, Jul 31, 2026 at 09:01:46AM +0200, Tommaso Merciai wrote:
> > renesas_i3c_daa() derives the number of newly assigned dynamic addresses
> > from cmd->rx_count, which the response ISR sets to the number of address
> > slots ENTDAA left unassigned. It starts out as zero, which already means
> > "every address was assigned", so a timed out transfer leaves that value
> > in place and it gets used as a result.
> >
> > On a bus with no target connected the ENTDAA times out and the driver
> > registers RENESAS_I3C_MAX_DEVS devices that are not there, each costing
> > the core two seconds on a GETPID that can only time out:
> >
> >   i3c i3c-0: Failed to add I3C device at address 9, error -110
> >   ...
> >   i3c i3c-0: Failed to add I3C device at address 16, error -110
> >
> > Start from maxdevs instead: no address is assigned before ENTDAA runs,
> > and the existing rx_count >= maxdevs check then reports an empty bus.
> >
> > Fixes: d028219a9f14 ("i3c: master: Add basic driver for the Renesas I3C controller")
> > Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> > ---
> 
> Does https://lore.kernel.org/linux-i3c/alUZ_N9VdxkhcpqM@lizhi-Precision-Tower-5810/
> 
> fix the same problem?

[1] cover the case when ENTDAA completes and reports
rx_count == data_len == maxdevs,. 
This is what an empty bus looks like in the response descriptor.

This patch cover the case when ENTDAA never completes.
renesas_i3c_resp_isr() never run then cmd->rx_count = 0

then we will have:

	GENMASK(maxdevs - 0 - 1, 0)
	GENMASK(8 - 0 - 1, 0) = 0xff

This marks every free slot as newly assigned.

IMHO I think we are seeing the same issues but having different
causes.

[1] https://lore.kernel.org/linux-i3c/alUZ_N9VdxkhcpqM@lizhi-Precision-Tower-5810/

Kind regards,
Tommaso

> 
> Frank
> 
> >  drivers/i3c/master/renesas-i3c.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/renesas-i3c.c
> > index 2b501f31e874..f4d9608978a9 100644
> > --- a/drivers/i3c/master/renesas-i3c.c
> > +++ b/drivers/i3c/master/renesas-i3c.c
> > @@ -685,7 +685,7 @@ static int renesas_i3c_daa(struct i3c_master_controller *m)
> >
> >  	init_completion(&xfer->comp);
> >  	cmd = xfer->cmds;
> > -	cmd->rx_count = 0;
> > +	cmd->rx_count = i3c->maxdevs;
> >
> >  	PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND(i3c->dev, pm);
> >  	ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
> > --
> > 2.54.0
> >

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] i3c: renesas: Don't register devices when ENTDAA times out
  2026-07-31  7:01 [PATCH] i3c: renesas: Don't register devices when ENTDAA times out Tommaso Merciai
  2026-07-31 16:12 ` Claudiu Beznea
  2026-08-05 20:28 ` Frank Li
@ 2026-08-06 18:48 ` Frank Li
  2026-08-08 13:12 ` Alexandre Belloni
  3 siblings, 0 replies; 6+ messages in thread
From: Frank Li @ 2026-08-06 18:48 UTC (permalink / raw)
  To: Tommaso Merciai
  Cc: tomm.merciai, linux-renesas-soc, claudiu.beznea.uj, biju.das.jz,
	Wolfram Sang, Alexandre Belloni, Frank Li, linux-i3c,
	linux-kernel

On Fri, Jul 31, 2026 at 09:01:46AM +0200, Tommaso Merciai wrote:
> renesas_i3c_daa() derives the number of newly assigned dynamic addresses
> from cmd->rx_count, which the response ISR sets to the number of address
> slots ENTDAA left unassigned. It starts out as zero, which already means
> "every address was assigned", so a timed out transfer leaves that value
> in place and it gets used as a result.
>
> On a bus with no target connected the ENTDAA times out and the driver
> registers RENESAS_I3C_MAX_DEVS devices that are not there, each costing
> the core two seconds on a GETPID that can only time out:
>
>   i3c i3c-0: Failed to add I3C device at address 9, error -110
>   ...
>   i3c i3c-0: Failed to add I3C device at address 16, error -110
>
> Start from maxdevs instead: no address is assigned before ENTDAA runs,
> and the existing rx_count >= maxdevs check then reports an empty bus.
>
> Fixes: d028219a9f14 ("i3c: master: Add basic driver for the Renesas I3C controller")
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/i3c/master/renesas-i3c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/renesas-i3c.c
> index 2b501f31e874..f4d9608978a9 100644
> --- a/drivers/i3c/master/renesas-i3c.c
> +++ b/drivers/i3c/master/renesas-i3c.c
> @@ -685,7 +685,7 @@ static int renesas_i3c_daa(struct i3c_master_controller *m)
>
>  	init_completion(&xfer->comp);
>  	cmd = xfer->cmds;
> -	cmd->rx_count = 0;
> +	cmd->rx_count = i3c->maxdevs;
>
>  	PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND(i3c->dev, pm);
>  	ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
> --
> 2.54.0
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] i3c: renesas: Don't register devices when ENTDAA times out
  2026-07-31  7:01 [PATCH] i3c: renesas: Don't register devices when ENTDAA times out Tommaso Merciai
                   ` (2 preceding siblings ...)
  2026-08-06 18:48 ` Frank Li
@ 2026-08-08 13:12 ` Alexandre Belloni
  3 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2026-08-08 13:12 UTC (permalink / raw)
  To: tomm.merciai, Tommaso Merciai
  Cc: linux-renesas-soc, claudiu.beznea.uj, biju.das.jz, Wolfram Sang,
	Frank Li, linux-i3c, linux-kernel

On Fri, 31 Jul 2026 09:01:46 +0200, Tommaso Merciai wrote:
> renesas_i3c_daa() derives the number of newly assigned dynamic addresses
> from cmd->rx_count, which the response ISR sets to the number of address
> slots ENTDAA left unassigned. It starts out as zero, which already means
> "every address was assigned", so a timed out transfer leaves that value
> in place and it gets used as a result.
> 
> On a bus with no target connected the ENTDAA times out and the driver
> registers RENESAS_I3C_MAX_DEVS devices that are not there, each costing
> the core two seconds on a GETPID that can only time out:
> 
> [...]

Applied, thanks!

[1/1] i3c: renesas: Don't register devices when ENTDAA times out
      https://git.kernel.org/i3c/c/b6e56fd8c8a8

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-08-08 13:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-31  7:01 [PATCH] i3c: renesas: Don't register devices when ENTDAA times out Tommaso Merciai
2026-07-31 16:12 ` Claudiu Beznea
2026-08-05 20:28 ` Frank Li
2026-08-06  9:30   ` Tommaso Merciai
2026-08-06 18:48 ` Frank Li
2026-08-08 13:12 ` Alexandre Belloni

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®