On 2023/2/17 19:21, Marek Szyprowski wrote:
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(). While fixing this, remove the conditional code
as it is not really needed.
Reported-by: Jason Gunthorpe<jgg@xxxxxxxx>
Fixes: 189d496b48b1 ("iommu/exynos: Add missing set_platform_dma_ops callback")
The exynos iommu driver actually supports default domain. Why need to
add the set_platform_dma_ops?
897 static struct iommu_domain *exynos_iommu_domain_alloc(unsigned type)
898 {
899 struct exynos_iommu_domain *domain;
900 dma_addr_t handle;
901 int i;
902
903 /* Check if correct PTE offsets are initialized */
904 BUG_ON(PG_ENT_SHIFT < 0 || !dma_dev);
905
906 if (type != IOMMU_DOMAIN_DMA && type !=
IOMMU_DOMAIN_UNMANAGED)
907 return NULL;
It actually doesn't support identity default domain. But the iommu core
allows this and roll back to DMA domain instead.
1686 static int iommu_group_alloc_default_domain(struct iommu_group *group,
1687 struct device *dev,
1688 unsigned int type)
1689 {
1690 struct iommu_domain *dom;
1691
1692 dom = __iommu_domain_alloc(dev, type);
1693 if (!dom && type != IOMMU_DOMAIN_DMA) {
1694 dom = __iommu_domain_alloc(dev, IOMMU_DOMAIN_DMA);
1695 if (dom)
1696 pr_warn("Failed to allocate default IOMMU
domain of type %u for group %s - Falling back to IOMMU_DOMAIN_D MA",
1697 type, group->name);
1698 }
I have a feeling, set_platform_dma_ops was mistakenly added to fix other
problems instead of missing a callback.
Best regards,
baolu