Re: [PATCH v6 19/24] vfio-iommufd: Add detach_ioas support for emulated VFIO devices

Nicolin Chen
2023-03-15T06:25:44Z

On Wed, Mar 15, 2023 at 06:15:02AM +0000, Liu, Yi L wrote:

> > > +void vfio_iommufd_emulated_detach_ioas(struct vfio_device *vdev)
> > > +{
> > > + lockdep_assert_held(&vdev->dev_set->lock);
> > > +
> > > + if (WARN_ON(!vdev->iommufd_access))
> > > + return;
> > > +
> > [...]
> > > + iommufd_access_destroy(vdev->iommufd_access);
> > > + vdev->iommufd_access = NULL;
> >
> > After moving access allocation/destroy to bind/unbind, here it
> > should be:
> > iommufd_access_set_ioas(vdev->iommufd_access, 0);
>
> You are right.

Yet...iommufd_access_set_ioas is getting reworked with my patch:
In another thread, Jason suggested to have iommufd_acces_detach
API, and I am trying to finalize it with Jason/Kevin.
https://lore.kernel.org/kvm/BN9PR11MB5276738DC59AC1B4A66AB3C38CBF9@BN9PR11MB5276.namprd11.prod.outlook.com/

Nic