On Wed, Nov 21, 2018 at 02:09:40AM +0530, Kirti Wankhede wrote: > Save and restore with MSIX type is not tested. > > Signed-off-by: Kirti Wankhede <kwankh...@nvidia.com> > Reviewed-by: Neo Jia <c...@nvidia.com> > --- > hw/vfio/pci.c | 95 > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > hw/vfio/pci.h | 29 ++++++++++++++++++ > 2 files changed, 124 insertions(+) > > diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c > index 6cbb8fa0549d..72daf1a358a0 100644 > --- a/hw/vfio/pci.c > +++ b/hw/vfio/pci.c > @@ -1234,6 +1234,101 @@ void vfio_pci_write_config(PCIDevice *pdev, > } > } > > +void vfio_pci_save_config(VFIODevice *vbasedev, QEMUFile *f) > +{ > + VFIOPCIDevice *vdev = container_of(vbasedev, VFIOPCIDevice, vbasedev); > + PCIDevice *pdev = &vdev->pdev; > + int i; > + > + for (i = 0; i < PCI_ROM_SLOT; i++) { > + uint32_t bar; > + > + bar = pci_default_read_config(pdev, PCI_BASE_ADDRESS_0 + i * 4, 4); > + qemu_put_be32(f, bar);
Is it possible to avoid calling qemu_put_*() directly from vfio code? E.g., using VMStateDescription and hooks like pre_save, post_load and etc. Then we update all the data into the data structure and leave all the rest of IO operations to general migration framework. Regards, -- Peter Xu