Re: [PATCH 0/6] Add support for the root PCI bus device-tree node creation.
From: Rob Herring
Date: Mon Nov 04 2024 - 15:15:17 EST
On Mon, Nov 04, 2024 at 06:19:54PM +0100, Herve Codina wrote:
> Hi,
>
> This series adds support for creating a device-tree node for a root PCI
> bus on non device-tree based system.
>
> Creating device-tree nodes for PCI devices already exists upstream. It
> was added in commit 407d1a51921e ("PCI: Create device tree node for
> bridge"). Created device-tree nodes need a parent node to be attached
> to. For the first level devices, on device-tree based system, this
> parent node (i.e. the root PCI bus) is described in the base device-tree
> (PCI controller).
>
> The LAN966x PCI device driver was recently accepted [1] and relies on
> this feature.
>
> On system where the base hardware is not described by a device-tree, the
> root PCI bus node to which first level created PCI devices need to be
> attach to does not exist. This is the case for instance on ACPI
> described systems such as x86.
>
> This series goal is to handle this case.
>
> In order to have the root PCI bus device-tree node available even on
> x86, this top level node is created (if not already present) based on
> information computed by the PCI core. It follows the same mechanism as
> the one used for PCI devices device-tree node creation.
>
> In order to have this feature available, a number of changes are needed:
> - Patch 1 and 2: Introduce and use device_{add,remove}_of_node().
> This function will also be used in the root PCI bus node creation.
>
> - Patch 3 and 4: Improve existing functions to reuse them in the root
> PCI bus node creation.
>
> - Patch 5: Update the default value used when #address-cells is not
> available in the device-tree root node.
>
> - Patch 6: The root PCI bus device-tree node creation itself.
>
> With those modifications, the LAN966x PCI device is working on x86 systems.
That's nice, but I don't have a LAN966x device nor do I want one. We
already have the QEMU PCI test device working with the existing PCI
support. Please ensure this series works with it as well.
Rob