aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/intel-iommu.c
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2014-03-09 19:19:13 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2014-03-24 10:08:01 -0400
commitbf9c9eda718bd56dde772270d117a8ef51bcea7e (patch)
tree02fc51f65666ec71217135b9641f2ae4ff23432d /drivers/iommu/intel-iommu.c
parent5040a918bd109a1903e7babac817325620939fa4 (diff)
iommu/vt-d: Make domain_remove_one_dev_info() take struct device
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/iommu/intel-iommu.c')
-rw-r--r--drivers/iommu/intel-iommu.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 60f8ceeb06e4..66c2921f6404 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -425,7 +425,7 @@ static long list_size;
425static void domain_exit(struct dmar_domain *domain); 425static void domain_exit(struct dmar_domain *domain);
426static void domain_remove_dev_info(struct dmar_domain *domain); 426static void domain_remove_dev_info(struct dmar_domain *domain);
427static void domain_remove_one_dev_info(struct dmar_domain *domain, 427static void domain_remove_one_dev_info(struct dmar_domain *domain,
428 struct pci_dev *pdev); 428 struct device *dev);
429static void iommu_detach_dependent_devices(struct intel_iommu *iommu, 429static void iommu_detach_dependent_devices(struct intel_iommu *iommu,
430 struct device *dev); 430 struct device *dev);
431 431
@@ -2488,7 +2488,7 @@ static int domain_add_dev_info(struct dmar_domain *domain,
2488 2488
2489 ret = domain_context_mapping(domain, &pdev->dev, translation); 2489 ret = domain_context_mapping(domain, &pdev->dev, translation);
2490 if (ret) { 2490 if (ret) {
2491 domain_remove_one_dev_info(domain, pdev); 2491 domain_remove_one_dev_info(domain, &pdev->dev);
2492 return ret; 2492 return ret;
2493 } 2493 }
2494 2494
@@ -2928,7 +2928,7 @@ static int iommu_no_mapping(struct device *dev)
2928 * 32 bit DMA is removed from si_domain and fall back 2928 * 32 bit DMA is removed from si_domain and fall back
2929 * to non-identity mapping. 2929 * to non-identity mapping.
2930 */ 2930 */
2931 domain_remove_one_dev_info(si_domain, pdev); 2931 domain_remove_one_dev_info(si_domain, dev);
2932 printk(KERN_INFO "32bit %s uses non-identity mapping\n", 2932 printk(KERN_INFO "32bit %s uses non-identity mapping\n",
2933 pci_name(pdev)); 2933 pci_name(pdev));
2934 return 0; 2934 return 0;
@@ -3810,7 +3810,6 @@ static int device_notifier(struct notifier_block *nb,
3810 unsigned long action, void *data) 3810 unsigned long action, void *data)
3811{ 3811{
3812 struct device *dev = data; 3812 struct device *dev = data;
3813 struct pci_dev *pdev = to_pci_dev(dev);
3814 struct dmar_domain *domain; 3813 struct dmar_domain *domain;
3815 3814
3816 if (iommu_dummy(dev)) 3815 if (iommu_dummy(dev))
@@ -3825,7 +3824,7 @@ static int device_notifier(struct notifier_block *nb,
3825 return 0; 3824 return 0;
3826 3825
3827 down_read(&dmar_global_lock); 3826 down_read(&dmar_global_lock);
3828 domain_remove_one_dev_info(domain, pdev); 3827 domain_remove_one_dev_info(domain, dev);
3829 if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) && 3828 if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) &&
3830 !(domain->flags & DOMAIN_FLAG_STATIC_IDENTITY) && 3829 !(domain->flags & DOMAIN_FLAG_STATIC_IDENTITY) &&
3831 list_empty(&domain->devices)) 3830 list_empty(&domain->devices))
@@ -4027,7 +4026,7 @@ static void iommu_detach_dependent_devices(struct intel_iommu *iommu,
4027} 4026}
4028 4027
4029static void domain_remove_one_dev_info(struct dmar_domain *domain, 4028static void domain_remove_one_dev_info(struct dmar_domain *domain,
4030 struct pci_dev *pdev) 4029 struct device *dev)
4031{ 4030{
4032 struct device_domain_info *info, *tmp; 4031 struct device_domain_info *info, *tmp;
4033 struct intel_iommu *iommu; 4032 struct intel_iommu *iommu;
@@ -4035,21 +4034,20 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain,
4035 int found = 0; 4034 int found = 0;
4036 u8 bus, devfn; 4035 u8 bus, devfn;
4037 4036
4038 iommu = device_to_iommu(&pdev->dev, &bus, &devfn); 4037 iommu = device_to_iommu(dev, &bus, &devfn);
4039 if (!iommu) 4038 if (!iommu)
4040 return; 4039 return;
4041 4040
4042 spin_lock_irqsave(&device_domain_lock, flags); 4041 spin_lock_irqsave(&device_domain_lock, flags);
4043 list_for_each_entry_safe(info, tmp, &domain->devices, link) { 4042 list_for_each_entry_safe(info, tmp, &domain->devices, link) {
4044 if (info->iommu->segment == pci_domain_nr(pdev->bus) && 4043 if (info->iommu == iommu && info->bus == bus &&
4045 info->bus == pdev->bus->number && 4044 info->devfn == devfn) {
4046 info->devfn == pdev->devfn) {
4047 unlink_domain_info(info); 4045 unlink_domain_info(info);
4048 spin_unlock_irqrestore(&device_domain_lock, flags); 4046 spin_unlock_irqrestore(&device_domain_lock, flags);
4049 4047
4050 iommu_disable_dev_iotlb(info); 4048 iommu_disable_dev_iotlb(info);
4051 iommu_detach_dev(iommu, info->bus, info->devfn); 4049 iommu_detach_dev(iommu, info->bus, info->devfn);
4052 iommu_detach_dependent_devices(iommu, &pdev->dev); 4050 iommu_detach_dependent_devices(iommu, dev);
4053 free_devinfo_mem(info); 4051 free_devinfo_mem(info);
4054 4052
4055 spin_lock_irqsave(&device_domain_lock, flags); 4053 spin_lock_irqsave(&device_domain_lock, flags);
@@ -4165,7 +4163,7 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,
4165 if (old_domain) { 4163 if (old_domain) {
4166 if (dmar_domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE || 4164 if (dmar_domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE ||
4167 dmar_domain->flags & DOMAIN_FLAG_STATIC_IDENTITY) 4165 dmar_domain->flags & DOMAIN_FLAG_STATIC_IDENTITY)
4168 domain_remove_one_dev_info(old_domain, pdev); 4166 domain_remove_one_dev_info(old_domain, dev);
4169 else 4167 else
4170 domain_remove_dev_info(old_domain); 4168 domain_remove_dev_info(old_domain);
4171 } 4169 }
@@ -4210,9 +4208,8 @@ static void intel_iommu_detach_device(struct iommu_domain *domain,
4210 struct device *dev) 4208 struct device *dev)
4211{ 4209{
4212 struct dmar_domain *dmar_domain = domain->priv; 4210 struct dmar_domain *dmar_domain = domain->priv;
4213 struct pci_dev *pdev = to_pci_dev(dev);
4214 4211
4215 domain_remove_one_dev_info(dmar_domain, pdev); 4212 domain_remove_one_dev_info(dmar_domain, dev);
4216} 4213}
4217 4214
4218static int intel_iommu_map(struct iommu_domain *domain, 4215static int intel_iommu_map(struct iommu_domain *domain,