mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
migration: extend VMStateInfo
Current migration code cannot handle some data structures such as QTAILQ in qemu/queue.h. Here we extend the signatures of put/get in VMStateInfo so that customized handling is supported. put now will return int type. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Jianjun Duan <duanj@linux.vnet.ibm.com> Message-Id: <1484852453-12728-2-git-send-email-duanj@linux.vnet.ibm.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
d7fc72ceb5
commit
2c21ee769e
22 changed files with 262 additions and 105 deletions
|
@ -587,12 +587,16 @@ void msix_unset_vector_notifiers(PCIDevice *dev)
|
|||
dev->msix_vector_poll_notifier = NULL;
|
||||
}
|
||||
|
||||
static void put_msix_state(QEMUFile *f, void *pv, size_t size)
|
||||
static int put_msix_state(QEMUFile *f, void *pv, size_t size,
|
||||
VMStateField *field, QJSON *vmdesc)
|
||||
{
|
||||
msix_save(pv, f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_msix_state(QEMUFile *f, void *pv, size_t size)
|
||||
static int get_msix_state(QEMUFile *f, void *pv, size_t size,
|
||||
VMStateField *field)
|
||||
{
|
||||
msix_load(pv, f);
|
||||
return 0;
|
||||
|
|
16
hw/pci/pci.c
16
hw/pci/pci.c
|
@ -445,7 +445,8 @@ int pci_bus_numa_node(PCIBus *bus)
|
|||
return PCI_BUS_GET_CLASS(bus)->numa_node(bus);
|
||||
}
|
||||
|
||||
static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
|
||||
static int get_pci_config_device(QEMUFile *f, void *pv, size_t size,
|
||||
VMStateField *field)
|
||||
{
|
||||
PCIDevice *s = container_of(pv, PCIDevice, config);
|
||||
PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(s);
|
||||
|
@ -484,11 +485,14 @@ static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
|
|||
}
|
||||
|
||||
/* just put buffer */
|
||||
static void put_pci_config_device(QEMUFile *f, void *pv, size_t size)
|
||||
static int put_pci_config_device(QEMUFile *f, void *pv, size_t size,
|
||||
VMStateField *field, QJSON *vmdesc)
|
||||
{
|
||||
const uint8_t **v = pv;
|
||||
assert(size == pci_config_size(container_of(pv, PCIDevice, config)));
|
||||
qemu_put_buffer(f, *v, size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static VMStateInfo vmstate_info_pci_config = {
|
||||
|
@ -497,7 +501,8 @@ static VMStateInfo vmstate_info_pci_config = {
|
|||
.put = put_pci_config_device,
|
||||
};
|
||||
|
||||
static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size)
|
||||
static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size,
|
||||
VMStateField *field)
|
||||
{
|
||||
PCIDevice *s = container_of(pv, PCIDevice, irq_state);
|
||||
uint32_t irq_state[PCI_NUM_PINS];
|
||||
|
@ -518,7 +523,8 @@ static int get_pci_irq_state(QEMUFile *f, void *pv, size_t size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void put_pci_irq_state(QEMUFile *f, void *pv, size_t size)
|
||||
static int put_pci_irq_state(QEMUFile *f, void *pv, size_t size,
|
||||
VMStateField *field, QJSON *vmdesc)
|
||||
{
|
||||
int i;
|
||||
PCIDevice *s = container_of(pv, PCIDevice, irq_state);
|
||||
|
@ -526,6 +532,8 @@ static void put_pci_irq_state(QEMUFile *f, void *pv, size_t size)
|
|||
for (i = 0; i < PCI_NUM_PINS; ++i) {
|
||||
qemu_put_be32(f, pci_irq_state(s, i));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static VMStateInfo vmstate_info_pci_irq_state = {
|
||||
|
|
|
@ -695,13 +695,16 @@ void shpc_cap_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
|
|||
shpc_cap_update_dword(d);
|
||||
}
|
||||
|
||||
static void shpc_save(QEMUFile *f, void *pv, size_t size)
|
||||
static int shpc_save(QEMUFile *f, void *pv, size_t size, VMStateField *field,
|
||||
QJSON *vmdesc)
|
||||
{
|
||||
PCIDevice *d = container_of(pv, PCIDevice, shpc);
|
||||
qemu_put_buffer(f, d->shpc->config, SHPC_SIZEOF(d));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int shpc_load(QEMUFile *f, void *pv, size_t size)
|
||||
static int shpc_load(QEMUFile *f, void *pv, size_t size, VMStateField *field)
|
||||
{
|
||||
PCIDevice *d = container_of(pv, PCIDevice, shpc);
|
||||
int ret = qemu_get_buffer(f, d->shpc->config, SHPC_SIZEOF(d));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue