aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/intel-iommu.c33
1 files changed, 8 insertions, 25 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index c674aa12ef31..a5ac99cc9ffc 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2327,6 +2327,12 @@ static struct dmar_domain *dmar_insert_dev_info(struct intel_iommu *iommu,
2327 dev->archdata.iommu = info; 2327 dev->archdata.iommu = info;
2328 spin_unlock_irqrestore(&device_domain_lock, flags); 2328 spin_unlock_irqrestore(&device_domain_lock, flags);
2329 2329
2330 if (dev && domain_context_mapping(domain, dev)) {
2331 pr_err("Domain context map for %s failed\n", dev_name(dev));
2332 domain_remove_one_dev_info(domain, dev);
2333 return NULL;
2334 }
2335
2330 return domain; 2336 return domain;
2331} 2337}
2332 2338
@@ -2339,11 +2345,11 @@ static int get_last_alias(struct pci_dev *pdev, u16 alias, void *opaque)
2339/* domain is initialized */ 2345/* domain is initialized */
2340static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw) 2346static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw)
2341{ 2347{
2348 struct device_domain_info *info = NULL;
2342 struct dmar_domain *domain, *tmp; 2349 struct dmar_domain *domain, *tmp;
2343 struct intel_iommu *iommu; 2350 struct intel_iommu *iommu;
2344 struct device_domain_info *info;
2345 u16 dma_alias;
2346 unsigned long flags; 2351 unsigned long flags;
2352 u16 dma_alias;
2347 u8 bus, devfn; 2353 u8 bus, devfn;
2348 2354
2349 domain = find_domain(dev); 2355 domain = find_domain(dev);
@@ -2492,11 +2498,6 @@ static int iommu_prepare_identity_map(struct device *dev,
2492 if (ret) 2498 if (ret)
2493 goto error; 2499 goto error;
2494 2500
2495 /* context entry init */
2496 ret = domain_context_mapping(domain, dev);
2497 if (ret)
2498 goto error;
2499
2500 return 0; 2501 return 0;
2501 2502
2502 error: 2503 error:
@@ -2592,7 +2593,6 @@ static int domain_add_dev_info(struct dmar_domain *domain, struct device *dev)
2592 struct dmar_domain *ndomain; 2593 struct dmar_domain *ndomain;
2593 struct intel_iommu *iommu; 2594 struct intel_iommu *iommu;
2594 u8 bus, devfn; 2595 u8 bus, devfn;
2595 int ret;
2596 2596
2597 iommu = device_to_iommu(dev, &bus, &devfn); 2597 iommu = device_to_iommu(dev, &bus, &devfn);
2598 if (!iommu) 2598 if (!iommu)
@@ -2602,12 +2602,6 @@ static int domain_add_dev_info(struct dmar_domain *domain, struct device *dev)
2602 if (ndomain != domain) 2602 if (ndomain != domain)
2603 return -EBUSY; 2603 return -EBUSY;
2604 2604
2605 ret = domain_context_mapping(domain, dev);
2606 if (ret) {
2607 domain_remove_one_dev_info(domain, dev);
2608 return ret;
2609 }
2610
2611 return 0; 2605 return 0;
2612} 2606}
2613 2607
@@ -3263,7 +3257,6 @@ static struct iova *intel_alloc_iova(struct device *dev,
3263static struct dmar_domain *__get_valid_domain_for_dev(struct device *dev) 3257static struct dmar_domain *__get_valid_domain_for_dev(struct device *dev)
3264{ 3258{
3265 struct dmar_domain *domain; 3259 struct dmar_domain *domain;
3266 int ret;
3267 3260
3268 domain = get_domain_for_dev(dev, DEFAULT_DOMAIN_ADDRESS_WIDTH); 3261 domain = get_domain_for_dev(dev, DEFAULT_DOMAIN_ADDRESS_WIDTH);
3269 if (!domain) { 3262 if (!domain) {
@@ -3272,16 +3265,6 @@ static struct dmar_domain *__get_valid_domain_for_dev(struct device *dev)
3272 return NULL; 3265 return NULL;
3273 } 3266 }
3274 3267
3275 /* make sure context mapping is ok */
3276 if (unlikely(!domain_context_mapped(dev))) {
3277 ret = domain_context_mapping(domain, dev);
3278 if (ret) {
3279 pr_err("Domain context map for %s failed\n",
3280 dev_name(dev));
3281 return NULL;
3282 }
3283 }
3284
3285 return domain; 3268 return domain;
3286} 3269}
3287 3270