aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/iommu/intel-iommu.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index a4407eabf0e6..3965e73db51c 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1711,6 +1711,7 @@ static void disable_dmar_iommu(struct intel_iommu *iommu)
1711 if (!iommu->domains || !iommu->domain_ids) 1711 if (!iommu->domains || !iommu->domain_ids)
1712 return; 1712 return;
1713 1713
1714again:
1714 spin_lock_irqsave(&device_domain_lock, flags); 1715 spin_lock_irqsave(&device_domain_lock, flags);
1715 list_for_each_entry_safe(info, tmp, &device_domain_list, global) { 1716 list_for_each_entry_safe(info, tmp, &device_domain_list, global) {
1716 struct dmar_domain *domain; 1717 struct dmar_domain *domain;
@@ -1723,10 +1724,19 @@ static void disable_dmar_iommu(struct intel_iommu *iommu)
1723 1724
1724 domain = info->domain; 1725 domain = info->domain;
1725 1726
1726 dmar_remove_one_dev_info(domain, info->dev); 1727 __dmar_remove_one_dev_info(info);
1727 1728
1728 if (!domain_type_is_vm_or_si(domain)) 1729 if (!domain_type_is_vm_or_si(domain)) {
1730 /*
1731 * The domain_exit() function can't be called under
1732 * device_domain_lock, as it takes this lock itself.
1733 * So release the lock here and re-run the loop
1734 * afterwards.
1735 */
1736 spin_unlock_irqrestore(&device_domain_lock, flags);
1729 domain_exit(domain); 1737 domain_exit(domain);
1738 goto again;
1739 }
1730 } 1740 }
1731 spin_unlock_irqrestore(&device_domain_lock, flags); 1741 spin_unlock_irqrestore(&device_domain_lock, flags);
1732 1742