Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20…
Browse files Browse the repository at this point in the history
…170927a' into staging

Migration pull 2017-09-27

# gpg: Signature made Wed 27 Sep 2017 14:56:23 BST
# gpg:                using RSA key 0x0516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-migration-20170927a:
  migration: Route more error paths
  migration: Route errors up through vmstate_save
  migration: wire vmstate_save_state errors up to vmstate_subsection_save
  migration: Check field save returns
  migration: check pre_save return in vmstate_save_state
  migration: pre_save return int
  migration: disable auto-converge during bulk block migration

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Sep 27, 2017
2 parents 1d89344 + 2f168d0 commit ab16152
Show file tree
Hide file tree
Showing 68 changed files with 288 additions and 105 deletions.
2 changes: 1 addition & 1 deletion docs/devel/migration.txt
Expand Up @@ -202,7 +202,7 @@ The functions to do that are inside a vmstate definition, and are called:

This function is called after we load the state of one device.

- void (*pre_save)(void *opaque);
- int (*pre_save)(void *opaque);

This function is called before we save the state of one device.

Expand Down
4 changes: 3 additions & 1 deletion hw/arm/pxa2xx.c
Expand Up @@ -1143,13 +1143,15 @@ static void pxa2xx_rtc_init(Object *obj)
sysbus_init_mmio(dev, &s->iomem);
}

static void pxa2xx_rtc_pre_save(void *opaque)
static int pxa2xx_rtc_pre_save(void *opaque)
{
PXA2xxRTCState *s = (PXA2xxRTCState *) opaque;

pxa2xx_rtc_hzupdate(s);
pxa2xx_rtc_piupdate(s);
pxa2xx_rtc_swupdate(s);

return 0;
}

static int pxa2xx_rtc_post_load(void *opaque, int version_id)
Expand Down
4 changes: 3 additions & 1 deletion hw/arm/strongarm.c
Expand Up @@ -406,11 +406,13 @@ static void strongarm_rtc_init(Object *obj)
sysbus_init_mmio(dev, &s->iomem);
}

static void strongarm_rtc_pre_save(void *opaque)
static int strongarm_rtc_pre_save(void *opaque)
{
StrongARMRTCState *s = opaque;

strongarm_rtc_hzupdate(s);

return 0;
}

static int strongarm_rtc_post_load(void *opaque, int version_id)
Expand Down
4 changes: 3 additions & 1 deletion hw/audio/wm8750.c
Expand Up @@ -567,11 +567,13 @@ static int wm8750_rx(I2CSlave *i2c)
return 0x00;
}

static void wm8750_pre_save(void *opaque)
static int wm8750_pre_save(void *opaque)
{
WM8750State *s = opaque;

s->rate_vmstate = s->rate - wm_rate_table;

return 0;
}

static int wm8750_post_load(void *opaque, int version_id)
Expand Down
4 changes: 3 additions & 1 deletion hw/block/fdc.c
Expand Up @@ -1101,11 +1101,13 @@ static int reconstruct_phase(FDCtrl *fdctrl)
}
}

static void fdc_pre_save(void *opaque)
static int fdc_pre_save(void *opaque)
{
FDCtrl *s = opaque;

s->dor_vmstate = s->dor | GET_CUR_DRV(s);

return 0;
}

static int fdc_pre_load(void *opaque)
Expand Down
4 changes: 3 additions & 1 deletion hw/block/m25p80.c
Expand Up @@ -1251,9 +1251,11 @@ static void m25p80_reset(DeviceState *d)
reset_memory(s);
}

static void m25p80_pre_save(void *opaque)
static int m25p80_pre_save(void *opaque)
{
flash_sync_dirty((Flash *)opaque, -1);

return 0;
}

static Property m25p80_properties[] = {
Expand Down
4 changes: 3 additions & 1 deletion hw/block/nand.c
Expand Up @@ -325,11 +325,13 @@ static void nand_command(NANDFlashState *s)
}
}

static void nand_pre_save(void *opaque)
static int nand_pre_save(void *opaque)
{
NANDFlashState *s = NAND(opaque);

s->ioaddr_vmstate = s->ioaddr - s->io;

return 0;
}

static int nand_post_load(void *opaque, int version_id)
Expand Down
4 changes: 3 additions & 1 deletion hw/block/onenand.c
Expand Up @@ -137,7 +137,7 @@ static void onenand_intr_update(OneNANDState *s)
qemu_set_irq(s->intr, ((s->intstatus >> 15) ^ (~s->config[0] >> 6)) & 1);
}

static void onenand_pre_save(void *opaque)
static int onenand_pre_save(void *opaque)
{
OneNANDState *s = opaque;
if (s->current == s->otp) {
Expand All @@ -147,6 +147,8 @@ static void onenand_pre_save(void *opaque)
} else {
s->current_direction = 0;
}

return 0;
}

