Commit f055a061 authored by Murillo Fernandes Bernardes's avatar Murillo Fernandes Bernardes Committed by Linus Torvalds

x86_64: Calgary - Fix mis-handled PCI topology

Current code assumed that devices were directly connected to a Calgary
bridge, as it tried to get the iommu table directly from the parent bus
controller.

When we have another bridge between the Calgary/CalIOC2 bridge and the
device we should look upwards until we get to the top (Calgary/CalIOC2
bridge), where the iommu table resides.
Signed-off-by: default avatarMurillo Fernandes Bernardes <mfb@br.ibm.com>
Signed-off-by: default avatarMuli Ben-Yehuda <muli@il.ibm.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3320ad99
...@@ -367,16 +367,15 @@ static inline struct iommu_table *find_iommu_table(struct device *dev) ...@@ -367,16 +367,15 @@ static inline struct iommu_table *find_iommu_table(struct device *dev)
pdev = to_pci_dev(dev); pdev = to_pci_dev(dev);
/* is the device behind a bridge? */ pbus = pdev->bus;
if (unlikely(pdev->bus->parent))
pbus = pdev->bus->parent; /* is the device behind a bridge? Look for the root bus */
else while (pbus->parent)
pbus = pdev->bus; pbus = pbus->parent;
tbl = pci_iommu(pbus); tbl = pci_iommu(pbus);
BUG_ON(pdev->bus->parent && BUG_ON(tbl && (tbl->it_busno != pbus->number));
(tbl->it_busno != pdev->bus->parent->number));
return tbl; return tbl;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment