Re: [Intel-gfx] [PATCH v7 7/9] vfio: Add helper to search vfio_device in a dev_set

Jason Gunthorpe
2023-06-13T11:47:56Z

On Fri, Jun 02, 2023 at 05:15:13AM -0700, Yi Liu wrote:
> There are drivers that need to search vfio_device within a given dev_set.
> e.g. vfio-pci. So add a helper.
>
> vfio_pci_is_device_in_set() now returns -EBUSY in commit a882c16a2b7e
> ("vfio/pci: Change vfio_pci_try_bus_reset() to use the dev_set") where
> it was trying to preserve the return of vfio_pci_try_zap_and_vma_lock_cb().
> However, it makes more sense to return -ENODEV.
>
> Suggested-by: Alex Williamson <alex.williamson@redhat.com>
> Tested-by: Terrence Xu <terrence.xu@intel.com>
> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
> ---
> drivers/vfio/pci/vfio_pci_core.c | 6 +-----
> drivers/vfio/vfio_main.c | 15 +++++++++++++++
> include/linux/vfio.h | 3 +++
> 3 files changed, 19 insertions(+), 5 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason