Re: [PATCH v8 08/10] vfio/pci: Extend VFIO_DEVICE_GET_PCI_HOT_RESET_INFO for vfio device cdev

Jason Gunthorpe
2023-06-22T15:22:19Z

On Fri, Jun 16, 2023 at 02:30:40AM -0700, Yi Liu wrote:
> This allows VFIO_DEVICE_GET_PCI_HOT_RESET_INFO ioctl use the iommufd_ctx
> of the cdev device to check the ownership of the other affected devices.
>
> When VFIO_DEVICE_GET_PCI_HOT_RESET_INFO is called on an IOMMUFD managed
> device, the new flag VFIO_PCI_HOT_RESET_FLAG_DEV_ID is reported to indicate
> the values returned are IOMMUFD devids rather than group IDs as used when
> accessing vfio devices through the conventional vfio group interface.
> Additionally the flag VFIO_PCI_HOT_RESET_FLAG_DEV_ID_OWNED will be reported
> in this mode if all of the devices affected by the hot-reset are owned by
> either virtue of being directly bound to the same iommufd context as the
> calling device, or implicitly owned via a shared IOMMU group.
>
> Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
> Suggested-by: Alex Williamson <alex.williamson@redhat.com>
> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
> ---
> drivers/vfio/iommufd.c | 44 ++++++++++++++++++++++++++
> drivers/vfio/pci/vfio_pci_core.c | 54 +++++++++++++++++++++++++++-----
> include/linux/vfio.h | 14 +++++++++
> include/uapi/linux/vfio.h | 50 ++++++++++++++++++++++++++++-
> 4 files changed, 154 insertions(+), 8 deletions(-)

I would have put patch 9 before this one, but it is OK this way too

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

Jason