]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
intel-iommu: Fix device-to-iommu mapping for PCI-PCI bridges.
authorDavid Woodhouse <David.Woodhouse@intel.com>
Fri, 3 Apr 2009 23:39:25 +0000 (00:39 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 4 Apr 2009 09:43:29 +0000 (10:43 +0100)
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>
drivers/pci/intel-iommu.c

index f3eebd2b2d72109bd122c731842d596aba6e242b..6262c198e56eb9c1ff69f4293c12afea6101956d 100644 (file)
@@ -477,11 +477,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;