summaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2014-03-09 13:19:22 -0700
committerDavid Woodhouse <David.Woodhouse@intel.com>2014-03-24 14:06:41 +0000
commit0ac72664853b3181a437afb02a86d7c6f792e031 (patch)
tree5f95f30ff9bff9148a1947f8e3a0d852a3f58777 /drivers/iommu
parentb718cd3d8412edaf02665d29b0cf5ef828675a45 (diff)
iommu/vt-d: use dmar_insert_dev_info() from dma_add_dev_info()
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/intel-iommu.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index c1c56423376..7d3d33f5c8d 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2452,29 +2452,21 @@ static int domain_add_dev_info(struct dmar_domain *domain,
struct pci_dev *pdev,
int translation)
{
+ struct dmar_domain *ndomain;
struct device_domain_info *info;
unsigned long flags;
int ret;
- info = alloc_devinfo_mem();
- if (!info)
- return -ENOMEM;
-
- info->segment = pci_domain_nr(pdev->bus);
- info->bus = pdev->bus->number;
- info->devfn = pdev->devfn;
- info->dev = &pdev->dev;
- info->domain = domain;
-
- spin_lock_irqsave(&device_domain_lock, flags);
- list_add(&info->link, &domain->devices);
- list_add(&info->global, &device_domain_list);
- pdev->dev.archdata.iommu = info;
- spin_unlock_irqrestore(&device_domain_lock, flags);
+ ndomain = dmar_insert_dev_info(pci_domain_nr(pdev->bus),
+ pdev->bus->number, pdev->devfn,
+ &pdev->dev, domain);
+ if (ndomain != domain)
+ return -EBUSY;
ret = domain_context_mapping(domain, pdev, translation);
if (ret) {
spin_lock_irqsave(&device_domain_lock, flags);
+ info = pdev->dev.archdata.iommu;
unlink_domain_info(info);
spin_unlock_irqrestore(&device_domain_lock, flags);
free_devinfo_mem(info);