Commit 4b6f0ea3 authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Joerg Roedel

iommu/tegra: gart: Ignore devices without IOMMU phandle in DT

GART can't handle all devices, hence ignore devices that aren't related
to GART. IOMMU phandle must be explicitly assign to devices in the device
tree.
Signed-off-by: default avatarDmitry Osipenko <digetx@gmail.com>
Acked-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent ae95c46d
...@@ -345,8 +345,12 @@ static bool gart_iommu_capable(enum iommu_cap cap) ...@@ -345,8 +345,12 @@ static bool gart_iommu_capable(enum iommu_cap cap)
static int gart_iommu_add_device(struct device *dev) static int gart_iommu_add_device(struct device *dev)
{ {
struct iommu_group *group = iommu_group_get_for_dev(dev); struct iommu_group *group;
if (!dev->iommu_fwspec)
return -ENODEV;
group = iommu_group_get_for_dev(dev);
if (IS_ERR(group)) if (IS_ERR(group))
return PTR_ERR(group); return PTR_ERR(group);
...@@ -363,6 +367,12 @@ static void gart_iommu_remove_device(struct device *dev) ...@@ -363,6 +367,12 @@ static void gart_iommu_remove_device(struct device *dev)
iommu_device_unlink(&gart_handle->iommu, dev); iommu_device_unlink(&gart_handle->iommu, dev);
} }
static int gart_iommu_of_xlate(struct device *dev,
struct of_phandle_args *args)
{
return 0;
}
static const struct iommu_ops gart_iommu_ops = { static const struct iommu_ops gart_iommu_ops = {
.capable = gart_iommu_capable, .capable = gart_iommu_capable,
.domain_alloc = gart_iommu_domain_alloc, .domain_alloc = gart_iommu_domain_alloc,
...@@ -376,6 +386,7 @@ static const struct iommu_ops gart_iommu_ops = { ...@@ -376,6 +386,7 @@ static const struct iommu_ops gart_iommu_ops = {
.unmap = gart_iommu_unmap, .unmap = gart_iommu_unmap,
.iova_to_phys = gart_iommu_iova_to_phys, .iova_to_phys = gart_iommu_iova_to_phys,
.pgsize_bitmap = GART_IOMMU_PGSIZES, .pgsize_bitmap = GART_IOMMU_PGSIZES,
.of_xlate = gart_iommu_of_xlate,
}; };
static int tegra_gart_suspend(struct device *dev) static int tegra_gart_suspend(struct device *dev)
...@@ -441,6 +452,7 @@ static int tegra_gart_probe(struct platform_device *pdev) ...@@ -441,6 +452,7 @@ static int tegra_gart_probe(struct platform_device *pdev)
} }
iommu_device_set_ops(&gart->iommu, &gart_iommu_ops); iommu_device_set_ops(&gart->iommu, &gart_iommu_ops);
iommu_device_set_fwnode(&gart->iommu, dev->fwnode);
ret = iommu_device_register(&gart->iommu); ret = iommu_device_register(&gart->iommu);
if (ret) { if (ret) {
......
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