Skip to content

Commit 05f8030

Browse files
rmurphy-armjoergroedel
authored andcommitted
iommu: Finish making iommu_group support mandatory
Now that all the drivers properly implementing the IOMMU API support groups (I'm ignoring the etnaviv GPU MMUs which seemingly only do just enough to convince the ARM DMA mapping ops), we can remove the FIXME workarounds from the core code. In the process, it also seems logical to make the .device_group callback non-optional for drivers calling iommu_group_get_for_dev() - the current callers all implement it anyway, and it doesn't make sense for any future callers not to either. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 15f9a31 commit 05f8030

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

drivers/iommu/iommu.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,11 +1005,10 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev)
10051005
if (group)
10061006
return group;
10071007

1008-
group = ERR_PTR(-EINVAL);
1009-
1010-
if (ops && ops->device_group)
1011-
group = ops->device_group(dev);
1008+
if (!ops)
1009+
return ERR_PTR(-EINVAL);
10121010

1011+
group = ops->device_group(dev);
10131012
if (WARN_ON_ONCE(group == NULL))
10141013
return ERR_PTR(-EINVAL);
10151014

@@ -1298,12 +1297,8 @@ int iommu_attach_device(struct iommu_domain *domain, struct device *dev)
12981297
int ret;
12991298

13001299
group = iommu_group_get(dev);
1301-
/* FIXME: Remove this when groups a mandatory for iommu drivers */
1302-
if (group == NULL)
1303-
return __iommu_attach_device(domain, dev);
1304-
13051300
/*
1306-
* We have a group - lock it to make sure the device-count doesn't
1301+
* Lock the group to make sure the device-count doesn't
13071302
* change while we are attaching
13081303
*/
13091304
mutex_lock(&group->mutex);
@@ -1336,9 +1331,6 @@ void iommu_detach_device(struct iommu_domain *domain, struct device *dev)
13361331
struct iommu_group *group;
13371332

13381333
group = iommu_group_get(dev);
1339-
/* FIXME: Remove this when groups a mandatory for iommu drivers */
1340-
if (group == NULL)
1341-
return __iommu_detach_device(domain, dev);
13421334

13431335
mutex_lock(&group->mutex);
13441336
if (iommu_group_device_count(group) != 1) {
@@ -1360,9 +1352,6 @@ struct iommu_domain *iommu_get_domain_for_dev(struct device *dev)
13601352
struct iommu_group *group;
13611353

13621354
group = iommu_group_get(dev);
1363-
/* FIXME: Remove this when groups a mandatory for iommu drivers */
1364-
if (group == NULL)
1365-
return NULL;
13661355

13671356
domain = group->domain;
13681357

0 commit comments

Comments
 (0)