Skip to content

Commit fff2fd1

Browse files
mszyprowjoergroedel
authored andcommitted
iommu/exynos: Properly release device from the default domain in ->remove
IOMMU core doesn't detach device from the default domain before calling ->iommu_remove_device, so check that and do the proper cleanup or warn if device is still attached to non-default domain. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 0bd5a0c commit fff2fd1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/iommu/exynos-iommu.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,9 +1242,21 @@ static int exynos_iommu_add_device(struct device *dev)
12421242

12431243
static void exynos_iommu_remove_device(struct device *dev)
12441244
{
1245+
struct exynos_iommu_owner *owner = dev->archdata.iommu;
1246+
12451247
if (!has_sysmmu(dev))
12461248
return;
12471249

1250+
if (owner->domain) {
1251+
struct iommu_group *group = iommu_group_get(dev);
1252+
1253+
if (group) {
1254+
WARN_ON(owner->domain !=
1255+
iommu_group_default_domain(group));
1256+
exynos_iommu_detach_device(owner->domain, dev);
1257+
iommu_group_put(group);
1258+
}
1259+
}
12481260
iommu_group_remove_device(dev);
12491261
}
12501262

0 commit comments

Comments
 (0)