> From: Jason Gunthorpe <jgg@xxxxxxxxxx> > Sent: Tuesday, November 5, 2024 11:42 PM > > On Mon, Nov 04, 2024 at 05:20:27AM -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. > > > > Signed-off-by: Yi Liu <yi.l.liu@xxxxxxxxx> > > --- > > drivers/iommu/iommu.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > I was wondering if we really needed this, but it does make the patches > a bit easier to understand > > Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > me too. btw when Vasant's series introduces the PASID flag to domain above checks can be moved to the domain alloc time then here just needs to check whether the domain allows pasid attach. for now, Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> and a nit - there is another reference to dev_iommu_ops in this function: if (!dev_has_iommu(dev) || dev_iommu_ops(dev) != domain->owner || could be replaced with ops too.