On Wed, Mar 27, 2024 at 05:54:33AM -0700, Yi Liu wrote: > There is no error handling now in __iommu_set_group_pasid(), it relies on > its caller to loop all the devices to undo the pasid attachment. This is > not self-contained and has unnecessary remove_dev_pasid() calls on the > devices that have not changed in the __iommu_set_group_pasid() call. this > results in unnecessary warnings by the underlying iommu drivers. Like the > Intel iommu driver, it would warn when there is no pasid attachment to > destroy in the remove_dev_pasid() callback. > > The ideal way is to handle the error within __iommu_set_group_pasid(). This > not only makes __iommu_set_group_pasid() self-contained, but also avoids > unnecessary warnings. > > Fixes: 16603704559c7a68 ("iommu: Add attach/detach_dev_pasid iommu interfaces") > Suggested-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > Signed-off-by: Yi Liu <yi.l.liu@xxxxxxxxx> > --- > drivers/iommu/iommu.c | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> This will need revising when we get to PASID replace, but good enough for now Thanks, Jason