提交 15f9a310 编写于 作者: R Robin Murphy 提交者: Joerg Roedel

iommu/tegra-gart: Add iommu_group support

As the last step to making groups mandatory, clean up the remaining
drivers by adding basic support. Whilst it may not perfectly reflect the
isolation capabilities of the hardware, using generic_device_group()
should at least maintain existing behaviour with respect to the API.
Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
Tested-by: NDmitry Osipenko <digetx@gmail.com>
Signed-off-by: NJoerg Roedel <jroedel@suse.de>
上级 d92e1f84
...@@ -334,12 +334,31 @@ static bool gart_iommu_capable(enum iommu_cap cap) ...@@ -334,12 +334,31 @@ static bool gart_iommu_capable(enum iommu_cap cap)
return false; return false;
} }
static int gart_iommu_add_device(struct device *dev)
{
struct iommu_group *group = iommu_group_get_for_dev(dev);
if (IS_ERR(group))
return PTR_ERR(group);
iommu_group_put(group);
return 0;
}
static void gart_iommu_remove_device(struct device *dev)
{
iommu_group_remove_device(dev);
}
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,
.domain_free = gart_iommu_domain_free, .domain_free = gart_iommu_domain_free,
.attach_dev = gart_iommu_attach_dev, .attach_dev = gart_iommu_attach_dev,
.detach_dev = gart_iommu_detach_dev, .detach_dev = gart_iommu_detach_dev,
.add_device = gart_iommu_add_device,
.remove_device = gart_iommu_remove_device,
.device_group = generic_device_group,
.map = gart_iommu_map, .map = gart_iommu_map,
.map_sg = default_iommu_map_sg, .map_sg = default_iommu_map_sg,
.unmap = gart_iommu_unmap, .unmap = gart_iommu_unmap,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册