> From: Jason Gunthorpe <jgg@xxxxxxxxxx> > Sent: Tuesday, February 7, 2023 9:13 PM > > On Tue, Feb 07, 2023 at 12:35:48AM +0000, Tian, Kevin wrote: > > > From: Liu, Yi L <yi.l.liu@xxxxxxxxx> > > > Sent: Monday, February 6, 2023 11:51 PM > > > > > > > From: Jason Gunthorpe <jgg@xxxxxxxxxx> > > > > Sent: Monday, February 6, 2023 11:11 PM > > > > > > > > On Mon, Feb 06, 2023 at 10:09:52AM +0000, Tian, Kevin wrote: > > > > > It's probably simpler if we always mark DMA owner with vfio_group > > > > > for the group path, no matter vfio type1 or iommufd compat is used. > > > > > This should avoid all the tricky corner cases between the two paths. > > > > > > > > Yes > > > > > > Then, we have two choices: > > > > > > 1) extend iommufd_device_bind() to allow a caller-specified DMA > marker > > > 2) claim DMA owner before calling iommufd_device_bind(), still need to > > > extend iommufd_device_bind() to accept a flag to bypass DMA > owner > > > claim > > > > > > which one would be better? or do we have a third choice? > > > > > > > first one > > Why can't this all be handled in vfio?? Are you preferring the second one? Surely VFIO can claim DMA owner by itself. But it is the vfio iommufd compat mode, so it still needs to call iommufd_device_bind(). And it should bypass DMA owner claim since it's already done. Regards, Yi Liu