Re: [PATCH 2/3] PCI: of: create DT nodes for PCI devices if they do not exists

From: Lizhi Hou
Date: Wed May 18 2022 - 15:22:37 EST



On 5/4/22 06:43, Clément Léger wrote:
Le Tue, 3 May 2022 17:53:53 -0500,
Bjorn Helgaas <helgaas@xxxxxxxxxx> a écrit :

In subject:

PCI: of: Create DT nodes ... if they do not exist

The subject could be read as saying that you're going to create DT
nodes before the PCI devices exist, but I think you mean that when we
enumerate a PCI devices, we're *always* going to create a DT node for
it, even if the DT didn't mention it.
Hi Bjorn,

Indeed ! I'll modify that.

Linking the dynamic generated dt node to PCIe device through pci_dev->dev.of_node may cause issues. Kernel and driver code may check of_node pointer and run complete different code path if of_node is not NULL.

For example:  in of_irq_parse_pci(): https://elixir.bootlin.com/linux/v5.18-rc2/source/drivers/pci/of.c#L492

I encountered different issues when I tried to create a prototype. And I have sent all may questions/thoughts through https://lore.kernel.org/lkml/79e4c876-e5a4-861f-cfbc-c75ed1a07ddd@xxxxxxxxxx/#t

I am wondering what would be the right way to resolve it?


Thanks,

Lizhi


Maybe something like:

PCI: of: Create DT node for every PCI device

although I see Rob thinks this should be done on demand instead of
doing it for every device, which sounds sensible to me.
Agreed, I'll rework this series.

Thanks,

On Wed, Apr 27, 2022 at 11:45:01AM +0200, Clément Léger wrote:
In order to apply overlays to PCI device nodes, the nodes must first
exist. This commit add support to populate a skeleton tree for PCI bus
and devices. These nodes can then be used by drivers to apply overlays.
s/This commit add support/Add support/

Bjorn