aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2014-03-06 11:19:30 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2014-03-24 10:06:34 -0400
commit1525a29a7d619901aed0dc5f1eb0592fc881805a (patch)
tree8d81d05fc2ef70d89b406c611d5e68c6e36cf0ac /drivers/iommu
parent3d89194a94da0c49f9d21720df6bbaf7c848449c (diff)
iommu/vt-d: Make dmar_insert_dev_info() take struct device instead of struct pci_dev
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/intel-iommu.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 2079cb65d478..40dbafd376fb 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2113,15 +2113,14 @@ static void domain_remove_dev_info(struct dmar_domain *domain)
2113 2113
2114/* 2114/*
2115 * find_domain 2115 * find_domain
2116 * Note: we use struct pci_dev->dev.archdata.iommu stores the info 2116 * Note: we use struct device->archdata.iommu stores the info
2117 */ 2117 */
2118static struct dmar_domain * 2118static struct dmar_domain *find_domain(struct device *dev)
2119find_domain(struct pci_dev *pdev)
2120{ 2119{
2121 struct device_domain_info *info; 2120 struct device_domain_info *info;
2122 2121
2123 /* No lock here, assumes no domain exit in normal case */ 2122 /* No lock here, assumes no domain exit in normal case */
2124 info = pdev->dev.archdata.iommu; 2123 info = dev->archdata.iommu;
2125 if (info) 2124 if (info)
2126 return info->domain; 2125 return info->domain;
2127 return NULL; 2126 return NULL;
@@ -2161,7 +2160,7 @@ static int dmar_insert_dev_info(int segment, int bus, int devfn,
2161 2160
2162 spin_lock_irqsave(&device_domain_lock, flags); 2161 spin_lock_irqsave(&device_domain_lock, flags);
2163 if (dev) 2162 if (dev)
2164 found = find_domain(dev); 2163 found = find_domain(&dev->dev);
2165 else 2164 else
2166 found = dmar_search_domain_by_dev_info(segment, bus, devfn); 2165 found = dmar_search_domain_by_dev_info(segment, bus, devfn);
2167 if (found) { 2166 if (found) {
@@ -2193,7 +2192,7 @@ static struct dmar_domain *get_domain_for_dev(struct pci_dev *pdev, int gaw)
2193 int bus = 0, devfn = 0; 2192 int bus = 0, devfn = 0;
2194 int segment; 2193 int segment;
2195 2194
2196 domain = find_domain(pdev); 2195 domain = find_domain(&pdev->dev);
2197 if (domain) 2196 if (domain)
2198 return domain; 2197 return domain;
2199 2198
@@ -2252,7 +2251,7 @@ error:
2252 if (free) 2251 if (free)
2253 domain_exit(free); 2252 domain_exit(free);
2254 /* recheck it here, maybe others set it */ 2253 /* recheck it here, maybe others set it */
2255 return find_domain(pdev); 2254 return find_domain(&pdev->dev);
2256} 2255}
2257 2256
2258static int iommu_identity_mapping; 2257static int iommu_identity_mapping;
@@ -3108,7 +3107,7 @@ static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr,
3108 if (iommu_no_mapping(dev)) 3107 if (iommu_no_mapping(dev))
3109 return; 3108 return;
3110 3109
3111 domain = find_domain(pdev); 3110 domain = find_domain(dev);
3112 BUG_ON(!domain); 3111 BUG_ON(!domain);
3113 3112
3114 iommu = domain_get_iommu(domain); 3113 iommu = domain_get_iommu(domain);
@@ -3200,7 +3199,7 @@ static void intel_unmap_sg(struct device *hwdev, struct scatterlist *sglist,
3200 if (iommu_no_mapping(hwdev)) 3199 if (iommu_no_mapping(hwdev))
3201 return; 3200 return;
3202 3201
3203 domain = find_domain(pdev); 3202 domain = find_domain(hwdev);
3204 BUG_ON(!domain); 3203 BUG_ON(!domain);
3205 3204
3206 iommu = domain_get_iommu(domain); 3205 iommu = domain_get_iommu(domain);
@@ -3808,7 +3807,7 @@ static int device_notifier(struct notifier_block *nb,
3808 action != BUS_NOTIFY_DEL_DEVICE) 3807 action != BUS_NOTIFY_DEL_DEVICE)
3809 return 0; 3808 return 0;
3810 3809
3811 domain = find_domain(pdev); 3810 domain = find_domain(dev);
3812 if (!domain) 3811 if (!domain)
3813 return 0; 3812 return 0;
3814 3813
@@ -4147,7 +4146,7 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,
4147 if (unlikely(domain_context_mapped(pdev))) { 4146 if (unlikely(domain_context_mapped(pdev))) {
4148 struct dmar_domain *old_domain; 4147 struct dmar_domain *old_domain;
4149 4148
4150 old_domain = find_domain(pdev); 4149 old_domain = find_domain(dev);
4151 if (old_domain) { 4150 if (old_domain) {
4152 if (dmar_domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE || 4151 if (dmar_domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE ||
4153 dmar_domain->flags & DOMAIN_FLAG_STATIC_IDENTITY) 4152 dmar_domain->flags & DOMAIN_FLAG_STATIC_IDENTITY)