iommu/vt-d: Detach domain when move device out of group
authorLu Baolu <baolu.lu@linux.intel.com>
Thu, 1 Aug 2019 03:14:58 +0000 (11:14 +0800)
committerJoerg Roedel <jroedel@suse.de>
Tue, 6 Aug 2019 15:27:10 +0000 (17:27 +0200)
When removing a device from an iommu group, the domain should
be detached from the device. Otherwise, the stale domain info
will still be cached by the driver and the driver will refuse
to attach any domain to the device again.

Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>
Fixes: b7297783c2bb6 ("iommu/vt-d: Remove duplicated code for device hotplug")
Reported-and-tested-by: Vlad Buslov <vladbu@mellanox.com>
Suggested-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lkml.org/lkml/2019/7/26/1133
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/intel-iommu.c

index bdaed2da8a55e5a96904d0a182b9d44db8843777..3e22fa6ae8c8a32e1d50852879e3b3c3e183782f 100644 (file)
@@ -5316,6 +5316,8 @@ static void intel_iommu_remove_device(struct device *dev)
        if (!iommu)
                return;
 
+       dmar_remove_one_dev_info(dev);
+
        iommu_group_remove_device(dev);
 
        iommu_device_unlink(&iommu->iommu, dev);