>-----Original Message----- >From: Cédric Le Goater <c...@redhat.com> >Sent: Tuesday, November 7, 2023 9:53 PM >Subject: Re: [PATCH v4 32/41] vfio/pci: Introduce a vfio pci hot reset >interface > >On 11/2/23 08:12, 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. >> >> Suggested-by: Cédric Le Goater <c...@redhat.com> >> Signed-off-by: Zhenzhong Duan <zhenzhong.d...@intel.com> >> --- >> hw/vfio/pci.h | 1 + >> include/hw/vfio/vfio-container-base.h | 3 +++ >> hw/vfio/container.c | 2 ++ >> hw/vfio/pci.c | 11 ++++++++++- >> 4 files changed, 16 insertions(+), 1 deletion(-) >> >> diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h >> index 1006061afb..12cc765821 100644 >> --- a/hw/vfio/pci.h >> +++ b/hw/vfio/pci.h >> @@ -220,6 +220,7 @@ extern const PropertyInfo >qdev_prop_nv_gpudirect_clique; >> >> int vfio_pci_get_pci_hot_reset_info(VFIOPCIDevice *vdev, >> struct vfio_pci_hot_reset_info >> **info_p); >> +int vfio_legacy_pci_hot_reset(VFIODevice *vbasedev, bool single); >> >> int vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp); >> >> diff --git a/include/hw/vfio/vfio-container-base.h b/include/hw/vfio/vfio- >container-base.h >> index 4b6f017c6f..45bb19c767 100644 >> --- a/include/hw/vfio/vfio-container-base.h >> +++ b/include/hw/vfio/vfio-container-base.h >> @@ -106,6 +106,9 @@ struct VFIOIOMMUOps { >> int (*set_dirty_page_tracking)(VFIOContainerBase *bcontainer, bool >> start); >> int (*query_dirty_bitmap)(VFIOContainerBase *bcontainer, VFIOBitmap >*vbmap, >> hwaddr iova, hwaddr size); >> + /* PCI specific */ >> + int (*pci_hot_reset)(VFIODevice *vbasedev, bool single); >> + >> /* SPAPR specific */ >> int (*add_window)(VFIOContainerBase *bcontainer, >> MemoryRegionSection *section, >> diff --git a/hw/vfio/container.c b/hw/vfio/container.c >> index ed2d721b2b..f27cc15d09 100644 >> --- a/hw/vfio/container.c >> +++ b/hw/vfio/container.c >> @@ -33,6 +33,7 @@ >> #include "trace.h" >> #include "qapi/error.h" >> #include "migration/migration.h" >> +#include "pci.h" >> >> VFIOGroupList vfio_group_list = >> QLIST_HEAD_INITIALIZER(vfio_group_list); >> @@ -929,4 +930,5 @@ const VFIOIOMMUOps vfio_legacy_ops = { >> .detach_device = vfio_legacy_detach_device, >> .set_dirty_page_tracking = vfio_legacy_set_dirty_page_tracking, >> .query_dirty_bitmap = vfio_legacy_query_dirty_bitmap, >> + .pci_hot_reset = vfio_legacy_pci_hot_reset, >> }; >> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c >> index eb55e8ae88..a6194b7bfe 100644 >> --- a/hw/vfio/pci.c >> +++ b/hw/vfio/pci.c >> @@ -2483,8 +2483,9 @@ int vfio_pci_get_pci_hot_reset_info(VFIOPCIDevice >*vdev, >> return 0; >> } >> >> -static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool single) >> +int vfio_legacy_pci_hot_reset(VFIODevice *vbasedev, bool single) > >Could we move this routine to container .c ?
Good idea, will do. Thanks Zhenzhong