[PATCH v22 1/5] i3c: hub: Mark downstream DT addresses as desired on parent bus

Frank Li Frank.li at oss.nxp.com
Mon Nov 23 12:07:16 PST 2026


On Thu, Nov 19, 2026 at 10:12:03AM +0000, sashiko-bot at kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 3 potential
> issues to consider:
> - [Medium] i3c: hub: attached downstream devices leave parent slot free
> - [Medium] i3c: hub: downstream ENTDAA devices miss boardinfo for
>   SETNEWDA
> - [Low] i3c: hub: missing Fixes trailer for commit b0cfe49a2e3b
> --
>
> commit 8029b535e0098c5324d297a089353d72c193eebe
> Author: Lakshay Piplani <lakshay.piplani at nxp.com>
>
> > i3c: hub: Mark downstream DT addresses as desired on parent bus
> >
> > I3C devices behind hub target ports share the parent controller's
> > dynamic address space. Their assigned dynamic addresses from Device
> > Tree must be preserved so that parent DAA does not allocate the same
> > addresses to other devices.
> >
> > Previously, the hub reserved these addresses by marking the parent
> > bus slots as I3C_ADDR_SLOT_I3C_DEV, even though the downstream devices
> > were not attached to the parent bus. This could cause address
> > reconciliation to incorrectly treat these slots as occupied by
> > orphaned I3C devices.
> >
> > Introduce i3c_bus_set_addr_slot_desired() to mark an address as
> > desired without changing its current slot status.
> >
> > Use this helper when processing downstream I3C devices described in
> > Device Tree. This allows parent DAA to avoid the desired addresses
> > while keeping the slots free until the corresponding devices are
> > actually attached.
> >
> > Keep the desired address markings for the lifetime of the parent bus,
> > as they represent the fixed Device Tree topology.
> >
> > Signed-off-by: Lakshay Piplani <lakshay.piplani at nxp.com>
>
> [Severity: Low]
> This fixes the parent-bus slot reservation in
> i3c_hub_reserve_parent_addrslots_from_dt().  Should this include:
>
>   Fixes: b0cfe49a2e3b ("i3c: hub: Add support for the I3C interface in the I3C hub")
>
> > diff --git a/drivers/i3c/hub.c b/drivers/i3c/hub.c
> > index 5390287680844..95eec5b0cada0 100644
> > --- a/drivers/i3c/hub.c
> > +++ b/drivers/i3c/hub.c
> > @@ -763,10 +763,15 @@ EXPORT_SYMBOL_GPL(i3c_hub_init);
> >   * @hubc: I3C hub controller for a target-port virtual bus.
> >   * @node: Target-port bus Device Tree node.
> >   *
> > - * Reserve parent bus address slots for the assigned dynamic address of each
> > - * downstream I3C device described in the Device Tree, so that parent DAA does
> > - * not hand the same address to another device. Downstream devices behind hub
> > - * target ports share the parent controller's dynamic address space.
> > + * Mark the assigned dynamic address of each downstream I3C device described in
> > + * the Device Tree as desired on the parent bus, so that parent DAA avoids
> > + * handing the same address to another device while it is still free.
> > + * Downstream devices behind hub target ports share the parent controller's
> > + * dynamic address space.
> > + *
> > + * A desired address is only a preference: the slot stays free, so the parent
> > + * does not report it as occupied and address reconciliation does not mistake
> > + * it for an orphaned device that has to be probed.
> >   *
> >   * The reservations describe a fixed Device Tree topology and are kept for the
> >   * lifetime of the parent bus; they are not released when a target port is
> > @@ -816,9 +821,8 @@ int i3c_hub_reserve_parent_addrslots_from_dt(struct i3c_hub_controller *hubc,
> >  		status = i3c_bus_get_addr_slot_status(&parent->bus,
> >  						      assigned_addr);
> >  		if (status == I3C_ADDR_SLOT_FREE)
> > -			i3c_bus_set_addr_slot_status(&parent->bus,
> > -						     assigned_addr,
> > -						     I3C_ADDR_SLOT_I3C_DEV);
> > +			i3c_bus_set_addr_slot_desired(&parent->bus,
> > +						      assigned_addr);
> >  		i3c_bus_maintenance_unlock(&parent->bus);
> >  	}
> >  	return 0;
>
> [Severity: Medium]
> Does assigned_addr ever get marked as I3C_ADDR_SLOT_I3C_DEV on parent->bus
> when a downstream device is attached via SETDASA or SETAASA?
>
> i3c_bus_set_addr_slot_desired() only sets I3C_ADDR_SLOT_EXT_DESIRED and
> leaves the slot status bits on parent->bus as I3C_ADDR_SLOT_FREE.  When
> the virtual hub controller initializes a downstream device that has a
> static address and assigned-address, i3c_master_attach_i3c_dev() and
> i3c_master_reattach_i3c_dev_locked() only update the virtual bus
> (hubc->controller.bus), while i3c_hub_attach_i3c_dev() and
> i3c_hub_reattach_i3c_dev() call the controller-only helpers on parent
> without updating parent->bus.addrslots.

Is it fixed if update parent->bus.addrslots at i3c_hub_reattach_i3c_dev()

Frank

>
> Because the device already received its dynamic address, it does not
> participate in ENTDAA during i3c_hub_do_daa().  Its slot status on
> parent->bus remains I3C_ADDR_SLOT_FREE even while the device is actively
> using assigned_addr on the shared physical bus, allowing the fallback loop
> in i3c_bus_get_free_addr(&parent->bus, ...) or other
> i3c_bus_get_addr_slot_status(&parent->bus, ...) checks to hand the in-use
> address to another device.
>
> [Severity: Medium]
> Can a downstream device with assigned-address that is discovered through
> ENTDAA ever receive its desired address?
>
> Marking assigned_addr with I3C_ADDR_SLOT_EXT_DESIRED causes
> i3c_bus_get_free_addr(&parent->bus, ...) to skip assigned_addr during
> ENTDAA and hand out a temporary dynamic address, relying on
> __i3c_master_add_i3c_dev_locked() to look up
> newdev->boardinfo->init_dyn_addr and switch the device to its desired
> address via SETNEWDA.
>
> However, i3c_hub_do_daa() calls i3c_master_do_daa(parent), so
> __i3c_master_add_i3c_dev_locked() runs with master set to parent and
> i3c_master_attach_boardinfo() only searches parent->boardinfo.i3c:
>
> drivers/i3c/master.c:i3c_master_attach_boardinfo() {
> 	struct i3c_master_controller *master = i3cdev->common.master;
> 	struct i3c_dev_boardinfo *i3cboardinfo;
>
> 	list_for_each_entry(i3cboardinfo, &master->boardinfo.i3c, node) {
> 	...
> }
>
> Because fwnode_populate_i3c_bus() populated the downstream boardinfo entries
> on hubc->controller.boardinfo.i3c rather than parent->boardinfo.i3c,
> newdev->boardinfo is never found, SETNEWDA is not issued, and the device is
> left at the temporary address without its DT boardinfo attached.
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261119095449.555593-1-lakshay.piplani@nxp.com?part=1



More information about the linux-i3c mailing list