[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241129125345.3cf2fde4@booty>
Date: Fri, 29 Nov 2024 12:53:45 +0100
From: Luca Ceresoli <luca.ceresoli@...tlin.com>
To: Romain Gantois <romain.gantois@...tlin.com>
Cc: Wolfram Sang <wsa+renesas@...g-engineering.com>, Andy Shevchenko
<andriy.shevchenko@...ux.intel.com>, Sakari Ailus
<sakari.ailus@...ux.intel.com>, Tomi Valkeinen
<tomi.valkeinen@...asonboard.com>, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org, Wolfram Sang <wsa@...nel.org>, Mauro Carvalho
Chehab <mchehab@...nel.org>, Cosmin Tanislav <demonsingur@...il.com>, Tomi
Valkeinen <tomi.valkeinen+renesas@...asonboard.com>, Matti Vaittinen
<Matti.Vaittinen@...rohmeurope.com>
Subject: Re: [PATCH v2 2/3] i2c: atr: Allow unmapped addresses from nested
ATRs
Hello Tomi, Romain,
+Cc Matti
On Tue, 26 Nov 2024 09:34:56 +0100
Romain Gantois <romain.gantois@...tlin.com> wrote:
> Hello Tomi,
>
> On vendredi 22 novembre 2024 13:26:19 heure normale d’Europe centrale Tomi Valkeinen wrote:
> > From: Cosmin Tanislav <demonsingur@...il.com>
> >
> > i2c-atr translates the i2c transactions and forwards them to its parent
> > i2c bus. Any transaction to an i2c address that has not been mapped on
> > the i2c-atr will be rejected with an error.
> >
> > However, if the parent i2c bus is another i2c-atr, the parent i2c-atr
> > gets a transaction to an i2c address that is not mapped in the parent
> > i2c-atr, and thus fails.
> >
> > Relax the checks, and allow non-mapped transactions to fix this issue.
>
> I have a series in the review pipeline which adds optional support for dynamic
> I2C ATR address translation. If this option is enabled, then transactions on any
> unmapped address are assigned an alias on-the-fly. This feature is required to
> handle alias shortages on some hardware setups:
>
> https://lore.kernel.org/all/20241125-fpc202-v3-0-34e86bcb5b56@bootlin.com/
>
> Letting all non-mapped transactions through would conflict with my series, since
> these two scenarios would be indistinguishable:
>
> case 1:
> transaction with 3 messages is requested, msg1 -> 0x50; msg2 -> 0x51; msg3 -> 0x56
> alias pool can only hold 2 mappings at a time, so transaction cannot go through
>
> case 2:
> transaction with 3 messages is requested, msg1 -> 0x50; msg2 -> 0x51; msg3 -> 0x50
> alias pool can hold 2 mappings at a time, so transaction can go through
>
> Could you perhaps introduce an ATR flag which would enable/disable letting all unmapped
> messages through? I have something similar in patch 8 of my FPC202 series:
>
> https://lore.kernel.org/all/20241125-fpc202-v3-8-34e86bcb5b56@bootlin.com/
>
> There could be a flag named "I2C_ATR_FLAG_NESTED_ATR", which would be enabled in i2c_atr_new():
>
> ```
> @@ i2c_atr_new()
>
> if (is_an_atr(parent))
> atr->flags |= I2C_ATR_FLAG_NESTED_ATR;
> ```
As I discussed on another branch of this thread, after Tomi's
explanations I think the flag is the correct solution because disabling
the checks in i2c_atr_map_msgs() is useful for a specific
implementation of the GMSL deserializer, but armful is other cases.
About the implementation, I think we should not use something like
is_an_atr(parent). First, it would potentially need to recursively
climb the parent tree, and handling all combinations of
ats/mux/whatever would be very complex. But even more because it is not
needed. Tomi explained the use case is for the GMSL deser being the
"parent ATR" (even though it is not physically an ATR) and the GMSL
serializer the "child ATR", and the change in this patch is only needed
for the parent ATR AFAICU. So the GMSL deser driver could
unconditionally set the flag, and no other driver should ever set it.
Tomi, do you think this is correct?
Based on the above, i2c_atr_new() or other parts of the i2c-atr code
are unable to self-detect whether the flag should be set or not. That
would mean we have a new user for the 'flags' field of i2c_atr_new()
that Romain proposed [0].
Finally, I think the name should not mention "nested ATR" but rather
tell what it does, like I2C_ATR_FLAG_PASS_THROUGH.
So, that's my random thoughts, what do you think about this?
[0] https://lore.kernel.org/linux-i2c/20241125-fpc202-v3-8-34e86bcb5b56@bootlin.com/
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists