qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/5] Add save and load functions for VFIO PCI de


From: Peter Xu
Subject: Re: [Qemu-devel] [PATCH 2/5] Add save and load functions for VFIO PCI devices
Date: Wed, 21 Nov 2018 13:32:05 +0800
User-agent: Mutt/1.10.1 (2018-07-13)

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 <address@hidden>
> Reviewed-by: Neo Jia <address@hidden>
> ---
>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]