Re: [PATCH V13 2/5] PCI: Create device tree node for bridge

Herve Codina
2023-09-11T21:21:04Z

Hi Jonathan,

On Mon, 11 Sep 2023 15:48:56 +0100
Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:

> On Tue, 15 Aug 2023 10:19:57 -0700
> Lizhi Hou <lizhi.hou@amd.com> wrote:
>
> > The PCI endpoint device such as Xilinx Alveo PCI card maps the register
> > spaces from multiple hardware peripherals to its PCI BAR. Normally,
> > the PCI core discovers devices and BARs using the PCI enumeration process.
> > There is no infrastructure to discover the hardware peripherals that are
> > present in a PCI device, and which can be accessed through the PCI BARs.
> >
> > Apparently, the device tree framework requires a device tree node for the
> > PCI device. Thus, it can generate the device tree nodes for hardware
> > peripherals underneath. Because PCI is self discoverable bus, there might
> > not be a device tree node created for PCI devices. Furthermore, if the PCI
> > device is hot pluggable, when it is plugged in, the device tree nodes for
> > its parent bridges are required. Add support to generate device tree node
> > for PCI bridges.
> >
> > Add an of_pci_make_dev_node() interface that can be used to create device
> > tree node for PCI devices.
> >
> > Add a PCI_DYNAMIC_OF_NODES config option. When the option is turned on,
> > the kernel will generate device tree nodes for PCI bridges unconditionally.
> >
> > Initially, add the basic properties for the dynamically generated device
> > tree nodes which include #address-cells, #size-cells, device_type,
> > compatible, ranges, reg.
> >
> > Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> > Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
>
> I tried to bring this up for a custom PCIe card emulated in QEMU on an ARM ACPI
> machine.
>
> There are some missing parts that were present in Clements series, but not this
> one, particularly creation of the root pci object.
>
> Anyhow, hit an intermittent crash...

I am facing the same issues.

I use a custom PCIe board too but on x86 ACPI machine.

In order to have a working system, I need also to build a DT node for the PCI
Host bridge (previously done by Clement's patch) and I am a bit stuck with
interrupts.

On your side (ACPI machine) how do you handle this ?
I mean is your PCI host bridge provided by ACPI ? And if so, you probably need
to build a DT node for this PCI host bridge and add some interrupt-map,
interrupt-map-mask properties in the DT node.

Best regards,
Hervé

--
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering