* Assigning fixed numbers to i2c buses via ACPI code
@ 2025-02-12 8:18 Konstantin Aladyshev
2025-02-12 11:08 ` Andy Shevchenko
0 siblings, 1 reply; 6+ messages in thread
From: Konstantin Aladyshev @ 2025-02-12 8:18 UTC (permalink / raw)
To: linux-acpi, linux-i2c, Andy Shevchenko
Hello!
Is it possible to assign fixed numbers to i2c buses via ACPI code?
In DTS code it is done via aliases
(https://docs.kernel.org/i2c/i2c-sysfs.html#caveat).
For example:
```
aliases {
i2c20 = &imux20;
}
&i2c1 {
status = "okay";
i2c-mux@77 {
...
imux20: i2c@0 {
...
}
...
}
}
```
Is it possible to do something like that in ACPI code?
Best regards,
Konstantin Aladyshev
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Assigning fixed numbers to i2c buses via ACPI code
2025-02-12 8:18 Assigning fixed numbers to i2c buses via ACPI code Konstantin Aladyshev
@ 2025-02-12 11:08 ` Andy Shevchenko
2025-02-12 12:06 ` Konstantin Aladyshev
0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2025-02-12 11:08 UTC (permalink / raw)
To: Konstantin Aladyshev; +Cc: linux-acpi, linux-i2c
On Wed, Feb 12, 2025 at 11:18:44AM +0300, Konstantin Aladyshev wrote:
> Hello!
>
> Is it possible to assign fixed numbers to i2c buses via ACPI code?
>
> In DTS code it is done via aliases
> (https://docs.kernel.org/i2c/i2c-sysfs.html#caveat).
>
> For example:
> ```
> aliases {
> i2c20 = &imux20;
> }
>
> &i2c1 {
> status = "okay";
>
> i2c-mux@77 {
> ...
> imux20: i2c@0 {
> ...
> }
> ...
> }
> }
> ```
>
> Is it possible to do something like that in ACPI code?
Why? What the problem do you actually have?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Assigning fixed numbers to i2c buses via ACPI code
2025-02-12 11:08 ` Andy Shevchenko
@ 2025-02-12 12:06 ` Konstantin Aladyshev
2025-02-12 12:06 ` Andy Shevchenko
0 siblings, 1 reply; 6+ messages in thread
From: Konstantin Aladyshev @ 2025-02-12 12:06 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-acpi, linux-i2c
I'm running OpenBmc project on the x86 host. One of the applications
from the OpenBmc ecosystem tries to find IPMI FRU devices on all
available I2C buses. For that it would perform some transactions for
every possible I2C device on every I2C bus to understand if it is an
EEPROM or not.
If the user doesn't want to scan some buses it can provide
blocklist.json with addresses of the buses which shouldn't be scanned
for FRU. But this blocklist operates with absolute addresses, which is
why I want to be sure that my I2C buses would have fixed numbers on
all systems.
Also it can be the case when the user wants to make sure that buses
behind different I2C muxes are numbered in a particular way.
Shortly speaking, existing OpenBmc software relies on this alias
functionality in a couple of different scenarios. There are many
examples of its usage in the BMC DTS code for different machines.
Therefore I wonder if it is possible to do the same with x86 via ACPI
tables to support existing OpenBmc applications.
Best regards,
Konstantin Aladyshev
On Wed, Feb 12, 2025 at 2:08 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Wed, Feb 12, 2025 at 11:18:44AM +0300, Konstantin Aladyshev wrote:
> > Hello!
> >
> > Is it possible to assign fixed numbers to i2c buses via ACPI code?
> >
> > In DTS code it is done via aliases
> > (https://docs.kernel.org/i2c/i2c-sysfs.html#caveat).
> >
> > For example:
> > ```
> > aliases {
> > i2c20 = &imux20;
> > }
> >
> > &i2c1 {
> > status = "okay";
> >
> > i2c-mux@77 {
> > ...
> > imux20: i2c@0 {
> > ...
> > }
> > ...
> > }
> > }
> > ```
> >
> > Is it possible to do something like that in ACPI code?
>
> Why? What the problem do you actually have?
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Assigning fixed numbers to i2c buses via ACPI code
2025-02-12 12:06 ` Konstantin Aladyshev
@ 2025-02-12 12:06 ` Andy Shevchenko
2025-02-12 12:37 ` Konstantin Aladyshev
0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2025-02-12 12:06 UTC (permalink / raw)
To: Konstantin Aladyshev; +Cc: linux-acpi, linux-i2c
On Wed, Feb 12, 2025 at 03:06:37PM +0300, Konstantin Aladyshev wrote:
> I'm running OpenBmc project on the x86 host. One of the applications
> from the OpenBmc ecosystem tries to find IPMI FRU devices on all
> available I2C buses. For that it would perform some transactions for
> every possible I2C device on every I2C bus to understand if it is an
> EEPROM or not.
> If the user doesn't want to scan some buses it can provide
> blocklist.json with addresses of the buses which shouldn't be scanned
> for FRU. But this blocklist operates with absolute addresses, which is
> why I want to be sure that my I2C buses would have fixed numbers on
> all systems.
The problem is how that blacklist is being organized. Nobody has to rely on
the bus numbers that are assigned during runtime by Linux kernel.
> Also it can be the case when the user wants to make sure that buses
> behind different I2C muxes are numbered in a particular way.
Why?
> Shortly speaking, existing OpenBmc software relies on this alias
> functionality in a couple of different scenarios.
Bad design. Even in OF world aliases are admitted to be a hack rather than
a solution.
> There are many examples of its usage in the BMC DTS code for different
> machines. Therefore I wonder if it is possible to do the same with x86 via
> ACPI tables to support existing OpenBmc applications.
I believe this is not an ACPI issue, this is issue of how that blacklist and
other things were designed and implemented. The correct way is to analyse sysfs
based on the registered host controllers, if one wants a platform-specific black
list, it should contain the HW addresses (bus, address, etc.) to identify
the controller and never the number that is assigned by the OS.
This is the very similar trap people got with eth0, eth1, ... in the past.
> On Wed, Feb 12, 2025 at 2:08 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Wed, Feb 12, 2025 at 11:18:44AM +0300, Konstantin Aladyshev wrote:
> > > Hello!
> > >
> > > Is it possible to assign fixed numbers to i2c buses via ACPI code?
> > >
> > > In DTS code it is done via aliases
> > > (https://docs.kernel.org/i2c/i2c-sysfs.html#caveat).
> > >
> > > For example:
> > > ```
> > > aliases {
> > > i2c20 = &imux20;
> > > }
> > >
> > > &i2c1 {
> > > status = "okay";
> > >
> > > i2c-mux@77 {
> > > ...
> > > imux20: i2c@0 {
> > > ...
> > > }
> > > ...
> > > }
> > > }
> > > ```
> > >
> > > Is it possible to do something like that in ACPI code?
> >
> > Why? What the problem do you actually have?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Assigning fixed numbers to i2c buses via ACPI code
2025-02-12 12:06 ` Andy Shevchenko
@ 2025-02-12 12:37 ` Konstantin Aladyshev
2025-02-12 13:31 ` Andy Shevchenko
0 siblings, 1 reply; 6+ messages in thread
From: Konstantin Aladyshev @ 2025-02-12 12:37 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-acpi, linux-i2c
Don't get me wrong, I'm not trying to defend a solution with aliases.
It is just there is existing code that relies on fixed i2c bus
numbers, and I was just trying to understand if it can be ported to
x86 easily.
Apparently it can't.
Thanks for the answer!
Best regards,
Konstantin Aladyshev
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Assigning fixed numbers to i2c buses via ACPI code
2025-02-12 12:37 ` Konstantin Aladyshev
@ 2025-02-12 13:31 ` Andy Shevchenko
0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-02-12 13:31 UTC (permalink / raw)
To: Konstantin Aladyshev; +Cc: linux-acpi, linux-i2c
On Wed, Feb 12, 2025 at 03:37:22PM +0300, Konstantin Aladyshev wrote:
> Don't get me wrong, I'm not trying to defend a solution with aliases.
I'm not assuming you defend it, just telling you that, yeah, design of
some solutions in the user space WRT HW finding and identification is
broken. And OF alias approach was maybe a mistake to work around that.
> It is just there is existing code that relies on fixed i2c bus
> numbers, and I was just trying to understand if it can be ported to
> x86 easily.
If you do it correctly from day 1, there porting will not be needed *at all*
independently on the architecture (it will work even on legacy non-OF/non-ACPI
platforms as good as on newest ones). That's my point.
> Apparently it can't.
It can't be done in current code base, but one may patch the kernel and
the ACPI tables to achieve that. I do not think it's a practical solution,
though.
> Thanks for the answer!
You're welcome!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-02-12 13:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-12 8:18 Assigning fixed numbers to i2c buses via ACPI code Konstantin Aladyshev
2025-02-12 11:08 ` Andy Shevchenko
2025-02-12 12:06 ` Konstantin Aladyshev
2025-02-12 12:06 ` Andy Shevchenko
2025-02-12 12:37 ` Konstantin Aladyshev
2025-02-12 13:31 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).