static int onenand_post_load(void *opaque, int version_id)
Expand Down
4 changes: 3 additions & 1 deletion hw/char/serial.c
Expand Up @@ -630,10 +630,12 @@ static void serial_event(void *opaque, int event)
serial_receive_break(s);
}

static void serial_pre_save(void *opaque)
static int serial_pre_save(void *opaque)
{
SerialState *s = opaque;
s->fcr_vmstate = s->fcr;

return 0;
}

static int serial_pre_load(void *opaque)
Expand Down
4 changes: 3 additions & 1 deletion hw/display/qxl.c
Expand Up @@ -2204,7 +2204,7 @@ static void qxl_realize_secondary(PCIDevice *dev, Error **errp)
qxl_realize_common(qxl, errp);
}

static void qxl_pre_save(void *opaque)
static int qxl_pre_save(void *opaque)
{
PCIQXLDevice* d = opaque;
uint8_t *ram_start = d->vga.vram_ptr;
Expand All @@ -2216,6 +2216,8 @@ static void qxl_pre_save(void *opaque)
d->last_release_offset = (uint8_t *)d->last_release - ram_start;
}
assert(d->last_release_offset < d->vga.vram_size);

return 0;
}

static int qxl_pre_load(void *opaque)
Expand Down
4 changes: 1 addition & 3 deletions hw/display/virtio-gpu.c
Expand Up @@ -1050,9 +1050,7 @@ static int virtio_gpu_save(QEMUFile *f, void *opaque, size_t size,
}
qemu_put_be32(f, 0); /* end of list */

vmstate_save_state(f, &vmstate_virtio_gpu_scanouts, g, NULL);

return 0;
return vmstate_save_state(f, &vmstate_virtio_gpu_scanouts, g, NULL);
}

static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,
Expand Down
4 changes: 3 additions & 1 deletion hw/i2c/core.c
Expand Up @@ -41,7 +41,7 @@ static const TypeInfo i2c_bus_info = {
.instance_size = sizeof(I2CBus),
};

static void i2c_bus_pre_save(void *opaque)
static int i2c_bus_pre_save(void *opaque)
{
I2CBus *bus = opaque;

Expand All @@ -53,6 +53,8 @@ static void i2c_bus_pre_save(void *opaque)
bus->saved_address = I2C_BROADCAST;
}
}

return 0;
}

static const VMStateDescription vmstate_i2c_bus = {
Expand Down
4 changes: 3 additions & 1 deletion hw/i386/kvm/clock.c
Expand Up @@ -254,11 +254,13 @@ static const VMStateDescription kvmclock_reliable_get_clock = {
* final pages of memory (which happens between vm_stop()
* and pre_save()) takes max_downtime.
*/
static void kvmclock_pre_save(void *opaque)
static int kvmclock_pre_save(void *opaque)
{
KVMClockState *s = opaque;

kvm_update_clock(s);

return 0;
}

static const VMStateDescription kvmclock_vmsd = {
Expand Down
4 changes: 3 additions & 1 deletion hw/ide/core.c
Expand Up @@ -2752,7 +2752,7 @@ static int ide_drive_pio_post_load(void *opaque, int version_id)
return 0;
}

static void ide_drive_pio_pre_save(void *opaque)
static int ide_drive_pio_pre_save(void *opaque)
{
IDEState *s = opaque;
int idx;
Expand All @@ -2768,6 +2768,8 @@ static void ide_drive_pio_pre_save(void *opaque)
} else {
s->end_transfer_fn_idx = idx;
}

return 0;
}

static bool ide_drive_pio_state_needed(void *opaque)
Expand Down
4 changes: 3 additions & 1 deletion hw/ide/pci.c
Expand Up @@ -296,7 +296,7 @@ static bool ide_bmdma_status_needed(void *opaque)
return ((bm->status & abused_bits) != 0);
}

static void ide_bmdma_pre_save(void *opaque)
static int ide_bmdma_pre_save(void *opaque)
{
BMDMAState *bm = opaque;
uint8_t abused_bits = BM_MIGRATION_COMPAT_STATUS_BITS;
Expand All @@ -310,6 +310,8 @@ static void ide_bmdma_pre_save(void *opaque)
bm->migration_retry_nsector = bm->bus->retry_nsector;
bm->migration_compat_status =
(bm->status & ~abused_bits) | (bm->bus->error_status & abused_bits);

return 0;
}

