summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/intel-iommu.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-06-14 11:49:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-06-14 11:49:35 -0400
commitc78ad1be4b4d65eb214421b90a788abf3c85c3ea (patch)
treed0959f89fe941b212f058c7633928c7d9856a602 /drivers/iommu/intel-iommu.c
parent7617c9a087d2036e12e1524a03d064884730f4a1 (diff)
parent4e4abae311e4b44aaf61f18a826fd7136037f199 (diff)
Merge tag 'iommu-fixes-v5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull iommu fixes from Joerg Roedel: - three fixes for Intel VT-d to fix a potential dead-lock, a formatting fix and a bit setting fix - one fix for the ARM-SMMU to make it work on some platforms with sub-optimal SMMU emulation * tag 'iommu-fixes-v5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: iommu/arm-smmu: Avoid constant zero in TLBI writes iommu/vt-d: Set the right field for Page Walk Snoop iommu/vt-d: Fix lock inversion between iommu->lock and device_domain_lock iommu: Add missing new line for dma type
Diffstat (limited to 'drivers/iommu/intel-iommu.c')
-rw-r--r--drivers/iommu/intel-iommu.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 162b3236e72c..56297298d6ee 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2504,6 +2504,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
2504 } 2504 }
2505 } 2505 }
2506 2506
2507 spin_lock(&iommu->lock);
2507 spin_lock_irqsave(&device_domain_lock, flags); 2508 spin_lock_irqsave(&device_domain_lock, flags);
2508 if (dev) 2509 if (dev)
2509 found = find_domain(dev); 2510 found = find_domain(dev);
@@ -2519,17 +2520,16 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
2519 2520
2520 if (found) { 2521 if (found) {
2521 spin_unlock_irqrestore(&device_domain_lock, flags); 2522 spin_unlock_irqrestore(&device_domain_lock, flags);
2523 spin_unlock(&iommu->lock);
2522 free_devinfo_mem(info); 2524 free_devinfo_mem(info);
2523 /* Caller must free the original domain */ 2525 /* Caller must free the original domain */
2524 return found; 2526 return found;
2525 } 2527 }
2526 2528
2527 spin_lock(&iommu->lock);
2528 ret = domain_attach_iommu(domain, iommu); 2529 ret = domain_attach_iommu(domain, iommu);
2529 spin_unlock(&iommu->lock);
2530
2531 if (ret) { 2530 if (ret) {
2532 spin_unlock_irqrestore(&device_domain_lock, flags); 2531 spin_unlock_irqrestore(&device_domain_lock, flags);
2532 spin_unlock(&iommu->lock);
2533 free_devinfo_mem(info); 2533 free_devinfo_mem(info);
2534 return NULL; 2534 return NULL;
2535 } 2535 }
@@ -2539,6 +2539,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
2539 if (dev) 2539 if (dev)
2540 dev->archdata.iommu = info; 2540 dev->archdata.iommu = info;
2541 spin_unlock_irqrestore(&device_domain_lock, flags); 2541 spin_unlock_irqrestore(&device_domain_lock, flags);
2542 spin_unlock(&iommu->lock);
2542 2543
2543 /* PASID table is mandatory for a PCI device in scalable mode. */ 2544 /* PASID table is mandatory for a PCI device in scalable mode. */
2544 if (dev && dev_is_pci(dev) && sm_supported(iommu)) { 2545 if (dev && dev_is_pci(dev) && sm_supported(iommu)) {