aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 f3eebd2b2d72..6262c198e56e 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -477,11 +477,16 @@ static struct intel_iommu *device_to_iommu(u8 bus, u8 devfn)
477 if (drhd->ignored) 477 if (drhd->ignored)
478 continue; 478 continue;
479 479
480 for (i = 0; i < drhd->devices_cnt; i++) 480 for (i = 0; i < drhd->devices_cnt; i++) {
481 if (drhd->devices[i] && 481 if (drhd->devices[i] &&
482 drhd->devices[i]->bus->number == bus && 482 drhd->devices[i]->bus->number == bus &&
483 drhd->devices[i]->devfn == devfn) 483 drhd->devices[i]->devfn == devfn)
484 return drhd->iommu; 484 return drhd->iommu;
485 if (drhd->devices[i]->subordinate &&
486 drhd->devices[i]->subordinate->number <= bus &&
487 drhd->devices[i]->subordinate->subordinate >= bus)
488 return drhd->iommu;
489 }
485 490
486 if (drhd->include_all) 491 if (drhd->include_all)
487 return drhd->iommu; 492 return drhd->iommu;