Skip to content

Commit 1fbf734

Browse files
yiliu1765joergroedel
authored andcommitted
iommu: Consolidate the ops->remove_dev_pasid usage into a helper
Add a wrapper for the ops->remove_dev_pasid, this consolidates the iommu_ops fetching and callback invoking. It is also a preparation for starting the transition from using remove_dev_pasid op to detach pasid to the way using blocked_domain to detach pasid. Reviewed-by: Vasant Hegde <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Lu Baolu <[email protected]> Signed-off-by: Yi Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent fb3de9f commit 1fbf734

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

drivers/iommu/iommu.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3312,6 +3312,14 @@ bool iommu_group_dma_owner_claimed(struct iommu_group *group)
33123312
}
33133313
EXPORT_SYMBOL_GPL(iommu_group_dma_owner_claimed);
33143314

3315+
static void iommu_remove_dev_pasid(struct device *dev, ioasid_t pasid,
3316+
struct iommu_domain *domain)
3317+
{
3318+
const struct iommu_ops *ops = dev_iommu_ops(dev);
3319+
3320+
ops->remove_dev_pasid(dev, pasid, domain);
3321+
}
3322+
33153323
static int __iommu_set_group_pasid(struct iommu_domain *domain,
33163324
struct iommu_group *group, ioasid_t pasid)
33173325
{
@@ -3330,11 +3338,9 @@ static int __iommu_set_group_pasid(struct iommu_domain *domain,
33303338
err_revert:
33313339
last_gdev = device;
33323340
for_each_group_device(group, device) {
3333-
const struct iommu_ops *ops = dev_iommu_ops(device->dev);
3334-
33353341
if (device == last_gdev)
33363342
break;
3337-
ops->remove_dev_pasid(device->dev, pasid, domain);
3343+
iommu_remove_dev_pasid(device->dev, pasid, domain);
33383344
}
33393345
return ret;
33403346
}
@@ -3344,12 +3350,9 @@ static void __iommu_remove_group_pasid(struct iommu_group *group,
33443350
struct iommu_domain *domain)
33453351
{
33463352
struct group_device *device;
3347-
const struct iommu_ops *ops;
33483353

3349-
for_each_group_device(group, device) {
3350-
ops = dev_iommu_ops(device->dev);
3351-
ops->remove_dev_pasid(device->dev, pasid, domain);
3352-
}
3354+
for_each_group_device(group, device)
3355+
iommu_remove_dev_pasid(device->dev, pasid, domain);
33533356
}
33543357

33553358
/*

0 commit comments

Comments
 (0)