Hi Zhenzhong,

On 21/11/23 09:44, Zhenzhong Duan wrote:
Legacy vfio pci and iommufd cdev have different process to hot reset
vfio device, expand current code to abstract out pci_hot_reset callback
for legacy vfio, this same interface will also be used by iommufd
cdev vfio device.

Rename vfio_pci_hot_reset to vfio_legacy_pci_hot_reset and move it
into container.c.

vfio_pci_[pre/post]_reset and vfio_pci_host_match are exported so
they could be called in legacy and iommufd pci_hot_reset callback.

Suggested-by: Cédric Le Goater <c...@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.d...@intel.com>
Reviewed-by: Eric Auger <eric.au...@redhat.com>
Tested-by: Eric Auger <eric.au...@redhat.com>
---
  hw/vfio/pci.h                         |   3 +
  include/hw/vfio/vfio-container-base.h |   3 +
  hw/vfio/container.c                   | 170 ++++++++++++++++++++++++++
  hw/vfio/pci.c                         | 168 +------------------------
  4 files changed, 182 insertions(+), 162 deletions(-)


@@ -2485,166 +2485,10 @@ int vfio_pci_get_pci_hot_reset_info(VFIOPCIDevice 
*vdev,
static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool single)
  {

+    return ops->pci_hot_reset(vbasedev, single);

At this point vfio_iommufd_ops.pci_hot_reset is NULL.
Worth checking for non-NULL before calling.

  }
/*


Reply via email to