diff options
| -rw-r--r-- | drivers/iommu/intel-iommu.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 56297298d6ee..162b3236e72c 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
| @@ -2504,7 +2504,6 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, | |||
| 2504 | } | 2504 | } |
| 2505 | } | 2505 | } |
| 2506 | 2506 | ||
| 2507 | spin_lock(&iommu->lock); | ||
| 2508 | spin_lock_irqsave(&device_domain_lock, flags); | 2507 | spin_lock_irqsave(&device_domain_lock, flags); |
| 2509 | if (dev) | 2508 | if (dev) |
| 2510 | found = find_domain(dev); | 2509 | found = find_domain(dev); |
| @@ -2520,16 +2519,17 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, | |||
| 2520 | 2519 | ||
| 2521 | if (found) { | 2520 | if (found) { |
| 2522 | spin_unlock_irqrestore(&device_domain_lock, flags); | 2521 | spin_unlock_irqrestore(&device_domain_lock, flags); |
| 2523 | spin_unlock(&iommu->lock); | ||
| 2524 | free_devinfo_mem(info); | 2522 | free_devinfo_mem(info); |
| 2525 | /* Caller must free the original domain */ | 2523 | /* Caller must free the original domain */ |
| 2526 | return found; | 2524 | return found; |
| 2527 | } | 2525 | } |
| 2528 | 2526 | ||
| 2527 | spin_lock(&iommu->lock); | ||
| 2529 | ret = domain_attach_iommu(domain, iommu); | 2528 | ret = domain_attach_iommu(domain, iommu); |
| 2529 | spin_unlock(&iommu->lock); | ||
| 2530 | |||
| 2530 | if (ret) { | 2531 | if (ret) { |
| 2531 | spin_unlock_irqrestore(&device_domain_lock, flags); | 2532 | 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,7 +2539,6 @@ 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); | ||
| 2543 | 2542 | ||
| 2544 | /* PASID table is mandatory for a PCI device in scalable mode. */ | 2543 | /* PASID table is mandatory for a PCI device in scalable mode. */ |
| 2545 | if (dev && dev_is_pci(dev) && sm_supported(iommu)) { | 2544 | if (dev && dev_is_pci(dev) && sm_supported(iommu)) { |
