diff options
author | Joerg Roedel <jroedel@suse.de> | 2015-07-23 18:09:11 +0200 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2015-08-12 16:23:36 +0200 |
commit | 08a7f456a759e971caf0cc13987a963de2b0ae7c (patch) | |
tree | cb8442f19bc77abf388777c9b3358a730fb40182 | |
parent | 127c761598f7fbe7ffe6650cdc491eb57c5aaecd (diff) |
iommu/vt-d: Only insert alias dev_info if there is an alias
For devices without an PCI alias there will be two
device_domain_info structures added. Prevent that by
checking if the alias is different from the device.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r-- | drivers/iommu/intel-iommu.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 18e44421a862..6e61b3eb47e8 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -2319,8 +2319,8 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw) struct device_domain_info *info = NULL; struct dmar_domain *domain, *tmp; struct intel_iommu *iommu; + u16 req_id, dma_alias; unsigned long flags; - u16 dma_alias; u8 bus, devfn; domain = find_domain(dev); @@ -2331,6 +2331,8 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw) if (!iommu) return NULL; + req_id = ((u16)bus << 8) | devfn; + if (dev_is_pci(dev)) { struct pci_dev *pdev = to_pci_dev(dev); @@ -2361,7 +2363,7 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw) } /* register PCI DMA alias device */ - if (dev_is_pci(dev)) { + if (req_id != dma_alias && dev_is_pci(dev)) { tmp = dmar_insert_one_dev_info(iommu, PCI_BUS_NUM(dma_alias), dma_alias & 0xff, NULL, domain); |