diff options
| -rw-r--r-- | drivers/iommu/intel-iommu.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 968e3d32e305..0984fa58d872 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
| @@ -425,6 +425,8 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain, | |||
| 425 | struct device *dev); | 425 | struct device *dev); |
| 426 | static void iommu_detach_dependent_devices(struct intel_iommu *iommu, | 426 | static void iommu_detach_dependent_devices(struct intel_iommu *iommu, |
| 427 | struct device *dev); | 427 | struct device *dev); |
| 428 | static int domain_detach_iommu(struct dmar_domain *domain, | ||
| 429 | struct intel_iommu *iommu); | ||
| 428 | 430 | ||
| 429 | #ifdef CONFIG_INTEL_IOMMU_DEFAULT_ON | 431 | #ifdef CONFIG_INTEL_IOMMU_DEFAULT_ON |
| 430 | int dmar_disabled = 0; | 432 | int dmar_disabled = 0; |
| @@ -1465,8 +1467,7 @@ static int iommu_init_domains(struct intel_iommu *iommu) | |||
| 1465 | static void free_dmar_iommu(struct intel_iommu *iommu) | 1467 | static void free_dmar_iommu(struct intel_iommu *iommu) |
| 1466 | { | 1468 | { |
| 1467 | struct dmar_domain *domain; | 1469 | struct dmar_domain *domain; |
| 1468 | int i, count; | 1470 | int i; |
| 1469 | unsigned long flags; | ||
| 1470 | 1471 | ||
| 1471 | if ((iommu->domains) && (iommu->domain_ids)) { | 1472 | if ((iommu->domains) && (iommu->domain_ids)) { |
| 1472 | for_each_set_bit(i, iommu->domain_ids, cap_ndoms(iommu->cap)) { | 1473 | for_each_set_bit(i, iommu->domain_ids, cap_ndoms(iommu->cap)) { |
| @@ -1479,11 +1480,7 @@ static void free_dmar_iommu(struct intel_iommu *iommu) | |||
| 1479 | 1480 | ||
| 1480 | domain = iommu->domains[i]; | 1481 | domain = iommu->domains[i]; |
| 1481 | clear_bit(i, iommu->domain_ids); | 1482 | clear_bit(i, iommu->domain_ids); |
| 1482 | 1483 | if (domain_detach_iommu(domain, iommu) == 0) | |
| 1483 | spin_lock_irqsave(&domain->iommu_lock, flags); | ||
| 1484 | count = --domain->iommu_count; | ||
| 1485 | spin_unlock_irqrestore(&domain->iommu_lock, flags); | ||
| 1486 | if (count == 0) | ||
| 1487 | domain_exit(domain); | 1484 | domain_exit(domain); |
| 1488 | } | 1485 | } |
| 1489 | } | 1486 | } |
