diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2014-03-09 16:19:22 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2014-03-24 10:06:41 -0400 |
commit | 0ac72664853b3181a437afb02a86d7c6f792e031 (patch) | |
tree | 5f95f30ff9bff9148a1947f8e3a0d852a3f58777 /drivers/iommu | |
parent | b718cd3d8412edaf02665d29b0cf5ef828675a45 (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.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index c1c564233768..7d3d33f5c8dc 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, | |||
2452 | struct pci_dev *pdev, | 2452 | struct pci_dev *pdev, |
2453 | int translation) | 2453 | int translation) |
2454 | { | 2454 | { |
2455 | struct dmar_domain *ndomain; | ||
2455 | struct device_domain_info *info; | 2456 | struct device_domain_info *info; |
2456 | unsigned long flags; | 2457 | unsigned long flags; |
2457 | int ret; | 2458 | int ret; |
2458 | 2459 | ||
2459 | info = alloc_devinfo_mem(); | 2460 | ndomain = dmar_insert_dev_info(pci_domain_nr(pdev->bus), |
2460 | if (!info) | 2461 | pdev->bus->number, pdev->devfn, |
2461 | return -ENOMEM; | 2462 | &pdev->dev, domain); |
2462 | 2463 | if (ndomain != domain) | |
2463 | info->segment = pci_domain_nr(pdev->bus); | 2464 | return -EBUSY; |
2464 | info->bus = pdev->bus->number; | ||
2465 | info->devfn = pdev->devfn; | ||
2466 | info->dev = &pdev->dev; | ||
2467 | info->domain = domain; | ||
2468 | |||
2469 | spin_lock_irqsave(&device_domain_lock, flags); | ||
2470 | list_add(&info->link, &domain->devices); | ||
2471 | list_add(&info->global, &device_domain_list); | ||
2472 | pdev->dev.archdata.iommu = info; | ||
2473 | spin_unlock_irqrestore(&device_domain_lock, flags); | ||
2474 | 2465 | ||
2475 | ret = domain_context_mapping(domain, pdev, translation); | 2466 | ret = domain_context_mapping(domain, pdev, translation); |
2476 | if (ret) { | 2467 | if (ret) { |
2477 | spin_lock_irqsave(&device_domain_lock, flags); | 2468 | spin_lock_irqsave(&device_domain_lock, flags); |
2469 | info = pdev->dev.archdata.iommu; | ||
2478 | unlink_domain_info(info); | 2470 | unlink_domain_info(info); |
2479 | spin_unlock_irqrestore(&device_domain_lock, flags); | 2471 | spin_unlock_irqrestore(&device_domain_lock, flags); |
2480 | free_devinfo_mem(info); | 2472 | free_devinfo_mem(info); |