Commit f91bf327 authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Joerg Roedel

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: default avatarJason Gunthorpe <jgg@ziepe.ca>
Fixes: 189d496b ("iommu/exynos: Add missing set_platform_dma_ops callback")
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: default avatarSam Protsenko <semen.protsenko@linaro.org>
Link: https://lore.kernel.org/r/20230315232514.1046589-1-m.szyprowski@samsung.comSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent d701cf65
...@@ -1415,23 +1415,26 @@ static struct iommu_device *exynos_iommu_probe_device(struct device *dev) ...@@ -1415,23 +1415,26 @@ static struct iommu_device *exynos_iommu_probe_device(struct device *dev)
return &data->iommu; return &data->iommu;
} }
static void exynos_iommu_release_device(struct device *dev) static void exynos_iommu_set_platform_dma(struct device *dev)
{ {
struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev); struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev);
struct sysmmu_drvdata *data;
if (owner->domain) { if (owner->domain) {
struct iommu_group *group = iommu_group_get(dev); struct iommu_group *group = iommu_group_get(dev);
if (group) { if (group) {
#ifndef CONFIG_ARM
WARN_ON(owner->domain !=
iommu_group_default_domain(group));
#endif
exynos_iommu_detach_device(owner->domain, dev); exynos_iommu_detach_device(owner->domain, dev);
iommu_group_put(group); iommu_group_put(group);
} }
} }
}
static void exynos_iommu_release_device(struct device *dev)
{
struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev);
struct sysmmu_drvdata *data;
exynos_iommu_set_platform_dma(dev);
list_for_each_entry(data, &owner->controllers, owner_node) list_for_each_entry(data, &owner->controllers, owner_node)
device_link_del(data->link); device_link_del(data->link);
...@@ -1479,7 +1482,7 @@ static const struct iommu_ops exynos_iommu_ops = { ...@@ -1479,7 +1482,7 @@ static const struct iommu_ops exynos_iommu_ops = {
.domain_alloc = exynos_iommu_domain_alloc, .domain_alloc = exynos_iommu_domain_alloc,
.device_group = generic_device_group, .device_group = generic_device_group,
#ifdef CONFIG_ARM #ifdef CONFIG_ARM
.set_platform_dma_ops = exynos_iommu_release_device, .set_platform_dma_ops = exynos_iommu_set_platform_dma,
#endif #endif
.probe_device = exynos_iommu_probe_device, .probe_device = exynos_iommu_probe_device,
.release_device = exynos_iommu_release_device, .release_device = exynos_iommu_release_device,
......
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