Individual PCI devices lack dedicated device tree nodes, but their IOMMU configuration (including reserved IOVA regions) is often defined at the PCI host controller level in the device tree. The "iommu-addresses" property in reserved-memory nodes specifies IOVA ranges that should be reserved for specific devices. Currently, PCI devices cannot access these configurations because their dev->of_node is NULL, preventing of_iommu_get_resv_regions() from discovering reserved regions defined in the device tree. Fix this by assigning the PCI host controller's device tree node to PCI devices during IOMMU configuration, enabling them to inherit the host controller's device tree properties. This allows PCI devices to properly discover and reserve IOVA regions specified in the device tree. Link: https://lore.kernel.org/linux-iommu/20250529183815.GA236098@xxxxxxxx/ Signed-off-by: Shyam Saini <shyamsaini@xxxxxxxxxxxxxxxxxxx> --- drivers/iommu/of_iommu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index 6b989a62def20..077482917e3e8 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -145,6 +145,17 @@ int of_iommu_configure(struct device *dev, struct device_node *master_np, err = pci_for_each_dma_alias(to_pci_dev(dev), of_pci_iommu_init, &info); of_pci_check_device_ats(dev, master_np); + + /* + * For PCI devices, ensure the device's of_node points to the + * PCI host controller's device tree node so that reserved regions + * and other DT-specific IOMMU configuration can be found. + * PCI devices typically don't have individual DT nodes, but + * their configuration (including reserved regions) is defined + * at the PCI host controller level. + */ + if (!err && master_np && !dev->of_node) + dev->of_node = of_node_get(master_np); } else { err = of_iommu_configure_device(master_np, dev, id); } -- 2.34.1