Message ID | 20220620150225.1307946-1-mw@semihalf.com (mailing list archive) |
---|---|
Headers | show |
Series | ACPI support for DSA | expand |
On Mon, Jun 20, 2022 at 05:02:13PM +0200, Marcin Wojtas wrote: > Hi! > > This patchset introduces the support for DSA in ACPI world. A couple of > words about the background and motivation behind those changes: > > The DSA code is strictly dependent on the Device Tree and Open Firmware > (of_*) interface, both in the drivers and the common high-level net/dsa API. > The only alternative is to pass the information about the topology via > platform data - a legacy approach used by older systems that compiled the > board description into the kernel. > > The above constraint is problematic for the embedded devices based e.g. on > x86_64 SoCs, which are described by ACPI tables - to use DSA, some tricks > and workarounds have to be applied. Addition of switch description to > DSDT/SSDT tables would help to solve many similar cases and use unmodified > kernel modules. It also enables this feature for ARM64 ACPI users. > > The key enablements allowing for adding ACPI support for DSA in Linux were > NIC drivers, MDIO, PHY, and phylink modifications – the latter three merged > in 2021. I thought it would be worth to experiment with DSA, which seemed > to be a natural follow-up challenge. > > It turned out that without much hassle it is possible to describe > DSA-compliant switches as child devices of the MDIO busses, which are > responsible for their enumeration based on the standard _ADR fields and > description in _DSD objects under 'device properties' UUID [1]. > The vast majority of required changes were simple of_* to fwnode_* > transition, as the DT and ACPI topolgies are analogous, except for > 'ports' and 'mdio' subnodes naming, as they don't conform ACPI > namespace constraints [2]. ... > Note that for now cascade topology remains unsupported in ACPI world > (based on "dsa" label and "link" property values). It seems to be feasible, > but would extend this patchset due to necessity of of_phandle_iterator > migration to fwnode_. Leave it as a possible future step. Wondering if this can be done using fwnode graph.
On Mon, Jun 20, 2022 at 05:02:13PM +0200, Marcin Wojtas wrote: > Hi! > > This patchset introduces the support for DSA in ACPI world. A couple of > words about the background and motivation behind those changes: > > The DSA code is strictly dependent on the Device Tree and Open Firmware > (of_*) interface, both in the drivers and the common high-level net/dsa API. > The only alternative is to pass the information about the topology via > platform data - a legacy approach used by older systems that compiled the > board description into the kernel. Not true. There are deployed x86 systems which do this, and they are fully up to date, not legacy. There are however limitations in what you can do. So please drop this wording. > The above constraint is problematic for the embedded devices based e.g. on > x86_64 SoCs, which are described by ACPI tables - to use DSA, some tricks > and workarounds have to be applied. It would be good to describe the limitations. As i said, there are x86 systems running with marvell 6390 switches. > It turned out that without much hassle it is possible to describe > DSA-compliant switches as child devices of the MDIO busses, which are > responsible for their enumeration based on the standard _ADR fields and > description in _DSD objects under 'device properties' UUID [1]. No surprises there. That is how the DT binding works. And the current ACPI concept is basically DT in different words. Maybe the more important question is, is rewording DT in ACPI the correct approach, or should you bo doing a more native ACPI implementation? I cannot answer that, you need to ask the ACPI maintainers. > Note that for now cascade topology remains unsupported in ACPI world > (based on "dsa" label and "link" property values). It seems to be feasible, > but would extend this patchset due to necessity of of_phandle_iterator > migration to fwnode_. Leave it as a possible future step. We really do need to ensure this is possible. You are setting an ABI here, which everybody else in the ACPI world needs to follow. Cascaded switches is fundamental to DSA, it is the D in DSA. So i would prefer that you at least define and document the binding for D in DSA and get it sanity checked by the ACPI people. Andrew
On Mon, Jun 20, 2022 at 07:55:44PM +0200, Andrew Lunn wrote: > On Mon, Jun 20, 2022 at 05:02:13PM +0200, Marcin Wojtas wrote: ... > > It turned out that without much hassle it is possible to describe > > DSA-compliant switches as child devices of the MDIO busses, which are > > responsible for their enumeration based on the standard _ADR fields and > > description in _DSD objects under 'device properties' UUID [1]. > > No surprises there. That is how the DT binding works. And the current > ACPI concept is basically DT in different words. Maybe the more > important question is, is rewording DT in ACPI the correct approach, > or should you bo doing a more native ACPI implementation? I cannot > answer that, you need to ask the ACPI maintainers. You beat me up to this. I also was about to mention that the problem with such conversions (like this series does) is not in the code. It's simplest part. The problem is bindings and how you get them to be a standard (at least de facto). > > Note that for now cascade topology remains unsupported in ACPI world > > (based on "dsa" label and "link" property values). It seems to be feasible, > > but would extend this patchset due to necessity of of_phandle_iterator > > migration to fwnode_. Leave it as a possible future step. > > We really do need to ensure this is possible. You are setting an ABI > here, which everybody else in the ACPI world needs to follow. Cascaded > switches is fundamental to DSA, it is the D in DSA. So i would prefer > that you at least define and document the binding for D in DSA and get > it sanity checked by the ACPI people.
> You beat me up to this. I also was about to mention that the problem with such > conversions (like this series does) is not in the code. It's simplest part. The > problem is bindings and how you get them to be a standard (at least de facto). De facto is easy. Get it merged. After that, i will simply refuse anything else, the same way i and other Maintainers would refuse a different DT binding. If the ACPI committee approve and publish a binding, we will naturally accept that as well. So in the end we might have two bindings. But so far in this whole ACPI for networking story, i've not heard anybody say they are going to submit anything for standardisation. So this might be a mute point. Andrew
pon., 20 cze 2022 o 19:21 Andy Shevchenko <andriy.shevchenko@linux.intel.com> napisał(a): > > On Mon, Jun 20, 2022 at 05:02:13PM +0200, Marcin Wojtas wrote: > > Hi! > > > > This patchset introduces the support for DSA in ACPI world. A couple of > > words about the background and motivation behind those changes: > > > > The DSA code is strictly dependent on the Device Tree and Open Firmware > > (of_*) interface, both in the drivers and the common high-level net/dsa API. > > The only alternative is to pass the information about the topology via > > platform data - a legacy approach used by older systems that compiled the > > board description into the kernel. > > > > The above constraint is problematic for the embedded devices based e.g. on > > x86_64 SoCs, which are described by ACPI tables - to use DSA, some tricks > > and workarounds have to be applied. Addition of switch description to > > DSDT/SSDT tables would help to solve many similar cases and use unmodified > > kernel modules. It also enables this feature for ARM64 ACPI users. > > > > The key enablements allowing for adding ACPI support for DSA in Linux were > > NIC drivers, MDIO, PHY, and phylink modifications – the latter three merged > > in 2021. I thought it would be worth to experiment with DSA, which seemed > > to be a natural follow-up challenge. > > > > It turned out that without much hassle it is possible to describe > > DSA-compliant switches as child devices of the MDIO busses, which are > > responsible for their enumeration based on the standard _ADR fields and > > description in _DSD objects under 'device properties' UUID [1]. > > The vast majority of required changes were simple of_* to fwnode_* > > transition, as the DT and ACPI topolgies are analogous, except for > > 'ports' and 'mdio' subnodes naming, as they don't conform ACPI > > namespace constraints [2]. > > ... > > > Note that for now cascade topology remains unsupported in ACPI world > > (based on "dsa" label and "link" property values). It seems to be feasible, > > but would extend this patchset due to necessity of of_phandle_iterator > > migration to fwnode_. Leave it as a possible future step. > > Wondering if this can be done using fwnode graph. > Probably yes. It's a general question whether to follow iterating over phandles pointed by properties, like DT with a minimal code change or do something completely different. Best regards, Marcin
pon., 20 cze 2022 o 19:56 Andrew Lunn <andrew@lunn.ch> napisał(a): > > On Mon, Jun 20, 2022 at 05:02:13PM +0200, Marcin Wojtas wrote: > > Hi! > > > > This patchset introduces the support for DSA in ACPI world. A couple of > > words about the background and motivation behind those changes: > > > > The DSA code is strictly dependent on the Device Tree and Open Firmware > > (of_*) interface, both in the drivers and the common high-level net/dsa API. > > The only alternative is to pass the information about the topology via > > platform data - a legacy approach used by older systems that compiled the > > board description into the kernel. > > Not true. There are deployed x86 systems which do this, and they are > fully up to date, not legacy. There are however limitations in what > you can do. So please drop this wording. > Ok, thanks for clarification, agree for rewording. Afair pdata was a legacy derived from the Orion/Dove times, but indeed it can be used in the new systems that lack other switch description. > > The above constraint is problematic for the embedded devices based e.g. on > > x86_64 SoCs, which are described by ACPI tables - to use DSA, some tricks > > and workarounds have to be applied. > > It would be good to describe the limitations. As i said, there are x86 > systems running with marvell 6390 switches. I'm aware of that and even saw some x86_64 + Marvell switch contemporary examples of how lack of DT in system was worked around: - out of tree updates to the module code - keep small DT blob on the system storage, from where the mv88e6xxx Those could be poor-coding / anecdotic showcases. I'd be happy to learn if there is a proper and recommended way, how to do it properly. > > > It turned out that without much hassle it is possible to describe > > DSA-compliant switches as child devices of the MDIO busses, which are > > responsible for their enumeration based on the standard _ADR fields and > > description in _DSD objects under 'device properties' UUID [1]. > > No surprises there. That is how the DT binding works. And the current > ACPI concept is basically DT in different words. Maybe the more > important question is, is rewording DT in ACPI the correct approach, > or should you bo doing a more native ACPI implementation? I cannot > answer that, you need to ask the ACPI maintainers. This is why I added linux-acpi list and the ACPI Maintainers to discuss > > > Note that for now cascade topology remains unsupported in ACPI world > > (based on "dsa" label and "link" property values). It seems to be feasible, > > but would extend this patchset due to necessity of of_phandle_iterator > > migration to fwnode_. Leave it as a possible future step. > > We really do need to ensure this is possible. You are setting an ABI > here, which everybody else in the ACPI world needs to follow. Cascaded > switches is fundamental to DSA, it is the D in DSA. So i would prefer > that you at least define and document the binding for D in DSA and get > it sanity checked by the ACPI people. > I'm aware of the "D" importance, just kept it aside for now due to lack of access to relevant HW and willing to discuss the overall approach first. WRT the technical side: multiple-phandle property is for sure supported in _DSD, so the most straightforward would be to follow that and simply migrate to fwnode_. The thing is in arm64 it's not widely used and (testing that with ACPI is making it even harder). There is also an alternative brought by Andy - definitely a thing to discuss further. I think we seem to have a quorum for that among recipents of this thread. Thanks, Marcin
pon., 20 cze 2022 o 20:45 Andrew Lunn <andrew@lunn.ch> napisał(a): > > > You beat me up to this. I also was about to mention that the problem with such > > conversions (like this series does) is not in the code. It's simplest part. The > > problem is bindings and how you get them to be a standard (at least de facto). > > De facto is easy. Get it merged. After that, i will simply refuse > anything else, the same way i and other Maintainers would refuse a > different DT binding. > > If the ACPI committee approve and publish a binding, we will naturally > accept that as well. So in the end we might have two bindings. But so > far in this whole ACPI for networking story, i've not heard anybody > say they are going to submit anything for standardisation. So this > might be a mute point. > I understand your concern and of course it's better to be on a safe side from the beginning. Based on the hitherto discussion under this patchset, I would split the question about standardization to 2 orthogonal topics: 1. Relation to the bus and enumeration: * As pointed out in another patch some switches can be attached to SPI or I2C. In such a case this is simple - SPISerialBus / I2CSerialBus structures in _CRS are included in the ACPI Spec. They allow to comprise more bus specific information and the code in acpi/scan.c marks those child devices as to be enumerated by parent bus. * MDIO bus doesn't have its own _CRS macro in the Spec, on the other hand the _ADR seems to be the only object required for proper operation - this was my base for proposed solution in patch 06/12. 2. The device description (unrelated to which bus it is attached) * In Linux and other OS's there is a great amount of devices conforming the guidelines and using only the standard device identification/configuration objects as per [1]. * Above do not contain custom items and entire information can be obtained by existing, generic ACPI accessors - those devices (e.g. NICs, SD/MMC controllers and many others) are not explicitly mentioned in official standards. * The question, also related to this DSA case - is the ACPI device() hierarchical structure of this kind a subject for standardization for including in official ACPI specification? * In case not, where to document it? Is Linux' Documentation enough? I agree that in the moment of merge it becomes de facto standard ABI and it's worth to sort it out. Rafael, Len, any other ACPI expert - I would appreciate your inputs and clarification of the above. Your recommendation would be extremely helpful. Best regards, Marcin
Hi, wt., 21 cze 2022 o 12:46 Marcin Wojtas <mw@semihalf.com> napisał(a): > > pon., 20 cze 2022 o 20:45 Andrew Lunn <andrew@lunn.ch> napisał(a): > > > > > You beat me up to this. I also was about to mention that the problem with such > > > conversions (like this series does) is not in the code. It's simplest part. The > > > problem is bindings and how you get them to be a standard (at least de facto). > > > > De facto is easy. Get it merged. After that, i will simply refuse > > anything else, the same way i and other Maintainers would refuse a > > different DT binding. > > > > If the ACPI committee approve and publish a binding, we will naturally > > accept that as well. So in the end we might have two bindings. But so > > far in this whole ACPI for networking story, i've not heard anybody > > say they are going to submit anything for standardisation. So this > > might be a mute point. > > > > I understand your concern and of course it's better to be on a safe > side from the beginning. Based on the hitherto discussion under this > patchset, I would split the question about standardization to 2 > orthogonal topics: > > 1. Relation to the bus and enumeration: > * As pointed out in another patch some switches can be attached to > SPI or I2C. In such a case this is simple - SPISerialBus / > I2CSerialBus structures > in _CRS are included in the ACPI Spec. They allow to comprise more > bus specific > information and the code in acpi/scan.c marks those child devices > as to be enumerated > by parent bus. > * MDIO bus doesn't have its own _CRS macro in the Spec, on the other > hand the _ADR > seems to be the only object required for proper operation - this > was my base for > proposed solution in patch 06/12. > > 2. The device description (unrelated to which bus it is attached) > * In Linux and other OS's there is a great amount of devices > conforming the guidelines > and using only the standard device identification/configuration > objects as per [1]. > * Above do not contain custom items and entire information can be obtained by > existing, generic ACPI accessors - those devices (e.g. NICs, > SD/MMC controllers and > many others) are not explicitly mentioned in official standards. > * The question, also related to this DSA case - is the ACPI device() > hierarchical > structure of this kind a subject for standardization for including > in official ACPI specification? > * In case not, where to document it? Is Linux' Documentation enough? > I agree that in the moment of merge it becomes de facto standard ABI and > it's worth to sort it out. > > Rafael, Len, any other ACPI expert - I would appreciate your inputs > and clarification > of the above. Your recommendation would be extremely helpful. > Thank you all for vivid discussions. As it may take some time for the MDIOSerialBus _CRS macro review and approval, for now I plan to submit v2 of_ -> fwnode_/device_ migration (patches 1-7,11/12) and skip ACPI-specific additions until it is unblocked by spec extension. Best regards, Marcin
On Wed, Jun 22, 2022 at 5:44 PM Marcin Wojtas <mw@semihalf.com> wrote: > > Hi, > > wt., 21 cze 2022 o 12:46 Marcin Wojtas <mw@semihalf.com> napisał(a): > > > > pon., 20 cze 2022 o 20:45 Andrew Lunn <andrew@lunn.ch> napisał(a): > > > > > > > You beat me up to this. I also was about to mention that the problem with such > > > > conversions (like this series does) is not in the code. It's simplest part. The > > > > problem is bindings and how you get them to be a standard (at least de facto). > > > > > > De facto is easy. Get it merged. After that, i will simply refuse > > > anything else, the same way i and other Maintainers would refuse a > > > different DT binding. > > > > > > If the ACPI committee approve and publish a binding, we will naturally > > > accept that as well. So in the end we might have two bindings. But so > > > far in this whole ACPI for networking story, i've not heard anybody > > > say they are going to submit anything for standardisation. So this > > > might be a mute point. > > > > > > > I understand your concern and of course it's better to be on a safe > > side from the beginning. Based on the hitherto discussion under this > > patchset, I would split the question about standardization to 2 > > orthogonal topics: > > > > 1. Relation to the bus and enumeration: > > * As pointed out in another patch some switches can be attached to > > SPI or I2C. In such a case this is simple - SPISerialBus / > > I2CSerialBus structures > > in _CRS are included in the ACPI Spec. They allow to comprise more > > bus specific > > information and the code in acpi/scan.c marks those child devices > > as to be enumerated > > by parent bus. > > * MDIO bus doesn't have its own _CRS macro in the Spec, on the other > > hand the _ADR > > seems to be the only object required for proper operation - this > > was my base for > > proposed solution in patch 06/12. > > > > 2. The device description (unrelated to which bus it is attached) > > * In Linux and other OS's there is a great amount of devices > > conforming the guidelines > > and using only the standard device identification/configuration > > objects as per [1]. > > * Above do not contain custom items and entire information can be obtained by > > existing, generic ACPI accessors - those devices (e.g. NICs, > > SD/MMC controllers and > > many others) are not explicitly mentioned in official standards. > > * The question, also related to this DSA case - is the ACPI device() > > hierarchical > > structure of this kind a subject for standardization for including > > in official ACPI specification? > > * In case not, where to document it? Is Linux' Documentation enough? > > I agree that in the moment of merge it becomes de facto standard ABI and > > it's worth to sort it out. > > > > Rafael, Len, any other ACPI expert - I would appreciate your inputs > > and clarification > > of the above. Your recommendation would be extremely helpful. > > > > Thank you all for vivid discussions. As it may take some time for the > MDIOSerialBus _CRS macro review and approval, for now I plan to submit > v2 of_ -> fwnode_/device_ migration (patches 1-7,11/12) and skip > ACPI-specific additions until it is unblocked by spec extension. Sounds good to me (as from fwnode perspective).