Linux-i3c Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lakshay Piplani" <lakshay.piplani@nxp.com>,
	linux-i3c@lists.infradead.org, mfd@lists.linux.dev
Cc: Frank.Li@kernel.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	lee@kernel.org
Subject: Re: [PATCH v22 1/5] i3c: hub: Mark downstream DT addresses as desired on parent bus
Date: Thu, 19 Nov 2026 10:12:03 +0000	[thread overview]
Message-ID: <sashiko-outbox-222922@kernel.org> (raw)
In-Reply-To: <20261119095449.555593-2-lakshay.piplani@nxp.com>

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@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@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.

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

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

  reply	other threads:[~2026-11-19 10:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  9:54 [PATCH v22 0/5] Add support for NXP P3H2x4x I3C hub driver Lakshay Piplani
2026-11-19  9:54 ` [PATCH v22 1/5] i3c: hub: Mark downstream DT addresses as desired on parent bus Lakshay Piplani
2026-11-19 10:12   ` sashiko-bot [this message]
2026-11-19  9:54 ` [PATCH v22 2/5] mfd: p3h2x4x: Add driver for NXP P3H2x4x i3c hub and on-die regulator Lakshay Piplani
2026-11-19  9:54 ` [PATCH v22 3/5] regulator: p3h2x4x: Add driver for on-die regulators in NXP P3H2x4x i3c hub Lakshay Piplani
2026-11-19  9:54 ` [PATCH v22 4/5] i3c: hub: p3h2x4x: Add support for NXP P3H2x4x I3C hub functionality Lakshay Piplani
2026-11-19  9:54 ` [PATCH v22 5/5] i3c: hub: p3h2x4x: Add SMBus slave mode support Lakshay Piplani

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=sashiko-outbox-222922@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=lakshay.piplani@nxp.com \
    --cc=lee@kernel.org \
    --cc=linux-i3c@lists.infradead.org \
    --cc=mfd@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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