From e720677e32e70b1f60637ebbcf2ffb23a4607f3e Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 8 Jan 2015 10:18:59 +0100 Subject: [PATCH] vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* Old users of VMSTATE_TIMER* are mechanically changed to VMSTATE_TIMER_PTR variants. Signed-off-by: Paolo Bonzini --- hw/acpi/ich9.c | 2 +- hw/acpi/piix4.c | 2 +- hw/arm/stellaris.c | 2 +- hw/block/fdc.c | 2 +- hw/char/cadence_uart.c | 2 +- hw/char/serial.c | 4 ++-- hw/core/ptimer.c | 2 +- hw/dma/pl330.c | 2 +- hw/input/lm832x.c | 2 +- hw/intc/armv7m_nvic.c | 2 +- hw/isa/vt82c686.c | 2 +- hw/misc/macio/cuda.c | 2 +- hw/net/pcnet.c | 2 +- hw/sd/sdhci.c | 4 ++-- hw/timer/a9gtimer.c | 2 +- hw/timer/arm_mptimer.c | 2 +- hw/timer/hpet.c | 2 +- hw/timer/mc146818rtc.c | 4 ++-- hw/usb/hcd-ehci.c | 2 +- hw/usb/hcd-ohci.c | 2 +- hw/usb/hcd-uhci.c | 2 +- hw/usb/hcd-xhci.c | 2 +- hw/usb/redirect.c | 2 +- hw/watchdog/wdt_i6300esb.c | 2 +- hw/watchdog/wdt_ib700.c | 2 +- include/migration/vmstate.h | 18 +++++++++++++++--- target-arm/machine.c | 4 ++-- 27 files changed, 45 insertions(+), 33 deletions(-) diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index ea991a3c65..43869d7980 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -166,7 +166,7 @@ const VMStateDescription vmstate_ich9_pm = { VMSTATE_UINT16(acpi_regs.pm1.evt.sts, ICH9LPCPMRegs), VMSTATE_UINT16(acpi_regs.pm1.evt.en, ICH9LPCPMRegs), VMSTATE_UINT16(acpi_regs.pm1.cnt.cnt, ICH9LPCPMRegs), - VMSTATE_TIMER(acpi_regs.tmr.timer, ICH9LPCPMRegs), + VMSTATE_TIMER_PTR(acpi_regs.tmr.timer, ICH9LPCPMRegs), VMSTATE_INT64(acpi_regs.tmr.overflow_time, ICH9LPCPMRegs), VMSTATE_GPE_ARRAY(acpi_regs.gpe.sts, ICH9LPCPMRegs), VMSTATE_GPE_ARRAY(acpi_regs.gpe.en, ICH9LPCPMRegs), diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 481a16c60a..184e7e49b9 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -285,7 +285,7 @@ static const VMStateDescription vmstate_acpi = { VMSTATE_UINT16(ar.pm1.evt.en, PIIX4PMState), VMSTATE_UINT16(ar.pm1.cnt.cnt, PIIX4PMState), VMSTATE_STRUCT(apm, PIIX4PMState, 0, vmstate_apm, APMState), - VMSTATE_TIMER(ar.tmr.timer, PIIX4PMState), + VMSTATE_TIMER_PTR(ar.tmr.timer, PIIX4PMState), VMSTATE_INT64(ar.tmr.overflow_time, PIIX4PMState), VMSTATE_STRUCT(ar.gpe, PIIX4PMState, 2, vmstate_gpe, ACPIGPE), VMSTATE_STRUCT_TEST( diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 64bd4b4c4b..ccc3b189c3 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -306,7 +306,7 @@ static const VMStateDescription vmstate_stellaris_gptm = { VMSTATE_UINT32_ARRAY(match_prescale, gptm_state, 2), VMSTATE_UINT32(rtc, gptm_state), VMSTATE_INT64_ARRAY(tick, gptm_state, 2), - VMSTATE_TIMER_ARRAY(timer, gptm_state, 2), + VMSTATE_TIMER_PTR_ARRAY(timer, gptm_state, 2), VMSTATE_END_OF_LIST() } }; diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 739a03ed58..2bf87c9eea 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -791,7 +791,7 @@ static const VMStateDescription vmstate_fdc_result_timer = { .version_id = 1, .minimum_version_id = 1, .fields = (VMStateField[]) { - VMSTATE_TIMER(result_timer, FDCtrl), + VMSTATE_TIMER_PTR(result_timer, FDCtrl), VMSTATE_END_OF_LIST() } }; diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c index a5736cbc07..7044b357dc 100644 --- a/hw/char/cadence_uart.c +++ b/hw/char/cadence_uart.c @@ -520,7 +520,7 @@ static const VMStateDescription vmstate_cadence_uart = { VMSTATE_UINT32(rx_count, UartState), VMSTATE_UINT32(tx_count, UartState), VMSTATE_UINT32(rx_wpos, UartState), - VMSTATE_TIMER(fifo_trigger_handle, UartState), + VMSTATE_TIMER_PTR(fifo_trigger_handle, UartState), VMSTATE_END_OF_LIST() } }; diff --git a/hw/char/serial.c b/hw/char/serial.c index 3aca87416d..bd25c03bea 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -730,7 +730,7 @@ const VMStateDescription vmstate_serial_fifo_timeout_timer = { .version_id = 1, .minimum_version_id = 1, .fields = (VMStateField[]) { - VMSTATE_TIMER(fifo_timeout_timer, SerialState), + VMSTATE_TIMER_PTR(fifo_timeout_timer, SerialState), VMSTATE_END_OF_LIST() } }; @@ -763,7 +763,7 @@ const VMStateDescription vmstate_serial_poll = { .minimum_version_id = 1, .fields = (VMStateField[]) { VMSTATE_INT32(poll_msl, SerialState), - VMSTATE_TIMER(modem_status_poll, SerialState), + VMSTATE_TIMER_PTR(modem_status_poll, SerialState), VMSTATE_END_OF_LIST() } }; diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index 466e543b3d..2abad1fa3d 100644 --- a/hw/core/ptimer.c +++ b/hw/core/ptimer.c @@ -214,7 +214,7 @@ const VMStateDescription vmstate_ptimer = { VMSTATE_INT64(period, ptimer_state), VMSTATE_INT64(last_event, ptimer_state), VMSTATE_INT64(next_event, ptimer_state), - VMSTATE_TIMER(timer, ptimer_state), + VMSTATE_TIMER_PTR(timer, ptimer_state), VMSTATE_END_OF_LIST() } }; diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c index 6b6eaaeb47..16cf77e7b2 100644 --- a/hw/dma/pl330.c +++ b/hw/dma/pl330.c @@ -286,7 +286,7 @@ static const VMStateDescription vmstate_pl330 = { PL330Queue), VMSTATE_STRUCT(write_queue, PL330State, 0, vmstate_pl330_queue, PL330Queue), - VMSTATE_TIMER(timer, PL330State), + VMSTATE_TIMER_PTR(timer, PL330State), VMSTATE_UINT32(inten, PL330State), VMSTATE_UINT32(int_status, PL330State), VMSTATE_UINT32(ev_status, PL330State), diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c index 9eb68e87cb..530a6e01f5 100644 --- a/hw/input/lm832x.c +++ b/hw/input/lm832x.c @@ -455,7 +455,7 @@ static const VMStateDescription vmstate_lm_kbd = { VMSTATE_UINT16_ARRAY(pwm.file, LM823KbdState, 256), VMSTATE_UINT8(pwm.faddr, LM823KbdState), VMSTATE_BUFFER(pwm.addr, LM823KbdState), - VMSTATE_TIMER_ARRAY(pwm.tm, LM823KbdState, 3), + VMSTATE_TIMER_PTR_ARRAY(pwm.tm, LM823KbdState, 3), VMSTATE_END_OF_LIST() } }; diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index d0543d4b9d..6ff6c7f0cc 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -450,7 +450,7 @@ static const VMStateDescription vmstate_nvic = { VMSTATE_UINT32(systick.control, nvic_state), VMSTATE_UINT32(systick.reload, nvic_state), VMSTATE_INT64(systick.tick, nvic_state), - VMSTATE_TIMER(systick.timer, nvic_state), + VMSTATE_TIMER_PTR(systick.timer, nvic_state), VMSTATE_END_OF_LIST() } }; diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 2f53bf8194..17510ce528 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -234,7 +234,7 @@ static const VMStateDescription vmstate_acpi = { VMSTATE_UINT16(ar.pm1.evt.en, VT686PMState), VMSTATE_UINT16(ar.pm1.cnt.cnt, VT686PMState), VMSTATE_STRUCT(apm, VT686PMState, 0, vmstate_apm, APMState), - VMSTATE_TIMER(ar.tmr.timer, VT686PMState), + VMSTATE_TIMER_PTR(ar.tmr.timer, VT686PMState), VMSTATE_INT64(ar.tmr.overflow_time, VT686PMState), VMSTATE_END_OF_LIST() } diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c index b4273aa171..47d9771a04 100644 --- a/hw/misc/macio/cuda.c +++ b/hw/misc/macio/cuda.c @@ -631,7 +631,7 @@ static const VMStateDescription vmstate_cuda_timer = { VMSTATE_UINT16(counter_value, CUDATimer), VMSTATE_INT64(load_time, CUDATimer), VMSTATE_INT64(next_irq_time, CUDATimer), - VMSTATE_TIMER_TEST(timer, CUDATimer, cuda_timer_exist), + VMSTATE_TIMER_PTR_TEST(timer, CUDATimer, cuda_timer_exist), VMSTATE_END_OF_LIST() } }; diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c index 8a1c8f17b0..8486b80bb7 100644 --- a/hw/net/pcnet.c +++ b/hw/net/pcnet.c @@ -1719,7 +1719,7 @@ const VMStateDescription vmstate_pcnet = { VMSTATE_BUFFER(buffer, PCNetState), VMSTATE_UNUSED_TEST(is_version_2, 4), VMSTATE_INT32(tx_busy, PCNetState), - VMSTATE_TIMER(poll_timer, PCNetState), + VMSTATE_TIMER_PTR(poll_timer, PCNetState), VMSTATE_END_OF_LIST() } }; diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 15064d3ec2..10e5355de7 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -1205,8 +1205,8 @@ const VMStateDescription sdhci_vmstate = { VMSTATE_UINT64(admasysaddr, SDHCIState), VMSTATE_UINT8(stopped_state, SDHCIState), VMSTATE_VBUFFER_UINT32(fifo_buffer, SDHCIState, 1, NULL, 0, buf_maxsz), - VMSTATE_TIMER(insert_timer, SDHCIState), - VMSTATE_TIMER(transfer_timer, SDHCIState), + VMSTATE_TIMER_PTR(insert_timer, SDHCIState), + VMSTATE_TIMER_PTR(transfer_timer, SDHCIState), VMSTATE_END_OF_LIST() } }; diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c index a0656d58a1..435142a3c9 100644 --- a/hw/timer/a9gtimer.c +++ b/hw/timer/a9gtimer.c @@ -328,7 +328,7 @@ static const VMStateDescription vmstate_a9_gtimer = { .version_id = 1, .minimum_version_id = 1, .fields = (VMStateField[]) { - VMSTATE_TIMER(timer, A9GTimerState), + VMSTATE_TIMER_PTR(timer, A9GTimerState), VMSTATE_UINT64(counter, A9GTimerState), VMSTATE_UINT64(ref_counter, A9GTimerState), VMSTATE_UINT64(cpu_ref_time, A9GTimerState), diff --git a/hw/timer/arm_mptimer.c b/hw/timer/arm_mptimer.c index 35a0a2356f..8b93b3c1ae 100644 --- a/hw/timer/arm_mptimer.c +++ b/hw/timer/arm_mptimer.c @@ -246,7 +246,7 @@ static const VMStateDescription vmstate_timerblock = { VMSTATE_UINT32(control, TimerBlock), VMSTATE_UINT32(status, TimerBlock), VMSTATE_INT64(tick, TimerBlock), - VMSTATE_TIMER(timer, TimerBlock), + VMSTATE_TIMER_PTR(timer, TimerBlock), VMSTATE_END_OF_LIST() } }; diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index d8bc231e5b..78d86be91c 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c @@ -299,7 +299,7 @@ static const VMStateDescription vmstate_hpet_timer = { VMSTATE_UINT64(fsb, HPETTimer), VMSTATE_UINT64(period, HPETTimer), VMSTATE_UINT8(wrap_flag, HPETTimer), - VMSTATE_TIMER(qemu_timer, HPETTimer), + VMSTATE_TIMER_PTR(qemu_timer, HPETTimer), VMSTATE_END_OF_LIST() } }; diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index f18d1281ca..5a107fad5d 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -758,7 +758,7 @@ static const VMStateDescription vmstate_rtc = { VMSTATE_BUFFER(cmos_data, RTCState), VMSTATE_UINT8(cmos_index, RTCState), VMSTATE_UNUSED(7*4), - VMSTATE_TIMER(periodic_timer, RTCState), + VMSTATE_TIMER_PTR(periodic_timer, RTCState), VMSTATE_INT64(next_periodic_time, RTCState), VMSTATE_UNUSED(3*8), VMSTATE_UINT32_V(irq_coalesced, RTCState, 2), @@ -766,7 +766,7 @@ static const VMStateDescription vmstate_rtc = { VMSTATE_UINT64_V(base_rtc, RTCState, 3), VMSTATE_UINT64_V(last_update, RTCState, 3), VMSTATE_INT64_V(offset, RTCState, 3), - VMSTATE_TIMER_V(update_timer, RTCState, 3), + VMSTATE_TIMER_PTR_V(update_timer, RTCState, 3), VMSTATE_UINT64_V(next_alarm_time, RTCState, 3), VMSTATE_END_OF_LIST() }, diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 1cc0fc116d..ccf54b6e09 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -2437,7 +2437,7 @@ const VMStateDescription vmstate_ehci = { VMSTATE_UINT32(portsc[4], EHCIState), VMSTATE_UINT32(portsc[5], EHCIState), /* frame timer */ - VMSTATE_TIMER(frame_timer, EHCIState), + VMSTATE_TIMER_PTR(frame_timer, EHCIState), VMSTATE_UINT64(last_run_ns, EHCIState), VMSTATE_UINT32(async_stepdown, EHCIState), /* schedule state */ diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 9a84eb6950..a0d478e63e 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -2015,7 +2015,7 @@ static const VMStateDescription vmstate_ohci_eof_timer = { .minimum_version_id = 1, .pre_load = ohci_eof_timer_pre_load, .fields = (VMStateField[]) { - VMSTATE_TIMER(eof_timer, OHCIState), + VMSTATE_TIMER_PTR(eof_timer, OHCIState), VMSTATE_END_OF_LIST() }, }; diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 4a4215d332..f903de7072 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -419,7 +419,7 @@ static const VMStateDescription vmstate_uhci = { VMSTATE_UINT32(fl_base_addr, UHCIState), VMSTATE_UINT8(sof_timing, UHCIState), VMSTATE_UINT8(status2, UHCIState), - VMSTATE_TIMER(frame_timer, UHCIState), + VMSTATE_TIMER_PTR(frame_timer, UHCIState), VMSTATE_INT64_V(expire_time, UHCIState, 2), VMSTATE_UINT32_V(pending_int_mask, UHCIState, 3), VMSTATE_END_OF_LIST() diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 9a942cfad4..776699b44e 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -3855,7 +3855,7 @@ static const VMStateDescription vmstate_xhci = { /* Runtime Registers & state */ VMSTATE_INT64(mfindex_start, XHCIState), - VMSTATE_TIMER(mfwrap_timer, XHCIState), + VMSTATE_TIMER_PTR(mfwrap_timer, XHCIState), VMSTATE_STRUCT(cmd_ring, XHCIState, 1, vmstate_xhci_ring, XHCIRing), VMSTATE_END_OF_LIST() diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 9fbd59e5ee..962d3f5118 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -2438,7 +2438,7 @@ static const VMStateDescription usbredir_vmstate = { .post_load = usbredir_post_load, .fields = (VMStateField[]) { VMSTATE_USB_DEVICE(dev, USBRedirDevice), - VMSTATE_TIMER(attach_timer, USBRedirDevice), + VMSTATE_TIMER_PTR(attach_timer, USBRedirDevice), { .name = "parser", .version_id = 0, diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c index 687c8b1d4a..33dd6d43c0 100644 --- a/hw/watchdog/wdt_i6300esb.c +++ b/hw/watchdog/wdt_i6300esb.c @@ -398,7 +398,7 @@ static const VMStateDescription vmstate_i6300esb = { VMSTATE_INT32(free_run, I6300State), VMSTATE_INT32(locked, I6300State), VMSTATE_INT32(enabled, I6300State), - VMSTATE_TIMER(timer, I6300State), + VMSTATE_TIMER_PTR(timer, I6300State), VMSTATE_UINT32(timer1_preload, I6300State), VMSTATE_UINT32(timer2_preload, I6300State), VMSTATE_INT32(stage, I6300State), diff --git a/hw/watchdog/wdt_ib700.c b/hw/watchdog/wdt_ib700.c index 8cb9827e3b..0917a713db 100644 --- a/hw/watchdog/wdt_ib700.c +++ b/hw/watchdog/wdt_ib700.c @@ -93,7 +93,7 @@ static const VMStateDescription vmstate_ib700 = { .version_id = 0, .minimum_version_id = 0, .fields = (VMStateField[]) { - VMSTATE_TIMER(timer, IB700State), + VMSTATE_TIMER_PTR(timer, IB700State), VMSTATE_END_OF_LIST() } }; diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 6097b9482f..fa307a6c0f 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -652,17 +652,29 @@ extern const VMStateInfo vmstate_info_bitmap; #define VMSTATE_FLOAT64(_f, _s) \ VMSTATE_FLOAT64_V(_f, _s, 0) -#define VMSTATE_TIMER_TEST(_f, _s, _test) \ +#define VMSTATE_TIMER_PTR_TEST(_f, _s, _test) \ VMSTATE_POINTER_TEST(_f, _s, _test, vmstate_info_timer, QEMUTimer *) -#define VMSTATE_TIMER_V(_f, _s, _v) \ +#define VMSTATE_TIMER_PTR_V(_f, _s, _v) \ VMSTATE_POINTER(_f, _s, _v, vmstate_info_timer, QEMUTimer *) +#define VMSTATE_TIMER_PTR(_f, _s) \ + VMSTATE_TIMER_PTR_V(_f, _s, 0) + +#define VMSTATE_TIMER_PTR_ARRAY(_f, _s, _n) \ + VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer *) + +#define VMSTATE_TIMER_TEST(_f, _s, _test) \ + VMSTATE_SINGLE_TEST(_f, _s, _test, 0, vmstate_info_timer, QEMUTimer) + +#define VMSTATE_TIMER_V(_f, _s, _v) \ + VMSTATE_SINGLE(_f, _s, _v, vmstate_info_timer, QEMUTimer) + #define VMSTATE_TIMER(_f, _s) \ VMSTATE_TIMER_V(_f, _s, 0) #define VMSTATE_TIMER_ARRAY(_f, _s, _n) \ - VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer *) + VMSTATE_ARRAY(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer) #define VMSTATE_BOOL_ARRAY_V(_f, _s, _n, _v) \ VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_bool, bool) diff --git a/target-arm/machine.c b/target-arm/machine.c index c29e7a2ac1..9446e5a8ab 100644 --- a/target-arm/machine.c +++ b/target-arm/machine.c @@ -277,8 +277,8 @@ const VMStateDescription vmstate_arm_cpu = { VMSTATE_UINT32(env.exception.syndrome, ARMCPU), VMSTATE_UINT32(env.exception.fsr, ARMCPU), VMSTATE_UINT64(env.exception.vaddress, ARMCPU), - VMSTATE_TIMER(gt_timer[GTIMER_PHYS], ARMCPU), - VMSTATE_TIMER(gt_timer[GTIMER_VIRT], ARMCPU), + VMSTATE_TIMER_PTR(gt_timer[GTIMER_PHYS], ARMCPU), + VMSTATE_TIMER_PTR(gt_timer[GTIMER_VIRT], ARMCPU), VMSTATE_BOOL(powered_off, ARMCPU), VMSTATE_END_OF_LIST() },