]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - drivers/iommu/intel-iommu.c
iommu/vt-d: Detach domain *only* from attached iommus
[mirror_ubuntu-zesty-kernel.git] / drivers / iommu / intel-iommu.c
index ae4c1a854e57896fc64e33668369bebc23f70945..a83c965410e07c117ade5374331b0854b0b9e07d 100644 (file)
@@ -1743,8 +1743,8 @@ static int domain_init(struct dmar_domain *domain, int guest_width)
 static void domain_exit(struct dmar_domain *domain)
 {
        struct dmar_drhd_unit *drhd;
-       struct intel_iommu *iommu;
        struct page *freelist = NULL;
+       int i;
 
        /* Domain 0 is reserved, so dont process it */
        if (!domain)
@@ -1764,8 +1764,8 @@ static void domain_exit(struct dmar_domain *domain)
 
        /* clear attached or cached domains */
        rcu_read_lock();
-       for_each_active_iommu(iommu, drhd)
-               iommu_detach_domain(domain, iommu);
+       for_each_set_bit(i, domain->iommu_bmp, g_num_of_iommus)
+               iommu_detach_domain(domain, g_iommus[i]);
        rcu_read_unlock();
 
        dma_free_pagelist(freelist);