Commit b6809ee5 authored by Joerg Roedel's avatar Joerg Roedel

iommu/amd: Detach device from domain before removal

Detach the device that is about to be removed from its
domain (if it has one) to clear any related state like DTE
entry and device's ATS state.
Reported-by: default avatarKelly Zytaruk <Kelly.Zytaruk@amd.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 358875fd
...@@ -114,6 +114,7 @@ struct kmem_cache *amd_iommu_irq_cache; ...@@ -114,6 +114,7 @@ struct kmem_cache *amd_iommu_irq_cache;
static void update_domain(struct protection_domain *domain); static void update_domain(struct protection_domain *domain);
static int protection_domain_init(struct protection_domain *domain); static int protection_domain_init(struct protection_domain *domain);
static void detach_device(struct device *dev);
/* /*
* For dynamic growth the aperture size is split into ranges of 128MB of * For dynamic growth the aperture size is split into ranges of 128MB of
...@@ -384,6 +385,9 @@ static void iommu_uninit_device(struct device *dev) ...@@ -384,6 +385,9 @@ static void iommu_uninit_device(struct device *dev)
if (!dev_data) if (!dev_data)
return; return;
if (dev_data->domain)
detach_device(dev);
iommu_device_unlink(amd_iommu_rlookup_table[dev_data->devid]->iommu_dev, iommu_device_unlink(amd_iommu_rlookup_table[dev_data->devid]->iommu_dev,
dev); dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment