From 801177535081e1b8bf286cbc2c2cf0c06c93f9b9 Mon Sep 17 00:00:00 2001 From: Igor Kuzmin Date: Fri, 23 Sep 2016 11:29:00 +0200 Subject: [PATCH] iommu/tegra: of: use root bus node to find stream id for PCIe If there are bridges in PCIe tolopology then parent node isn't necessarily a root bus, so loop all the way to the top instead of doing just one step. Fixes creation of IOMMU mappings for such PCIe configurations. --- drivers/iommu/of_tegra-smmu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/of_tegra-smmu.c b/drivers/iommu/of_tegra-smmu.c index af6c752..72bea5b 100644 --- a/drivers/iommu/of_tegra-smmu.c +++ b/drivers/iommu/of_tegra-smmu.c @@ -168,8 +168,10 @@ u64 tegra_smmu_of_get_swgids(struct device *dev, if (dev_is_pci(dev)) { struct pci_bus *bus = to_pci_dev(dev)->bus; - if (!pci_is_root_bus(bus)) + while (!pci_is_root_bus(bus)) { dev = bus->bridge; + bus = to_pci_dev(dev)->bus; + } np = of_get_parent(dev->of_node); } -- 2.0.4