Message ID | 20180924004153.8232-4-digetx@gmail.com |
---|---|
State | Deferred |
Headers | show |
Series | IOMMU: Tegra GART driver clean up and optimization | expand |
On Mon, Sep 24, 2018 at 03:41:36AM +0300, Dmitry Osipenko wrote: > 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. I think technically the GART can indeed handle all devices since it is just a physical address region that can be used to remap other physical addresses. That's not to say that doing so would be a good idea. So the commit message here is slightly confusing, but other than that the idea is good, so: Acked-by: Thierry Reding <treding@nvidia.com>
On 9/24/18 1:05 PM, Thierry Reding wrote: > On Mon, Sep 24, 2018 at 03:41:36AM +0300, Dmitry Osipenko wrote: >> 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. > > I think technically the GART can indeed handle all devices since it is > just a physical address region that can be used to remap other physical > addresses. That's not to say that doing so would be a good idea. So the > commit message here is slightly confusing, but other than that the idea > is good, so: > > Acked-by: Thierry Reding <treding@nvidia.com> > It shouldn't be able to serve something like SDHCI, though I haven't tried to verify that.
diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index e9524ed264cf..f6cf5cd5aaca 100644 --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu/tegra-gart.c @@ -342,8 +342,12 @@ static bool gart_iommu_capable(enum iommu_cap cap) 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)) return PTR_ERR(group); @@ -360,6 +364,12 @@ static void gart_iommu_remove_device(struct device *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 = { .capable = gart_iommu_capable, .domain_alloc = gart_iommu_domain_alloc, @@ -373,6 +383,7 @@ static const struct iommu_ops gart_iommu_ops = { .unmap = gart_iommu_unmap, .iova_to_phys = gart_iommu_iova_to_phys, .pgsize_bitmap = GART_IOMMU_PGSIZES, + .of_xlate = gart_iommu_of_xlate, }; static int tegra_gart_suspend(struct device *dev) @@ -438,6 +449,7 @@ static int tegra_gart_probe(struct platform_device *pdev) } iommu_device_set_ops(&gart->iommu, &gart_iommu_ops); + iommu_device_set_fwnode(&gart->iommu, dev->fwnode); ret = iommu_device_register(&gart->iommu); if (ret) {
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: Dmitry Osipenko <digetx@gmail.com> --- drivers/iommu/tegra-gart.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)