diff options
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-rw-r--r-- | drivers/pci/intel-iommu.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 35463ddf10a1..292f2233295e 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -3260,9 +3260,15 @@ static int device_notifier(struct notifier_block *nb, | |||
3260 | if (!domain) | 3260 | if (!domain) |
3261 | return 0; | 3261 | return 0; |
3262 | 3262 | ||
3263 | if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through) | 3263 | if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through) { |
3264 | domain_remove_one_dev_info(domain, pdev); | 3264 | domain_remove_one_dev_info(domain, pdev); |
3265 | 3265 | ||
3266 | if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) && | ||
3267 | !(domain->flags & DOMAIN_FLAG_STATIC_IDENTITY) && | ||
3268 | list_empty(&domain->devices)) | ||
3269 | domain_exit(domain); | ||
3270 | } | ||
3271 | |||
3266 | return 0; | 3272 | return 0; |
3267 | } | 3273 | } |
3268 | 3274 | ||
@@ -3411,6 +3417,11 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain, | |||
3411 | domain->iommu_count--; | 3417 | domain->iommu_count--; |
3412 | domain_update_iommu_cap(domain); | 3418 | domain_update_iommu_cap(domain); |
3413 | spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags); | 3419 | spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags); |
3420 | |||
3421 | spin_lock_irqsave(&iommu->lock, tmp_flags); | ||
3422 | clear_bit(domain->id, iommu->domain_ids); | ||
3423 | iommu->domains[domain->id] = NULL; | ||
3424 | spin_unlock_irqrestore(&iommu->lock, tmp_flags); | ||
3414 | } | 3425 | } |
3415 | 3426 | ||
3416 | spin_unlock_irqrestore(&device_domain_lock, flags); | 3427 | spin_unlock_irqrestore(&device_domain_lock, flags); |