vfio: Add VM state change handler to know state of VM

VM state change handler is called on change in VM's state. Based on
VM state, VFIO device state should be changed.
Added read/write helper functions for migration region.
Added function to set device_state.

Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
Reviewed-by: Neo Jia <cjia@nvidia.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
[aw: lx -> HWADDR_PRIx, remove redundant parens]
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
Kirti Wankhede 2020-10-26 15:06:15 +05:30 committed by Alex Williamson
parent a9e271ec9b
commit 02a7e71b1e
3 changed files with 166 additions and 0 deletions

View file

@ -29,6 +29,7 @@
#ifdef CONFIG_LINUX
#include <linux/vfio.h>
#endif
#include "sysemu/sysemu.h"
#define VFIO_MSG_PREFIX "vfio %s: "
@ -58,7 +59,10 @@ typedef struct VFIORegion {
} VFIORegion;
typedef struct VFIOMigration {
VMChangeStateEntry *vm_state;
VFIORegion region;
uint32_t device_state;
int vm_running;
} VFIOMigration;
typedef struct VFIOAddressSpace {