Re: [PATCH v2 2/3] i2c: atr: Allow unmapped addresses from nested ATRs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Tomi,

On vendredi 22 novembre 2024 13:26:19 heure normale d’Europe centrale Tomi Valkeinen wrote:
> From: Cosmin Tanislav <demonsingur@xxxxxxxxx>
> 
> 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@xxxxxxxxxxx/

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@xxxxxxxxxxx/

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;
```

Please let me know what you think.

Best Regards,

-- 
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com








[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux