aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2015-07-23 11:44:46 -0400
committerJoerg Roedel <jroedel@suse.de>2015-08-12 10:23:36 -0400
commit127c761598f7fbe7ffe6650cdc491eb57c5aaecd (patch)
tree5fd890f4f177cfe695413c3b711a4ff410ac123b /drivers
parent2309bd793ead6d5e4ace611502aa87b3202856ca (diff)
iommu/vt-d: Pass device_domain_info to __dmar_remove_one_dev_info
This struct contains all necessary information for the function already. Also handle the info->dev == NULL case while at it. Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iommu/intel-iommu.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index d55ef9df0879..18e44421a862 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -473,10 +473,9 @@ static void domain_exit(struct dmar_domain *domain);
473static void domain_remove_dev_info(struct dmar_domain *domain); 473static void domain_remove_dev_info(struct dmar_domain *domain);
474static void dmar_remove_one_dev_info(struct dmar_domain *domain, 474static void dmar_remove_one_dev_info(struct dmar_domain *domain,
475 struct device *dev); 475 struct device *dev);
476static void __dmar_remove_one_dev_info(struct device_domain_info *info);
476static void domain_context_clear(struct intel_iommu *iommu, 477static void domain_context_clear(struct intel_iommu *iommu,
477 struct device *dev); 478 struct device *dev);
478static void __dmar_remove_one_dev_info(struct dmar_domain *domain,
479 struct device *dev);
480static int domain_detach_iommu(struct dmar_domain *domain, 479static int domain_detach_iommu(struct dmar_domain *domain,
481 struct intel_iommu *iommu); 480 struct intel_iommu *iommu);
482 481
@@ -2216,7 +2215,7 @@ static void domain_remove_dev_info(struct dmar_domain *domain)
2216 2215
2217 spin_lock_irqsave(&device_domain_lock, flags); 2216 spin_lock_irqsave(&device_domain_lock, flags);
2218 list_for_each_entry_safe(info, tmp, &domain->devices, link) 2217 list_for_each_entry_safe(info, tmp, &domain->devices, link)
2219 __dmar_remove_one_dev_info(domain, info->dev); 2218 __dmar_remove_one_dev_info(info);
2220 spin_unlock_irqrestore(&device_domain_lock, flags); 2219 spin_unlock_irqrestore(&device_domain_lock, flags);
2221} 2220}
2222 2221
@@ -4538,43 +4537,41 @@ static void domain_context_clear(struct intel_iommu *iommu, struct device *dev)
4538 pci_for_each_dma_alias(to_pci_dev(dev), &domain_context_clear_one_cb, iommu); 4537 pci_for_each_dma_alias(to_pci_dev(dev), &domain_context_clear_one_cb, iommu);
4539} 4538}
4540 4539
4541static void __dmar_remove_one_dev_info(struct dmar_domain *domain, 4540static void __dmar_remove_one_dev_info(struct device_domain_info *info)
4542 struct device *dev)
4543{ 4541{
4544 struct device_domain_info *info;
4545 struct intel_iommu *iommu; 4542 struct intel_iommu *iommu;
4546 unsigned long flags; 4543 unsigned long flags;
4547 u8 bus, devfn;
4548 4544
4549 assert_spin_locked(&device_domain_lock); 4545 assert_spin_locked(&device_domain_lock);
4550 4546
4551 iommu = device_to_iommu(dev, &bus, &devfn); 4547 if (WARN_ON(!info))
4552 if (!iommu)
4553 return; 4548 return;
4554 4549
4555 info = dev->archdata.iommu; 4550 iommu = info->iommu;
4556 4551
4557 if (WARN_ON(!info)) 4552 if (info->dev) {
4558 return; 4553 iommu_disable_dev_iotlb(info);
4554 domain_context_clear(iommu, info->dev);
4555 }
4559 4556
4560 unlink_domain_info(info); 4557 unlink_domain_info(info);
4561 4558
4562 iommu_disable_dev_iotlb(info);
4563 domain_context_clear(iommu, dev);
4564 free_devinfo_mem(info);
4565
4566 spin_lock_irqsave(&iommu->lock, flags); 4559 spin_lock_irqsave(&iommu->lock, flags);
4567 domain_detach_iommu(domain, iommu); 4560 domain_detach_iommu(info->domain, iommu);
4568 spin_unlock_irqrestore(&iommu->lock, flags); 4561 spin_unlock_irqrestore(&iommu->lock, flags);
4562
4563 free_devinfo_mem(info);
4569} 4564}
4570 4565
4571static void dmar_remove_one_dev_info(struct dmar_domain *domain, 4566static void dmar_remove_one_dev_info(struct dmar_domain *domain,
4572 struct device *dev) 4567 struct device *dev)
4573{ 4568{
4569 struct device_domain_info *info;
4574 unsigned long flags; 4570 unsigned long flags;
4575 4571
4576 spin_lock_irqsave(&device_domain_lock, flags); 4572 spin_lock_irqsave(&device_domain_lock, flags);
4577 __dmar_remove_one_dev_info(domain, dev); 4573 info = dev->archdata.iommu;
4574 __dmar_remove_one_dev_info(info);
4578 spin_unlock_irqrestore(&device_domain_lock, flags); 4575 spin_unlock_irqrestore(&device_domain_lock, flags);
4579} 4576}
4580 4577