Skip to content

Commit 8f68911

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu/ipmmu-vmsa: Convert to generic_single_device_group()
Use the new helper. This driver is kind of weird since in ARM mode it pretends it has per-device groups, but ARM64 mode does not. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/6-v1-c869a95191f2+5e8-iommu_single_grp_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent ef0f48c commit 8f68911

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

drivers/iommu/ipmmu-vmsa.c

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ struct ipmmu_vmsa_device {
6464
struct ipmmu_vmsa_domain *domains[IPMMU_CTX_MAX];
6565
s8 utlb_ctx[IPMMU_UTLB_MAX];
6666

67-
struct iommu_group *group;
6867
struct dma_iommu_mapping *mapping;
6968
};
7069

@@ -872,29 +871,18 @@ static void ipmmu_release_device(struct device *dev)
872871
arm_iommu_release_mapping(mmu->mapping);
873872
}
874873

875-
static struct iommu_group *ipmmu_find_group(struct device *dev)
876-
{
877-
struct ipmmu_vmsa_device *mmu = to_ipmmu(dev);
878-
struct iommu_group *group;
879-
880-
if (mmu->group)
881-
return iommu_group_ref_get(mmu->group);
882-
883-
group = iommu_group_alloc();
884-
if (!IS_ERR(group))
885-
mmu->group = group;
886-
887-
return group;
888-
}
889-
890874
static const struct iommu_ops ipmmu_ops = {
891875
.identity_domain = &ipmmu_iommu_identity_domain,
892876
.domain_alloc_paging = ipmmu_domain_alloc_paging,
893877
.probe_device = ipmmu_probe_device,
894878
.release_device = ipmmu_release_device,
895879
.probe_finalize = ipmmu_probe_finalize,
880+
/*
881+
* FIXME: The device grouping is a fixed property of the hardware's
882+
* ability to isolate and control DMA, it should not depend on kconfig.
883+
*/
896884
.device_group = IS_ENABLED(CONFIG_ARM) && !IS_ENABLED(CONFIG_IOMMU_DMA)
897-
? generic_device_group : ipmmu_find_group,
885+
? generic_device_group : generic_single_device_group,
898886
.pgsize_bitmap = SZ_1G | SZ_2M | SZ_4K,
899887
.of_xlate = ipmmu_of_xlate,
900888
.default_domain_ops = &(const struct iommu_domain_ops) {

0 commit comments

Comments
 (0)