Skip to content

Commit

Permalink
iommu/vt-d: use dmar_insert_dev_info() from dma_add_dev_info()
Browse files Browse the repository at this point in the history
Signed-off-by: David Woodhouse <[email protected]>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Mar 24, 2014
1 parent b718cd3 commit 0ac7266
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions drivers/iommu/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0ac7266

Please sign in to comment.