/* This function accesses bm->bus->error_status which is loaded only after
Expand Down
8 changes: 6 additions & 2 deletions hw/input/ps2.c
Expand Up @@ -1216,12 +1216,14 @@ static int ps2_kbd_post_load(void* opaque, int version_id)
return 0;
}

static void ps2_kbd_pre_save(void *opaque)
static int ps2_kbd_pre_save(void *opaque)
{
PS2KbdState *s = (PS2KbdState *)opaque;
PS2State *ps2 = &s->common;

ps2_common_post_load(ps2);

return 0;
}

static const VMStateDescription vmstate_ps2_keyboard = {
Expand Down Expand Up @@ -1254,12 +1256,14 @@ static int ps2_mouse_post_load(void *opaque, int version_id)
return 0;
}

static void ps2_mouse_pre_save(void *opaque)
static int ps2_mouse_pre_save(void *opaque)
{
PS2MouseState *s = (PS2MouseState *)opaque;
PS2State *ps2 = &s->common;

ps2_common_post_load(ps2);

return 0;
}

static const VMStateDescription vmstate_ps2_mouse = {
Expand Down
4 changes: 3 additions & 1 deletion hw/input/tsc210x.c
Expand Up @@ -976,10 +976,12 @@ static void tsc210x_i2s_set_rate(TSC210xState *s, int in, int out)
s->i2s_rx_rate = in;
}

static void tsc210x_pre_save(void *opaque)
static int tsc210x_pre_save(void *opaque)
{
TSC210xState *s = (TSC210xState *) opaque;
s->now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);

return 0;
}

static int tsc210x_post_load(void *opaque, int version_id)
Expand Down
4 changes: 3 additions & 1 deletion hw/intc/apic_common.c
Expand Up @@ -360,14 +360,16 @@ static int apic_pre_load(void *opaque)
return 0;
}

static void apic_dispatch_pre_save(void *opaque)
static int apic_dispatch_pre_save(void *opaque)
{
APICCommonState *s = APIC_COMMON(opaque);
APICCommonClass *info = APIC_COMMON_GET_CLASS(s);

if (info->pre_save) {
info->pre_save(s);
}

return 0;
}

static int apic_dispatch_post_load(void *opaque, int version_id)
Expand Down
4 changes: 3 additions & 1 deletion hw/intc/arm_gic_common.c
Expand Up @@ -23,14 +23,16 @@
#include "gic_internal.h"
#include "hw/arm/linux-boot-if.h"

static void gic_pre_save(void *opaque)
static int gic_pre_save(void *opaque)
{
GICState *s = (GICState *)opaque;
ARMGICCommonClass *c = ARM_GIC_COMMON_GET_CLASS(s);

if (c->pre_save) {
c->pre_save(s);
}

return 0;
}

static int gic_post_load(void *opaque, int version_id)
Expand Down
4 changes: 3 additions & 1 deletion hw/intc/arm_gicv3_common.c
Expand Up @@ -28,14 +28,16 @@
#include "gicv3_internal.h"
#include "hw/arm/linux-boot-if.h"

static void gicv3_pre_save(void *opaque)
static int gicv3_pre_save(void *opaque)
{
GICv3State *s = (GICv3State *)opaque;
ARMGICv3CommonClass *c = ARM_GICV3_COMMON_GET_CLASS(s);

if (c->pre_save) {
c->pre_save(s);
}

return 0;
}

static int gicv3_post_load(void *opaque, int version_id)
Expand Down
4 changes: 3 additions & 1 deletion hw/intc/arm_gicv3_its_common.c
Expand Up @@ -23,14 +23,16 @@
#include "hw/intc/arm_gicv3_its_common.h"
#include "qemu/log.h"

static void gicv3_its_pre_save(void *opaque)
static int gicv3_its_pre_save(void *opaque)
{
GICv3ITSState *s = (GICv3ITSState *)opaque;
GICv3ITSCommonClass *c = ARM_GICV3_ITS_COMMON_GET_CLASS(s);

if (c->pre_save) {
c->pre_save(s);
}

return 0;
}

static int gicv3_its_post_load(void *opaque, int version_id)
Expand Down
4 changes: 3 additions & 1 deletion hw/intc/i8259_common.c
Expand Up @@ -46,14 +46,16 @@ void pic_reset_common(PICCommonState *s)
/* Note: ELCR is not reset */
}

static void pic_dispatch_pre_save(void *opaque)
static int pic_dispatch_pre_save(void *opaque)
{
PICCommonState *s = opaque;
PICCommonClass *info = PIC_COMMON_GET_CLASS(s);

if (info->pre_save) {
info->pre_save(s);
}

return 0;
}

static int pic_dispatch_post_load(void *opaque, int version_id)
Expand Down
4 changes: 3 additions & 1 deletion hw/intc/ioapic_common.c
Expand Up @@ -102,14 +102,16 @@ void ioapic_reset_common(DeviceState *dev)
}
}

static void ioapic_dispatch_pre_save(void *opaque)
static int ioapic_dispatch_pre_save(void *opaque)
{
IOAPICCommonState *s = IOAPIC_COMMON(opaque);
IOAPICCommonClass *info = IOAPIC_COMMON_GET_CLASS(s);

if (info->pre_save) {
info->pre_save(s);
}

return 0;
}

static int ioapic_dispatch_post_load(void *opaque, int version_id)
Expand Down

0 comments on commit ab16152

Please sign in to comment.