Re: [PATCH v3 0/7] Make the rest of the VFIO driver interface use vfio_device

Jason Gunthorpe
2022-05-04T18:21:31Z

On Mon, May 02, 2022 at 02:31:30PM -0300, Jason Gunthorpe wrote:
> Prior series have transformed other parts of VFIO from working on struct
> device or struct vfio_group into working directly on struct
> vfio_device. Based on that work we now have vfio_device's readily
> available in all the drivers.
>
> Update the rest of the driver facing API to use vfio_device as an input.
>
> The following are switched from struct device to struct vfio_device:
> vfio_register_notifier()
> vfio_unregister_notifier()
> vfio_pin_pages()
> vfio_unpin_pages()
> vfio_dma_rw()
>
> The following group APIs are obsoleted and removed by just using struct
> vfio_device with the above:
> vfio_group_pin_pages()
> vfio_group_unpin_pages()
> vfio_group_iommu_domain()
> vfio_group_get_external_user_from_dev()
>
> To retain the performance of the new device APIs relative to their group
> versions optimize how vfio_group_add_container_user() is used to avoid
> calling it when the driver must already guarantee the device is open and
> the container_users incrd.
>
> The remaining exported VFIO group interfaces are only used by kvm, and are
> addressed by a parallel series.
>
> This series is based on Christoph's gvt rework here:
>
> https://lore.kernel.org/all/5a8b9f48-2c32-8177-1c18-e3bd7bfde558@intel.com/
>
> and so will need the PR merged first.
>
> I have a followup series that needs this.
>
> This is also part of the iommufd work - moving the driver facing interface
> to vfio_device provides a much cleaner path to integrate with iommufd.
>
> v3:
> - Based on VFIO's gvt/iommu merge
> - Remove mention of mdev_legacy_get_vfio_device() from commit message
> - Clarify commit message for vfio_dma_rw() conversion
> - Talk about the open_count change in the commit message
> - No code change
> v2: https://lore.kernel.org/r/0-v2-6011bde8e0a1+5f-vfio_mdev_no_group_jgg@nvidia.com
> - Based on Christoph's series so mdev_legacy_get_vfio_device() is removed
> - Reflow indenting
> - Use vfio_assert_device_open() and WARN_ON_ONCE instead of open coding
> the assertion
> v1: https://lore.kernel.org/r/0-v1-a8faf768d202+125dd-vfio_mdev_no_group_jgg@nvidia.com

Hi Alex,

This v3 is still good to go, it applies clean on top of the gvt series.

Thanks,
Jason