Message ID | 20241104132033.14027-3-yi.l.liu@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Support attaching PASID to the blocked_domain | expand |
On Mon, Nov 04, 2024 at 05:20:28AM -0800, Yi Liu wrote: > 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. > > Signed-off-by: Yi Liu <yi.l.liu@intel.com> > --- > drivers/iommu/iommu.c | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Jason
On 11/4/2024 6:50 PM, Yi Liu wrote: > 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. > > Signed-off-by: Yi Liu <yi.l.liu@intel.com> Reviewed-by: Vasant Hegde <vasant.hegde@amd.com> > --- > drivers/iommu/iommu.c | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 866559bbc4e4..21320578d801 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -3400,6 +3400,14 @@ bool iommu_group_dma_owner_claimed(struct iommu_group *group) > } > EXPORT_SYMBOL_GPL(iommu_group_dma_owner_claimed); > > +static void iommu_remove_dev_pasid(struct device *dev, ioasid_t pasid, > + struct iommu_domain *domain) > +{ > + const struct iommu_ops *ops = dev_iommu_ops(dev); > + > + ops->remove_dev_pasid(dev, pasid, domain); > +} > + > static int __iommu_set_group_pasid(struct iommu_domain *domain, > struct iommu_group *group, ioasid_t pasid) > { > @@ -3418,11 +3426,9 @@ static int __iommu_set_group_pasid(struct iommu_domain *domain, > err_revert: > last_gdev = device; > for_each_group_device(group, device) { > - const struct iommu_ops *ops = dev_iommu_ops(device->dev); > - > if (device == last_gdev) > break; > - ops->remove_dev_pasid(device->dev, pasid, domain); > + iommu_remove_dev_pasid(device->dev, pasid, domain); > } > return ret; > } > @@ -3432,11 +3438,9 @@ static void __iommu_remove_group_pasid(struct iommu_group *group, > struct iommu_domain *domain) > { > struct group_device *device; > - const struct iommu_ops *ops; > > for_each_group_device(group, device) { > - ops = dev_iommu_ops(device->dev); > - ops->remove_dev_pasid(device->dev, pasid, domain); > + iommu_remove_dev_pasid(device->dev, pasid, domain); > } Now its single statement inside loop. We don't need braces. -Vasant
> From: Liu, Yi L <yi.l.liu@intel.com> > Sent: Monday, November 4, 2024 9:20 PM > > 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. > > Signed-off-by: Yi Liu <yi.l.liu@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 866559bbc4e4..21320578d801 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -3400,6 +3400,14 @@ bool iommu_group_dma_owner_claimed(struct iommu_group *group) } EXPORT_SYMBOL_GPL(iommu_group_dma_owner_claimed); +static void iommu_remove_dev_pasid(struct device *dev, ioasid_t pasid, + struct iommu_domain *domain) +{ + const struct iommu_ops *ops = dev_iommu_ops(dev); + + ops->remove_dev_pasid(dev, pasid, domain); +} + static int __iommu_set_group_pasid(struct iommu_domain *domain, struct iommu_group *group, ioasid_t pasid) { @@ -3418,11 +3426,9 @@ static int __iommu_set_group_pasid(struct iommu_domain *domain, err_revert: last_gdev = device; for_each_group_device(group, device) { - const struct iommu_ops *ops = dev_iommu_ops(device->dev); - if (device == last_gdev) break; - ops->remove_dev_pasid(device->dev, pasid, domain); + iommu_remove_dev_pasid(device->dev, pasid, domain); } return ret; } @@ -3432,11 +3438,9 @@ static void __iommu_remove_group_pasid(struct iommu_group *group, struct iommu_domain *domain) { struct group_device *device; - const struct iommu_ops *ops; for_each_group_device(group, device) { - ops = dev_iommu_ops(device->dev); - ops->remove_dev_pasid(device->dev, pasid, domain); + iommu_remove_dev_pasid(device->dev, pasid, domain); } }
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. Signed-off-by: Yi Liu <yi.l.liu@intel.com> --- drivers/iommu/iommu.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)