aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2009-05-05 09:25:23 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2009-05-08 15:45:10 -0700
commitedfbb1affe9454a32cb55c0c77dedac0b60746f5 (patch)
tree6d6fa28f1677ce75733d12937361dd36a9ec2391
parent80c2d4701095c98d01ae4cda681bd231625e4ac7 (diff)
intel-iommu: Fix device-to-iommu mapping for PCI-PCI bridges.
(cherry picked from commit 924b6231edfaf1e764ffb4f97ea382bf4facff58) When the DMAR table identifies that a PCI-PCI bridge belongs to a given IOMMU, that means that the bridge and all devices behind it should be associated with the IOMMU. Not just the bridge itself. This fixes the device_to_iommu() function accordingly. (It's broken if you have the same PCI bus numbers in multiple domains, but this function was always broken in that way; I'll be dealing with that later). Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/pci/intel-iommu.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index f3f686581a90..efc7c12c805a 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -447,11 +447,16 @@ static struct intel_iommu *device_to_iommu(u8 bus, u8 devfn)
if (drhd->ignored)
continue;
- for (i = 0; i < drhd->devices_cnt; i++)
+ for (i = 0; i < drhd->devices_cnt; i++) {
if (drhd->devices[i] &&
drhd->devices[i]->bus->number == bus &&
drhd->devices[i]->devfn == devfn)
return drhd->iommu;
+ if (drhd->devices[i]->subordinate &&
+ drhd->devices[i]->subordinate->number <= bus &&
+ drhd->devices[i]->subordinate->subordinate >= bus)
+ return drhd->iommu;
+ }
if (drhd->include_all)
return drhd->iommu;