Re: [PATCH v3 03/11] i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_INIT

Miquel Raynal
2024-09-02T14:12:59Z

Hi Frank,

> > > switch to this address if it is free.
> > > *
> > > In step 1, i3c_bus_get_free_addr() is called. To optimize for step 2b, this
> > > function should return an address that is not pre-reserved by any target
> > > device with an assigned address in the device tree (DT).
> >
> > This does not make sense, if you want to optimize for 2b, why not
> > selecting the assigned-address property in the first place if it's
> > available?
>
> This is my first idea. But I gived up this way.
>
> Select an assigned-address here will involve a big change in i3c framework.
> There are no PID information in i3c_master_get_free_addr().
>
> In DAA flow:
> - SVC is get PID first, the get_free_addr(). This case, we can use PID to
> get dt assigned address.(if change/add API)
> - But HCI, it is difference, hci_cmd_v2_daa(), get_free_addr() firstly then
> send out DAA command. So no PID information when call get_free_addr().
>
> To cover both case, return a *real* free address here is simplest solution.

But this is a limitation of the HCI driver? So why not addressing this
in the HCI driver instead? It would greatly simplify the core logic
which becomes complex for wrong reasons.

> > Also, I don't understand why you would care to specifically
> > *not* return an address that might be the default one for another
> > device in the first place.
>
> If devices A (want adddress 0xA), device B (want address 0xB), if both
> device send hot join at the same time. device B's PID less than device A,
>
> Device B will be found firstly, call get_free_addr(), 0xA will be return
> if no this patch.
>
> Device A, call try_get_freeaddr() to get 0xB.
>
> So Devcie B will be assign to 0xA, and Device A will be assign to address 0xB.
>
> After do_daa command, framework will add device B and device A into i3c bus.
>
> When framework try to add device B to i3c bus, framework will try switch
> device B's address to 0xB from 0xA, but it will be fail because 0xB already
> assigned to device A.

Well, okay, but that's exactly the situation that will happen if these
devices are not described in your DT. I guess it's expected that a
device not described in your DT can be connected, thanks to the
hot-join feature. In this case you cannot know what is this device
preferred address and you might end-up in the exact same situation.

May I question the need for preferred addresses at all? Is this even
part of the spec? What is the use-case?

Thanks,
Miquèl