aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/intel-iommu.c
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2011-05-24 12:19:04 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2011-06-01 07:47:29 -0400
commit9b4554b21ed07e8556405510638171f0c787742a (patch)
tree384c8517f6aee9a09a43ac55c7d0cbadc3d2ee23 /drivers/pci/intel-iommu.c
parent6dd9a7c73761a8a5f5475d5cfdc15368a0f4c06d (diff)
intel-iommu: Only unlink device domains from iommu
Commit a97590e5 added unlinking domains from iommus to reciprocate the iommu from domains unlinking that was already done. We actually want to only do this for device domains and never for the static identity map domain or VM domains. The SI domain is special and never freed, while VM domain->id lives in their own special address space, separate from iommu->domain_ids. In the current code, a VM can get domain->id zero, then mark that domain unused when unbound from pci-stub. This leads to DMAR write faults when the device is re-bound to the host driver. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Cc: stable@kernel.org Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-rw-r--r--drivers/pci/intel-iommu.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index e6fe1994f9d3..4eaec2fa1369 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -3561,10 +3561,13 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain,
3561 domain_update_iommu_cap(domain); 3561 domain_update_iommu_cap(domain);
3562 spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags); 3562 spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags);
3563 3563
3564 spin_lock_irqsave(&iommu->lock, tmp_flags); 3564 if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) &&
3565 clear_bit(domain->id, iommu->domain_ids); 3565 !(domain->flags & DOMAIN_FLAG_STATIC_IDENTITY)) {
3566 iommu->domains[domain->id] = NULL; 3566 spin_lock_irqsave(&iommu->lock, tmp_flags);
3567 spin_unlock_irqrestore(&iommu->lock, tmp_flags); 3567 clear_bit(domain->id, iommu->domain_ids);
3568 iommu->domains[domain->id] = NULL;
3569 spin_unlock_irqrestore(&iommu->lock, tmp_flags);
3570 }
3568 } 3571 }
3569 3572
3570 spin_unlock_irqrestore(&device_domain_lock, flags); 3573 spin_unlock_irqrestore(&device_domain_lock, flags);