Now that the save state handler can return error, this is redundant. Update the only user to return error from their save handler.
Signed-off-by: Alex Williamson <alex.william...@redhat.com> --- hw/hw.h | 2 -- hw/ivshmem.c | 9 +++++---- savevm.c | 31 ------------------------------- 3 files changed, 5 insertions(+), 37 deletions(-) diff --git a/hw/hw.h b/hw/hw.h index b6f1236..5209ed9 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -264,8 +264,6 @@ int register_savevm_live(DeviceState *dev, void *opaque); void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque); -void register_device_unmigratable(DeviceState *dev, const char *idstr, - void *opaque); typedef void QEMUResetHandler(void *opaque); diff --git a/hw/ivshmem.c b/hw/ivshmem.c index 0919c4e..f0cfed5 100644 --- a/hw/ivshmem.c +++ b/hw/ivshmem.c @@ -621,6 +621,11 @@ static int ivshmem_save(QEMUFile* f, void *opaque) IVShmemState *proxy = opaque; IVSHMEM_DPRINTF("ivshmem_save\n"); + + if (proxy->role_val == IVSHMEM_PEER) { + return -EINVAL; + } + pci_device_save(&proxy->dev, f); if (ivshmem_has_feature(proxy, IVSHMEM_MSI)) { @@ -702,10 +707,6 @@ static int pci_ivshmem_init(PCIDevice *dev) s->role_val = IVSHMEM_MASTER; /* default */ } - if (s->role_val == IVSHMEM_PEER) { - register_device_unmigratable(&s->dev.qdev, "ivshmem", s); - } - pci_conf = s->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REDHAT_QUMRANET); pci_conf[0x02] = 0x10; diff --git a/savevm.c b/savevm.c index f8a7819..7ca27f6 100644 --- a/savevm.c +++ b/savevm.c @@ -1018,7 +1018,6 @@ typedef struct SaveStateEntry { const VMStateDescription *vmsd; void *opaque; CompatEntry *compat; - int no_migrate; } SaveStateEntry; @@ -1082,7 +1081,6 @@ int register_savevm_live(DeviceState *dev, se->load_state = load_state; se->opaque = opaque; se->vmsd = NULL; - se->no_migrate = 0; if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) { char *id = dev->parent_bus->info->get_dev_path(dev); @@ -1149,31 +1147,6 @@ void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque) } } -/* mark a device as not to be migrated, that is the device should be - unplugged before migration */ -void register_device_unmigratable(DeviceState *dev, const char *idstr, - void *opaque) -{ - SaveStateEntry *se; - char id[256] = ""; - - if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) { - char *path = dev->parent_bus->info->get_dev_path(dev); - if (path) { - pstrcpy(id, sizeof(id), path); - pstrcat(id, sizeof(id), "/"); - qemu_free(path); - } - } - pstrcat(id, sizeof(id), idstr); - - QTAILQ_FOREACH(se, &savevm_handlers, entry) { - if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) { - se->no_migrate = 1; - } - } -} - int vmstate_register_with_alias_id(DeviceState *dev, int instance_id, const VMStateDescription *vmsd, void *opaque, int alias_id, @@ -1382,10 +1355,6 @@ static int vmstate_load(QEMUFile *f, SaveStateEntry *se, int version_id) static int vmstate_save(QEMUFile *f, SaveStateEntry *se) { - if (se->no_migrate) { - return -1; - } - if (!se->vmsd) { /* Old style */ return se->save_state(f, se->opaque); }