On Wed, Nov 13, 2024 at 05:46:07AM -0800, Yi Liu wrote: > driver should implement both set_dev_pasid and remove_dev_pasid op, otherwise > it is a problem how to detach pasid. In reality, it is impossible that an > iommu driver implements set_dev_pasid() but no remove_dev_pasid() op. However, > it is better to check it. > > Move the group check to be the first as dev_iommu_ops() may fail when there > is no valid group. Also take the chance to remove the dev_has_iommu() check > as it is duplicated to the group check. > > Signed-off-by: Yi Liu <yi.l.liu@xxxxxxxxx> > --- > drivers/iommu/iommu.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Jason