X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=drivers%2Fiommu%2Fintel-iommu.c;h=0649b94f59584ca5b885cd0ecad595a84af0d89d;hb=d683477020be2036d6c2d7d2cd3ffac4f2acbd6c;hp=a98a7b27aca1dec2cb2f53319df8a49abcf8e645;hpb=c8a075ab1ecdbbe7dc883925cee44c54b535cd8d;p=uclinux-h8%2Flinux.git diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index a98a7b27aca1..0649b94f5958 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -1830,8 +1830,9 @@ 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) @@ -1851,8 +1852,10 @@ static void domain_exit(struct dmar_domain *domain) /* clear attached or cached domains */ rcu_read_lock(); - for_each_set_bit(i, domain->iommu_bmp, g_num_of_iommus) - iommu_detach_domain(domain, g_iommus[i]); + for_each_active_iommu(iommu, drhd) + if (domain_type_is_vm(domain) || + test_bit(iommu->seq_id, domain->iommu_bmp)) + iommu_detach_domain(domain, iommu); rcu_read_unlock(); dma_free_pagelist(freelist);