Skip to content

Commit ab95b32

Browse files
mszyprowmoodyhunter
authored andcommitted
iommu/exynos: Fix set_platform_dma_ops() callback
There are some subtle differences between release_device() and set_platform_dma_ops() callbacks, so separate those two callbacks. Device links should be removed only in release_device(), because they were created in probe_device() on purpose and they are needed for proper Exynos IOMMU driver operation. While fixing this, remove the conditional code as it is not really needed. Reported-by: Jason Gunthorpe <[email protected]> Fixes: 189d496 ("iommu/exynos: Add missing set_platform_dma_ops callback") Signed-off-by: Marek Szyprowski <[email protected]> Reviewed-by: Sam Protsenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent b8166d0 commit ab95b32

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

drivers/iommu/exynos-iommu.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,23 +1415,26 @@ static struct iommu_device *exynos_iommu_probe_device(struct device *dev)
14151415
return &data->iommu;
14161416
}
14171417

1418-
static void exynos_iommu_release_device(struct device *dev)
1418+
static void exynos_iommu_set_platform_dma(struct device *dev)
14191419
{
14201420
struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev);
1421-
struct sysmmu_drvdata *data;
14221421

14231422
if (owner->domain) {
14241423
struct iommu_group *group = iommu_group_get(dev);
14251424

14261425
if (group) {
1427-
#ifndef CONFIG_ARM
1428-
WARN_ON(owner->domain !=
1429-
iommu_group_default_domain(group));
1430-
#endif
14311426
exynos_iommu_detach_device(owner->domain, dev);
14321427
iommu_group_put(group);
14331428
}
14341429
}
1430+
}
1431+
1432+
static void exynos_iommu_release_device(struct device *dev)
1433+
{
1434+
struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev);
1435+
struct sysmmu_drvdata *data;
1436+
1437+
exynos_iommu_set_platform_dma(dev);
14351438

14361439
list_for_each_entry(data, &owner->controllers, owner_node)
14371440
device_link_del(data->link);
@@ -1479,7 +1482,7 @@ static const struct iommu_ops exynos_iommu_ops = {
14791482
.domain_alloc = exynos_iommu_domain_alloc,
14801483
.device_group = generic_device_group,
14811484
#ifdef CONFIG_ARM
1482-
.set_platform_dma_ops = exynos_iommu_release_device,
1485+
.set_platform_dma_ops = exynos_iommu_set_platform_dma,
14831486
#endif
14841487
.probe_device = exynos_iommu_probe_device,
14851488
.release_device = exynos_iommu_release_device,

0 commit comments

Comments
 (0)