diff options
| -rw-r--r-- | drivers/iommu/intel-iommu.c | 9 |
1 files changed, 6 insertions, 3 deletions
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) | |||
| 1830 | 1830 | ||
| 1831 | static void domain_exit(struct dmar_domain *domain) | 1831 | static void domain_exit(struct dmar_domain *domain) |
| 1832 | { | 1832 | { |
| 1833 | struct dmar_drhd_unit *drhd; | ||
| 1834 | struct intel_iommu *iommu; | ||
| 1833 | struct page *freelist = NULL; | 1835 | struct page *freelist = NULL; |
| 1834 | int i; | ||
| 1835 | 1836 | ||
| 1836 | /* Domain 0 is reserved, so dont process it */ | 1837 | /* Domain 0 is reserved, so dont process it */ |
| 1837 | if (!domain) | 1838 | if (!domain) |
| @@ -1851,8 +1852,10 @@ static void domain_exit(struct dmar_domain *domain) | |||
| 1851 | 1852 | ||
| 1852 | /* clear attached or cached domains */ | 1853 | /* clear attached or cached domains */ |
| 1853 | rcu_read_lock(); | 1854 | rcu_read_lock(); |
| 1854 | for_each_set_bit(i, domain->iommu_bmp, g_num_of_iommus) | 1855 | for_each_active_iommu(iommu, drhd) |
| 1855 | iommu_detach_domain(domain, g_iommus[i]); | 1856 | if (domain_type_is_vm(domain) || |
| 1857 | test_bit(iommu->seq_id, domain->iommu_bmp)) | ||
| 1858 | iommu_detach_domain(domain, iommu); | ||
| 1856 | rcu_read_unlock(); | 1859 | rcu_read_unlock(); |
| 1857 | 1860 | ||
| 1858 | dma_free_pagelist(freelist); | 1861 | dma_free_pagelist(freelist); |
