diff options
author | Murillo Fernandes Bernardes <bernarde@br.ibm.com> | 2007-08-10 16:31:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-08-11 18:58:12 -0400 |
commit | f055a0619aae795832ef6a783021184925758b67 (patch) | |
tree | 56fb79b8aea479310be34664576119e5b5cbd4c6 /arch/x86_64/kernel/pci-calgary.c | |
parent | 3320ad994afb2c44ad34b3b34c3c5cf0da297331 (diff) |
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: Murillo Fernandes Bernardes <mfb@br.ibm.com>
Signed-off-by: Muli Ben-Yehuda <muli@il.ibm.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86_64/kernel/pci-calgary.c')
-rw-r--r-- | arch/x86_64/kernel/pci-calgary.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/arch/x86_64/kernel/pci-calgary.c b/arch/x86_64/kernel/pci-calgary.c index ba16c968ca3f..71da01e73f03 100644 --- a/arch/x86_64/kernel/pci-calgary.c +++ b/arch/x86_64/kernel/pci-calgary.c | |||
@@ -367,16 +367,15 @@ static inline struct iommu_table *find_iommu_table(struct device *dev) | |||
367 | 367 | ||
368 | pdev = to_pci_dev(dev); | 368 | pdev = to_pci_dev(dev); |
369 | 369 | ||
370 | /* is the device behind a bridge? */ | 370 | pbus = pdev->bus; |
371 | if (unlikely(pdev->bus->parent)) | 371 | |
372 | pbus = pdev->bus->parent; | 372 | /* is the device behind a bridge? Look for the root bus */ |
373 | else | 373 | while (pbus->parent) |
374 | pbus = pdev->bus; | 374 | pbus = pbus->parent; |
375 | 375 | ||
376 | tbl = pci_iommu(pbus); | 376 | tbl = pci_iommu(pbus); |
377 | 377 | ||
378 | BUG_ON(pdev->bus->parent && | 378 | BUG_ON(tbl && (tbl->it_busno != pbus->number)); |
379 | (tbl->it_busno != pdev->bus->parent->number)); | ||
380 | 379 | ||
381 | return tbl; | 380 | return tbl; |
382 | } | 381 | } |