]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/iommu/intel-iommu.c
Merge git://git.infradead.org/intel-iommu
[mirror_ubuntu-artful-kernel.git] / drivers / iommu / intel-iommu.c
index 2723090a0d5498462866634dc9c557301e9ba37e..d8376c2d18b3bf7491cb80473053b1a34f6cd54f 100644 (file)
@@ -1724,6 +1724,7 @@ static void disable_dmar_iommu(struct intel_iommu *iommu)
        if (!iommu->domains || !iommu->domain_ids)
                return;
 
+again:
        spin_lock_irqsave(&device_domain_lock, flags);
        list_for_each_entry_safe(info, tmp, &device_domain_list, global) {
                struct dmar_domain *domain;
@@ -1736,10 +1737,19 @@ static void disable_dmar_iommu(struct intel_iommu *iommu)
 
                domain = info->domain;
 
-               dmar_remove_one_dev_info(domain, info->dev);
+               __dmar_remove_one_dev_info(info);
 
-               if (!domain_type_is_vm_or_si(domain))
+               if (!domain_type_is_vm_or_si(domain)) {
+                       /*
+                        * The domain_exit() function  can't be called under
+                        * device_domain_lock, as it takes this lock itself.
+                        * So release the lock here and re-run the loop
+                        * afterwards.
+                        */
+                       spin_unlock_irqrestore(&device_domain_lock, flags);
                        domain_exit(domain);
+                       goto again;
+               }
        }
        spin_unlock_irqrestore(&device_domain_lock, flags);