Skip to contentSkip to conversation

VMState simplification (massive)

PATCH In review Juan Quintela 7 participants 116 messages Apr 7, 2014 Page 1 of 2

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover VMState simplification (massive)

Hi

Look at the diffstat. Almost all the additions are at
test-vmstate.c. That is the reason why it is called a simplification.

What this series does:
- peter removal of version_minimum_id_old field when not needed (Peter)
- cleanup: based on the previous one, I removed all the unneeded the uses on the tree. This should make your compiles
a couple of nanoseconds faster.
- once there, fixed the indentation of the .fields line, to a canonical

    .fields = (VMStateField[])

- mst simplifications for vmstate engine

And now, the big cleanup.
- Patches only do one thing, to make easy the review.

- Added test for all VMSTATE_FOO() definitions
(well, I am lying, VMSTATE_STRUCT* are still missing, will come soon)
- We had two ways to make a field optional VMSTATE_INT64_V(field, state, version)
and
VMSTATE_INT64_TEST(field, state, test)

We can do the version one with one test like:

static inline bool vmstate_5_plus(void *opaque, int version_id)

{
    return version_id >= 5;
}
  and then change:
  VMSTATE_INT64_V(field, state, 5);

  into
  VMSTATE_INT64_TEST(field, state, vmstate_5_plus);

The functions until version 15 are already defined on the tree. All the users on the tree are changed to this new schema. Actually we used to have:
VMSTATE_FOO()
VMSTATE_FOO_V()
VMSTATE_FOO_TEST()

Where some of them where defined. After all the changes, only exst VMSTATE_FOO()
VMSTATE_FOO_TEST() (When needed)

- When all the changes are done, removal from version_id at the FieldLevel is removed. Notice that from the toplevel, all the versions work the same at the section level, the only thing that has changed is at the field level.

- Doing the tests, I found a bug (tests have some utility after all)

When the incoming migration stream stoped for any reason, we setup an error, but until we don't end a section, we never check for one error, so it could take a lot until we found it. Now we check after each field read.

- You can see that all the tests share a lot of the boilerplate code. If you have any good idea about how to refactor it to not repeat so much code, let me know.

- Remove all the VMSTATE_FOO* that had no users

- Create new ones for things that were opencoded

VMSTATE_SYNTHETIC(): fields that don't exist on the state struct and are generated It was already opencoded, just created a macro and used it where needed.

VMSTATE_OPENCODED_UNSAFE: There are a couple of cases where a non vmstate field is needed from vmstate. We can cheat and declare that as an struct, but that is not vmstate. There were already users on the tree, so create it.

If you ever wanted to know more about VMState, this is your opportunity. As the tests are aded one field at a time, you can see how the things on the wire change each time to add a new field.

ToDo:
- Finish the tests for the STRUCTS and ARRAYS of STRUCTS of several kinds
- synthetic fields: we can do even better/easier. We can add a hook for the cases where we want to compute the value in a different way.

This could be used for the validate stuff that Michael requested on its patches, while allowing to simplify even more tests.

- port the _vmstate fields to the new synthetic framework.

Thanks for reading until here.

Later, Juan.

The following changes since commit 466e6e9d13d56bbb6da1d2396d7d6347df483af0:

target-i386: reorder fields in cpu/msr_hyperv_hypercall subsection (2014-04-05 10:49:05 +0100)

are available in the git repository at:

git://github.com/juanquintela/qemu.git tags/vmstate-simplification-v1/20140407

for you to fetch changes up to 965f5c4b7b0f87a6c326d968ebd2b5f6022a962d:

vmstate: Test for VMSTATE_VBUFFER_UINT32 (2014-04-07 04:35:22 +0200)

----------------------------------------------------------------
vmstate-simplification-v1/next for 20140407

----------------------------------------------------------------
Juan Quintela (94):
savevm: Remove all the unneded version_minimum_id_old (Massive)
vmstate: return error in case of error
vmstate: refactor opening of files
vmstate: Refactor & increase tests for primitive types
vmstate: create test functions for versions until 15
vmstate: Remove VMSTATE_UINTL_EQUAL_V
vmstate: Change VMSTATE_INTTL_V to VMSTATE_INTTL_TEST
vmstate: Remove unused VMSTATE_UINTTL_ARRAY_V
vmstate: Test for VMSTATE_BOOL_TEST
vmstate: Test for VMSTATE_INT8_TEST
vmstate: Test for VMSTATE_INT16_TEST
vmstate: Test for VMSTATE_INT32_TEST
vmstate: test for VMSTATE_INT64_TEST
vmstate: Test for VMSTATE_UINT8_TEST
vmstate: Test for VMSTATE_UINT16_TEST
vmstate: Test for VMSTATE_UINT32_TEST
vmstate: Test for VMSTATE_UINT64_TEST
vmstate: Test for VMSTATE_FLOAT64
vmstate: Test for VMSTATE_UNUSED
vmstate: Test for VMSTATE_BITMAP
vmstate: Test for VMSTATE_UINT8_EQUAL
vmstate: Test for VMSTATE_UINT16_EQUAL
vmstate: Test for VMSTATE_UINT32_EQUAL
vmstate: Test for VMSTATE_UINT64_EQUAL
vmstate: Test for VMSTATE_INT32_EQUAL
vmstate: Test for VMSTATE_INT32_LE
vmstate: Move VMSTATE_TIMER_V to VMSTATE_TIMER_TEST
vmstate: Test for VMSTATE_ARRAY_BOOL_TEST
vmstate: Test for VMSTATE_UINT8_ARRAY
vmstate: Test for VMSTATE_UINT16_ARRAY
vmstate: Test for VMSTATE_UINT32_ARRAY{_TEST}
vmstate: Test for VMSTATE_UINT64_ARRAY{_TEST}
vmstate: Test for VMSTATE_INT16_ARRAY
vmstate: Test for VMSTATE_INT32_ARRAY{_TEST}
vmstate: Test for VMSTATE_INT64_ARRAY
vmstate: Test for VMSTATE_FLOAT64_ARRAY
vmstate: Test for VMSTATE_UINT8_2DARRAY
vmstate: Test for VMSTATE_UINT16_2DARRAY.
vmstate: Test for VMSTATE_UINT32_2DARRAY
vmstate: Remove unused VMSTATE_BUFFER_V
vmstate: Remove version from VMSTATE_BUFFER_UNSAFE
vmstate: Remove unused version fields from ARM
vmstate: All ptimers users were at least at version 1 or more
vmstate: remove version from all variants of VMSTATE_STRUCT_POINTER*
vmstate: Port last 3 users of VMSTATE_ARRAY to VMSTATE_ARRAY_TEST
vmstate: Port last user of VMSTATE_SINGLE to VMSTATE_SINGLE_TEST
vmstate: Remove unused VMSTATE_POINTER
vmstate: Rename VMSTATE_SINGLE_TEST to VMSTATE_SINGLE
vmstate: Move VMSTATE_2DARRAY to use _test
vmstate: Rename VMSTATE_POINTER_TEST without _TEST
vmstate: Rename VMSTATE_ARRAY_TEST to VMSTATE_ARRAY
vmstate: Remove version_id from VMSTATE_VBUFFER
vmstate: Remove version_id fields that were not used
vmstate: Remove version_id from VMSTATE_SUB_ARRAY
vmstate: Remove version parameter from VMSTATE_VARRAY_INT32
vmstate: Remove version_id from VMSTATE_VARRAY_UINT16_UNSAFE
vmstate: VMSTATE_ARRAY_OF_POINTER didn't used the version_id field
vmstate: remove version parameter from VMSTATE_BUFFER_POINTER_UNSAFE
vmstate: Remove version, test and start parameter from VMSTATE_VBUFFER_UINT32
vmstate: Remove version paramenter from VMSTATE_ARRAY_OF_POINTER_TO_STRUCT
vmstate: Remove VMSTATE_BUFFER_MULTIPLY
vmstate: Remove version parameter from VMSTATE_STATIC_BUFFER
vmstate: Remove version field from VMSTATE_STRUCT_VARRAY_UINT32
vmstate: Move all users of versioning of VMSTATE_STRUCT_ARRAY to _TEST
vmstate: Remove version paramenter from VMSTATE_STRUCT_ARRAY
vmstate: Remove version parameter from VMSTATE_STRUCT_ARRAY_TEST
vmstate: Remove unused version parameter from VMSTATE_STRUCT_VARRAY_INT32
vmstate: Remove unused version parameter from VMSTATE_STRUCT_VARRAY_UINT8
vmstate: Introduce VMSTATE_VARRAY_UINT32_TEST
vmstate: Remove version parameter from VMSTATE_VARRAY_UINT32
vmstate: Remove version parameter from VMSTATE_STRUCT_TEST
vmstate: Move all users of versioning to VMSTATE_STRUCT_TEST
vmstate: Remove version from all VMSTATE_STRUCT calls
vmstate: Create VMSTATE_VARRAY macro
vmstate: Create VMSTATE_POINTER_UNSAFE
vmstate: Create VMSTATE_OPENCODED_UNSAFE
vmstate: Create VMSTATE_SYNTHETIC
vmstate: version_id is gone from fields
vmstate: Test for VMSTATE_SYNTHETIC
vmstate: Test for VMSTATE_UINT8_SUB_ARRAY
vmstate: Test for VMSTATE_UINT32_SUB_ARRAY
vmstate: Test for VMSTATE_BUFFER
vmstate: Test for VMSTATE_PARTIAL_BUFFER
vmstate: Test for VMSTATE_BUFFER_START_MIDDLE
vmstate: Add tests for VMSTATE_BUFFER_TEST
vmstate: Use VMSTATE_UINT8_2DARRAY instead of VMSTATE_BUFFER_TEST
vmstate: Test for VMSTATE_BUFFER_UNSAFE
vmstate: Remove unused VMSTATE_SUB_VBUFFER
vmstate: Remove unused VMSTATE_PARTIAL_VBUFFER_UINT32
vmstate: Test for VMSTATE_PARTIAL_VBUFFER
vmstate: ename VMSTATE_PARTIAL_VBUFFER to VMSTATE_VBUFFER_INT32
vmstate: Create VMS_VBUFFER_UINT32
vmstate: Rename VMS_VBUFFER to VMST_VBUFFER_INT32 for consintency
vmstate: Test for VMSTATE_VBUFFER_UINT32

Michael S. Tsirkin (2):
vmstate: reduce code duplication
vmstate: s/VMSTATE_INT32_LE/VMSTATE_INT32_POSITIVE_LE/

Peter Maydell (1):
savevm: Ignore minimum_version_id_old if there is no load_state_old

 audio/audio.c                      |    3 +-
 cpus.c                             |    5 +-
 docs/migration.txt                 |   20 +-
 exec.c                             |    3 +-
 hw/acpi/ich9.c                     |   12 +-
 hw/acpi/pcihp.c                    |    3 +-
 hw/acpi/piix4.c                    |   29 +-
 hw/arm/highbank.c                  |    1 -
 hw/arm/musicpal.c                  |   10 +-
 hw/arm/pxa2xx.c                    |   19 +-
 hw/arm/pxa2xx_gpio.c               |    3 +-
 hw/arm/pxa2xx_pic.c                |    1 -
 hw/arm/spitz.c                     |   14 +-
 hw/arm/stellaris.c                 |   14 +-
 hw/arm/strongarm.c                 |    6 -
 hw/arm/z2.c                        |    2 -
 hw/audio/ac97.c                    |    8 +-
 hw/audio/cs4231.c                  |    3 +-
 hw/audio/cs4231a.c                 |    3 +-
 hw/audio/es1370.c                  |    8 +-
 hw/audio/gus.c                     |    3 +-
 hw/audio/hda-codec.c               |   10 +-
 hw/audio/intel-hda.c               |    7 +-
 hw/audio/lm4549.c                  |    5 +-
 hw/audio/marvell_88w8618.c         |    1 -
 hw/audio/milkymist-ac97.c          |    3 +-
 hw/audio/pl041.c                   |   25 +-
 hw/audio/sb16.c                    |    3 +-
 hw/audio/wm8750.c                  |    3 +-
 hw/block/ecc.c                     |    3 +-
 hw/block/fdc.c                     |   24 +-
 hw/block/m25p80.c                  |    1 -
 hw/block/nand.c                    |    3 +-
 hw/block/onenand.c                 |    5 +-
 hw/char/cadence_uart.c             |    1 -
 hw/char/digic-uart.c               |    1 -
 hw/char/escc.c                     |   10 +-
 hw/char/exynos4210_uart.c          |    6 +-
 hw/char/imx_serial.c               |    1 -
 hw/char/ipoctal232.c               |   13 +-
 hw/char/lm32_juart.c               |    3 +-
 hw/char/lm32_uart.c                |    3 +-
 hw/char/milkymist-uart.c           |    3 +-
 hw/char/pl011.c                    |    3 +-
 hw/char/sclpconsole-lm.c           |    3 +-
 hw/char/sclpconsole.c              |    3 +-
 hw/char/serial-isa.c               |    2 +-
 hw/char/serial-pci.c               |    8 +-
 hw/char/serial.c                   |    6 +-
 hw/char/spapr_vty.c                |    3 +-
 hw/core/ptimer.c                   |    3 +-
 hw/display/ads7846.c               |    3 +-
 hw/display/cg3.c                   |    2 +-
 hw/display/cirrus_vga.c            |    8 +-
 hw/display/exynos4210_fimd.c       |    6 +-
 hw/display/g364fb.c                |    7 +-
 hw/display/jazz_led.c              |    1 -
 hw/display/milkymist-tmu2.c        |    3 +-
 hw/display/milkymist-vgafb.c       |    3 +-
 hw/display/pl110.c                 |    2 +-
 hw/display/pxa2xx_lcd.c            |    8 +-
 hw/display/qxl.c                   |    8 +-
 hw/display/ssd0303.c               |    3 +-
 hw/display/tcx.c                   |    3 +-
 hw/display/vga-pci.c               |    5 +-
 hw/display/vga.c                   |    3 +-
 hw/display/vmware_vga.c            |   10 +-
 hw/dma/i82374.c                    |    2 +-
 hw/dma/i8257.c                     |    8 +-
 hw/dma/pl080.c                     |    2 +-
 hw/dma/pl330.c                     |   25 +-
 hw/dma/pxa2xx_dma.c                |    2 -
 hw/dma/sparc32_dma.c               |    3 +-
 hw/dma/sun4m_iommu.c               |    3 +-
 hw/gpio/max7310.c                  |    3 +-
 hw/gpio/pl061.c                    |    2 +-
 hw/gpio/zaurus.c                   |    3 +-
 hw/i2c/core.c                      |    6 +-
 hw/i2c/smbus_ich9.c                |    1 -
 hw/i386/acpi-build.c               |    3 +-
 hw/i386/kvm/clock.c                |    1 -
 hw/i386/kvmvapic.c                 |    9 +-
 hw/i386/pc.c                       |    3 +-
 hw/ide/ahci.c                      |    6 +-
 hw/ide/core.c                      |   20 +-
 hw/ide/ich.c                       |    2 +-
 hw/ide/internal.h                  |    7 +-
 hw/ide/isa.c                       |    3 +-
 hw/ide/macio.c                     |    3 +-
 hw/ide/microdrive.c                |    3 +-
 hw/ide/mmio.c                      |    3 +-
 hw/ide/pci.c                       |   15 +-
 hw/input/adb.c                     |    6 +-
 hw/input/hid.c                     |    2 +-
 hw/input/lm832x.c                  |    3 +-
 hw/input/milkymist-softusb.c       |    3 +-
 hw/input/pckbd.c                   |    8 +-
 hw/input/ps2.c                     |   18 +-
 hw/input/pxa2xx_keypad.c           |    3 +-
 hw/input/stellaris_input.c         |    8 +-
 hw/input/vmmouse.c                 |    3 +-
 hw/intc/allwinner-a10-pic.c        |    1 -
 hw/intc/arm_gic_common.c           |    2 +-
 hw/intc/armv7m_nvic.c              |    3 +-
 hw/intc/exynos4210_combiner.c      |    4 +-
 hw/intc/exynos4210_gic.c           |    3 +-
 hw/intc/heathrow_pic.c             |    8 +-
 hw/intc/i8259_common.c             |    1 -
 hw/intc/imx_avic.c                 |    1 -
 hw/intc/ioapic_common.c            |    6 +-
 hw/intc/lm32_pic.c                 |    3 +-
 hw/intc/slavio_intctl.c            |    8 +-
 hw/intc/xics.c                     |    9 +-
 hw/ipack/ipack.c                   |    3 +-
 hw/ipack/tpci200.c                 |    3 +-
 hw/isa/apm.c                       |    1 -
 hw/isa/lpc_ich9.c                  |    5 +-
 hw/isa/piix4.c                     |    3 +-
 hw/isa/vt82c686.c                  |    8 +-
 hw/misc/arm_sysctl.c               |   18 +-
 hw/misc/eccmemctl.c                |    3 +-
 hw/misc/exynos4210_pmu.c           |    2 +-
 hw/misc/imx_ccm.c                  |    1 -
 hw/misc/lm32_sys.c                 |    3 +-
 hw/misc/macio/cuda.c               |    8 +-
 hw/misc/macio/mac_dbdma.c          |    8 +-
 hw/misc/max111x.c                  |    3 +-
 hw/misc/milkymist-hpdmc.c          |    3 +-
 hw/misc/milkymist-pfpu.c           |    3 +-
 hw/misc/mst_fpga.c                 |   11 +-
 hw/misc/slavio_misc.c              |    3 +-
 hw/misc/tmp105.c                   |    3 +-
 hw/misc/zynq_slcr.c                |    3 +-
 hw/net/allwinner_emac.c            |    4 +-
 hw/net/cadence_gem.c               |    3 +-
 hw/net/e1000.c                     |    6 +-
 hw/net/eepro100.c                  |    3 +-
 hw/net/lan9118.c                   |   20 +-
 hw/net/lance.c                     |    5 +-
 hw/net/milkymist-minimac2.c        |    8 +-
 hw/net/mipsnet.c                   |    3 +-
 hw/net/ne2000-isa.c                |    5 +-
 hw/net/ne2000.c                    |   10 +-
 hw/net/pcnet-pci.c                 |    5 +-
 hw/net/pcnet.c                     |    3 +-
 hw/net/rtl8139.c                   |   13 +-
 hw/net/smc91c111.c                 |    4 +-
 hw/net/spapr_llan.c                |    3 +-
 hw/net/vmxnet3.c                   |   13 +-
 hw/net/xgmac.c                     |    4 +-
 hw/nvram/ds1225y.c                 |    3 +-
 hw/nvram/eeprom93xx.c              |   14 +-
 hw/nvram/fw_cfg.c                  |    7 +-
 hw/nvram/mac_nvram.c               |    5 +-
 hw/pci-bridge/ioh3420.c            |    3 +-
 hw/pci-bridge/xio3130_downstream.c |    3 +-
 hw/pci-bridge/xio3130_upstream.c   |    3 +-
 hw/pci-host/bonito.c               |    3 +-
 hw/pci-host/piix.c                 |   11 +-
 hw/pci-host/ppce500.c              |   13 +-
 hw/pci-host/q35.c                  |    3 +-
 hw/pci/msix.c                      |   10 +-
 hw/pci/pci.c                       |   26 +-
 hw/pci/pcie_aer.c                  |    6 +-
 hw/ppc/ppc4xx_pci.c                |   19 +-
 hw/ppc/spapr.c                     |    3 +-
 hw/ppc/spapr_iommu.c               |    6 +-
 hw/ppc/spapr_pci.c                 |   13 +-
 hw/ppc/spapr_vio.c                 |    3 +-
 hw/s390x/event-facility.c          |    3 +-
 hw/s390x/sclpquiesce.c             |    3 +-
 hw/scsi/esp-pci.c                  |    5 +-
 hw/scsi/esp.c                      |    6 +-
 hw/scsi/lsi53c895a.c               |    7 +-
 hw/scsi/megasas.c                  |    3 +-
 hw/scsi/scsi-bus.c                 |   14 +-
 hw/scsi/scsi-disk.c                |    1 -
 hw/scsi/spapr_vscsi.c              |    6 +-
 hw/scsi/vmw_pvscsi.c               |    3 +-
 hw/sd/milkymist-memcard.c          |    3 +-
 hw/sd/sd.c                         |    4 +-
 hw/sd/sdhci.c                      |    4 +-
 hw/ssi/pl022.c                     |    3 +-
 hw/ssi/ssi.c                       |    3 +-
 hw/ssi/xilinx_spi.c                |    1 -
 hw/ssi/xilinx_spips.c              |    1 -
 hw/timer/a9gtimer.c                |    2 +-
 hw/timer/allwinner-a10-pit.c       |    1 -
 hw/timer/arm_mptimer.c             |    2 +-
 hw/timer/arm_timer.c               |    6 +-
 hw/timer/cadence_ttc.c             |    5 +-
 hw/timer/digic-timer.c             |    1 -
 hw/timer/ds1338.c                  |    3 +-
 hw/timer/exynos4210_mct.c          |   19 +-
 hw/timer/exynos4210_pwm.c          |    6 +-
 hw/timer/exynos4210_rtc.c          |    1 -
 hw/timer/hpet.c                    |   13 +-
 hw/timer/i8254_common.c            |    9 +-
 hw/timer/imx_epit.c                |    3 +-
 hw/timer/imx_gpt.c                 |    3 +-
 hw/timer/lm32_timer.c              |    3 +-
 hw/timer/m48t59.c                  |    5 +-
 hw/timer/mc146818rtc.c             |   17 +-
 hw/timer/milkymist-sysctl.c        |    3 +-
 hw/timer/pxa2xx_timer.c            |   13 +-
 hw/timer/slavio_timer.c            |    8 +-
 hw/timer/twl92230.c                |   14 +-
 hw/usb/bus.c                       |    2 +-
 hw/usb/dev-hid.c                   |    4 +-
 hw/usb/dev-hub.c                   |    6 +-
 hw/usb/dev-smartcard-reader.c      |    6 +-
 hw/usb/dev-storage.c               |    2 +-
 hw/usb/hcd-ehci-pci.c              |    5 +-
 hw/usb/hcd-ehci-sysbus.c           |    5 +-
 hw/usb/hcd-ehci.c                  |    6 +-
 hw/usb/hcd-uhci.c                  |   12 +-
 hw/usb/hcd-xhci.c                  |   10 +-
 hw/usb/redirect.c                  |   40 +-
 hw/watchdog/wdt_i6300esb.c         |   14 +-
 hw/watchdog/wdt_ib700.c            |    3 +-
 hw/xen/xen_platform.c              |    3 +-
 include/hw/acpi/pcihp.h            |    2 +-
 include/hw/hw.h                    |   31 +-
 include/hw/ipack/ipack.h           |    2 +-
 include/hw/pci/shpc.h              |    2 +-
 include/hw/ppc/spapr_vio.h         |    2 +-
 include/hw/ptimer.h                |    4 +-
 include/migration/vmstate.h        |  475 ++++++--------
 target-alpha/machine.c             |   20 +-
 target-arm/machine.c               |   29 +-
 target-i386/machine.c              |  155 ++---
 target-lm32/machine.c              |    8 +-
 target-moxie/machine.c             |    3 +-
 target-openrisc/machine.c          |    4 +-
 target-ppc/machine.c               |   52 +-
 tests/test-vmstate.c               | 1220 +++++++++++++++++++++++++++++++++---
 util/fifo8.c                       |    5 +-
 vmstate.c                          |  116 ++--
 238 files changed, 2035 insertions(+), 1432 deletions(-)
#1 lore raw

PATCH 1/97 savevm: Ignore minimum_version_id_old if there is no load_state_old

From: Peter Maydell <[email protected]>

At the moment we require vmstate definitions to set minimum_version_id_old to the same value as minimum_version_id if they do not provide a load_state_old handler. Since the load_state_old functionality is required only for a handful of devices that need to retain migration compatibility with a pre-vmstate implementation, this means the bulk of devices have pointless boilerplate. Relax the definition so that minimum_version_id_old is ignored if there is no load_state_old handler.

Note that under the old scheme we would segfault if the vmstate specified a minimum_version_id_old that was less than minimum_version_id but did not provide a load_state_old function, and the incoming state specified a version number between minimum_version_id_old and minimum_version_id. Under the new scheme this will just result in our failing the migration.

---
 docs/migration.txt | 12 +++++-------
 vmstate.c          |  9 +++++----
 2 files changed, 10 insertions(+), 11 deletions(-)
docs/migration.txt +5 -7
index 0e0a1d4..fe1f2bb 100644
@@ -139,7 +139,6 @@ static const VMStateDescription vmstate_kbd = {
     .name = "pckbd",
     .version_id = 3,
     .minimum_version_id = 3,
-    .minimum_version_id_old = 3,
     .fields      = (VMStateField []) {
         VMSTATE_UINT8(write_cmd, KBDState),
         VMSTATE_UINT8(status, KBDState),
@@ -168,12 +167,13 @@ You can see that there are several version fields:
 - minimum_version_id: the minimum version_id that VMState is able to understand
   for that device.
 - minimum_version_id_old: For devices that were not able to port to vmstate, we can
-  assign a function that knows how to read this old state.
+  assign a function that knows how to read this old state. This field is
+  ignored if there is no load_state_old handler.
 
 So, VMState is able to read versions from minimum_version_id to
-version_id.  And the function load_state_old() is able to load state
-from minimum_version_id_old to minimum_version_id.  This function is
-deprecated and will be removed when no more users are left.
+version_id.  And the function load_state_old() (if present) is able to
+load state from minimum_version_id_old to minimum_version_id.  This
+function is deprecated and will be removed when no more users are left.
 
 ===  Massaging functions ===
 
@@ -255,7 +255,6 @@ const VMStateDescription vmstate_ide_drive_pio_state = {
     .name = "ide_drive/pio_state",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_save = ide_drive_pio_pre_save,
     .post_load = ide_drive_pio_post_load,
     .fields      = (VMStateField []) {
@@ -275,7 +274,6 @@ const VMStateDescription vmstate_ide_drive = {
     .name = "ide_drive",
     .version_id = 3,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = ide_drive_post_load,
     .fields      = (VMStateField []) {
         .... several fields ....
vmstate.c +5 -4
index b689f2f..bfa34cc 100644
@@ -19,11 +19,12 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
     if (version_id > vmsd->version_id) {
         return -EINVAL;
     }
-    if (version_id < vmsd->minimum_version_id_old) {
-        return -EINVAL;
-    }
     if  (version_id < vmsd->minimum_version_id) {
-        return vmsd->load_state_old(f, opaque, version_id);
+        if (vmsd->load_state_old &&
+            version_id >= vmsd->minimum_version_id_old) {
+            return vmsd->load_state_old(f, opaque, version_id);
+        }
+        return -EINVAL;
     }
     if (vmsd->pre_load) {
         int ret = vmsd->pre_load(opaque);
Signature · 1 line
1.9.0
#2 lore raw

PATCH 2/97 savevm: Remove all the unneded version_minimum_id_old (Massive)

In reply to Juan Quintela

After previous Peter patch, they are redundant. This way we don't asign them except when needed. Once there, there were lots of case where the ".fields" indentation was wrong:

     .fields = (VMStateField []) {
and
     .fields =      (VMStateField []) {

Change all the combinations to:

     .fields = (VMStateField[]){

The biggest problem (appart of aesthetics) was that checkpatch complained when we copy&pasted the code from one place to another.

---
 audio/audio.c                      |  3 +-
 cpus.c                             |  3 +-
 docs/migration.txt                 |  6 ++--
 exec.c                             |  3 +-
 hw/acpi/ich9.c                     |  1 -
 hw/acpi/pcihp.c                    |  3 +-
 hw/acpi/piix4.c                    |  8 ++----
 hw/arm/highbank.c                  |  1 -
 hw/arm/musicpal.c                  |  8 ------
 hw/arm/pxa2xx.c                    | 19 ++++---------
 hw/arm/pxa2xx_gpio.c               |  3 +-
 hw/arm/pxa2xx_pic.c                |  1 -
 hw/arm/spitz.c                     | 12 +++-----
 hw/arm/stellaris.c                 | 12 +++-----
 hw/arm/strongarm.c                 |  6 ----
 hw/arm/z2.c                        |  2 --
 hw/audio/ac97.c                    |  6 ++--
 hw/audio/cs4231.c                  |  3 +-
 hw/audio/cs4231a.c                 |  3 +-
 hw/audio/es1370.c                  |  6 ++--
 hw/audio/gus.c                     |  3 +-
 hw/audio/hda-codec.c               |  4 +--
 hw/audio/intel-hda.c               |  4 +--
 hw/audio/lm4549.c                  |  5 ++--
 hw/audio/marvell_88w8618.c         |  1 -
 hw/audio/milkymist-ac97.c          |  3 +-
 hw/audio/pl041.c                   |  9 ++----
 hw/audio/sb16.c                    |  3 +-
 hw/audio/wm8750.c                  |  3 +-
 hw/block/ecc.c                     |  3 +-
 hw/block/fdc.c                     | 16 ++++-------
 hw/block/m25p80.c                  |  1 -
 hw/block/nand.c                    |  3 +-
 hw/block/onenand.c                 |  1 -
 hw/char/cadence_uart.c             |  1 -
 hw/char/digic-uart.c               |  1 -
 hw/char/escc.c                     |  6 ++--
 hw/char/exynos4210_uart.c          |  2 --
 hw/char/imx_serial.c               |  1 -
 hw/char/ipoctal232.c               |  9 ++----
 hw/char/lm32_juart.c               |  3 +-
 hw/char/lm32_uart.c                |  3 +-
 hw/char/milkymist-uart.c           |  3 +-
 hw/char/pl011.c                    |  3 +-
 hw/char/sclpconsole-lm.c           |  3 +-
 hw/char/sclpconsole.c              |  3 +-
 hw/char/serial-pci.c               |  4 +--
 hw/char/serial.c                   |  2 +-
 hw/char/spapr_vty.c                |  3 +-
 hw/core/ptimer.c                   |  3 +-
 hw/display/ads7846.c               |  3 +-
 hw/display/cg3.c                   |  2 +-
 hw/display/cirrus_vga.c            |  6 ++--
 hw/display/exynos4210_fimd.c       |  4 +--
 hw/display/g364fb.c                |  1 -
 hw/display/jazz_led.c              |  1 -
 hw/display/milkymist-tmu2.c        |  3 +-
 hw/display/milkymist-vgafb.c       |  3 +-
 hw/display/pxa2xx_lcd.c            |  6 ++--
 hw/display/ssd0303.c               |  3 +-
 hw/display/tcx.c                   |  3 +-
 hw/display/vga-pci.c               |  3 +-
 hw/display/vga.c                   |  3 +-
 hw/display/vmware_vga.c            |  6 ++--
 hw/dma/i8257.c                     |  6 ++--
 hw/dma/pl330.c                     |  5 ----
 hw/dma/pxa2xx_dma.c                |  2 --
 hw/dma/sparc32_dma.c               |  3 +-
 hw/dma/sun4m_iommu.c               |  3 +-
 hw/gpio/max7310.c                  |  3 +-
 hw/gpio/zaurus.c                   |  3 +-
 hw/i2c/core.c                      |  6 ++--
 hw/i2c/smbus_ich9.c                |  1 -
 hw/i386/acpi-build.c               |  3 +-
 hw/i386/kvm/clock.c                |  1 -
 hw/i386/kvmvapic.c                 |  3 --
 hw/i386/pc.c                       |  3 +-
 hw/ide/ahci.c                      |  6 ++--
 hw/ide/core.c                      | 16 ++++-------
 hw/ide/ich.c                       |  2 +-
 hw/ide/isa.c                       |  3 +-
 hw/ide/macio.c                     |  3 +-
 hw/ide/microdrive.c                |  3 +-
 hw/ide/mmio.c                      |  3 +-
 hw/ide/pci.c                       | 12 +++-----
 hw/input/adb.c                     |  6 ++--
 hw/input/lm832x.c                  |  3 +-
 hw/input/milkymist-softusb.c       |  3 +-
 hw/input/pckbd.c                   |  6 ++--
 hw/input/ps2.c                     | 12 +++-----
 hw/input/pxa2xx_keypad.c           |  3 +-
 hw/input/stellaris_input.c         |  6 ++--
 hw/input/vmmouse.c                 |  3 +-
 hw/intc/allwinner-a10-pic.c        |  1 -
 hw/intc/armv7m_nvic.c              |  3 +-
 hw/intc/exynos4210_combiner.c      |  2 --
 hw/intc/exynos4210_gic.c           |  1 -
 hw/intc/heathrow_pic.c             |  6 ++--
 hw/intc/i8259_common.c             |  1 -
 hw/intc/imx_avic.c                 |  1 -
 hw/intc/ioapic_common.c            |  1 -
 hw/intc/lm32_pic.c                 |  3 +-
 hw/intc/slavio_intctl.c            |  6 ++--
 hw/intc/xics.c                     |  9 ++----
 hw/ipack/ipack.c                   |  3 +-
 hw/ipack/tpci200.c                 |  3 +-
 hw/isa/apm.c                       |  1 -
 hw/isa/lpc_ich9.c                  |  1 -
 hw/isa/piix4.c                     |  3 +-
 hw/isa/vt82c686.c                  |  6 ++--
 hw/misc/eccmemctl.c                |  3 +-
 hw/misc/exynos4210_pmu.c           |  2 +-
 hw/misc/imx_ccm.c                  |  1 -
 hw/misc/lm32_sys.c                 |  3 +-
 hw/misc/macio/cuda.c               |  6 ++--
 hw/misc/macio/mac_dbdma.c          |  6 ++--
 hw/misc/max111x.c                  |  3 +-
 hw/misc/milkymist-hpdmc.c          |  3 +-
 hw/misc/milkymist-pfpu.c           |  3 +-
 hw/misc/mst_fpga.c                 | 11 ++++----
 hw/misc/slavio_misc.c              |  3 +-
 hw/misc/tmp105.c                   |  3 +-
 hw/misc/zynq_slcr.c                |  3 +-
 hw/net/cadence_gem.c               |  3 +-
 hw/net/e1000.c                     |  6 ++--
 hw/net/eepro100.c                  |  3 +-
 hw/net/lance.c                     |  3 +-
 hw/net/milkymist-minimac2.c        |  6 ++--
 hw/net/mipsnet.c                   |  3 +-
 hw/net/ne2000-isa.c                |  3 +-
 hw/net/ne2000.c                    |  6 ++--
 hw/net/pcnet-pci.c                 |  3 +-
 hw/net/pcnet.c                     |  3 +-
 hw/net/rtl8139.c                   |  9 ++----
 hw/net/smc91c111.c                 |  2 +-
 hw/net/spapr_llan.c                |  3 +-
 hw/net/vmxnet3.c                   |  4 +--
 hw/net/xgmac.c                     |  2 +-
 hw/nvram/ds1225y.c                 |  1 -
 hw/nvram/eeprom93xx.c              |  3 +-
 hw/nvram/fw_cfg.c                  |  3 +-
 hw/nvram/mac_nvram.c               |  3 +-
 hw/pci-bridge/ioh3420.c            |  1 -
 hw/pci-bridge/xio3130_downstream.c |  1 -
 hw/pci-bridge/xio3130_upstream.c   |  1 -
 hw/pci-host/bonito.c               |  3 +-
 hw/pci-host/piix.c                 |  7 ++---
 hw/pci-host/ppce500.c              |  9 ++----
 hw/pci-host/q35.c                  |  3 +-
 hw/pci/pci.c                       |  9 ++----
 hw/pci/pcie_aer.c                  |  6 ++--
 hw/ppc/ppc4xx_pci.c                |  9 ++----
 hw/ppc/spapr.c                     |  3 +-
 hw/ppc/spapr_iommu.c               |  3 +-
 hw/ppc/spapr_pci.c                 |  9 ++----
 hw/ppc/spapr_vio.c                 |  3 +-
 hw/s390x/event-facility.c          |  3 +-
 hw/s390x/sclpquiesce.c             |  3 +-
 hw/scsi/esp-pci.c                  |  1 -
 hw/scsi/esp.c                      |  4 +--
 hw/scsi/lsi53c895a.c               |  3 +-
 hw/scsi/megasas.c                  |  3 +-
 hw/scsi/scsi-bus.c                 |  4 +--
 hw/scsi/scsi-disk.c                |  1 -
 hw/scsi/spapr_vscsi.c              |  6 ++--
 hw/scsi/vmw_pvscsi.c               |  3 +-
 hw/sd/milkymist-memcard.c          |  3 +-
 hw/sd/sdhci.c                      |  2 +-
 hw/ssi/pl022.c                     |  3 +-
 hw/ssi/ssi.c                       |  3 +-
 hw/ssi/xilinx_spi.c                |  1 -
 hw/ssi/xilinx_spips.c              |  1 -
 hw/timer/allwinner-a10-pit.c       |  1 -
 hw/timer/arm_timer.c               |  6 ++--
 hw/timer/cadence_ttc.c             |  2 --
 hw/timer/digic-timer.c             |  1 -
 hw/timer/ds1338.c                  |  1 -
 hw/timer/exynos4210_mct.c          |  6 ----
 hw/timer/exynos4210_pwm.c          |  2 --
 hw/timer/exynos4210_rtc.c          |  1 -
 hw/timer/hpet.c                    |  9 ++----
 hw/timer/i8254_common.c            |  1 -
 hw/timer/imx_epit.c                |  3 +-
 hw/timer/imx_gpt.c                 |  3 +-
 hw/timer/lm32_timer.c              |  3 +-
 hw/timer/m48t59.c                  |  3 +-
 hw/timer/mc146818rtc.c             |  3 +-
 hw/timer/milkymist-sysctl.c        |  3 +-
 hw/timer/pxa2xx_timer.c            |  3 --
 hw/timer/slavio_timer.c            |  6 ++--
 hw/timer/twl92230.c                |  6 ++--
 hw/usb/bus.c                       |  2 +-
 hw/usb/dev-hid.c                   |  4 +--
 hw/usb/dev-hub.c                   |  4 +--
 hw/usb/dev-storage.c               |  2 +-
 hw/usb/hcd-ehci-pci.c              |  2 +-
 hw/usb/hcd-ehci-sysbus.c           |  2 +-
 hw/usb/hcd-ehci.c                  |  2 +-
 hw/usb/hcd-uhci.c                  |  6 ++--
 hw/watchdog/wdt_i6300esb.c         | 14 +++++-----
 hw/watchdog/wdt_ib700.c            |  3 +-
 hw/xen/xen_platform.c              |  3 +-
 target-alpha/machine.c             |  2 --
 target-arm/machine.c               |  5 ----
 target-i386/machine.c              | 57 +++++++++++++-------------------------
 target-lm32/machine.c              |  6 ++--
 target-moxie/machine.c             |  3 +-
 target-openrisc/machine.c          |  2 --
 target-ppc/machine.c               | 38 +++++++++----------------
 tests/test-vmstate.c               |  9 ++----
 util/fifo8.c                       |  3 +-
 211 files changed, 289 insertions(+), 621 deletions(-)
audio/audio.c +1 -2
index fc77511..9d018e9 100644
@@ -1812,8 +1812,7 @@ static const VMStateDescription vmstate_audio = {
     .name = "audio",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_END_OF_LIST()
     }
 };
cpus.c +1 -2
index 1104d61..c510052 100644
@@ -430,8 +430,7 @@ static const VMStateDescription vmstate_timers = {
     .name = "timer",
     .version_id = 2,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT64(cpu_ticks_offset, TimersState),
         VMSTATE_INT64(dummy, TimersState),
         VMSTATE_INT64_V(cpu_clock_offset, TimersState, 2),
docs/migration.txt +3 -3
index fe1f2bb..0492a45 100644
@@ -139,7 +139,7 @@ static const VMStateDescription vmstate_kbd = {
     .name = "pckbd",
     .version_id = 3,
     .minimum_version_id = 3,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(write_cmd, KBDState),
         VMSTATE_UINT8(status, KBDState),
         VMSTATE_UINT8(mode, KBDState),
@@ -257,7 +257,7 @@ const VMStateDescription vmstate_ide_drive_pio_state = {
     .minimum_version_id = 1,
     .pre_save = ide_drive_pio_pre_save,
     .post_load = ide_drive_pio_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(req_nb_sectors, IDEState),
         VMSTATE_VARRAY_INT32(io_buffer, IDEState, io_buffer_total_len, 1,
                              vmstate_info_uint8, uint8_t),
@@ -275,7 +275,7 @@ const VMStateDescription vmstate_ide_drive = {
     .version_id = 3,
     .minimum_version_id = 0,
     .post_load = ide_drive_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         .... several fields ....
         VMSTATE_END_OF_LIST()
     },
exec.c +1 -2
index 91513c6..a87774e 100644
@@ -429,9 +429,8 @@ const VMStateDescription vmstate_cpu_common = {
     .name = "cpu_common",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = cpu_common_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(halted, CPUState),
         VMSTATE_UINT32(interrupt_request, CPUState),
         VMSTATE_END_OF_LIST()
hw/acpi/ich9.c +0 -1
index 0afac42..407ae89 100644
@@ -143,7 +143,6 @@ const VMStateDescription vmstate_ich9_pm = {
     .name = "ich9_pm",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = ich9_pm_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_UINT16(acpi_regs.pm1.evt.sts, ICH9LPCPMRegs),
hw/acpi/pcihp.c +1 -2
index f80c480..d807cf1 100644
@@ -322,8 +322,7 @@ const VMStateDescription vmstate_acpi_pcihp_pci_status = {
     .name = "acpi_pcihp_pci_status",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(up, AcpiPciHpPciStatus),
         VMSTATE_UINT32(down, AcpiPciHpPciStatus),
         VMSTATE_END_OF_LIST()
hw/acpi/piix4.c +3 -5
index 67dc075..252bbf2 100644
@@ -177,8 +177,7 @@ static const VMStateDescription vmstate_gpe = {
     .name = "gpe",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_GPE_ARRAY(sts, ACPIGPE),
         VMSTATE_GPE_ARRAY(en, ACPIGPE),
         VMSTATE_END_OF_LIST()
@@ -189,8 +188,7 @@ static const VMStateDescription vmstate_pci_status = {
     .name = "pci_status",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(up, struct AcpiPciHpPciStatus),
         VMSTATE_UINT32(down, struct AcpiPciHpPciStatus),
         VMSTATE_END_OF_LIST()
@@ -259,7 +257,7 @@ static const VMStateDescription vmstate_acpi = {
     .minimum_version_id_old = 1,
     .load_state_old = acpi_load_old,
     .post_load = vmstate_acpi_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, PIIX4PMState),
         VMSTATE_UINT16(ar.pm1.evt.sts, PIIX4PMState),
         VMSTATE_UINT16(ar.pm1.evt.en, PIIX4PMState),
hw/arm/highbank.c +0 -1
index 46b9f1e..24231e5 100644
@@ -134,7 +134,6 @@ static VMStateDescription vmstate_highbank_regs = {
     .name = "highbank-regs",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, HighbankRegsState, NUM_REGS),
         VMSTATE_END_OF_LIST(),
hw/arm/musicpal.c +0 -8
index de54201..2a27a19 100644
@@ -405,7 +405,6 @@ static const VMStateDescription mv88w8618_eth_vmsd = {
     .name = "mv88w8618_eth",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(smir, mv88w8618_eth_state),
         VMSTATE_UINT32(icr, mv88w8618_eth_state),
@@ -642,7 +641,6 @@ static const VMStateDescription musicpal_lcd_vmsd = {
     .name = "musicpal_lcd",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(brightness, musicpal_lcd_state),
         VMSTATE_UINT32(mode, musicpal_lcd_state),
@@ -769,7 +767,6 @@ static const VMStateDescription mv88w8618_pic_vmsd = {
     .name = "mv88w8618_pic",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(level, mv88w8618_pic_state),
         VMSTATE_UINT32(enabled, mv88w8618_pic_state),
@@ -940,7 +937,6 @@ static const VMStateDescription mv88w8618_timer_vmsd = {
     .name = "timer",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_PTIMER(ptimer, mv88w8618_timer_state),
         VMSTATE_UINT32(limit, mv88w8618_timer_state),
@@ -952,7 +948,6 @@ static const VMStateDescription mv88w8618_pit_vmsd = {
     .name = "mv88w8618_pit",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_STRUCT_ARRAY(timer, mv88w8618_pit_state, 4, 1,
                              mv88w8618_timer_vmsd, mv88w8618_timer_state),
@@ -1041,7 +1036,6 @@ static const VMStateDescription mv88w8618_flashcfg_vmsd = {
     .name = "mv88w8618_flashcfg",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(cfgr0, mv88w8618_flashcfg_state),
         VMSTATE_END_OF_LIST()
@@ -1381,7 +1375,6 @@ static const VMStateDescription musicpal_gpio_vmsd = {
     .name = "musicpal_gpio",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(lcd_brightness, musicpal_gpio_state),
         VMSTATE_UINT32(out_state, musicpal_gpio_state),
@@ -1548,7 +1541,6 @@ static const VMStateDescription musicpal_key_vmsd = {
     .name = "musicpal_key",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(kbd_extended, musicpal_key_state),
         VMSTATE_UINT32(pressed_keys, musicpal_key_state),
hw/arm/pxa2xx.c +6 -13
index 0429148..6b7f99b 100644
@@ -148,8 +148,7 @@ static const VMStateDescription vmstate_pxa2xx_pm = {
     .name = "pxa2xx_pm",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(pm_regs, PXA2xxState, 0x40),
         VMSTATE_END_OF_LIST()
     }
@@ -215,8 +214,7 @@ static const VMStateDescription vmstate_pxa2xx_cm = {
     .name = "pxa2xx_cm",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(cm_regs, PXA2xxState, 4),
         VMSTATE_UINT32(clkcfg, PXA2xxState),
         VMSTATE_UINT32(pmnc, PXA2xxState),
@@ -440,8 +438,7 @@ static const VMStateDescription vmstate_pxa2xx_mm = {
     .name = "pxa2xx_mm",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(mm_regs, PXA2xxState, 0x1a),
         VMSTATE_END_OF_LIST()
     }
@@ -1168,7 +1165,6 @@ static const VMStateDescription vmstate_pxa2xx_rtc_regs = {
     .name = "pxa2xx_rtc",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .pre_save = pxa2xx_rtc_pre_save,
     .post_load = pxa2xx_rtc_post_load,
     .fields = (VMStateField[]) {
@@ -1432,8 +1428,7 @@ static const VMStateDescription vmstate_pxa2xx_i2c_slave = {
     .name = "pxa2xx_i2c_slave",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_I2C_SLAVE(parent_obj, PXA2xxI2CSlaveState),
         VMSTATE_END_OF_LIST()
     }
@@ -1443,8 +1438,7 @@ static const VMStateDescription vmstate_pxa2xx_i2c = {
     .name = "pxa2xx_i2c",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT16(control, PXA2xxI2CState),
         VMSTATE_UINT16(status, PXA2xxI2CState),
         VMSTATE_UINT8(ibmr, PXA2xxI2CState),
@@ -1701,8 +1695,7 @@ static const VMStateDescription vmstate_pxa2xx_i2s = {
     .name = "pxa2xx_i2s",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(control, PXA2xxI2SState, 2),
         VMSTATE_UINT32(status, PXA2xxI2SState),
         VMSTATE_UINT32(mask, PXA2xxI2SState),
hw/arm/pxa2xx_gpio.c +1 -2
index 0727428..7f75f05 100644
@@ -313,8 +313,7 @@ static const VMStateDescription vmstate_pxa2xx_gpio_regs = {
     .name = "pxa2xx-gpio",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(lines, PXA2xxGPIOInfo),
         VMSTATE_UINT32_ARRAY(ilevel, PXA2xxGPIOInfo, PXA2XX_GPIO_BANKS),
         VMSTATE_UINT32_ARRAY(olevel, PXA2xxGPIOInfo, PXA2XX_GPIO_BANKS),
hw/arm/pxa2xx_pic.c +0 -1
index d37fb54..9cfc714 100644
@@ -296,7 +296,6 @@ static VMStateDescription vmstate_pxa2xx_pic_regs = {
     .name = "pxa2xx_pic",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = pxa2xx_pic_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(int_enabled, PXA2xxPICState, 2),
hw/arm/spitz.c +4 -8
index 392ca84..a179c1d 100644
@@ -1006,8 +1006,7 @@ static VMStateDescription vmstate_sl_nand_info = {
     .name = "sl-nand",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(ctl, SLNANDState),
         VMSTATE_STRUCT(ecc, SLNANDState, 0, vmstate_ecc_state, ECCState),
         VMSTATE_END_OF_LIST(),
@@ -1041,9 +1040,8 @@ static VMStateDescription vmstate_spitz_kbd = {
     .name = "spitz-keyboard",
     .version_id = 1,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = spitz_keyboard_post_load,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT16(sense_state, SpitzKeyboardState),
         VMSTATE_UINT16(strobe_state, SpitzKeyboardState),
         VMSTATE_UNUSED_TEST(is_version_0, 5),
@@ -1076,8 +1074,7 @@ static const VMStateDescription vmstate_corgi_ssp_regs = {
     .name = "corgi-ssp",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_SSI_SLAVE(ssidev, CorgiSSPState),
         VMSTATE_UINT32_ARRAY(enable, CorgiSSPState, 3),
         VMSTATE_END_OF_LIST(),
@@ -1105,8 +1102,7 @@ static const VMStateDescription vmstate_spitz_lcdtg_regs = {
     .name = "spitz-lcdtg",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_SSI_SLAVE(ssidev, SpitzLCDTG),
         VMSTATE_UINT32(bl_intensity, SpitzLCDTG),
         VMSTATE_UINT32(bl_power, SpitzLCDTG),
hw/arm/stellaris.c +4 -8
index d6cc77b..c7de9cf 100644
@@ -286,8 +286,7 @@ static const VMStateDescription vmstate_stellaris_gptm = {
     .name = "stellaris_gptm",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(config, gptm_state),
         VMSTATE_UINT32_ARRAY(mode, gptm_state, 2),
         VMSTATE_UINT32(control, gptm_state),
@@ -643,9 +642,8 @@ static const VMStateDescription vmstate_stellaris_sys = {
     .name = "stellaris_sys",
     .version_id = 2,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = stellaris_sys_post_load,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(pborctl, ssys_state),
         VMSTATE_UINT32(ldopctl, ssys_state),
         VMSTATE_UINT32(int_mask, ssys_state),
@@ -851,8 +849,7 @@ static const VMStateDescription vmstate_stellaris_i2c = {
     .name = "stellaris_i2c",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(msa, stellaris_i2c_state),
         VMSTATE_UINT32(mcs, stellaris_i2c_state),
         VMSTATE_UINT32(mdr, stellaris_i2c_state),
@@ -1121,8 +1118,7 @@ static const VMStateDescription vmstate_stellaris_adc = {
     .name = "stellaris_adc",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(actss, stellaris_adc_state),
         VMSTATE_UINT32(ris, stellaris_adc_state),
         VMSTATE_UINT32(im, stellaris_adc_state),
hw/arm/strongarm.c +0 -6
index 170d0ce..0da9015 100644
@@ -199,7 +199,6 @@ static VMStateDescription vmstate_strongarm_pic_regs = {
     .name = "strongarm_pic",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = strongarm_pic_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(pending, StrongARMPICState),
@@ -424,7 +423,6 @@ static const VMStateDescription vmstate_strongarm_rtc_regs = {
     .name = "strongarm-rtc",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .pre_save = strongarm_rtc_pre_save,
     .post_load = strongarm_rtc_post_load,
     .fields = (VMStateField[]) {
@@ -670,7 +668,6 @@ static const VMStateDescription vmstate_strongarm_gpio_regs = {
     .name = "strongarm-gpio",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(ilevel, StrongARMGPIOInfo),
         VMSTATE_UINT32(olevel, StrongARMGPIOInfo),
@@ -842,7 +839,6 @@ static const VMStateDescription vmstate_strongarm_ppc_regs = {
     .name = "strongarm-ppc",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(ilevel, StrongARMPPCInfo),
         VMSTATE_UINT32(olevel, StrongARMPPCInfo),
@@ -1293,7 +1289,6 @@ static const VMStateDescription vmstate_strongarm_uart_regs = {
     .name = "strongarm-uart",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = strongarm_uart_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_UINT8(utcr0, StrongARMUARTState),
@@ -1553,7 +1548,6 @@ static const VMStateDescription vmstate_strongarm_ssp_regs = {
     .name = "strongarm-ssp",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = strongarm_ssp_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_UINT16_ARRAY(sscr, StrongARMSSPState, 2),
hw/arm/z2.c +0 -2
index 67c1be8..5df014b 100644
@@ -164,7 +164,6 @@ static VMStateDescription vmstate_zipit_lcd_state = {
     .name = "zipit-lcd",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
     .fields = (VMStateField[]) {
         VMSTATE_SSI_SLAVE(ssidev, ZipitLCD),
         VMSTATE_INT32(selected, ZipitLCD),
@@ -275,7 +274,6 @@ static VMStateDescription vmstate_aer915_state = {
     .name = "aer915",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_INT32(len, AER915State),
         VMSTATE_BUFFER(buf, AER915State),
hw/audio/ac97.c +2 -4
index 03f4846..45cb118 100644
@@ -1163,8 +1163,7 @@ static const VMStateDescription vmstate_ac97_bm_regs = {
     .name = "ac97_bm_regs",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32 (bdbar, AC97BusMasterRegs),
         VMSTATE_UINT8 (civ, AC97BusMasterRegs),
         VMSTATE_UINT8 (lvi, AC97BusMasterRegs),
@@ -1211,9 +1210,8 @@ static const VMStateDescription vmstate_ac97 = {
     .name = "ac97",
     .version_id = 3,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
     .post_load = ac97_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE (dev, AC97LinkState),
         VMSTATE_UINT32 (glob_cnt, AC97LinkState),
         VMSTATE_UINT32 (glob_sta, AC97LinkState),
hw/audio/cs4231.c +1 -2
index d19195a..6325a8c 100644
@@ -137,8 +137,7 @@ static const VMStateDescription vmstate_cs4231 = {
     .name ="cs4231",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, CSState, CS_REGS),
         VMSTATE_UINT8_ARRAY(dregs, CSState, CS_DREGS),
         VMSTATE_END_OF_LIST()
hw/audio/cs4231a.c +1 -2
index a0ec17a..f96f561 100644
@@ -621,10 +621,9 @@ static const VMStateDescription vmstate_cs4231a = {
     .name = "cs4231a",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_load = cs4231a_pre_load,
     .post_load = cs4231a_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY (regs, CSState, CS_REGS),
         VMSTATE_BUFFER (dregs, CSState),
         VMSTATE_INT32 (dma_running, CSState),
hw/audio/es1370.c +2 -4
index 1ec7ace..5dbf803 100644
@@ -953,8 +953,7 @@ static const VMStateDescription vmstate_es1370_channel = {
     .name = "es1370_channel",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32 (shift, struct chan),
         VMSTATE_UINT32 (leftover, struct chan),
         VMSTATE_UINT32 (scount, struct chan),
@@ -997,9 +996,8 @@ static const VMStateDescription vmstate_es1370 = {
     .name = "es1370",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
     .post_load = es1370_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE (dev, ES1370State),
         VMSTATE_STRUCT_ARRAY (chan, ES1370State, NB_CHANNELS, 2,
                               vmstate_es1370_channel, struct chan),
hw/audio/gus.c +1 -2
index e29a571..bba6840 100644
@@ -222,8 +222,7 @@ static const VMStateDescription vmstate_gus = {
     .name = "gus",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32 (pos, GUSState),
         VMSTATE_INT32 (left, GUSState),
         VMSTATE_INT32 (shift, GUSState),
hw/audio/hda-codec.c +2 -2
index a67ca91..09559ef 100644
@@ -580,7 +580,7 @@ static void hda_audio_reset(DeviceState *dev)
 static const VMStateDescription vmstate_hda_audio_stream = {
     .name = "hda-audio-stream",
     .version_id = 1,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(stream, HDAAudioStream),
         VMSTATE_UINT32(channel, HDAAudioStream),
         VMSTATE_UINT32(format, HDAAudioStream),
@@ -598,7 +598,7 @@ static const VMStateDescription vmstate_hda_audio = {
     .name = "hda-audio",
     .version_id = 2,
     .post_load = hda_audio_post_load,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT_ARRAY(st, HDAAudioState, 4, 0,
                              vmstate_hda_audio_stream,
                              HDAAudioStream),
hw/audio/intel-hda.c +2 -2
index d41f82c..1c660a4 100644
@@ -1175,7 +1175,7 @@ static int intel_hda_post_load(void *opaque, int version)
 static const VMStateDescription vmstate_intel_hda_stream = {
     .name = "intel-hda-stream",
     .version_id = 1,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(ctl, IntelHDAStream),
         VMSTATE_UINT32(lpib, IntelHDAStream),
         VMSTATE_UINT32(cbl, IntelHDAStream),
@@ -1191,7 +1191,7 @@ static const VMStateDescription vmstate_intel_hda = {
     .name = "intel-hda",
     .version_id = 1,
     .post_load = intel_hda_post_load,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(pci, IntelHDAState),
 
         /* registers */
hw/audio/lm4549.c +2 -3
index d75f7ec..380ef60 100644
@@ -324,9 +324,8 @@ const VMStateDescription vmstate_lm4549_state = {
     .name = "lm4549_state",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .post_load = &lm4549_post_load,
-    .fields      = (VMStateField[]) {
+    .post_load = lm4549_post_load,
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(voice_is_active, lm4549_state),
         VMSTATE_UINT16_ARRAY(regfile, lm4549_state, 128),
         VMSTATE_UINT16_ARRAY(buffer, lm4549_state, LM4549_BUFFER_SIZE),
hw/audio/marvell_88w8618.c +0 -1
index cdce238..8699267 100644
@@ -259,7 +259,6 @@ static const VMStateDescription mv88w8618_audio_vmsd = {
     .name = "mv88w8618_audio",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(playback_mode, mv88w8618_audio_state),
         VMSTATE_UINT32(status, mv88w8618_audio_state),
hw/audio/milkymist-ac97.c +1 -2
index 9c0f7a0..28f55e8 100644
@@ -316,9 +316,8 @@ static const VMStateDescription vmstate_milkymist_ac97 = {
     .name = "milkymist-ac97",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = ac97_post_load,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, MilkymistAC97State, R_MAX),
         VMSTATE_END_OF_LIST()
     }
hw/audio/pl041.c +3 -6
index ed82be5..19982f2 100644
@@ -561,8 +561,7 @@ static const VMStateDescription vmstate_pl041_regfile = {
     .name = "pl041_regfile",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
 #define REGISTER(name, offset) VMSTATE_UINT32(name, pl041_regfile),
         #include "pl041.hx"
 #undef REGISTER
@@ -574,8 +573,7 @@ static const VMStateDescription vmstate_pl041_fifo = {
     .name = "pl041_fifo",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(level, pl041_fifo),
         VMSTATE_UINT32_ARRAY(data, pl041_fifo, MAX_FIFO_DEPTH),
         VMSTATE_END_OF_LIST()
@@ -586,8 +584,7 @@ static const VMStateDescription vmstate_pl041_channel = {
     .name = "pl041_channel",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT(tx_fifo, pl041_channel, 0,
                        vmstate_pl041_fifo, pl041_fifo),
         VMSTATE_UINT8(tx_enabled, pl041_channel),
hw/audio/sb16.c +1 -2
index bb24e00..60c4b3b 100644
@@ -1289,9 +1289,8 @@ static const VMStateDescription vmstate_sb16 = {
     .name = "sb16",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = sb16_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32 (irq, SB16State),
         VMSTATE_UINT32 (dma, SB16State),
         VMSTATE_UINT32 (hdma, SB16State),
hw/audio/wm8750.c +1 -2
index c18f245..b50b331 100644
@@ -583,10 +583,9 @@ static const VMStateDescription vmstate_wm8750 = {
     .name = CODEC,
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .pre_save = wm8750_pre_save,
     .post_load = wm8750_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8_ARRAY(i2c_data, WM8750State, 2),
         VMSTATE_INT32(i2c_len, WM8750State),
         VMSTATE_INT32(enable, WM8750State),
hw/block/ecc.c +1 -2
index 8c888cc..10bb233 100644
@@ -81,8 +81,7 @@ VMStateDescription vmstate_ecc_state = {
     .name = "ecc-state",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(cp, ECCState),
         VMSTATE_UINT16_ARRAY(lp, ECCState, 2),
         VMSTATE_UINT16(count, ECCState),
hw/block/fdc.c +6 -10
index 1651007..490d127 100644
@@ -672,8 +672,7 @@ static const VMStateDescription vmstate_fdrive_media_changed = {
     .name = "fdrive/media_changed",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(media_changed, FDrive),
         VMSTATE_END_OF_LIST()
     }
@@ -690,8 +689,7 @@ static const VMStateDescription vmstate_fdrive_media_rate = {
     .name = "fdrive/media_rate",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(media_rate, FDrive),
         VMSTATE_END_OF_LIST()
     }
@@ -701,8 +699,7 @@ static const VMStateDescription vmstate_fdrive = {
     .name = "fdrive",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(head, FDrive),
         VMSTATE_UINT8(track, FDrive),
         VMSTATE_UINT8(sect, FDrive),
@@ -741,10 +738,9 @@ static const VMStateDescription vmstate_fdc = {
     .name = "fdc",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
     .pre_save = fdc_pre_save,
     .post_load = fdc_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         /* Controller State */
         VMSTATE_UINT8(sra, FDCtrl),
         VMSTATE_UINT8(srb, FDCtrl),
@@ -2209,7 +2205,7 @@ static const VMStateDescription vmstate_isa_fdc ={
     .name = "fdc",
     .version_id = 2,
     .minimum_version_id = 2,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT(state, FDCtrlISABus, 0, vmstate_fdc, FDCtrl),
         VMSTATE_END_OF_LIST()
     }
@@ -2251,7 +2247,7 @@ static const VMStateDescription vmstate_sysbus_fdc ={
     .name = "fdc",
     .version_id = 2,
     .minimum_version_id = 2,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT(state, FDCtrlSysBus, 0, vmstate_fdc, FDCtrl),
         VMSTATE_END_OF_LIST()
     }
hw/block/m25p80.c +0 -1
index e29a738..4076114 100644
@@ -653,7 +653,6 @@ static const VMStateDescription vmstate_m25p80 = {
     .name = "xilinx_spi",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_save = m25p80_pre_save,
     .fields = (VMStateField[]) {
         VMSTATE_UINT8(state, Flash),
hw/block/nand.c +1 -2
index 6d7c804..38eefd4 100644
@@ -346,10 +346,9 @@ static const VMStateDescription vmstate_nand = {
     .name = "nand",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_save = nand_pre_save,
     .post_load = nand_post_load,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(cle, NANDFlashState),
         VMSTATE_UINT8(ale, NANDFlashState),
         VMSTATE_UINT8(ce, NANDFlashState),
hw/block/onenand.c +0 -1
index aae9ee7..60d5311 100644
@@ -169,7 +169,6 @@ static const VMStateDescription vmstate_onenand = {
     .name = "onenand",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_save = onenand_pre_save,
     .post_load = onenand_post_load,
     .fields = (VMStateField[]) {
hw/char/cadence_uart.c +0 -1
index 1012f1a..bf0c853 100644
@@ -504,7 +504,6 @@ static const VMStateDescription vmstate_cadence_uart = {
     .name = "cadence_uart",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
     .post_load = cadence_uart_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(r, UartState, R_MAX),
hw/char/digic-uart.c +0 -1
index fd8e077..8abe944 100644
@@ -162,7 +162,6 @@ static const VMStateDescription vmstate_digic_uart = {
     .name = "digic-uart",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(reg_rx, DigicUartState),
         VMSTATE_UINT32(reg_st, DigicUartState),
hw/char/escc.c +2 -4
index 6397f6f..4875a2b 100644
@@ -658,8 +658,7 @@ static const VMStateDescription vmstate_escc_chn = {
     .name ="escc_chn",
     .version_id = 2,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(vmstate_dummy, ChannelState),
         VMSTATE_UINT32(reg, ChannelState),
         VMSTATE_UINT32(rxint, ChannelState),
@@ -678,8 +677,7 @@ static const VMStateDescription vmstate_escc = {
     .name ="escc",
     .version_id = 2,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT_ARRAY(chn, ESCCState, 2, 2, vmstate_escc_chn,
                              ChannelState),
         VMSTATE_END_OF_LIST()
hw/char/exynos4210_uart.c +0 -2
index 19b59cc..7614e58 100644
@@ -560,7 +560,6 @@ static const VMStateDescription vmstate_exynos4210_uart_fifo = {
     .name = "exynos4210.uart.fifo",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(sp, Exynos4210UartFIFO),
         VMSTATE_UINT32(rp, Exynos4210UartFIFO),
@@ -573,7 +572,6 @@ static const VMStateDescription vmstate_exynos4210_uart = {
     .name = "exynos4210.uart",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_STRUCT(rx, Exynos4210UartState, 1,
                        vmstate_exynos4210_uart_fifo, Exynos4210UartFIFO),
hw/char/imx_serial.c +0 -1
index 7f16835..f3fbc77 100644
@@ -76,7 +76,6 @@ static const VMStateDescription vmstate_imx_serial = {
     .name = "imx-serial",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_INT32(readbuff, IMXSerialState),
         VMSTATE_UINT32(usr1, IMXSerialState),
hw/char/ipoctal232.c +3 -6
index f9c388e..c8d5cdb 100644
@@ -124,8 +124,7 @@ static const VMStateDescription vmstate_scc2698_channel = {
     .name = "scc2698_channel",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_BOOL(rx_enabled, SCC2698Channel),
         VMSTATE_UINT8_ARRAY(mr, SCC2698Channel, 2),
         VMSTATE_UINT8(mr_idx, SCC2698Channel),
@@ -141,8 +140,7 @@ static const VMStateDescription vmstate_scc2698_block = {
     .name = "scc2698_block",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(imr, SCC2698Block),
         VMSTATE_UINT8(isr, SCC2698Block),
         VMSTATE_END_OF_LIST()
@@ -153,8 +151,7 @@ static const VMStateDescription vmstate_ipoctal = {
     .name = "ipoctal232",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_IPACK_DEVICE(parent_obj, IPOctalState),
         VMSTATE_STRUCT_ARRAY(ch, IPOctalState, N_CHANNELS, 1,
                              vmstate_scc2698_channel, SCC2698Channel),
hw/char/lm32_juart.c +1 -2
index 380cb5d..628a86f 100644
@@ -129,8 +129,7 @@ static const VMStateDescription vmstate_lm32_juart = {
     .name = "lm32-juart",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(jtx, LM32JuartState),
         VMSTATE_UINT32(jrx, LM32JuartState),
         VMSTATE_END_OF_LIST()
hw/char/lm32_uart.c +1 -2
index 84c2549..4f20966 100644
@@ -270,8 +270,7 @@ static const VMStateDescription vmstate_lm32_uart = {
     .name = "lm32-uart",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, LM32UartState, R_MAX),
         VMSTATE_END_OF_LIST()
     }
hw/char/milkymist-uart.c +1 -2
index da51f82..d05b825 100644
@@ -221,8 +221,7 @@ static const VMStateDescription vmstate_milkymist_uart = {
     .name = "milkymist-uart",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, MilkymistUartState, R_MAX),
         VMSTATE_END_OF_LIST()
     }
hw/char/pl011.c +1 -2
index 644aad7..0a45115 100644
@@ -251,8 +251,7 @@ static const VMStateDescription vmstate_pl011 = {
     .name = "pl011",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(readbuff, PL011State),
         VMSTATE_UINT32(flags, PL011State),
         VMSTATE_UINT32(lcr, PL011State),
hw/char/sclpconsole-lm.c +1 -2
index a2dc1c6..80dd0a9 100644
@@ -291,8 +291,7 @@ static const VMStateDescription vmstate_sclplmconsole = {
     .name = "sclplmconsole",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_BOOL(event.event_pending, SCLPConsoleLM),
         VMSTATE_UINT32(write_errors, SCLPConsoleLM),
         VMSTATE_UINT32(length, SCLPConsoleLM),
hw/char/sclpconsole.c +1 -2
index ce40673..fca105d 100644
@@ -185,8 +185,7 @@ static const VMStateDescription vmstate_sclpconsole = {
     .name = "sclpconsole",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_BOOL(event.event_pending, SCLPConsole),
         VMSTATE_UINT8_ARRAY(iov, SCLPConsole, SIZE_BUFFER_VT220),
         VMSTATE_UINT32(iov_sclp, SCLPConsole),
hw/char/serial-pci.c +2 -2
index 991c99f..44f50c3 100644
@@ -155,7 +155,7 @@ static const VMStateDescription vmstate_pci_serial = {
     .name = "pci-serial",
     .version_id = 1,
     .minimum_version_id = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, PCISerialState),
         VMSTATE_STRUCT(state, PCISerialState, 0, vmstate_serial, SerialState),
         VMSTATE_END_OF_LIST()
@@ -166,7 +166,7 @@ static const VMStateDescription vmstate_pci_multi_serial = {
     .name = "pci-serial-multi",
     .version_id = 1,
     .minimum_version_id = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, PCIMultiSerialState),
         VMSTATE_STRUCT_ARRAY(state, PCIMultiSerialState, PCI_SERIAL_MAX_PORTS,
                              0, vmstate_serial, SerialState),
hw/char/serial.c +1 -1
index 6d3b5af..16646d0 100644
@@ -600,7 +600,7 @@ const VMStateDescription vmstate_serial = {
     .minimum_version_id = 2,
     .pre_save = serial_pre_save,
     .post_load = serial_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT16_V(divider, SerialState, 2),
         VMSTATE_UINT8(rbr, SerialState),
         VMSTATE_UINT8(ier, SerialState),
hw/char/spapr_vty.c +1 -2
index f8a4981..0adf096 100644
@@ -148,8 +148,7 @@ static const VMStateDescription vmstate_spapr_vty = {
     .name = "spapr_vty",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_SPAPR_VIO(sdev, VIOsPAPRVTYDevice),
 
         VMSTATE_UINT32(in, VIOsPAPRVTYDevice),
hw/core/ptimer.c +1 -2
index 3036bde..466e543 100644
@@ -206,8 +206,7 @@ const VMStateDescription vmstate_ptimer = {
     .name = "ptimer",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(enabled, ptimer_state),
         VMSTATE_UINT64(limit, ptimer_state),
         VMSTATE_UINT64(delta, ptimer_state),
hw/display/ads7846.c +1 -2
index 85252a2..3f35369 100644
@@ -121,9 +121,8 @@ static const VMStateDescription vmstate_ads7846 = {
     .name = "ads7846",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = ads7856_post_load,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_SSI_SLAVE(ssidev, ADS7846State),
         VMSTATE_INT32_ARRAY(input, ADS7846State, 8),
         VMSTATE_INT32(noise, ADS7846State),
hw/display/cg3.c +1 -1
index a042b9e..f5a8299 100644
@@ -324,7 +324,7 @@ static const VMStateDescription vmstate_cg3 = {
     .version_id = 1,
     .minimum_version_id = 1,
     .post_load = vmstate_cg3_post_load,
-    .fields    = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT16(height, CG3State),
         VMSTATE_UINT16(width, CG3State),
         VMSTATE_UINT16(depth, CG3State),
hw/display/cirrus_vga.c +2 -4
index 0d3127d..55449a6 100644
@@ -2702,9 +2702,8 @@ static const VMStateDescription vmstate_cirrus_vga = {
     .name = "cirrus_vga",
     .version_id = 2,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = cirrus_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(vga.latch, CirrusVGAState),
         VMSTATE_UINT8(vga.sr_index, CirrusVGAState),
         VMSTATE_BUFFER(vga.sr, CirrusVGAState),
@@ -2742,8 +2741,7 @@ static const VMStateDescription vmstate_pci_cirrus_vga = {
     .name = "cirrus_vga",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, PCICirrusVGAState),
         VMSTATE_STRUCT(cirrus_vga, PCICirrusVGAState, 0,
                        vmstate_cirrus_vga, CirrusVGAState),
hw/display/exynos4210_fimd.c +2 -2
index 9750330..45c62af 100644
@@ -1845,7 +1845,7 @@ static const VMStateDescription exynos4210_fimd_window_vmstate = {
     .name = "exynos4210.fimd_window",
     .version_id = 1,
     .minimum_version_id = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(wincon, Exynos4210fimdWindow),
         VMSTATE_UINT32_ARRAY(buf_start, Exynos4210fimdWindow, 3),
         VMSTATE_UINT32_ARRAY(buf_end, Exynos4210fimdWindow, 3),
@@ -1875,7 +1875,7 @@ static const VMStateDescription exynos4210_fimd_vmstate = {
     .version_id = 1,
     .minimum_version_id = 1,
     .post_load = exynos4210_fimd_load,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(vidcon, Exynos4210fimdState, 4),
         VMSTATE_UINT32_ARRAY(vidtcon, Exynos4210fimdState, 4),
         VMSTATE_UINT32(shadowcon, Exynos4210fimdState),
hw/display/g364fb.c +0 -1
index 5c6a2d3..46f7b41 100644
@@ -459,7 +459,6 @@ static const VMStateDescription vmstate_g364fb = {
     .name = "g364fb",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = g364fb_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_VBUFFER_UINT32(vram, G364State, 1, NULL, 0, vram_size),
hw/display/jazz_led.c +0 -1
index f9e7d7c..e9bb005 100644
@@ -250,7 +250,6 @@ static const VMStateDescription vmstate_jazz_led = {
     .name = "jazz-led",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = jazz_led_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_UINT8(segments, LedState),
hw/display/milkymist-tmu2.c +1 -2
index b2a5fba..3e1d0b9 100644
@@ -463,8 +463,7 @@ static const VMStateDescription vmstate_milkymist_tmu2 = {
     .name = "milkymist-tmu2",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, MilkymistTMU2State, R_MAX),
         VMSTATE_END_OF_LIST()
     }
hw/display/milkymist-vgafb.c +1 -2
index 603537a..9b35e76 100644
@@ -305,9 +305,8 @@ static const VMStateDescription vmstate_milkymist_vgafb = {
     .name = "milkymist-vgafb",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = vgafb_post_load,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, MilkymistVgafbState, R_MAX),
         VMSTATE_END_OF_LIST()
     }
hw/display/pxa2xx_lcd.c +2 -4
index 09cdf17..80edb70 100644
@@ -932,8 +932,7 @@ static const VMStateDescription vmstate_dma_channel = {
     .name = "dma_channel",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(branch, struct DMAChannel),
         VMSTATE_UINT8(up, struct DMAChannel),
         VMSTATE_BUFFER(pbuffer, struct DMAChannel),
@@ -959,9 +958,8 @@ static const VMStateDescription vmstate_pxa2xx_lcdc = {
     .name = "pxa2xx_lcdc",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = pxa2xx_lcdc_post_load,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(irqlevel, PXA2xxLCDState),
         VMSTATE_INT32(transp, PXA2xxLCDState),
         VMSTATE_UINT32_ARRAY(control, PXA2xxLCDState, 6),
hw/display/ssd0303.c +1 -2
index c2eea04..f6804fb 100644
@@ -272,8 +272,7 @@ static const VMStateDescription vmstate_ssd0303 = {
     .name = "ssd0303_oled",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(row, ssd0303_state),
         VMSTATE_INT32(col, ssd0303_state),
         VMSTATE_INT32(start_line, ssd0303_state),
hw/display/tcx.c +1 -2
index 2b37ffa..2551b67 100644
@@ -416,9 +416,8 @@ static const VMStateDescription vmstate_tcx = {
     .name ="tcx",
     .version_id = 4,
     .minimum_version_id = 4,
-    .minimum_version_id_old = 4,
     .post_load = vmstate_tcx_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT16(height, TCXState),
         VMSTATE_UINT16(width, TCXState),
         VMSTATE_UINT16(depth, TCXState),
hw/display/vga-pci.c +1 -2
index 574ea0e..a2a9ca1 100644
@@ -54,8 +54,7 @@ static const VMStateDescription vmstate_vga_pci = {
     .name = "vga",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, PCIVGAState),
         VMSTATE_STRUCT(vga, PCIVGAState, 0, vmstate_vga_common, VGACommonState),
         VMSTATE_END_OF_LIST()
hw/display/vga.c +1 -2
index 063319d..9e35dd2 100644
@@ -2210,9 +2210,8 @@ const VMStateDescription vmstate_vga_common = {
     .name = "vga",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
     .post_load = vga_common_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(latch, VGACommonState),
         VMSTATE_UINT8(sr_index, VGACommonState),
         VMSTATE_PARTIAL_BUFFER(sr, VGACommonState, 8),
hw/display/vmware_vga.c +2 -4
index 6ae3348..00bb385 100644
@@ -1152,9 +1152,8 @@ static const VMStateDescription vmstate_vmware_vga_internal = {
     .name = "vmware_vga_internal",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = vmsvga_post_load,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32_EQUAL(new_depth, struct vmsvga_state_s),
         VMSTATE_INT32(enable, struct vmsvga_state_s),
         VMSTATE_INT32(config, struct vmsvga_state_s),
@@ -1179,8 +1178,7 @@ static const VMStateDescription vmstate_vmware_vga = {
     .name = "vmware_vga",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, struct pci_vmsvga_state_s),
         VMSTATE_STRUCT(chip, struct pci_vmsvga_state_s, 0,
                        vmstate_vmware_vga_internal, struct vmsvga_state_s),
hw/dma/i8257.c +2 -4
index 4490372..dd370ed 100644
@@ -551,8 +551,7 @@ static const VMStateDescription vmstate_dma_regs = {
     .name = "dma_regs",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32_ARRAY(now, struct dma_regs, 2),
         VMSTATE_UINT16_ARRAY(base, struct dma_regs, 2),
         VMSTATE_UINT8(mode, struct dma_regs),
@@ -575,9 +574,8 @@ static const VMStateDescription vmstate_dma = {
     .name = "dma",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = dma_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(command, struct dma_cont),
         VMSTATE_UINT8(mask, struct dma_cont),
         VMSTATE_UINT8(flip_flop, struct dma_cont),
hw/dma/pl330.c +0 -5
index 608a58c..6b6eaae 100644
@@ -138,7 +138,6 @@ static const VMStateDescription vmstate_pl330_chan = {
     .name = "pl330_chan",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(src, PL330Chan),
         VMSTATE_UINT32(dst, PL330Chan),
@@ -170,7 +169,6 @@ static const VMStateDescription vmstate_pl330_fifo = {
     .name = "pl330_chan",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_VBUFFER_UINT32(buf, PL330Fifo, 1, NULL, 0, buf_size),
         VMSTATE_VBUFFER_UINT32(tag, PL330Fifo, 1, NULL, 0, buf_size),
@@ -195,7 +193,6 @@ static const VMStateDescription vmstate_pl330_queue_entry = {
     .name = "pl330_queue_entry",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(addr, PL330QueueEntry),
         VMSTATE_UINT32(len, PL330QueueEntry),
@@ -218,7 +215,6 @@ static const VMStateDescription vmstate_pl330_queue = {
     .name = "pl330_queue",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_STRUCT_VARRAY_UINT32(queue, PL330Queue, queue_size, 1,
                                  vmstate_pl330_queue_entry, PL330QueueEntry),
@@ -279,7 +275,6 @@ static const VMStateDescription vmstate_pl330 = {
     .name = "pl330",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_STRUCT(manager, PL330State, 0, vmstate_pl330_chan, PL330Chan),
         VMSTATE_STRUCT_VARRAY_UINT32(chan, PL330State, num_chnls, 0,
hw/dma/pxa2xx_dma.c +0 -2
index c013abb..d4501fb 100644
@@ -514,7 +514,6 @@ static VMStateDescription vmstate_pxa2xx_dma_chan = {
     .name = "pxa2xx_dma_chan",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(descr, PXA2xxDMAChannel),
         VMSTATE_UINT32(src, PXA2xxDMAChannel),
@@ -530,7 +529,6 @@ static VMStateDescription vmstate_pxa2xx_dma = {
     .name = "pxa2xx_dma",
     .version_id = 1,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .fields = (VMStateField[]) {
         VMSTATE_UNUSED_TEST(is_version_0, 4),
         VMSTATE_UINT32(stopintr, PXA2xxDMAState),
hw/dma/sparc32_dma.c +1 -2
index eac338f..e6a453c 100644
@@ -263,8 +263,7 @@ static const VMStateDescription vmstate_dma = {
     .name ="sparc32_dma",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(dmaregs, DMAState, DMA_REGS),
         VMSTATE_END_OF_LIST()
     }
hw/dma/sun4m_iommu.c +1 -2
index 899d454..ec7c2ef 100644
@@ -327,8 +327,7 @@ static const VMStateDescription vmstate_iommu = {
     .name ="iommu",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, IOMMUState, IOMMU_NREGS),
         VMSTATE_UINT64(iostart, IOMMUState),
         VMSTATE_END_OF_LIST()
hw/gpio/max7310.c +1 -2
index cfcd89c..7fbf313 100644
@@ -152,8 +152,7 @@ static const VMStateDescription vmstate_max7310 = {
     .name = "max7310",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(i2c_command_byte, MAX7310State),
         VMSTATE_INT32(len, MAX7310State),
         VMSTATE_UINT8(level, MAX7310State),
hw/gpio/zaurus.c +1 -2
index dc79a8b..658eac2 100644
@@ -207,9 +207,8 @@ static const VMStateDescription vmstate_scoop_regs = {
     .name = "scoop",
     .version_id = 1,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = scoop_post_load,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT16(status, ScoopInfo),
         VMSTATE_UINT16(power, ScoopInfo),
         VMSTATE_UINT32(gpio_level, ScoopInfo),
hw/i2c/core.c +2 -4
index efd8b4f..5a64026 100644
@@ -52,10 +52,9 @@ static const VMStateDescription vmstate_i2c_bus = {
     .name = "i2c_bus",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_save = i2c_bus_pre_save,
     .post_load = i2c_bus_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(saved_address, I2CBus),
         VMSTATE_END_OF_LIST()
     }
@@ -194,9 +193,8 @@ const VMStateDescription vmstate_i2c_slave = {
     .name = "I2CSlave",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = i2c_slave_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(address, I2CSlave),
         VMSTATE_END_OF_LIST()
     }
hw/i2c/smbus_ich9.c +0 -1
index 295b62e..0803dc4 100644
@@ -48,7 +48,6 @@ static const VMStateDescription vmstate_ich9_smbus = {
     .name = "ich9_smb",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, struct ICH9SMBState),
         VMSTATE_END_OF_LIST()
hw/i386/acpi-build.c +1 -2
index a5d3fbf..0bc8895 100644
@@ -1497,8 +1497,7 @@ static const VMStateDescription vmstate_acpi_build = {
     .name = "acpi_build",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(patched, AcpiBuildState),
         VMSTATE_END_OF_LIST()
     },
hw/i386/kvm/clock.c +0 -1
index 892aa02..07b9c0e 100644
@@ -102,7 +102,6 @@ static const VMStateDescription kvmclock_vmsd = {
     .name = "kvmclock",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT64(clock, KVMClockState),
         VMSTATE_END_OF_LIST()
hw/i386/kvmvapic.c +0 -3
index a1c3d1c..a730f4b 100644
@@ -773,7 +773,6 @@ static const VMStateDescription vmstate_handlers = {
     .name = "kvmvapic-handlers",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(set_tpr, VAPICHandlers),
         VMSTATE_UINT32(set_tpr_eax, VAPICHandlers),
@@ -787,7 +786,6 @@ static const VMStateDescription vmstate_guest_rom = {
     .name = "kvmvapic-guest-rom",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UNUSED(8),     /* signature */
         VMSTATE_UINT32(vaddr, GuestROMState),
@@ -807,7 +805,6 @@ static const VMStateDescription vmstate_vapic = {
     .name = "kvm-tpr-opt",      /* compatible with qemu-kvm VAPIC */
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = vapic_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_STRUCT(rom_state, VAPICROMState, 0, vmstate_guest_rom,
hw/i386/pc.c +1 -2
index 14f0d91..5155393 100644
@@ -502,8 +502,7 @@ static const VMStateDescription vmstate_port92_isa = {
     .name = "port92",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(outport, Port92State),
         VMSTATE_END_OF_LIST()
     }
hw/ide/ahci.c +3 -3
index bfe633f..a225181 100644
@@ -1225,7 +1225,7 @@ void ahci_reset(AHCIState *s)
 static const VMStateDescription vmstate_ahci_device = {
     .name = "ahci port",
     .version_id = 1,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_IDE_BUS(port, AHCIDevice),
         VMSTATE_UINT32(port_state, AHCIDevice),
         VMSTATE_UINT32(finished, AHCIDevice),
@@ -1284,7 +1284,7 @@ const VMStateDescription vmstate_ahci = {
     .name = "ahci",
     .version_id = 1,
     .post_load = ahci_state_post_load,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT_VARRAY_POINTER_INT32(dev, AHCIState, ports,
                                      vmstate_ahci_device, AHCIDevice),
         VMSTATE_UINT32(control_regs.cap, AHCIState),
@@ -1313,7 +1313,7 @@ typedef struct SysbusAHCIState {
 static const VMStateDescription vmstate_sysbus_ahci = {
     .name = "sysbus-ahci",
     .unmigratable = 1, /* Still buggy under I/O load */
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_AHCI(ahci, SysbusAHCIState),
         VMSTATE_END_OF_LIST()
     },
hw/ide/core.c +5 -11
index e1dfe54..ade1b89 100644
@@ -2342,8 +2342,7 @@ static const VMStateDescription vmstate_ide_atapi_gesn_state = {
     .name ="ide_drive/atapi/gesn_state",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_BOOL(events.new_media, IDEState),
         VMSTATE_BOOL(events.eject_request, IDEState),
         VMSTATE_END_OF_LIST()
@@ -2354,7 +2353,6 @@ static const VMStateDescription vmstate_ide_tray_state = {
     .name = "ide_drive/tray_state",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_BOOL(tray_open, IDEState),
         VMSTATE_BOOL(tray_locked, IDEState),
@@ -2366,10 +2364,9 @@ static const VMStateDescription vmstate_ide_drive_pio_state = {
     .name = "ide_drive/pio_state",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_save = ide_drive_pio_pre_save,
     .post_load = ide_drive_pio_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(req_nb_sectors, IDEState),
         VMSTATE_VARRAY_INT32(io_buffer, IDEState, io_buffer_total_len, 1,
 			     vmstate_info_uint8, uint8_t),
@@ -2386,9 +2383,8 @@ const VMStateDescription vmstate_ide_drive = {
     .name = "ide_drive",
     .version_id = 3,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = ide_drive_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(mult_sectors, IDEState),
         VMSTATE_INT32(identify_set, IDEState),
         VMSTATE_BUFFER_TEST(identify_data, IDEState, is_identify_set),
@@ -2431,8 +2427,7 @@ static const VMStateDescription vmstate_ide_error_status = {
     .name ="ide_bus/error",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(error_status, IDEBus),
         VMSTATE_END_OF_LIST()
     }
@@ -2442,8 +2437,7 @@ const VMStateDescription vmstate_ide_bus = {
     .name = "ide_bus",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(cmd, IDEBus),
         VMSTATE_UINT8(unit, IDEBus),
         VMSTATE_END_OF_LIST()
hw/ide/ich.c +1 -1
index 1c7c058..a2f1639 100644
@@ -83,7 +83,7 @@ static const VMStateDescription vmstate_ich9_ahci = {
     .name = "ich9_ahci",
     .unmigratable = 1, /* Still buggy under I/O load */
     .version_id = 1,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, AHCIPCIState),
         VMSTATE_AHCI(ahci, AHCIPCIState),
         VMSTATE_END_OF_LIST()
hw/ide/isa.c +1 -2
index d2cabc1..4cbcb1c 100644
@@ -57,8 +57,7 @@ static const VMStateDescription vmstate_ide_isa = {
     .name = "isa-ide",
     .version_id = 3,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_IDE_BUS(bus, ISAIDEState),
         VMSTATE_IDE_DRIVES(bus.ifs, ISAIDEState),
         VMSTATE_END_OF_LIST()
hw/ide/macio.c +1 -2
index da94580..1c20616 100644
@@ -480,8 +480,7 @@ static const VMStateDescription vmstate_pmac = {
     .name = "ide",
     .version_id = 3,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_IDE_BUS(bus, MACIOIDEState),
         VMSTATE_IDE_DRIVES(bus.ifs, MACIOIDEState),
         VMSTATE_END_OF_LIST()
hw/ide/microdrive.c +1 -2
index 21d6495..f24946d 100644
@@ -332,8 +332,7 @@ static const VMStateDescription vmstate_microdrive = {
     .name = "microdrive",
     .version_id = 3,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(opt, MicroDriveState),
         VMSTATE_UINT8(stat, MicroDriveState),
         VMSTATE_UINT8(pins, MicroDriveState),
hw/ide/mmio.c +1 -2
index 9f66a52..01c1d0e 100644
@@ -109,8 +109,7 @@ static const VMStateDescription vmstate_ide_mmio = {
     .name = "mmio-ide",
     .version_id = 3,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_IDE_BUS(bus, MMIOState),
         VMSTATE_IDE_DRIVES(bus.ifs, MMIOState),
         VMSTATE_END_OF_LIST()
hw/ide/pci.c +4 -8
index d8b1157..6257a21 100644
@@ -411,8 +411,7 @@ static const VMStateDescription vmstate_bmdma_current = {
     .name = "ide bmdma_current",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(cur_addr, BMDMAState),
         VMSTATE_UINT32(cur_prd_last, BMDMAState),
         VMSTATE_UINT32(cur_prd_addr, BMDMAState),
@@ -425,8 +424,7 @@ static const VMStateDescription vmstate_bmdma_status = {
     .name ="ide bmdma/status",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(status, BMDMAState),
         VMSTATE_END_OF_LIST()
     }
@@ -436,9 +434,8 @@ static const VMStateDescription vmstate_bmdma = {
     .name = "ide bmdma",
     .version_id = 3,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .pre_save  = ide_bmdma_pre_save,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(cmd, BMDMAState),
         VMSTATE_UINT8(migration_compat_status, BMDMAState),
         VMSTATE_UINT32(addr, BMDMAState),
@@ -479,9 +476,8 @@ const VMStateDescription vmstate_ide_pci = {
     .name = "ide",
     .version_id = 3,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = ide_pci_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, PCIIDEState),
         VMSTATE_STRUCT_ARRAY(bmdma, PCIIDEState, 2, 0,
                              vmstate_bmdma, BMDMAState),
hw/input/adb.c +2 -4
index a75d3fd..34c8058 100644
@@ -303,8 +303,7 @@ static const VMStateDescription vmstate_adb_kbd = {
     .name = "adb_kbd",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_BUFFER(data, KBDState),
         VMSTATE_INT32(rptr, KBDState),
         VMSTATE_INT32(wptr, KBDState),
@@ -518,8 +517,7 @@ static const VMStateDescription vmstate_adb_mouse = {
     .name = "adb_mouse",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(buttons_state, MouseState),
         VMSTATE_INT32(last_buttons_state, MouseState),
         VMSTATE_INT32(dx, MouseState),
hw/input/lm832x.c +1 -2
index 4ae1cd9..9eb68e8 100644
@@ -432,9 +432,8 @@ static const VMStateDescription vmstate_lm_kbd = {
     .name = "LM8323",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = lm_kbd_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_I2C_SLAVE(parent_obj, LM823KbdState),
         VMSTATE_UINT8(i2c_dir, LM823KbdState),
         VMSTATE_UINT8(i2c_cycle, LM823KbdState),
hw/input/milkymist-softusb.c +1 -2
index ecde33c..53ba714 100644
@@ -295,8 +295,7 @@ static const VMStateDescription vmstate_milkymist_softusb = {
     .name = "milkymist-softusb",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, MilkymistSoftUsbState, R_MAX),
         VMSTATE_HID_KEYBOARD_DEVICE(hid_kbd, MilkymistSoftUsbState),
         VMSTATE_HID_POINTER_DEVICE(hid_mouse, MilkymistSoftUsbState),
hw/input/pckbd.c +2 -4
index 29af3d7..ca1cffc 100644
@@ -373,8 +373,7 @@ static const VMStateDescription vmstate_kbd = {
     .name = "pckbd",
     .version_id = 3,
     .minimum_version_id = 3,
-    .minimum_version_id_old = 3,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(write_cmd, KBDState),
         VMSTATE_UINT8(status, KBDState),
         VMSTATE_UINT8(mode, KBDState),
@@ -462,8 +461,7 @@ static const VMStateDescription vmstate_kbd_isa = {
     .name = "pckbd",
     .version_id = 3,
     .minimum_version_id = 3,
-    .minimum_version_id_old = 3,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT(kbd, ISAKBDState, 0, vmstate_kbd, KBDState),
         VMSTATE_END_OF_LIST()
     }
hw/input/ps2.c +4 -8
index 3412079..0a0bd80 100644
@@ -559,8 +559,7 @@ static const VMStateDescription vmstate_ps2_common = {
     .name = "PS2 Common State",
     .version_id = 3,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(write_cmd, PS2State),
         VMSTATE_INT32(queue.rptr, PS2State),
         VMSTATE_INT32(queue.wptr, PS2State),
@@ -589,9 +588,8 @@ static const VMStateDescription vmstate_ps2_keyboard_ledstate = {
     .name = "ps2kbd/ledstate",
     .version_id = 3,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
     .post_load = ps2_kbd_ledstate_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(ledstate, PS2KbdState),
         VMSTATE_END_OF_LIST()
     }
@@ -610,9 +608,8 @@ static const VMStateDescription vmstate_ps2_keyboard = {
     .name = "ps2kbd",
     .version_id = 3,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
     .post_load = ps2_kbd_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT(common, PS2KbdState, 0, vmstate_ps2_common, PS2State),
         VMSTATE_INT32(scan_enabled, PS2KbdState),
         VMSTATE_INT32(translate, PS2KbdState),
@@ -633,8 +630,7 @@ static const VMStateDescription vmstate_ps2_mouse = {
     .name = "ps2mouse",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT(common, PS2MouseState, 0, vmstate_ps2_common, PS2State),
         VMSTATE_UINT8(mouse_status, PS2MouseState),
         VMSTATE_UINT8(mouse_resolution, PS2MouseState),
hw/input/pxa2xx_keypad.c +1 -2
index b90b0ba..8501114 100644
@@ -291,8 +291,7 @@ static const VMStateDescription vmstate_pxa2xx_keypad = {
     .name = "pxa2xx_keypad",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(kpc, PXA2xxKeyPadState),
         VMSTATE_UINT32(kpdk, PXA2xxKeyPadState),
         VMSTATE_UINT32(kprec, PXA2xxKeyPadState),
hw/input/stellaris_input.c +2 -4
index 4e40792..0609e80 100644
@@ -51,8 +51,7 @@ static const VMStateDescription vmstate_stellaris_button = {
     .name = "stellaris_button",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(pressed, gamepad_button),
         VMSTATE_END_OF_LIST()
     }
@@ -62,8 +61,7 @@ static const VMStateDescription vmstate_stellaris_gamepad = {
     .name = "stellaris_gamepad",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(extension, gamepad_state),
         VMSTATE_STRUCT_VARRAY_INT32(buttons, gamepad_state, num_buttons, 0,
                               vmstate_stellaris_button, gamepad_button),
hw/input/vmmouse.c +1 -2
index 6a50533..d7b1c76 100644
@@ -240,9 +240,8 @@ static const VMStateDescription vmstate_vmmouse = {
     .name = "vmmouse",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = vmmouse_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32_EQUAL(queue_size, VMMouseState),
         VMSTATE_UINT32_ARRAY(queue, VMMouseState, VMMOUSE_QUEUE_SIZE),
         VMSTATE_UINT16(nb_queue, VMMouseState),
hw/intc/allwinner-a10-pic.c +0 -1
index 407d563..2db411d 100644
@@ -129,7 +129,6 @@ static const VMStateDescription vmstate_aw_a10_pic = {
     .name = "a10.pic",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(vector, AwA10PICState),
         VMSTATE_UINT32(base_addr, AwA10PICState),
hw/intc/armv7m_nvic.c +1 -2
index 6066fa6..980eaab 100644
@@ -443,8 +443,7 @@ static const VMStateDescription vmstate_nvic = {
     .name = "armv7m_nvic",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(systick.control, nvic_state),
         VMSTATE_UINT32(systick.reload, nvic_state),
         VMSTATE_INT64(systick.tick, nvic_state),
hw/intc/exynos4210_combiner.c +0 -2
index 3287479..a6b7028 100644
@@ -77,7 +77,6 @@ static const VMStateDescription vmstate_exynos4210_combiner_group_state = {
     .name = "exynos4210.combiner.groupstate",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT8(src_mask, CombinerGroupState),
         VMSTATE_UINT8(src_pending, CombinerGroupState),
@@ -89,7 +88,6 @@ static const VMStateDescription vmstate_exynos4210_combiner = {
     .name = "exynos4210.combiner",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_STRUCT_ARRAY(group, Exynos4210CombinerState, IIC_NGRP, 0,
                 vmstate_exynos4210_combiner_group_state, CombinerGroupState),
hw/intc/exynos4210_gic.c +0 -1
index 5b913f7..0590d5d 100644
@@ -394,7 +394,6 @@ static const VMStateDescription vmstate_exynos4210_irq_gate = {
     .name = "exynos4210.irq_gate",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
     .fields = (VMStateField[]) {
         VMSTATE_VBUFFER_UINT32(level, Exynos4210IRQGateState, 1, NULL, 0, n_in),
         VMSTATE_END_OF_LIST()
hw/intc/heathrow_pic.c +2 -4
index 9818f24..9ff3119 100644
@@ -159,8 +159,7 @@ static const VMStateDescription vmstate_heathrow_pic_one = {
     .name = "heathrow_pic_one",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(events, HeathrowPIC),
         VMSTATE_UINT32(mask, HeathrowPIC),
         VMSTATE_UINT32(levels, HeathrowPIC),
@@ -173,8 +172,7 @@ static const VMStateDescription vmstate_heathrow_pic = {
     .name = "heathrow_pic",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT_ARRAY(pics, HeathrowPICS, 2, 1,
                              vmstate_heathrow_pic_one, HeathrowPIC),
         VMSTATE_END_OF_LIST()
hw/intc/i8259_common.c +0 -1
index 61381c4..fbf26e5 100644
@@ -98,7 +98,6 @@ static const VMStateDescription vmstate_pic_common = {
     .name = "i8259",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_save = pic_dispatch_pre_save,
     .post_load = pic_dispatch_post_load,
     .fields = (VMStateField[]) {
hw/intc/imx_avic.c +0 -1
index fb00e91..ec5f9ad 100644
@@ -77,7 +77,6 @@ static const VMStateDescription vmstate_imx_avic = {
     .name = "imx-avic",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT64(pending, IMXAVICState),
         VMSTATE_UINT64(enabled, IMXAVICState),
hw/intc/ioapic_common.c +0 -1
index 4d3d309..8b7d118 100644
@@ -86,7 +86,6 @@ static const VMStateDescription vmstate_ioapic_common = {
     .name = "ioapic",
     .version_id = 3,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_save = ioapic_dispatch_pre_save,
     .post_load = ioapic_dispatch_post_load,
     .fields = (VMStateField[]) {
hw/intc/lm32_pic.c +1 -2
index 32d009f..72fc9ef 100644
@@ -169,8 +169,7 @@ static const VMStateDescription vmstate_lm32_pic = {
     .name = "lm32-pic",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(im, LM32PicState),
         VMSTATE_UINT32(ip, LM32PicState),
         VMSTATE_UINT32(irq_state, LM32PicState),
hw/intc/slavio_intctl.c +2 -4
index b10fb66..f22aba0 100644
@@ -381,8 +381,7 @@ static const VMStateDescription vmstate_intctl_cpu = {
     .name ="slavio_intctl_cpu",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(intreg_pending, SLAVIO_CPUINTCTLState),
         VMSTATE_END_OF_LIST()
     }
@@ -392,9 +391,8 @@ static const VMStateDescription vmstate_intctl = {
     .name ="slavio_intctl",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = vmstate_intctl_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT_ARRAY(slaves, SLAVIO_INTCTLState, MAX_CPUS, 1,
                              vmstate_intctl_cpu, SLAVIO_CPUINTCTLState),
         VMSTATE_UINT32(intregm_pending, SLAVIO_INTCTLState),
hw/intc/xics.c +3 -6
index 64aabe7..76dd6f5 100644
@@ -330,10 +330,9 @@ static const VMStateDescription vmstate_icp_server = {
     .name = "icp/server",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_save = icp_dispatch_pre_save,
     .post_load = icp_dispatch_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         /* Sanity check */
         VMSTATE_UINT32(xirr, ICPState),
         VMSTATE_UINT8(pending_priority, ICPState),
@@ -566,8 +565,7 @@ static const VMStateDescription vmstate_ics_irq = {
     .name = "ics/irq",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(server, ICSIRQState),
         VMSTATE_UINT8(priority, ICSIRQState),
         VMSTATE_UINT8(saved_priority, ICSIRQState),
@@ -580,10 +578,9 @@ static const VMStateDescription vmstate_ics = {
     .name = "ics",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_save = ics_dispatch_pre_save,
     .post_load = ics_dispatch_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         /* Sanity check */
         VMSTATE_UINT32_EQUAL(nr_irqs, ICSState),
 
hw/ipack/ipack.c +1 -2
index ed63d2a..ef032e6 100644
@@ -89,8 +89,7 @@ const VMStateDescription vmstate_ipack_device = {
     .name = "ipack_device",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(slot, IPackDevice),
         VMSTATE_END_OF_LIST()
     }
hw/ipack/tpci200.c +1 -2
index e1b69b4..42ca923 100644
@@ -629,8 +629,7 @@ static const VMStateDescription vmstate_tpci200 = {
     .name = "tpci200",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, TPCI200State),
         VMSTATE_BOOL_ARRAY(big_endian, TPCI200State, 3),
         VMSTATE_UINT8_ARRAY(ctrl, TPCI200State, N_MODULES),
hw/isa/apm.c +0 -1
index f97e7a0..054d529 100644
@@ -72,7 +72,6 @@ const VMStateDescription vmstate_apm = {
     .name = "APM State",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT8(apmc, APMState),
         VMSTATE_UINT8(apms, APMState),
hw/isa/lpc_ich9.c +0 -1
index 51ce12d..97f69d6 100644
@@ -616,7 +616,6 @@ static const VMStateDescription vmstate_ich9_lpc = {
     .name = "ICH9LPC",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = ich9_lpc_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(d, ICH9LPCState),
hw/isa/piix4.c +1 -2
index 492cd22..1aa17d7 100644
@@ -76,8 +76,7 @@ static const VMStateDescription vmstate_piix4 = {
     .name = "PIIX4",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, PIIX4State),
         VMSTATE_END_OF_LIST()
     }
hw/isa/vt82c686.c +2 -4
index 1a93afd..e0c235c 100644
@@ -230,9 +230,8 @@ static const VMStateDescription vmstate_acpi = {
     .name = "vt82c686b_pm",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = vmstate_acpi_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, VT686PMState),
         VMSTATE_UINT16(ar.pm1.evt.sts, VT686PMState),
         VMSTATE_UINT16(ar.pm1.evt.en, VT686PMState),
@@ -418,8 +417,7 @@ static const VMStateDescription vmstate_via = {
     .name = "vt82c686b",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, VT82C686BState),
         VMSTATE_END_OF_LIST()
     }
hw/misc/eccmemctl.c +1 -2
index 549431c..8bad6f6 100644
@@ -266,8 +266,7 @@ static const VMStateDescription vmstate_ecc = {
     .name ="ECC",
     .version_id = 3,
     .minimum_version_id = 3,
-    .minimum_version_id_old = 3,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, ECCState, ECC_NREGS),
         VMSTATE_BUFFER(diag, ECCState),
         VMSTATE_UINT32(version, ECCState),
hw/misc/exynos4210_pmu.c +1 -1
index 5ec14d1..2b118c7 100644
@@ -471,7 +471,7 @@ static const VMStateDescription exynos4210_pmu_vmstate = {
     .name = "exynos4210.pmu",
     .version_id = 1,
     .minimum_version_id = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(reg, Exynos4210PmuState, PMU_NUM_OF_REGISTERS),
         VMSTATE_END_OF_LIST()
     }
hw/misc/imx_ccm.c +0 -1
index 63e33a4..750b906 100644
@@ -57,7 +57,6 @@ static const VMStateDescription vmstate_imx_ccm = {
     .name = "imx-ccm",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(ccmr, IMXCCMState),
         VMSTATE_UINT32(pdr0, IMXCCMState),
hw/misc/lm32_sys.c +1 -2
index e394f2e..778eb6e 100644
@@ -141,8 +141,7 @@ static const VMStateDescription vmstate_lm32_sys = {
     .name = "lm32-sys",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, LM32SysState, R_MAX),
         VMSTATE_BUFFER(testname, LM32SysState),
         VMSTATE_END_OF_LIST()
hw/misc/macio/cuda.c +2 -4
index bc71aa7..ff6051d 100644
@@ -617,8 +617,7 @@ static const VMStateDescription vmstate_cuda_timer = {
     .name = "cuda_timer",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT16(latch, CUDATimer),
         VMSTATE_UINT16(counter_value, CUDATimer),
         VMSTATE_INT64(load_time, CUDATimer),
@@ -632,8 +631,7 @@ static const VMStateDescription vmstate_cuda = {
     .name = "cuda",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(a, CUDAState),
         VMSTATE_UINT8(b, CUDAState),
         VMSTATE_UINT8(dira, CUDAState),
hw/misc/macio/mac_dbdma.c +2 -4
index f47a736..3335476 100644
@@ -719,8 +719,7 @@ static const VMStateDescription vmstate_dbdma_channel = {
     .name = "dbdma_channel",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, struct DBDMA_channel, DBDMA_REGS),
         VMSTATE_END_OF_LIST()
     }
@@ -730,8 +729,7 @@ static const VMStateDescription vmstate_dbdma = {
     .name = "dbdma",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT_ARRAY(channels, DBDMAState, DBDMA_CHANNELS, 1,
                              vmstate_dbdma_channel, DBDMA_channel),
         VMSTATE_END_OF_LIST()
hw/misc/max111x.c +1 -2
index bba87c2..bef3651 100644
@@ -110,8 +110,7 @@ static const VMStateDescription vmstate_max111x = {
     .name = "max111x",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_SSI_SLAVE(parent_obj, MAX111xState),
         VMSTATE_UINT8(tb1, MAX111xState),
         VMSTATE_UINT8(rb2, MAX111xState),
hw/misc/milkymist-hpdmc.c +1 -2
index aef135e..f5f4c1b 100644
@@ -143,8 +143,7 @@ static const VMStateDescription vmstate_milkymist_hpdmc = {
     .name = "milkymist-hpdmc",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, MilkymistHpdmcState, R_MAX),
         VMSTATE_END_OF_LIST()
     }
hw/misc/milkymist-pfpu.c +1 -2
index b3b2143..609f33f 100644
@@ -513,8 +513,7 @@ static const VMStateDescription vmstate_milkymist_pfpu = {
     .name = "milkymist-pfpu",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, MilkymistPFPUState, R_MAX),
         VMSTATE_UINT32_ARRAY(gp_regs, MilkymistPFPUState, 128),
         VMSTATE_UINT32_ARRAY(microcode, MilkymistPFPUState, MICROCODE_WORDS),
hw/misc/mst_fpga.c +5 -6
index c96810f..d509079 100644
@@ -219,12 +219,11 @@ static int mst_fpga_init(SysBusDevice *sbd)
 }
 
 static VMStateDescription vmstate_mst_fpga_regs = {
-	.name = "mainstone_fpga",
-	.version_id = 0,
-	.minimum_version_id = 0,
-	.minimum_version_id_old = 0,
-	.post_load = mst_fpga_post_load,
-	.fields = (VMStateField []) {
+    .name = "mainstone_fpga",
+    .version_id = 0,
+    .minimum_version_id = 0,
+    .post_load = mst_fpga_post_load,
+    .fields = (VMStateField[]) {
 		VMSTATE_UINT32(prev_level, mst_irq_state),
 		VMSTATE_UINT32(leddat1, mst_irq_state),
 		VMSTATE_UINT32(leddat2, mst_irq_state),
hw/misc/slavio_misc.c +1 -2
index 767544e..5098595 100644
@@ -400,8 +400,7 @@ static const VMStateDescription vmstate_misc = {
     .name ="slavio_misc",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(dummy, MiscState),
         VMSTATE_UINT8(config, MiscState),
         VMSTATE_UINT8(aux1, MiscState),
hw/misc/tmp105.c +1 -2
index 63aa3d6..7eab802 100644
@@ -197,9 +197,8 @@ static const VMStateDescription vmstate_tmp105 = {
     .name = "TMP105",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = tmp105_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(len, TMP105State),
         VMSTATE_UINT8_ARRAY(buf, TMP105State, 2),
         VMSTATE_UINT8(pointer, TMP105State),
hw/misc/zynq_slcr.c +1 -2
index d1cc233..84310bb 100644
@@ -512,8 +512,7 @@ static const VMStateDescription vmstate_zynq_slcr = {
     .name = "zynq_slcr",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8_ARRAY(data, ZynqSLCRState, 0x1000),
         VMSTATE_END_OF_LIST()
     }
hw/net/cadence_gem.c +1 -2
index 92dc2f2..f8f7b12 100644
@@ -1257,8 +1257,7 @@ static const VMStateDescription vmstate_cadence_gem = {
     .name = "cadence_gem",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, GemState, GEM_MAXREG),
         VMSTATE_UINT16_ARRAY(phy_regs, GemState, 32),
         VMSTATE_UINT8(phy_loop, GemState),
hw/net/e1000.c +2 -4
index 8387443..a13b8c3 100644
@@ -1341,8 +1341,7 @@ static const VMStateDescription vmstate_e1000_mit_state = {
     .name = "e1000/mit_state",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields    = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(mac_reg[RDTR], E1000State),
         VMSTATE_UINT32(mac_reg[RADV], E1000State),
         VMSTATE_UINT32(mac_reg[TADV], E1000State),
@@ -1356,10 +1355,9 @@ static const VMStateDescription vmstate_e1000 = {
     .name = "e1000",
     .version_id = 2,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_save = e1000_pre_save,
     .post_load = e1000_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, E1000State),
         VMSTATE_UNUSED_TEST(is_version_1, 4), /* was instance id */
         VMSTATE_UNUSED(4), /* Was mmio_base.  */
hw/net/eepro100.c +1 -2
index 3b891ca..aaa3ff2 100644
@@ -1784,8 +1784,7 @@ static ssize_t nic_receive(NetClientState *nc, const uint8_t * buf, size_t size)
 static const VMStateDescription vmstate_eepro100 = {
     .version_id = 3,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, EEPRO100State),
         VMSTATE_UNUSED(32),
         VMSTATE_BUFFER(mult, EEPRO100State),
hw/net/lance.c +1 -2
index fe18564..7811a9e 100644
@@ -110,8 +110,7 @@ static const VMStateDescription vmstate_lance = {
     .name = "pcnet",
     .version_id = 3,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT(state, SysBusPCNetState, 0, vmstate_pcnet, PCNetState),
         VMSTATE_END_OF_LIST()
     }
hw/net/milkymist-minimac2.c +2 -4
index 1e92379..c023351 100644
@@ -492,8 +492,7 @@ static const VMStateDescription vmstate_milkymist_minimac2_mdio = {
     .name = "milkymist-minimac2-mdio",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(last_clk, MilkymistMinimac2MdioState),
         VMSTATE_INT32(count, MilkymistMinimac2MdioState),
         VMSTATE_UINT32(data, MilkymistMinimac2MdioState),
@@ -509,8 +508,7 @@ static const VMStateDescription vmstate_milkymist_minimac2 = {
     .name = "milkymist-minimac2",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, MilkymistMinimac2State, R_MAX),
         VMSTATE_UINT16_ARRAY(phy_regs, MilkymistMinimac2State, R_PHY_MAX),
         VMSTATE_STRUCT(mdio, MilkymistMinimac2State, 0,
hw/net/mipsnet.c +1 -2
index e421b86..b26c369 100644
@@ -198,8 +198,7 @@ static const VMStateDescription vmstate_mipsnet = {
     .name = "mipsnet",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(busy, MIPSnetState),
         VMSTATE_UINT32(rx_count, MIPSnetState),
         VMSTATE_UINT32(rx_read, MIPSnetState),
hw/net/ne2000-isa.c +1 -2
index c660e58..8740844 100644
@@ -59,8 +59,7 @@ static const VMStateDescription vmstate_isa_ne2000 = {
     .name = "ne2000",
     .version_id = 2,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT(ne2000, ISANE2000State, 0, vmstate_ne2000, NE2000State),
         VMSTATE_END_OF_LIST()
     }
hw/net/ne2000.c +2 -4
index 4c32e9e..d558b8c 100644
@@ -615,9 +615,8 @@ const VMStateDescription vmstate_ne2000 = {
     .name = "ne2000",
     .version_id = 2,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = ne2000_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8_V(rxcr, NE2000State, 2),
         VMSTATE_UINT8(cmd, NE2000State),
         VMSTATE_UINT32(start, NE2000State),
@@ -645,8 +644,7 @@ static const VMStateDescription vmstate_pci_ne2000 = {
     .name = "ne2000",
     .version_id = 3,
     .minimum_version_id = 3,
-    .minimum_version_id_old = 3,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, PCINE2000State),
         VMSTATE_STRUCT(ne2000, PCINE2000State, 0, vmstate_ne2000, NE2000State),
         VMSTATE_END_OF_LIST()
hw/net/pcnet-pci.c +1 -2
index 6a5d806..b25d789 100644
@@ -241,8 +241,7 @@ static const VMStateDescription vmstate_pci_pcnet = {
     .name = "pcnet",
     .version_id = 3,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, PCIPCNetState),
         VMSTATE_STRUCT(state, PCIPCNetState, 0, vmstate_pcnet, PCNetState),
         VMSTATE_END_OF_LIST()
hw/net/pcnet.c +1 -2
index 7cb47b3..8c54692 100644
@@ -1701,8 +1701,7 @@ const VMStateDescription vmstate_pcnet = {
     .name = "pcnet",
     .version_id = 3,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(rap, PCNetState),
         VMSTATE_INT32(isr, PCNetState),
         VMSTATE_INT32(lnkst, PCNetState),
hw/net/rtl8139.c +3 -6
index 5329f44..90bc5ec 100644
@@ -1358,8 +1358,7 @@ static const VMStateDescription vmstate_tally_counters = {
     .name = "tally_counters",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT64(TxOk, RTL8139TallyCounters),
         VMSTATE_UINT64(RxOk, RTL8139TallyCounters),
         VMSTATE_UINT64(TxERR, RTL8139TallyCounters),
@@ -3271,8 +3270,7 @@ static const VMStateDescription vmstate_rtl8139_hotplug_ready ={
     .name = "rtl8139/hotplug_ready",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_END_OF_LIST()
     }
 };
@@ -3293,10 +3291,9 @@ static const VMStateDescription vmstate_rtl8139 = {
     .name = "rtl8139",
     .version_id = 4,
     .minimum_version_id = 3,
-    .minimum_version_id_old = 3,
     .post_load = rtl8139_post_load,
     .pre_save  = rtl8139_pre_save,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, RTL8139State),
         VMSTATE_PARTIAL_BUFFER(phys, RTL8139State, 6),
         VMSTATE_BUFFER(mult, RTL8139State),
hw/net/smc91c111.c +1 -1
index a8e29b3..d1dca8f 100644
@@ -54,7 +54,7 @@ static const VMStateDescription vmstate_smc91c111 = {
     .name = "smc91c111",
     .version_id = 1,
     .minimum_version_id = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT16(tcr, smc91c111_state),
         VMSTATE_UINT16(rcr, smc91c111_state),
         VMSTATE_UINT16(cr, smc91c111_state),
hw/net/spapr_llan.c +1 -2
index c433337..2d47df6 100644
@@ -509,8 +509,7 @@ static const VMStateDescription vmstate_spapr_llan = {
     .name = "spapr_llan",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_SPAPR_VIO(sdev, VIOsPAPRVLANDevice),
         /* LLAN state */
         VMSTATE_BOOL(isopen, VIOsPAPRVLANDevice),
hw/net/vmxnet3.c +1 -3
index 5be807c..781b06a 100644
@@ -2174,7 +2174,6 @@ static const VMStateDescription vmxstate_vmxnet3_mcast_list = {
     .name = "vmxnet3/mcast_list",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_load = vmxnet3_mcast_list_pre_load,
     .fields = (VMStateField[]) {
         VMSTATE_VBUFFER_UINT32(mcast_list, VMXNET3State, 0, NULL, 0,
@@ -2381,10 +2380,9 @@ static const VMStateDescription vmstate_vmxnet3 = {
     .name = "vmxnet3",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_save = vmxnet3_pre_save,
     .post_load = vmxnet3_post_load,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
             VMSTATE_PCI_DEVICE(parent_obj, VMXNET3State),
             VMSTATE_BOOL(rx_packets_compound, VMXNET3State),
             VMSTATE_BOOL(rx_vlan_stripping, VMXNET3State),
hw/net/xgmac.c +1 -1
index 9384fa0..8619491 100644
@@ -156,7 +156,7 @@ const VMStateDescription vmstate_rxtx_stats = {
     .name = "xgmac_stats",
     .version_id = 1,
     .minimum_version_id = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT64(rx_bytes, RxTxStats),
         VMSTATE_UINT64(tx_bytes, RxTxStats),
         VMSTATE_UINT64(rx, RxTxStats),
hw/nvram/ds1225y.c +0 -1
index f9a700b..332598b 100644
@@ -95,7 +95,6 @@ static const VMStateDescription vmstate_nvram = {
     .name = "nvram",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .post_load = nvram_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_VARRAY_UINT32(contents, NvRamState, chip_size, 0,
hw/nvram/eeprom93xx.c +1 -2
index a98f924..0af4d67 100644
@@ -125,8 +125,7 @@ static const VMStateDescription vmstate_eeprom = {
     .name = "eeprom",
     .version_id = EEPROM_VERSION,
     .minimum_version_id = OLD_EEPROM_VERSION,
-    .minimum_version_id_old = OLD_EEPROM_VERSION,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(tick, eeprom_t),
         VMSTATE_UINT8(address, eeprom_t),
         VMSTATE_UINT8(command, eeprom_t),
hw/nvram/fw_cfg.c +1 -2
index 282341a..b71d251 100644
@@ -377,8 +377,7 @@ static const VMStateDescription vmstate_fw_cfg = {
     .name = "fw_cfg",
     .version_id = 2,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT16(cur_entry, FWCfgState),
         VMSTATE_UINT16_HACK(cur_offset, FWCfgState, is_version_1),
         VMSTATE_UINT32_V(cur_offset, FWCfgState, 2),
hw/nvram/mac_nvram.c +1 -2
index 2eb0081..170b10b 100644
@@ -96,8 +96,7 @@ static const VMStateDescription vmstate_macio_nvram = {
     .name = "macio_nvram",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_VBUFFER_UINT32(data, MacIONVRAMState, 0, NULL, 0, size),
         VMSTATE_END_OF_LIST()
     }
hw/pci-bridge/ioh3420.c +0 -1
index 0f7f209..f4e17ac 100644
@@ -184,7 +184,6 @@ static const VMStateDescription vmstate_ioh3420 = {
     .name = "ioh-3240-express-root-port",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = pcie_cap_slot_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_PCIE_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
hw/pci-bridge/xio3130_downstream.c +0 -1
index 94f9781..8f22f93 100644
@@ -151,7 +151,6 @@ static const VMStateDescription vmstate_xio3130_downstream = {
     .name = "xio3130-express-downstream-port",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = pcie_cap_slot_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_PCIE_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
hw/pci-bridge/xio3130_upstream.c +0 -1
index 59f97f6..eada582 100644
@@ -131,7 +131,6 @@ static const VMStateDescription vmstate_xio3130_upstream = {
     .name = "xio3130-express-upstream-port",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_PCIE_DEVICE(parent_obj.parent_obj, PCIEPort),
         VMSTATE_STRUCT(parent_obj.parent_obj.exp.aer_log, PCIEPort, 0,
hw/pci-host/bonito.c +1 -2
index 902441f..56292ad 100644
@@ -687,8 +687,7 @@ static const VMStateDescription vmstate_bonito = {
     .name = "Bonito",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, PCIBonitoState),
         VMSTATE_END_OF_LIST()
     }
hw/pci-host/piix.c +3 -4
index ffdc853..e0e0946 100644
@@ -203,7 +203,7 @@ static const VMStateDescription vmstate_i440fx = {
     .minimum_version_id_old = 1,
     .load_state_old = i440fx_load_old,
     .post_load = i440fx_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, PCII440FXState),
         VMSTATE_UINT8(smm_enabled, PCII440FXState),
         VMSTATE_END_OF_LIST()
@@ -553,7 +553,7 @@ static const VMStateDescription vmstate_piix3_rcr = {
     .name = "PIIX3/rcr",
     .version_id = 1,
     .minimum_version_id = 1,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(rcr, PIIX3State),
         VMSTATE_END_OF_LIST()
     }
@@ -563,10 +563,9 @@ static const VMStateDescription vmstate_piix3 = {
     .name = "PIIX3",
     .version_id = 3,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
     .post_load = piix3_post_load,
     .pre_save = piix3_pre_save,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, PIIX3State),
         VMSTATE_INT32_ARRAY_V(pci_irq_levels_vmstate, PIIX3State,
                               PIIX_NUM_PIRQS, 3),
hw/pci-host/ppce500.c +3 -6
index c80b7cb..e12d731 100644
@@ -278,8 +278,7 @@ static const VMStateDescription vmstate_pci_outbound = {
     .name = "pci_outbound",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(potar, struct pci_outbound),
         VMSTATE_UINT32(potear, struct pci_outbound),
         VMSTATE_UINT32(powbar, struct pci_outbound),
@@ -292,8 +291,7 @@ static const VMStateDescription vmstate_pci_inbound = {
     .name = "pci_inbound",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(pitar, struct pci_inbound),
         VMSTATE_UINT32(piwbar, struct pci_inbound),
         VMSTATE_UINT32(piwbear, struct pci_inbound),
@@ -306,8 +304,7 @@ static const VMStateDescription vmstate_ppce500_pci = {
     .name = "ppce500_pci",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT_ARRAY(pob, PPCE500PCIState, PPCE500_PCI_NR_POBS, 1,
                              vmstate_pci_outbound, struct pci_outbound),
         VMSTATE_STRUCT_ARRAY(pib, PPCE500PCIState, PPCE500_PCI_NR_PIBS, 1,
hw/pci-host/q35.c +1 -2
index 8b8cc4e..571e523 100644
@@ -330,9 +330,8 @@ static const VMStateDescription vmstate_mch = {
     .name = "mch",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = mch_post_load,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, MCHPCIState),
         VMSTATE_UINT8(smm_enabled, MCHPCIState),
         VMSTATE_END_OF_LIST()
hw/pci/pci.c +3 -6
index 2a9f08e..d4375b6 100644
@@ -64,8 +64,7 @@ static const VMStateDescription vmstate_pcibus = {
     .name = "PCIBUS",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32_EQUAL(nirq, PCIBus),
         VMSTATE_VARRAY_INT32(irq_count, PCIBus,
                              nirq, 0, vmstate_info_int32,
@@ -473,8 +472,7 @@ const VMStateDescription vmstate_pci_device = {
     .name = "PCIDevice",
     .version_id = 2,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32_LE(version_id, PCIDevice),
         VMSTATE_BUFFER_UNSAFE_INFO(config, PCIDevice, 0,
                                    vmstate_info_pci_config,
@@ -490,8 +488,7 @@ const VMStateDescription vmstate_pcie_device = {
     .name = "PCIEDevice",
     .version_id = 2,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32_LE(version_id, PCIDevice),
         VMSTATE_BUFFER_UNSAFE_INFO(config, PCIDevice, 0,
                                    vmstate_info_pci_config,
hw/pci/pcie_aer.c +2 -4
index 991502e..090f307 100644
@@ -784,8 +784,7 @@ static const VMStateDescription vmstate_pcie_aer_err = {
     .name = "PCIE_AER_ERROR",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields     = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(status, PCIEAERErr),
         VMSTATE_UINT16(source_id, PCIEAERErr),
         VMSTATE_UINT16(flags, PCIEAERErr),
@@ -799,8 +798,7 @@ const VMStateDescription vmstate_pcie_aer_log = {
     .name = "PCIE_AER_ERROR_LOG",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields     = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT16(log_num, PCIEAERLog),
         VMSTATE_UINT16(log_max, PCIEAERLog),
         VMSTATE_STRUCT_VARRAY_POINTER_UINT16(log, PCIEAERLog, log_num,
hw/ppc/ppc4xx_pci.c +3 -6
index 4cb7851..55a3cab 100644
@@ -294,8 +294,7 @@ static const VMStateDescription vmstate_pci_master_map = {
     .name = "pci_master_map",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(la, struct PCIMasterMap),
         VMSTATE_UINT32(ma, struct PCIMasterMap),
         VMSTATE_UINT32(pcila, struct PCIMasterMap),
@@ -308,8 +307,7 @@ static const VMStateDescription vmstate_pci_target_map = {
     .name = "pci_target_map",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(ms, struct PCITargetMap),
         VMSTATE_UINT32(la, struct PCITargetMap),
         VMSTATE_END_OF_LIST()
@@ -320,8 +318,7 @@ static const VMStateDescription vmstate_ppc4xx_pci = {
     .name = "ppc4xx_pci",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT_ARRAY(pmm, PPC4xxPCIState, PPC4xx_PCI_NR_PMMS, 1,
                              vmstate_pci_master_map,
                              struct PCIMasterMap),
hw/ppc/spapr.c +1 -2
index a11e121..ceae989 100644
@@ -819,8 +819,7 @@ static const VMStateDescription vmstate_spapr = {
     .name = "spapr",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(next_irq, sPAPREnvironment),
 
         /* RTC offset */
hw/ppc/spapr_iommu.c +1 -2
index d9fe946..ce15751 100644
@@ -97,9 +97,8 @@ static const VMStateDescription vmstate_spapr_tce_table = {
     .name = "spapr_iommu",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_load = spapr_tce_table_pre_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         /* Sanity check */
         VMSTATE_UINT32_EQUAL(liobn, sPAPRTCETable),
         VMSTATE_UINT32_EQUAL(window_size, sPAPRTCETable),
hw/ppc/spapr_pci.c +3 -6
index cbef095..a4a51d4 100644
@@ -659,8 +659,7 @@ static const VMStateDescription vmstate_spapr_pci_lsi = {
     .name = "spapr_pci/lsi",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_EQUAL(irq, struct spapr_pci_lsi),
 
         VMSTATE_END_OF_LIST()
@@ -671,8 +670,7 @@ static const VMStateDescription vmstate_spapr_pci_msi = {
     .name = "spapr_pci/lsi",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(config_addr, struct spapr_pci_msi),
         VMSTATE_UINT32(irq, struct spapr_pci_msi),
         VMSTATE_UINT32(nvec, struct spapr_pci_msi),
@@ -685,8 +683,7 @@ static const VMStateDescription vmstate_spapr_pci = {
     .name = "spapr_pci",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT64_EQUAL(buid, sPAPRPHBState),
         VMSTATE_UINT32_EQUAL(dma_liobn, sPAPRPHBState),
         VMSTATE_UINT64_EQUAL(mem_win_addr, sPAPRPHBState),
hw/ppc/spapr_vio.c +1 -2
index 2ae06a3..bce8d7f 100644
@@ -547,8 +547,7 @@ const VMStateDescription vmstate_spapr_vio = {
     .name = "spapr_vio",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         /* Sanity check */
         VMSTATE_UINT32_EQUAL(reg, VIOsPAPRDevice),
         VMSTATE_UINT32_EQUAL(irq, VIOsPAPRDevice),
hw/s390x/event-facility.c +1 -2
index 0777a93..057cb57 100644
@@ -319,8 +319,7 @@ static const VMStateDescription vmstate_event_facility = {
     .name = "vmstate-event-facility",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(receive_mask, SCLPEventFacility),
         VMSTATE_END_OF_LIST()
      }
hw/s390x/sclpquiesce.c +1 -2
index a3c4bd6..1a399bd 100644
@@ -69,8 +69,7 @@ static const VMStateDescription vmstate_sclpquiesce = {
     .name = "sclpquiesce",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_BOOL(event_pending, SCLPEvent),
         VMSTATE_END_OF_LIST()
      }
hw/scsi/esp-pci.c +0 -1
index 48c8b82..9971bbf 100644
@@ -310,7 +310,6 @@ static const VMStateDescription vmstate_esp_pci_scsi = {
     .name = "pciespscsi",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, PCIESPState),
         VMSTATE_BUFFER_UNSAFE(dma_regs, PCIESPState, 0, 8 * sizeof(uint32_t)),
hw/scsi/esp.c +1 -3
index 2d150bf..5ab44d8 100644
@@ -560,8 +560,7 @@ const VMStateDescription vmstate_esp = {
     .name ="esp",
     .version_id = 3,
     .minimum_version_id = 3,
-    .minimum_version_id_old = 3,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_BUFFER(rregs, ESPState),
         VMSTATE_BUFFER(wregs, ESPState),
         VMSTATE_INT32(ti_size, ESPState),
@@ -706,7 +705,6 @@ static const VMStateDescription vmstate_sysbus_esp_scsi = {
     .name = "sysbusespscsi",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .fields = (VMStateField[]) {
         VMSTATE_STRUCT(esp, SysBusESPState, 0, vmstate_esp, ESPState),
         VMSTATE_END_OF_LIST()
hw/scsi/lsi53c895a.c +1 -2
index cb30414..786d848 100644
@@ -1994,9 +1994,8 @@ static const VMStateDescription vmstate_lsi_scsi = {
     .name = "lsiscsi",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .pre_save = lsi_pre_save,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, LSIState),
 
         VMSTATE_INT32(carry, LSIState),
hw/scsi/megasas.c +1 -2
index e6e1ffd..c735c08 100644
@@ -2065,8 +2065,7 @@ static const VMStateDescription vmstate_megasas = {
     .name = "megasas",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, MegasasState),
 
         VMSTATE_INT32(fw_state, MegasasState),
hw/scsi/scsi-bus.c +1 -3
index ae921a6..a137c98 100644
@@ -1915,8 +1915,7 @@ static const VMStateDescription vmstate_scsi_sense_state = {
     .name = "SCSIDevice/sense",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8_SUB_ARRAY(sense, SCSIDevice,
                                 SCSI_SENSE_BUF_SIZE_OLD,
                                 SCSI_SENSE_BUF_SIZE - SCSI_SENSE_BUF_SIZE_OLD),
@@ -1928,7 +1927,6 @@ const VMStateDescription vmstate_scsi_device = {
     .name = "SCSIDevice",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT8(unit_attention.key, SCSIDevice),
         VMSTATE_UINT8(unit_attention.asc, SCSIDevice),
hw/scsi/scsi-disk.c +0 -1
index 48a28ae..f05c772 100644
@@ -2571,7 +2571,6 @@ static const VMStateDescription vmstate_scsi_disk_state = {
     .name = "scsi-disk",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_SCSI_DEVICE(qdev, SCSIDiskState),
         VMSTATE_BOOL(media_changed, SCSIDiskState),
hw/scsi/spapr_vscsi.c +2 -4
index d4ada4f..f96b7af 100644
@@ -598,8 +598,7 @@ static const VMStateDescription vmstate_spapr_vscsi_req = {
     .name = "spapr_vscsi_req",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_BUFFER(crq.raw, vscsi_req),
         VMSTATE_BUFFER(iu.srp.reserved, vscsi_req),
         VMSTATE_UINT32(qtag, vscsi_req),
@@ -1260,8 +1259,7 @@ static const VMStateDescription vmstate_spapr_vscsi = {
     .name = "spapr_vscsi",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_SPAPR_VIO(vdev, VSCSIState),
         /* VSCSI state */
         /* ???? */
hw/scsi/vmw_pvscsi.c +1 -2
index e35bff7..f9ed926 100644
@@ -1143,10 +1143,9 @@ static const VMStateDescription vmstate_pvscsi = {
     .name = "pvscsi",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .pre_save = pvscsi_pre_save,
     .post_load = pvscsi_post_load,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, PVSCSIState),
         VMSTATE_UINT8(msi_used, PVSCSIState),
         VMSTATE_UINT32(resetting, PVSCSIState),
hw/sd/milkymist-memcard.c +1 -2
index d1168c9..2a40f92 100644
@@ -272,8 +272,7 @@ static const VMStateDescription vmstate_milkymist_memcard = {
     .name = "milkymist-memcard",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(command_write_ptr, MilkymistMemcardState),
         VMSTATE_INT32(response_read_ptr, MilkymistMemcardState),
         VMSTATE_INT32(response_len, MilkymistMemcardState),
hw/sd/sdhci.c +1 -1
index 843e697..e2951e6 100644
@@ -1197,7 +1197,7 @@ const VMStateDescription sdhci_vmstate = {
     .name = "sdhci",
     .version_id = 1,
     .minimum_version_id = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(sdmasysad, SDHCIState),
         VMSTATE_UINT16(blksize, SDHCIState),
         VMSTATE_UINT16(blkcnt, SDHCIState),
hw/ssi/pl022.c +1 -2
index fd479ef..c1e2c97 100644
@@ -244,8 +244,7 @@ static const VMStateDescription vmstate_pl022 = {
     .name = "pl022_ssp",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(cr0, PL022State),
         VMSTATE_UINT32(cr1, PL022State),
         VMSTATE_UINT32(bitmask, PL022State),
hw/ssi/ssi.c +1 -2
index 017f022..1c82a93 100644
@@ -126,8 +126,7 @@ const VMStateDescription vmstate_ssi_slave = {
     .name = "SSISlave",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_BOOL(cs, SSISlave),
         VMSTATE_END_OF_LIST()
     }
hw/ssi/xilinx_spi.c +0 -1
index d44caae..207f47a 100644
@@ -351,7 +351,6 @@ static const VMStateDescription vmstate_xilinx_spi = {
     .name = "xilinx_spi",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_FIFO8(tx_fifo, XilinxSPI),
         VMSTATE_FIFO8(rx_fifo, XilinxSPI),
hw/ssi/xilinx_spips.c +0 -1
index 8977243..0910f54 100644
@@ -704,7 +704,6 @@ static const VMStateDescription vmstate_xilinx_spips = {
     .name = "xilinx_spips",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
     .post_load = xilinx_spips_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_FIFO8(tx_fifo, XilinxSPIPS),
hw/timer/allwinner-a10-pit.c +0 -1
index b27fce8..5e78e12 100644
@@ -154,7 +154,6 @@ static const VMStateDescription vmstate_a10_pit = {
     .name = "a10.pit",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(irq_enable, AwA10PITState),
         VMSTATE_UINT32(irq_status, AwA10PITState),
hw/timer/arm_timer.c +2 -4
index fb0a45c..1452910 100644
@@ -150,8 +150,7 @@ static const VMStateDescription vmstate_arm_timer = {
     .name = "arm_timer",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(control, arm_timer_state),
         VMSTATE_UINT32(limit, arm_timer_state),
         VMSTATE_INT32(int_level, arm_timer_state),
@@ -271,8 +270,7 @@ static const VMStateDescription vmstate_sp804 = {
     .name = "sp804",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32_ARRAY(level, SP804State, 2),
         VMSTATE_END_OF_LIST()
     }
hw/timer/cadence_ttc.c +0 -2
index a279bce..19f89fc 100644
@@ -441,7 +441,6 @@ static const VMStateDescription vmstate_cadence_timer = {
     .name = "cadence_timer",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_save = cadence_timer_pre_save,
     .post_load = cadence_timer_post_load,
     .fields = (VMStateField[]) {
@@ -462,7 +461,6 @@ static const VMStateDescription vmstate_cadence_ttc = {
     .name = "cadence_TTC",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_STRUCT_ARRAY(timer, CadenceTTCState, 3, 0,
                             vmstate_cadence_timer,
hw/timer/digic-timer.c +0 -1
index 1fde22c..7e28e7e 100644
@@ -36,7 +36,6 @@ static const VMStateDescription vmstate_digic_timer = {
     .name = "digic.timer",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_PTIMER(ptimer, DigicTimerState),
         VMSTATE_UINT32(control, DigicTimerState),
hw/timer/ds1338.c +0 -1
index bb2f8ee..ec6dbee 100644
@@ -40,7 +40,6 @@ static const VMStateDescription vmstate_ds1338 = {
     .name = "ds1338",
     .version_id = 2,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_I2C_SLAVE(parent_obj, DS1338State),
         VMSTATE_INT64(offset, DS1338State),
hw/timer/exynos4210_mct.c +0 -6
index 86f4fcd..01e750e 100644
@@ -264,7 +264,6 @@ static const VMStateDescription vmstate_tick_timer = {
     .name = "exynos4210.mct.tick_timer",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(cnt_run, struct tick_timer),
         VMSTATE_UINT32(int_run, struct tick_timer),
@@ -284,7 +283,6 @@ static const VMStateDescription vmstate_lregs = {
     .name = "exynos4210.mct.lregs",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(cnt, struct lregs, L_REG_CNT_AMOUNT),
         VMSTATE_UINT32(tcon, struct lregs),
@@ -299,7 +297,6 @@ static const VMStateDescription vmstate_exynos4210_mct_lt = {
     .name = "exynos4210.mct.lt",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_INT32(id, Exynos4210MCTLT),
         VMSTATE_STRUCT(tick_timer, Exynos4210MCTLT, 0,
@@ -317,7 +314,6 @@ static const VMStateDescription vmstate_gregs = {
     .name = "exynos4210.mct.lregs",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT64(cnt, struct gregs),
         VMSTATE_UINT32(cnt_wstat, struct gregs),
@@ -336,7 +332,6 @@ static const VMStateDescription vmstate_exynos4210_mct_gt = {
     .name = "exynos4210.mct.lt",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_STRUCT(reg, Exynos4210MCTGT, 0, vmstate_gregs,
                 struct gregs),
@@ -351,7 +346,6 @@ static const VMStateDescription vmstate_exynos4210_mct_state = {
     .name = "exynos4210.mct",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(reg_mct_cfg, Exynos4210MCTState),
         VMSTATE_STRUCT_ARRAY(l_timer, Exynos4210MCTState, 2, 0,
hw/timer/exynos4210_pwm.c +0 -2
index 1aa8f4d..1c1a2b8 100644
@@ -120,7 +120,6 @@ static const VMStateDescription vmstate_exynos4210_pwm = {
     .name = "exynos4210.pwm.pwm",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(id, Exynos4210PWM),
         VMSTATE_UINT32(freq, Exynos4210PWM),
@@ -135,7 +134,6 @@ static const VMStateDescription vmstate_exynos4210_pwm_state = {
     .name = "exynos4210.pwm",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(reg_tcfg, Exynos4210PWMState, 2),
         VMSTATE_UINT32(reg_tcon, Exynos4210PWMState),
hw/timer/exynos4210_rtc.c +0 -1
index 026f81a..bf2ee9f 100644
@@ -118,7 +118,6 @@ static const VMStateDescription vmstate_exynos4210_rtc_state = {
     .name = "exynos4210.rtc",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(reg_intp, Exynos4210RTCState),
         VMSTATE_UINT32(reg_rtccon, Exynos4210RTCState),
hw/timer/hpet.c +3 -6
index e15d6bc..fa590e3 100644
@@ -270,8 +270,7 @@ static const VMStateDescription vmstate_hpet_rtc_irq_level = {
     .name = "hpet/rtc_irq_level",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(rtc_irq_level, HPETState),
         VMSTATE_END_OF_LIST()
     }
@@ -281,8 +280,7 @@ static const VMStateDescription vmstate_hpet_timer = {
     .name = "hpet_timer",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(tn, HPETTimer),
         VMSTATE_UINT64(config, HPETTimer),
         VMSTATE_UINT64(cmp, HPETTimer),
@@ -298,11 +296,10 @@ static const VMStateDescription vmstate_hpet = {
     .name = "hpet",
     .version_id = 2,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .pre_save = hpet_pre_save,
     .pre_load = hpet_pre_load,
     .post_load = hpet_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT64(config, HPETState),
         VMSTATE_UINT64(isr, HPETState),
         VMSTATE_UINT64(hpet_counter, HPETState),
hw/timer/i8254_common.c +0 -1
index 9db5c9d..07345f6 100644
@@ -180,7 +180,6 @@ static const VMStateDescription vmstate_pit_channel = {
     .name = "pit channel",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
     .fields = (VMStateField[]) {
         VMSTATE_INT32(count, PITChannelState),
         VMSTATE_UINT16(latched_count, PITChannelState),
hw/timer/imx_epit.c +1 -2
index 0dbe15c..c855eba 100644
@@ -353,8 +353,7 @@ static const VMStateDescription vmstate_imx_timer_epit = {
     .name = "imx.epit",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(cr, IMXEPITState),
         VMSTATE_UINT32(sr, IMXEPITState),
         VMSTATE_UINT32(lr, IMXEPITState),
hw/timer/imx_gpt.c +1 -2
index f2d1975..56ee4db 100644
@@ -146,8 +146,7 @@ static const VMStateDescription vmstate_imx_timer_gpt = {
     .name = "imx.gpt",
     .version_id = 3,
     .minimum_version_id = 3,
-    .minimum_version_id_old = 3,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32(cr, IMXGPTState),
         VMSTATE_UINT32(pr, IMXGPTState),
         VMSTATE_UINT32(sr, IMXGPTState),
hw/timer/lm32_timer.c +1 -2
index 8ed138c..d2ab1e7 100644
@@ -196,8 +196,7 @@ static const VMStateDescription vmstate_lm32_timer = {
     .name = "lm32-timer",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_PTIMER(ptimer, LM32TimerState),
         VMSTATE_UINT32(freq_hz, LM32TimerState),
         VMSTATE_UINT32_ARRAY(regs, LM32TimerState, R_MAX),
hw/timer/m48t59.c +1 -2
index 7cf8684..31509d5 100644
@@ -595,8 +595,7 @@ static const VMStateDescription vmstate_m48t59 = {
     .name = "m48t59",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(lock, M48t59State),
         VMSTATE_UINT16(addr, M48t59State),
         VMSTATE_VBUFFER_UINT32(buffer, M48t59State, 0, NULL, 0, size),
hw/timer/mc146818rtc.c +1 -2
index 8509309..1822af2 100644
@@ -720,9 +720,8 @@ static const VMStateDescription vmstate_rtc = {
     .name = "mc146818rtc",
     .version_id = 3,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = rtc_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_BUFFER(cmos_data, RTCState),
         VMSTATE_UINT8(cmos_index, RTCState),
         VMSTATE_UNUSED(7*4),
hw/timer/milkymist-sysctl.c +1 -2
index 94246e5..30535a4 100644
@@ -295,8 +295,7 @@ static const VMStateDescription vmstate_milkymist_sysctl = {
     .name = "milkymist-sysctl",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT32_ARRAY(regs, MilkymistSysctlState, R_MAX),
         VMSTATE_PTIMER(ptimer0, MilkymistSysctlState),
         VMSTATE_PTIMER(ptimer1, MilkymistSysctlState),
hw/timer/pxa2xx_timer.c +0 -3
index 0f546c4..130e9dc 100644
@@ -476,7 +476,6 @@ static const VMStateDescription vmstate_pxa2xx_timer0_regs = {
     .name = "pxa2xx_timer0",
     .version_id = 2,
     .minimum_version_id = 2,
-    .minimum_version_id_old = 2,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(value, PXA2xxTimer0),
         VMSTATE_END_OF_LIST(),
@@ -487,7 +486,6 @@ static const VMStateDescription vmstate_pxa2xx_timer4_regs = {
     .name = "pxa2xx_timer4",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_STRUCT(tm, PXA2xxTimer4, 1,
                         vmstate_pxa2xx_timer0_regs, PXA2xxTimer0),
@@ -509,7 +507,6 @@ static const VMStateDescription vmstate_pxa2xx_timer_regs = {
     .name = "pxa2xx_timer",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = pxa25x_timer_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_INT32(clock, PXA2xxTimerInfo),
hw/timer/slavio_timer.c +2 -4
index e4dccea..45d97e6 100644
@@ -329,8 +329,7 @@ static const VMStateDescription vmstate_timer = {
     .name ="timer",
     .version_id = 3,
     .minimum_version_id = 3,
-    .minimum_version_id_old = 3,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT64(limit, CPUTimerState),
         VMSTATE_UINT32(count, CPUTimerState),
         VMSTATE_UINT32(counthigh, CPUTimerState),
@@ -345,8 +344,7 @@ static const VMStateDescription vmstate_slavio_timer = {
     .name ="slavio_timer",
     .version_id = 3,
     .minimum_version_id = 3,
-    .minimum_version_id_old = 3,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT_ARRAY(cputimer, SLAVIO_TIMERState, MAX_CPUS + 1, 3,
                              vmstate_timer, CPUTimerState),
         VMSTATE_END_OF_LIST()
hw/timer/twl92230.c +2 -4
index 85d5990..7ded4ba 100644
@@ -772,8 +772,7 @@ static const VMStateDescription vmstate_menelaus_tm = {
     .name = "menelaus_tm",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT16_HACK(tm_sec, struct tm),
         VMSTATE_UINT16_HACK(tm_min, struct tm),
         VMSTATE_UINT16_HACK(tm_hour, struct tm),
@@ -811,10 +810,9 @@ static const VMStateDescription vmstate_menelaus = {
     .name = "menelaus",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
     .pre_save = menelaus_pre_save,
     .post_load = menelaus_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_INT32(firstbyte, MenelausState),
         VMSTATE_UINT8(reg, MenelausState),
         VMSTATE_UINT8_ARRAY(vcore, MenelausState, 5),
hw/usb/bus.c +1 -1
index fe70429..5f201cb 100644
@@ -61,7 +61,7 @@ const VMStateDescription vmstate_usb_device = {
     .version_id = 1,
     .minimum_version_id = 1,
     .post_load = usb_device_post_load,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT8(addr, USBDevice),
         VMSTATE_INT32(state, USBDevice),
         VMSTATE_INT32(remote_wakeup, USBDevice),
hw/usb/dev-hid.c +2 -2
index f36e617..d097d93 100644
@@ -622,7 +622,7 @@ static const VMStateDescription vmstate_usb_ptr = {
     .version_id = 1,
     .minimum_version_id = 1,
     .post_load = usb_ptr_post_load,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_USB_DEVICE(dev, USBHIDState),
         VMSTATE_HID_POINTER_DEVICE(hid, USBHIDState),
         VMSTATE_END_OF_LIST()
@@ -633,7 +633,7 @@ static const VMStateDescription vmstate_usb_kbd = {
     .name = "usb-kbd",
     .version_id = 1,
     .minimum_version_id = 1,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_USB_DEVICE(dev, USBHIDState),
         VMSTATE_HID_KEYBOARD_DEVICE(hid, USBHIDState),
         VMSTATE_END_OF_LIST()
hw/usb/dev-hub.c +2 -2
index bc03531..7492174 100644
@@ -540,7 +540,7 @@ static const VMStateDescription vmstate_usb_hub_port = {
     .name = "usb-hub-port",
     .version_id = 1,
     .minimum_version_id = 1,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT16(wPortStatus, USBHubPort),
         VMSTATE_UINT16(wPortChange, USBHubPort),
         VMSTATE_END_OF_LIST()
@@ -551,7 +551,7 @@ static const VMStateDescription vmstate_usb_hub = {
     .name = "usb-hub",
     .version_id = 1,
     .minimum_version_id = 1,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_USB_DEVICE(dev, USBHubState),
         VMSTATE_STRUCT_ARRAY(ports, USBHubState, NUM_PORTS, 0,
                              vmstate_usb_hub_port, USBHubPort),
hw/usb/dev-storage.c +1 -1
index 2852669..e919100 100644
@@ -716,7 +716,7 @@ static const VMStateDescription vmstate_usb_msd = {
     .name = "usb-storage",
     .version_id = 1,
     .minimum_version_id = 1,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_USB_DEVICE(dev, MSDState),
         VMSTATE_UINT32(mode, MSDState),
         VMSTATE_UINT32(scsi_len, MSDState),
hw/usb/hcd-ehci-pci.c +1 -1
index 484a9bd..505741a 100644
@@ -108,7 +108,7 @@ static const VMStateDescription vmstate_ehci_pci = {
     .name        = "ehci",
     .version_id  = 2,
     .minimum_version_id  = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(pcidev, EHCIPCIState),
         VMSTATE_STRUCT(ehci, EHCIPCIState, 2, vmstate_ehci, EHCIState),
         VMSTATE_END_OF_LIST()
hw/usb/hcd-ehci-sysbus.c +1 -1
index fe6eea5..19ed2c2 100644
@@ -21,7 +21,7 @@ static const VMStateDescription vmstate_ehci_sysbus = {
     .name        = "ehci-sysbus",
     .version_id  = 2,
     .minimum_version_id  = 1,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         VMSTATE_STRUCT(ehci, EHCISysBusState, 2, vmstate_ehci, EHCIState),
         VMSTATE_END_OF_LIST()
     }
hw/usb/hcd-ehci.c +1 -1
index 355bbd6..a3ae9f2 100644
@@ -2492,7 +2492,7 @@ const VMStateDescription vmstate_ehci = {
     .minimum_version_id  = 1,
     .pre_save    = usb_ehci_pre_save,
     .post_load   = usb_ehci_post_load,
-    .fields      = (VMStateField[]) {
+    .fields = (VMStateField[]) {
         /* mmio registers */
         VMSTATE_UINT32(usbcmd, EHCIState),
         VMSTATE_UINT32(usbsts, EHCIState),
hw/usb/hcd-uhci.c +2 -4
index 0820244..9b1166b 100644
@@ -422,8 +422,7 @@ static const VMStateDescription vmstate_uhci_port = {
     .name = "uhci port",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_UINT16(ctrl, UHCIPort),
         VMSTATE_END_OF_LIST()
     }
@@ -444,9 +443,8 @@ static const VMStateDescription vmstate_uhci = {
     .name = "uhci",
     .version_id = 3,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .post_load = uhci_post_load,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, UHCIState),
         VMSTATE_UINT8_EQUAL(num_ports_vmstate, UHCIState),
         VMSTATE_STRUCT_ARRAY(ports, UHCIState, NB_PORTS, 1,
hw/watchdog/wdt_i6300esb.c +7 -7
index 36d3887..b3d6f39 100644
@@ -379,18 +379,18 @@ static const VMStateDescription vmstate_i6300esb = {
      * version_id to be set for every build. This eventually broke
      * migration.
      *
-     * To correct this without breaking old->new migration for older versions
-     * of QEMU, we've set version_id to a value high enough to exceed all past
-     * values of sizeof(I6300State) across various build environments, and have
-     * reset minimum_version_id_old/minimum_version_id to 1, since this VMSD
-     * has never changed and thus can accept all past versions.
+     * To correct this without breaking old->new migration for older
+     * versions of QEMU, we've set version_id to a value high enough
+     * to exceed all past values of sizeof(I6300State) across various
+     * build environments, and have reset minimum_version_id to 1,
+     * since this VMSD has never changed and thus can accept all past
+     * versions.
      *
      * For future changes we can treat these values as we normally would.
      */
     .version_id = 10000,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, I6300State),
         VMSTATE_INT32(reboot_enabled, I6300State),
         VMSTATE_INT32(clock_scale, I6300State),
hw/watchdog/wdt_ib700.c +1 -2
index bc994a4..99bd7ea 100644
@@ -90,8 +90,7 @@ static const VMStateDescription vmstate_ib700 = {
     .name = "ib700_wdt",
     .version_id = 0,
     .minimum_version_id = 0,
-    .minimum_version_id_old = 0,
-    .fields      = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_TIMER(timer, IB700State),
         VMSTATE_END_OF_LIST()
     }
hw/xen/xen_platform.c +1 -2
index 1d9d0e9..8bb18b4 100644
@@ -375,9 +375,8 @@ static const VMStateDescription vmstate_xen_platform = {
     .name = "platform",
     .version_id = 4,
     .minimum_version_id = 4,
-    .minimum_version_id_old = 4,
     .post_load = xen_platform_post_load,
-    .fields = (VMStateField []) {
+    .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, PCIXenPlatformState),
         VMSTATE_UINT8(flags, PCIXenPlatformState),
         VMSTATE_END_OF_LIST()
target-alpha/machine.c +0 -2
index 889f2fc..e796bbe 100644
@@ -72,7 +72,6 @@ static const VMStateDescription vmstate_env = {
     .name = "env",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = vmstate_env_fields,
 };
 
@@ -86,6 +85,5 @@ const VMStateDescription vmstate_alpha_cpu = {
     .name = "cpu",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = vmstate_cpu_fields,
 };
target-arm/machine.c +0 -5
index 7ced87a..ee67b67 100644
@@ -39,7 +39,6 @@ static const VMStateDescription vmstate_vfp = {
     .name = "cpu/vfp",
     .version_id = 3,
     .minimum_version_id = 3,
-    .minimum_version_id_old = 3,
     .fields = (VMStateField[]) {
         VMSTATE_FLOAT64_ARRAY(env.vfp.regs, ARMCPU, 64),
         /* The xregs array is a little awkward because element 1 (FPSCR)
@@ -72,7 +71,6 @@ static const VMStateDescription vmstate_iwmmxt = {
     .name = "cpu/iwmmxt",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT64_ARRAY(env.iwmmxt.regs, ARMCPU, 16),
         VMSTATE_UINT32_ARRAY(env.iwmmxt.cregs, ARMCPU, 16),
@@ -92,7 +90,6 @@ static const VMStateDescription vmstate_m = {
     .name = "cpu/m",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(env.v7m.other_sp, ARMCPU),
         VMSTATE_UINT32(env.v7m.vecbase, ARMCPU),
@@ -116,7 +113,6 @@ static const VMStateDescription vmstate_thumb2ee = {
     .name = "cpu/thumb2ee",
     .version_id = 1,
     .minimum_version_id = 1,
-    .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(env.teecr, ARMCPU),
         VMSTATE_UINT32(env.teehbr, ARMCPU),
@@ -224,7 +220,6 @@ const VMStateDescription vmstate_arm_cpu = {
     .name = "cpu",
     .version_id = 14,
     .minimum_version_id = 14,
-    .minimum_version_id_old = 14,
     .pre_save = cpu_pre_save,
     .post_load = cpu_post_load,
     .fields = (VMStateField[]) {
target-i386/machine.c +19 -38

171 lines not on this page · raw message

target-lm32/machine.c +2 -4
index 9e0919c..8327c6d 100644

Lines of this file are not shown. View the raw message.

target-moxie/machine.c +1 -2
index 0f5992b..da1a857 100644

Lines of this file are not shown. View the raw message.

target-openrisc/machine.c +0 -2
index 6f864fe..9f66a9c 100644

Lines of this file are not shown. View the raw message.

target-ppc/machine.c +13 -25
index 063b379..d7807f8 100644

Lines of this file are not shown. View the raw message.

tests/test-vmstate.c +3 -6
index 75cd1a1..30cc721 100644

Lines of this file are not shown. View the raw message.

util/fifo8.c +1 -2
index 6a43482..0ea5ad9 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.9.0

Part of the diff is not shown here. View the raw message.

#3 lore raw

Re: [Qemu-devel] [PATCH 02/97] savevm: Remove all the unneded version_minimum_id_old (Massive)

Quoted 8 lines · Juan Quintela

After previous Peter patch, they are redundant. This way we don't asign them except when needed. Once there, there were lots of case where the ".fields" indentation was wrong:

     .fields = (VMStateField []) {
and
     .fields =      (VMStateField []) {
Quoted 8 lines

Change all the combinations to:

     .fields = (VMStateField[]){

The biggest problem (appart of aesthetics) was that checkpatch complained when we copy&pasted the code from one place to another.

 211 files changed, 289 insertions(+), 621 deletions(-)

I'm really not a fan of this kind of single patch that touches a huge number of files at once. They're basically impossible to review and they introduce the possibility of conflicts between submaintainer tree changes and the big patch. There's no reason to have all these changes in a single patch -- I'd much rather see one patch per subsystem sent to the relevant submaintainers, plus one for all the unmaintained stuff which can go via the migration tree.

thanks
-- PMM

#4 lore raw

Re: [Qemu-devel] [PATCH 02/97] savevm: Remove all the unneded version_minimum_id_old (Massive)

Quoted 18 lines · Peter Maydell
Quoted 8 lines · Juan Quintela

After previous Peter patch, they are redundant. This way we don't asign them except when needed. Once there, there were lots of case where the ".fields" indentation was wrong:

     .fields = (VMStateField []) {
and
     .fields =      (VMStateField []) {
Quoted 8 lines

Change all the combinations to:

     .fields = (VMStateField[]){

The biggest problem (appart of aesthetics) was that checkpatch complained when we copy&pasted the code from one place to another.

 211 files changed, 289 insertions(+), 621 deletions(-)
Quoted 9 lines

I'm really not a fan of this kind of single patch that touches a huge number of files at once. They're basically impossible to review and they introduce the possibility of conflicts between submaintainer tree changes and the big patch. There's no reason to have all these changes in a single patch -- I'd much rather see one patch per subsystem sent to the relevant submaintainers, plus one for all the unmaintained stuff which can go via the migration tree.

If you say how to split, I am all for it. But remomeber that all this changes go inside VMSTateDescription descriptions, touch nothing else outside of that. And that is not something that is touched a lot to have lots of conflicts.

My problem with leaving things as are, is that people continue to copy from the ones that still use the old system/format :-(

Later, Juan.

#5 lore raw

Re: [Qemu-devel] [PATCH 02/97] savevm: Remove all the unneded version_minimum_id_old (Massive)

Quoted 11 lines · Juan Quintela
Quoted 9 lines · Peter Maydell

I'm really not a fan of this kind of single patch that touches a huge number of files at once. They're basically impossible to review and they introduce the possibility of conflicts between submaintainer tree changes and the big patch. There's no reason to have all these changes in a single patch -- I'd much rather see one patch per subsystem sent to the relevant submaintainers, plus one for all the unmaintained stuff which can go via the migration tree.

Quoted 1 line

If you say how to split, I am all for it.

Like I said, one patch per maintained subsystem,
one patch for the leftovers.

thanks
-- PMM

#6 lore raw

Re: [Qemu-devel] [PATCH 02/97] savevm: Remove all the unneded version_minimum_id_old (Massive)

Quoted 12 lines · Peter Maydell
Quoted 11 lines · Juan Quintela
Quoted 9 lines · Peter Maydell

I'm really not a fan of this kind of single patch that touches a huge number of files at once. They're basically impossible to review and they introduce the possibility of conflicts between submaintainer tree changes and the big patch. There's no reason to have all these changes in a single patch -- I'd much rather see one patch per subsystem sent to the relevant submaintainers, plus one for all the unmaintained stuff which can go via the migration tree.

Quoted 4 lines
Quoted 1 line

If you say how to split, I am all for it.

Like I said, one patch per maintained subsystem,
one patch for the leftovers.

Easier said than done. MAINTAINERS has more than 100 sections, yet it leaves more than 1200 files uncovered, roughly half of them C sources. I doubt splitting mechanically along those sections plus a catch-all patch for the "unmaintained" files would be appreciated.

Could you give some guidance on splitting?

#7 lore raw

Re: [Qemu-devel] [PATCH 02/97] savevm: Remove all the unneded version_minimum_id_old (Massive)

Quoted 7 lines · Markus Armbruster
Quoted 4 lines · Peter Maydell
Quoted 1 line · Juan Quintela

Peter Maydell <[email protected]> wrote:

Like I said, one patch per maintained subsystem,
one patch for the leftovers.

Quoted 6 lines

Easier said than done. MAINTAINERS has more than 100 sections, yet it leaves more than 1200 files uncovered, roughly half of them C sources. I doubt splitting mechanically along those sections plus a catch-all patch for the "unmaintained" files would be appreciated.

Could you give some guidance on splitting?

Well, I would just eyeball the filenames. If you had a patch with the ARM related stuff, a patch for the things that are x86 PC devices, one for the PPC devices, and a USB patch, that ought to whittle the list down a fair amount.

thanks
-- PMM

#8 lore raw

Re: [Qemu-devel] [PATCH 02/97] savevm: Remove all the unneded version_minimum_id_old (Massive)

Quoted 13 lines · Peter Maydell
Quoted 12 lines · Markus Armbruster
Quoted 4 lines · Peter Maydell
Quoted 1 line · Juan Quintela

Peter Maydell <[email protected]> wrote:

Like I said, one patch per maintained subsystem,
one patch for the leftovers.

Easier said than done. MAINTAINERS has more than 100 sections, yet it leaves more than 1200 files uncovered, roughly half of them C sources. I doubt splitting mechanically along those sections plus a catch-all patch for the "unmaintained" files would be appreciated.

Quoted 7 lines
Quoted 1 line

Could you give some guidance on splitting?

Well, I would just eyeball the filenames. If you had a patch with the ARM related stuff, a patch for the things that are x86 PC devices, one for the PPC devices, and a USB patch, that ought to whittle the list down a fair amount.

Thanks. Will do.

Later, Juan.

#9 lore raw

Re: [Qemu-devel] [PATCH 02/97] savevm: Remove all the unneded version_minimum_id_old (Massive)

In reply to Markus Armbruster
Quoted 19 lines · Markus Armbruster
Quoted 12 lines · Peter Maydell
Quoted 11 lines · Juan Quintela
Quoted 9 lines · Peter Maydell

I'm really not a fan of this kind of single patch that touches a huge number of files at once. They're basically impossible to review and they introduce the possibility of conflicts between submaintainer tree changes and the big patch. There's no reason to have all these changes in a single patch -- I'd much rather see one patch per subsystem sent to the relevant submaintainers, plus one for all the unmaintained stuff which can go via the migration tree.

Quoted 4 lines
Quoted 1 line

If you say how to split, I am all for it.

Like I said, one patch per maintained subsystem,
one patch for the leftovers.

Quoted 6 lines

Easier said than done. MAINTAINERS has more than 100 sections, yet it leaves more than 1200 files uncovered, roughly half of them C sources. I doubt splitting mechanically along those sections plus a catch-all patch for the "unmaintained" files would be appreciated.

Could you give some guidance on splitting?

+1

#10 lore raw

PATCH 3/97 vmstate: return error in case of error

In reply to Juan Quintela

If there is an error while loading a field, we should stop reading and not continue with the rest of fields.

---
 vmstate.c | 3 +++
 1 file changed, 3 insertions(+)
vmstate.c +3 -0
index bfa34cc..d82cccf 100644
@@ -74,6 +74,9 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
                     ret = field->info->get(f, addr, size);
 
                 }
+                if (ret >= 0) {
+                    ret = qemu_file_get_error(f);
+                }
                 if (ret < 0) {
                     trace_vmstate_load_field_error(field->name, ret);
                     return ret;
Signature · 1 line
1.9.0
Reviewed-by on v1 3/97
#11 lore raw

Re: [Qemu-devel] [PATCH 03/97] vmstate: return error in case of error

Quoted 4 lines · * Juan Quintela ([email protected]) wrote:

If there is an error while loading a field, we should stop reading and not continue with the rest of fields.

Quoted 22 lines
---
 vmstate.c | 3 +++
 1 file changed, 3 insertions(+)
vmstate.c +3 -0
index bfa34cc..d82cccf 100644
@@ -74,6 +74,9 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
                     ret = field->info->get(f, addr, size);
 
                 }
+                if (ret >= 0) {
+                    ret = qemu_file_get_error(f);
+                }
                 if (ret < 0) {
                     trace_vmstate_load_field_error(field->name, ret);
                     return ret;
Signature · 1 line
1.9.0

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#12 lore raw

PATCH 4/97 vmstate: reduce code duplication

In reply to Juan Quintela

From: "Michael S. Tsirkin" <[email protected]>

move size offset and number of elements math out to functions, to reduce code duplication.

---
 vmstate.c | 100 ++++++++++++++++++++++++++++++++------------------------------
 1 file changed, 52 insertions(+), 48 deletions(-)
vmstate.c +52 -48
index d82cccf..cb0af5e 100644
@@ -10,6 +10,50 @@ static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
 static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
                                    void *opaque);
 
+static int vmstate_n_elems(void *opaque, VMStateField *field)
+{
+    int n_elems = 1;
+
+    if (field->flags & VMS_ARRAY) {
+        n_elems = field->num;
+    } else if (field->flags & VMS_VARRAY_INT32) {
+        n_elems = *(int32_t *)(opaque+field->num_offset);
+    } else if (field->flags & VMS_VARRAY_UINT32) {
+        n_elems = *(uint32_t *)(opaque+field->num_offset);
+    } else if (field->flags & VMS_VARRAY_UINT16) {
+        n_elems = *(uint16_t *)(opaque+field->num_offset);
+    } else if (field->flags & VMS_VARRAY_UINT8) {
+        n_elems = *(uint8_t *)(opaque+field->num_offset);
+    }
+
+    return n_elems;
+}
+
+static int vmstate_size(void *opaque, VMStateField *field)
+{
+    int size = field->size;
+
+    if (field->flags & VMS_VBUFFER) {
+        size = *(int32_t *)(opaque+field->size_offset);
+        if (field->flags & VMS_MULTIPLY) {
+            size *= field->size;
+        }
+    }
+
+    return size;
+}
+
+static void *vmstate_base_addr(void *opaque, VMStateField *field)
+{
+    void *base_addr = opaque + field->offset;
+
+    if (field->flags & VMS_POINTER) {
+        base_addr = *(void **)base_addr + field->start;
+    }
+
+    return base_addr;
+}
+
 int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
                        void *opaque, int version_id)
 {
@@ -37,30 +81,10 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
              field->field_exists(opaque, version_id)) ||
             (!field->field_exists &&
              field->version_id <= version_id)) {
-            void *base_addr = opaque + field->offset;
-            int i, n_elems = 1;
-            int size = field->size;
-
-            if (field->flags & VMS_VBUFFER) {
-                size = *(int32_t *)(opaque+field->size_offset);
-                if (field->flags & VMS_MULTIPLY) {
-                    size *= field->size;
-                }
-            }
-            if (field->flags & VMS_ARRAY) {
-                n_elems = field->num;
-            } else if (field->flags & VMS_VARRAY_INT32) {
-                n_elems = *(int32_t *)(opaque+field->num_offset);
-            } else if (field->flags & VMS_VARRAY_UINT32) {
-                n_elems = *(uint32_t *)(opaque+field->num_offset);
-            } else if (field->flags & VMS_VARRAY_UINT16) {
-                n_elems = *(uint16_t *)(opaque+field->num_offset);
-            } else if (field->flags & VMS_VARRAY_UINT8) {
-                n_elems = *(uint8_t *)(opaque+field->num_offset);
-            }
-            if (field->flags & VMS_POINTER) {
-                base_addr = *(void **)base_addr + field->start;
-            }
+            void *base_addr = vmstate_base_addr(opaque, field);
+            int i, n_elems = vmstate_n_elems(opaque, field);
+            int size = vmstate_size(opaque, field);
+
             for (i = 0; i < n_elems; i++) {
                 void *addr = base_addr + size * i;
 
@@ -106,30 +130,10 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
     while (field->name) {
         if (!field->field_exists ||
             field->field_exists(opaque, vmsd->version_id)) {
-            void *base_addr = opaque + field->offset;
-            int i, n_elems = 1;
-            int size = field->size;
-
-            if (field->flags & VMS_VBUFFER) {
-                size = *(int32_t *)(opaque+field->size_offset);
-                if (field->flags & VMS_MULTIPLY) {
-                    size *= field->size;
-                }
-            }
-            if (field->flags & VMS_ARRAY) {
-                n_elems = field->num;
-            } else if (field->flags & VMS_VARRAY_INT32) {
-                n_elems = *(int32_t *)(opaque+field->num_offset);
-            } else if (field->flags & VMS_VARRAY_UINT32) {
-                n_elems = *(uint32_t *)(opaque+field->num_offset);
-            } else if (field->flags & VMS_VARRAY_UINT16) {
-                n_elems = *(uint16_t *)(opaque+field->num_offset);
-            } else if (field->flags & VMS_VARRAY_UINT8) {
-                n_elems = *(uint8_t *)(opaque+field->num_offset);
-            }
-            if (field->flags & VMS_POINTER) {
-                base_addr = *(void **)base_addr + field->start;
-            }
+            void *base_addr = vmstate_base_addr(opaque, field);
+            int i, n_elems = vmstate_n_elems(opaque, field);
+            int size = vmstate_size(opaque, field);
+
             for (i = 0; i < n_elems; i++) {
                 void *addr = base_addr + size * i;
 
Signature · 1 line
1.9.0
#13 lore raw

PATCH 5/97 vmstate: refactor opening of files

In reply to Juan Quintela
---
 tests/test-vmstate.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)
tests/test-vmstate.c +19 -19
index 30cc721..8b242c4 100644
@@ -44,14 +44,14 @@ void yield_until_fd_readable(int fd)
 }
 
 /* Duplicate temp_fd and seek to the beginning of the file */
-static int dup_temp_fd(bool truncate)
+static QEMUFile *open_test_file(bool write)
 {
     int fd = dup(temp_fd);
     lseek(fd, 0, SEEK_SET);
-    if (truncate) {
+    if (write) {
         g_assert_cmpint(ftruncate(fd, 0), ==, 0);
     }
-    return fd;
+    return qemu_fdopen(fd, write ? "wb" : "rb");
 }
 
 typedef struct TestSruct {
@@ -76,13 +76,13 @@ static const VMStateDescription vmstate_simple = {
 
 static void test_simple_save(void)
 {
-    QEMUFile *fsave = qemu_fdopen(dup_temp_fd(true), "wb");
+    QEMUFile *fsave = open_test_file(true);
     TestStruct obj = { .a = 1, .b = 2, .c = 3, .d = 4 };
     vmstate_save_state(fsave, &vmstate_simple, &obj);
     g_assert(!qemu_file_get_error(fsave));
     qemu_fclose(fsave);
 
-    QEMUFile *loading = qemu_fdopen(dup_temp_fd(false), "rb");
+    QEMUFile *loading = open_test_file(false);
     uint8_t expected[] = {
         0, 0, 0, 1, /* a */
         0, 0, 0, 2, /* b */
@@ -104,7 +104,7 @@ static void test_simple_save(void)
 
 static void test_simple_load(void)
 {
-    QEMUFile *fsave = qemu_fdopen(dup_temp_fd(true), "wb");
+    QEMUFile *fsave = open_test_file(true);
     uint8_t buf[] = {
         0, 0, 0, 10,             /* a */
         0, 0, 0, 20,             /* b */
@@ -115,7 +115,7 @@ static void test_simple_load(void)
     qemu_put_buffer(fsave, buf, sizeof(buf));
     qemu_fclose(fsave);
 
-    QEMUFile *loading = qemu_fdopen(dup_temp_fd(false), "rb");
+    QEMUFile *loading = open_test_file(false);
     TestStruct obj;
     vmstate_load_state(loading, &vmstate_simple, &obj, 1);
     g_assert(!qemu_file_get_error(loading));
@@ -145,7 +145,7 @@ static const VMStateDescription vmstate_versioned = {
 
 static void test_load_v1(void)
 {
-    QEMUFile *fsave = qemu_fdopen(dup_temp_fd(true), "wb");
+    QEMUFile *fsave = open_test_file(true);
     uint8_t buf[] = {
         0, 0, 0, 10,             /* a */
         0, 0, 0, 30,             /* c */
@@ -155,7 +155,7 @@ static void test_load_v1(void)
     qemu_put_buffer(fsave, buf, sizeof(buf));
     qemu_fclose(fsave);
 
-    QEMUFile *loading = qemu_fdopen(dup_temp_fd(false), "rb");
+    QEMUFile *loading = open_test_file(false);
     TestStruct obj = { .b = 200, .e = 500, .f = 600 };
     vmstate_load_state(loading, &vmstate_versioned, &obj, 1);
     g_assert(!qemu_file_get_error(loading));
@@ -170,7 +170,7 @@ static void test_load_v1(void)
 
 static void test_load_v2(void)
 {
-    QEMUFile *fsave = qemu_fdopen(dup_temp_fd(true), "wb");
+    QEMUFile *fsave = open_test_file(true);
     uint8_t buf[] = {
         0, 0, 0, 10,             /* a */
         0, 0, 0, 20,             /* b */
@@ -183,7 +183,7 @@ static void test_load_v2(void)
     qemu_put_buffer(fsave, buf, sizeof(buf));
     qemu_fclose(fsave);
 
-    QEMUFile *loading = qemu_fdopen(dup_temp_fd(false), "rb");
+    QEMUFile *loading = open_test_file(false);
     TestStruct obj;
     vmstate_load_state(loading, &vmstate_versioned, &obj, 2);
     g_assert_cmpint(obj.a, ==, 10);
@@ -219,14 +219,14 @@ static const VMStateDescription vmstate_skipping = {
 
 static void test_save_noskip(void)
 {
-    QEMUFile *fsave = qemu_fdopen(dup_temp_fd(true), "wb");
+    QEMUFile *fsave = open_test_file(true);
     TestStruct obj = { .a = 1, .b = 2, .c = 3, .d = 4, .e = 5, .f = 6,
                        .skip_c_e = false };
     vmstate_save_state(fsave, &vmstate_skipping, &obj);
     g_assert(!qemu_file_get_error(fsave));
     qemu_fclose(fsave);
 
-    QEMUFile *loading = qemu_fdopen(dup_temp_fd(false), "rb");
+    QEMUFile *loading = open_test_file(false);
     uint8_t expected[] = {
         0, 0, 0, 1,             /* a */
         0, 0, 0, 2,             /* b */
@@ -250,14 +250,14 @@ static void test_save_noskip(void)
 
 static void test_save_skip(void)
 {
-    QEMUFile *fsave = qemu_fdopen(dup_temp_fd(true), "wb");
+    QEMUFile *fsave = open_test_file(true);
     TestStruct obj = { .a = 1, .b = 2, .c = 3, .d = 4, .e = 5, .f = 6,
                        .skip_c_e = true };
     vmstate_save_state(fsave, &vmstate_skipping, &obj);
     g_assert(!qemu_file_get_error(fsave));
     qemu_fclose(fsave);
 
-    QEMUFile *loading = qemu_fdopen(dup_temp_fd(false), "rb");
+    QEMUFile *loading = open_test_file(false);
     uint8_t expected[] = {
         0, 0, 0, 1,             /* a */
         0, 0, 0, 2,             /* b */
@@ -280,7 +280,7 @@ static void test_save_skip(void)
 
 static void test_load_noskip(void)
 {
-    QEMUFile *fsave = qemu_fdopen(dup_temp_fd(true), "wb");
+    QEMUFile *fsave = open_test_file(true);
     uint8_t buf[] = {
         0, 0, 0, 10,             /* a */
         0, 0, 0, 20,             /* b */
@@ -293,7 +293,7 @@ static void test_load_noskip(void)
     qemu_put_buffer(fsave, buf, sizeof(buf));
     qemu_fclose(fsave);
 
-    QEMUFile *loading = qemu_fdopen(dup_temp_fd(false), "rb");
+    QEMUFile *loading = open_test_file(false);
     TestStruct obj = { .skip_c_e = false };
     vmstate_load_state(loading, &vmstate_skipping, &obj, 2);
     g_assert(!qemu_file_get_error(loading));
@@ -308,7 +308,7 @@ static void test_load_noskip(void)
 
 static void test_load_skip(void)
 {
-    QEMUFile *fsave = qemu_fdopen(dup_temp_fd(true), "wb");
+    QEMUFile *fsave = open_test_file(true);
     uint8_t buf[] = {
         0, 0, 0, 10,             /* a */
         0, 0, 0, 20,             /* b */
@@ -319,7 +319,7 @@ static void test_load_skip(void)
     qemu_put_buffer(fsave, buf, sizeof(buf));
     qemu_fclose(fsave);
 
-    QEMUFile *loading = qemu_fdopen(dup_temp_fd(false), "rb");
+    QEMUFile *loading = open_test_file(false);
     TestStruct obj = { .skip_c_e = true, .c = 300, .e = 500 };
     vmstate_load_state(loading, &vmstate_skipping, &obj, 2);
     g_assert(!qemu_file_get_error(loading));
Signature · 1 line
1.9.0
#15 lore raw

PATCH 6/97 vmstate: Refactor & increase tests for primitive types

In reply to Juan Quintela

This commit refactor the simple tests to test all integer types. We move to hex because it is easier to read values of different types.

---
 tests/test-vmstate.c | 195 +++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 150 insertions(+), 45 deletions(-)
tests/test-vmstate.c +150 -45
index 8b242c4..39a769e 100644
@@ -54,80 +54,186 @@ static QEMUFile *open_test_file(bool write)
     return qemu_fdopen(fd, write ? "wb" : "rb");
 }
 
-typedef struct TestSruct {
-    uint32_t a, b, c, e;
-    uint64_t d, f;
-    bool skip_c_e;
-} TestStruct;
+/* Test struct that we are going to use for our tests */
+
+typedef struct TestSimple {
+    bool     b_1,   b_2;
+    uint8_t  u8_1,  u8_2;
+    uint16_t u16_1, u16_2;
+    uint32_t u32_1, u32_2;
+    uint64_t u64_1, u64_2;
+    int8_t   i8_1,  i8_2;
+    int16_t  i16_1, i16_2;
+    int32_t  i32_1, i32_2;
+    int64_t  i64_1, i64_2;
+} TestSimple;
+
+/* Object instantiation, we are going to use it in more than one test */
+
+TestSimple obj_simple = {
+    .b_1 = true,
+    .b_2 = false,
+    .u8_1 = 129,
+    .u8_1 = 130,
+    .u16_1 = 512,
+    .u16_2 = 45000,
+    .u32_1 = 70000,
+    .u32_2 = 100000,
+    .u64_1 = 12121212,
+    .u64_2 = 23232323,
+    .i8_1 = 65,
+    .i8_2 = -65,
+    .i16_1 = 512,
+    .i16_2 = -512,
+    .i32_1 = 70000,
+    .i32_2 = -70000,
+    .i64_1 = 12121212,
+    .i64_2 = -12121212,
+};
 
+/* Description of the values.  If you add a primitive type
+   you are expected to add a test here */
 
-static const VMStateDescription vmstate_simple = {
-    .name = "test",
+static const VMStateDescription vmstate_simple_primitive = {
+    .name = "simple/primitive",
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_UINT32(a, TestStruct),
-        VMSTATE_UINT32(b, TestStruct),
-        VMSTATE_UINT32(c, TestStruct),
-        VMSTATE_UINT64(d, TestStruct),
+        VMSTATE_BOOL(b_1, TestSimple),
+        VMSTATE_BOOL(b_2, TestSimple),
+        VMSTATE_UINT8(u8_1, TestSimple),
+        VMSTATE_UINT16(u16_1, TestSimple),
+        VMSTATE_UINT32(u32_1, TestSimple),
+        VMSTATE_UINT64(u64_1, TestSimple),
+        VMSTATE_INT8(i8_1, TestSimple),
+        VMSTATE_INT8(i8_2, TestSimple),
+        VMSTATE_INT16(i16_1, TestSimple),
+        VMSTATE_INT16(i16_2, TestSimple),
+        VMSTATE_INT32(i32_1, TestSimple),
+        VMSTATE_INT32(i32_2, TestSimple),
+        VMSTATE_INT64(i64_1, TestSimple),
+        VMSTATE_INT64(i64_2, TestSimple),
         VMSTATE_END_OF_LIST()
     }
 };
 
-static void test_simple_save(void)
+/* It describes what goes through the wire.  Our tests are basically:
+
+   * save test
+     - save a struct a vmstate to a file
+     - read that file back (binary read, no vmstate)
+     - compare it with what we expect to be on the wire
+   * load test
+     - save to the file what we expect to be on the wire
+     - read struct back with vmstate in a different
+     - compare back with the original struct
+*/
+
+uint8_t wire_simple_primitive[] = {
+    /* b_1 */   0x01,
+    /* b_2 */   0x00,
+    /* u8_1 */  0x82,
+    /* u16_1 */ 0x02, 0x00,
+    /* u32_1 */ 0x00, 0x01, 0x11, 0x70,
+    /* u64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
+    /* i8_1 */  0x41,
+    /* i8_2 */  0xbf,
+    /* i16_1 */ 0x02, 0x00,
+    /* i16_2 */ 0xfe, 0x0,
+    /* i32_1 */ 0x00, 0x01, 0x11, 0x70,
+    /* i32_2 */ 0xff, 0xfe, 0xee, 0x90,
+    /* i64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
+    /* i64_2 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0x47, 0x0b, 0x84,
+    QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
+};
+
+#define SUCCESS(val) \
+    g_assert_cmpint((val), ==, 0)
+
+#define FAILURE(val) \
+    g_assert_cmpint((val), !=, 0)
+
+static void test_simple_primitive(void)
 {
     QEMUFile *fsave = open_test_file(true);
-    TestStruct obj = { .a = 1, .b = 2, .c = 3, .d = 4 };
-    vmstate_save_state(fsave, &vmstate_simple, &obj);
+
+    /* Save file with vmstate */
+    vmstate_save_state(fsave, &vmstate_simple_primitive, &obj_simple);
     g_assert(!qemu_file_get_error(fsave));
     qemu_fclose(fsave);
 
     QEMUFile *loading = open_test_file(false);
-    uint8_t expected[] = {
-        0, 0, 0, 1, /* a */
-        0, 0, 0, 2, /* b */
-        0, 0, 0, 3, /* c */
-        0, 0, 0, 0, 0, 0, 0, 4, /* d */
-    };
-    uint8_t result[sizeof(expected)];
+    /* we don't need QEMU_VM_EOF */
+    uint8_t result[sizeof(wire_simple_primitive)-1];
+
+    /* read back as binary */
+
     g_assert_cmpint(qemu_get_buffer(loading, result, sizeof(result)), ==,
                     sizeof(result));
     g_assert(!qemu_file_get_error(loading));
-    g_assert_cmpint(memcmp(result, expected, sizeof(result)), ==, 0);
+
+    /* Compare that what is on the file is the same that what we
+       expected to be there */
+    SUCCESS(memcmp(result, wire_simple_primitive, sizeof(result)));
 
     /* Must reach EOF */
     qemu_get_byte(loading);
     g_assert_cmpint(qemu_file_get_error(loading), ==, -EIO);
 
     qemu_fclose(loading);
-}
 
-static void test_simple_load(void)
-{
-    QEMUFile *fsave = open_test_file(true);
-    uint8_t buf[] = {
-        0, 0, 0, 10,             /* a */
-        0, 0, 0, 20,             /* b */
-        0, 0, 0, 30,             /* c */
-        0, 0, 0, 0, 0, 0, 0, 40, /* d */
-        QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
-    };
-    qemu_put_buffer(fsave, buf, sizeof(buf));
+    /* We save the file again.  We want the EOF this time */
+
+    fsave = open_test_file(true);
+    qemu_put_buffer(fsave, wire_simple_primitive,
+                    sizeof(wire_simple_primitive));
     qemu_fclose(fsave);
 
-    QEMUFile *loading = open_test_file(false);
-    TestStruct obj;
-    vmstate_load_state(loading, &vmstate_simple, &obj, 1);
+    loading = open_test_file(false);
+    TestSimple obj;
+    SUCCESS(vmstate_load_state(loading, &vmstate_simple_primitive, &obj, 1));
     g_assert(!qemu_file_get_error(loading));
-    g_assert_cmpint(obj.a, ==, 10);
-    g_assert_cmpint(obj.b, ==, 20);
-    g_assert_cmpint(obj.c, ==, 30);
-    g_assert_cmpint(obj.d, ==, 40);
+
+#define FIELD_ASSERT(name)   g_assert_cmpint(obj.name, ==, obj_simple.name)
+    FIELD_ASSERT(b_1);
+    FIELD_ASSERT(b_2);
+    FIELD_ASSERT(u8_1);
+    FIELD_ASSERT(u16_1);
+    FIELD_ASSERT(u32_1);
+    FIELD_ASSERT(u64_1);
+    FIELD_ASSERT(i8_1);
+    FIELD_ASSERT(i8_2);
+    FIELD_ASSERT(i16_1);
+    FIELD_ASSERT(i16_2);
+    FIELD_ASSERT(i32_1);
+    FIELD_ASSERT(i32_2);
+    FIELD_ASSERT(i64_1);
+    FIELD_ASSERT(i64_2);
+#undef FIELD_ASSERT
+
+    /* We save the file again.  We want the EOF this time */
+
+    fsave = open_test_file(true);
+    /* this time we don't write the whole file */
+    qemu_put_buffer(fsave, wire_simple_primitive, 10);
+    qemu_fclose(fsave);
+
+    loading = open_test_file(false);
+    FAILURE(vmstate_load_state(loading, &vmstate_simple_primitive, &obj, 1));
+
+    /* Now it has to have an error */
+    g_assert(qemu_file_get_error(loading));
     qemu_fclose(loading);
 }
 
+typedef struct TestStruct {
+    uint32_t a, b, c, e;
+    uint64_t d, f;
+    bool skip_c_e;
+} TestStruct;
+
 static const VMStateDescription vmstate_versioned = {
-    .name = "test",
+    .name = "test/versioned",
     .version_id = 2,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
@@ -202,7 +308,7 @@ static bool test_skip(void *opaque, int version_id)
 }
 
 static const VMStateDescription vmstate_skipping = {
-    .name = "test",
+    .name = "test/skip",
     .version_id = 2,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
@@ -337,8 +443,7 @@ int main(int argc, char **argv)
     temp_fd = mkstemp(temp_file);
 
     g_test_init(&argc, &argv, NULL);
-    g_test_add_func("/vmstate/simple/save", test_simple_save);
-    g_test_add_func("/vmstate/simple/load", test_simple_load);
+    g_test_add_func("/vmstate/simple/primitive", test_simple_primitive);
     g_test_add_func("/vmstate/versioned/load/v1", test_load_v1);
     g_test_add_func("/vmstate/versioned/load/v2", test_load_v2);
     g_test_add_func("/vmstate/field_exists/load/noskip", test_load_noskip);
Signature · 1 line
1.9.0
#16 lore raw

Re: [Qemu-devel] [PATCH 06/97] vmstate: Refactor & increase tests for primitive types

Quoted 110 lines · Juan Quintela

This commit refactor the simple tests to test all integer types. We move to hex because it is easier to read values of different types.

---
 tests/test-vmstate.c | 195 +++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 150 insertions(+), 45 deletions(-)
tests/test-vmstate.c +73 -12
index 8b242c4..39a769e 100644
@@ -54,80 +54,186 @@ static QEMUFile *open_test_file(bool write)
     return qemu_fdopen(fd, write ? "wb" : "rb");
 }
 
-typedef struct TestSruct {
-    uint32_t a, b, c, e;
-    uint64_t d, f;
-    bool skip_c_e;
-} TestStruct;
+/* Test struct that we are going to use for our tests */
+
+typedef struct TestSimple {
+    bool     b_1,   b_2;
+    uint8_t  u8_1,  u8_2;
+    uint16_t u16_1, u16_2;
+    uint32_t u32_1, u32_2;
+    uint64_t u64_1, u64_2;
+    int8_t   i8_1,  i8_2;
+    int16_t  i16_1, i16_2;
+    int32_t  i32_1, i32_2;
+    int64_t  i64_1, i64_2;
+} TestSimple;
+
+/* Object instantiation, we are going to use it in more than one test */
+
+TestSimple obj_simple = {
+    .b_1 = true,
+    .b_2 = false,
+    .u8_1 = 129,
+    .u8_1 = 130,
+    .u16_1 = 512,
+    .u16_2 = 45000,
+    .u32_1 = 70000,
+    .u32_2 = 100000,
+    .u64_1 = 12121212,
+    .u64_2 = 23232323,
+    .i8_1 = 65,
+    .i8_2 = -65,
+    .i16_1 = 512,
+    .i16_2 = -512,
+    .i32_1 = 70000,
+    .i32_2 = -70000,
+    .i64_1 = 12121212,
+    .i64_2 = -12121212,
+};
 
+/* Description of the values.  If you add a primitive type
+   you are expected to add a test here */
 
-static const VMStateDescription vmstate_simple = {
-    .name = "test",
+static const VMStateDescription vmstate_simple_primitive = {
+    .name = "simple/primitive",
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_UINT32(a, TestStruct),
-        VMSTATE_UINT32(b, TestStruct),
-        VMSTATE_UINT32(c, TestStruct),
-        VMSTATE_UINT64(d, TestStruct),
+        VMSTATE_BOOL(b_1, TestSimple),
+        VMSTATE_BOOL(b_2, TestSimple),
+        VMSTATE_UINT8(u8_1, TestSimple),
+        VMSTATE_UINT16(u16_1, TestSimple),
+        VMSTATE_UINT32(u32_1, TestSimple),
+        VMSTATE_UINT64(u64_1, TestSimple),
+        VMSTATE_INT8(i8_1, TestSimple),
+        VMSTATE_INT8(i8_2, TestSimple),
+        VMSTATE_INT16(i16_1, TestSimple),
+        VMSTATE_INT16(i16_2, TestSimple),
+        VMSTATE_INT32(i32_1, TestSimple),
+        VMSTATE_INT32(i32_2, TestSimple),
+        VMSTATE_INT64(i64_1, TestSimple),
+        VMSTATE_INT64(i64_2, TestSimple),
         VMSTATE_END_OF_LIST()
     }
 };
 
-static void test_simple_save(void)
+/* It describes what goes through the wire.  Our tests are basically:
+
+   * save test
+     - save a struct a vmstate to a file
+     - read that file back (binary read, no vmstate)
+     - compare it with what we expect to be on the wire
+   * load test
+     - save to the file what we expect to be on the wire
+     - read struct back with vmstate in a different
+     - compare back with the original struct
+*/
+
+uint8_t wire_simple_primitive[] = {
+    /* b_1 */   0x01,
+    /* b_2 */   0x00,
+    /* u8_1 */  0x82,
+    /* u16_1 */ 0x02, 0x00,
+    /* u32_1 */ 0x00, 0x01, 0x11, 0x70,
+    /* u64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,

tests/test-vmstate.c static QEMUFile *open_test_file(bool write) · line 148

Quoted 10 lines
tests/test-vmstate.c +10 -0
+    /* i8_1 */  0x41,
+    /* i8_2 */  0xbf,
+    /* i16_1 */ 0x02, 0x00,
+    /* i16_2 */ 0xfe, 0x0,
+    /* i32_1 */ 0x00, 0x01, 0x11, 0x70,
+    /* i32_2 */ 0xff, 0xfe, 0xee, 0x90,
+    /* i64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
+    /* i64_2 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0x47, 0x0b, 0x84,
+    QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
+};

Nice job. I was too lazy to test every single type. :-)

tests/test-vmstate.c static QEMUFile *open_test_file(bool write) · line 151

Quoted 3 lines
tests/test-vmstate.c +3 -0
+
+#define SUCCESS(val) \
+    g_assert_cmpint((val), ==, 0)

Isn't this the same as g_assert(!val)?

tests/test-vmstate.c static QEMUFile *open_test_file(bool write) · line 154

Quoted 3 lines
tests/test-vmstate.c +3 -0
+
+#define FAILURE(val) \
+    g_assert_cmpint((val), !=, 0)

Isn't this the same as g_assert(val)?

I know, it is my fault as I have written the g_assert_cmpint(..., 0) code in the first place. :)

Quoted 77 lines
tests/test-vmstate.c +29 -29
+
+static void test_simple_primitive(void)
 {
     QEMUFile *fsave = open_test_file(true);
-    TestStruct obj = { .a = 1, .b = 2, .c = 3, .d = 4 };
-    vmstate_save_state(fsave, &vmstate_simple, &obj);
+
+    /* Save file with vmstate */
+    vmstate_save_state(fsave, &vmstate_simple_primitive, &obj_simple);
     g_assert(!qemu_file_get_error(fsave));
     qemu_fclose(fsave);
 
     QEMUFile *loading = open_test_file(false);
-    uint8_t expected[] = {
-        0, 0, 0, 1, /* a */
-        0, 0, 0, 2, /* b */
-        0, 0, 0, 3, /* c */
-        0, 0, 0, 0, 0, 0, 0, 4, /* d */
-    };
-    uint8_t result[sizeof(expected)];
+    /* we don't need QEMU_VM_EOF */
+    uint8_t result[sizeof(wire_simple_primitive)-1];
+
+    /* read back as binary */
+
     g_assert_cmpint(qemu_get_buffer(loading, result, sizeof(result)), ==,
                     sizeof(result));
     g_assert(!qemu_file_get_error(loading));
-    g_assert_cmpint(memcmp(result, expected, sizeof(result)), ==, 0);
+
+    /* Compare that what is on the file is the same that what we
+       expected to be there */
+    SUCCESS(memcmp(result, wire_simple_primitive, sizeof(result)));
 
     /* Must reach EOF */
     qemu_get_byte(loading);
     g_assert_cmpint(qemu_file_get_error(loading), ==, -EIO);
 
     qemu_fclose(loading);
-}
 
-static void test_simple_load(void)
-{
-    QEMUFile *fsave = open_test_file(true);
-    uint8_t buf[] = {
-        0, 0, 0, 10,             /* a */
-        0, 0, 0, 20,             /* b */
-        0, 0, 0, 30,             /* c */
-        0, 0, 0, 0, 0, 0, 0, 40, /* d */
-        QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
-    };
-    qemu_put_buffer(fsave, buf, sizeof(buf));
+    /* We save the file again.  We want the EOF this time */
+
+    fsave = open_test_file(true);
+    qemu_put_buffer(fsave, wire_simple_primitive,
+                    sizeof(wire_simple_primitive));
     qemu_fclose(fsave);
 
-    QEMUFile *loading = open_test_file(false);
-    TestStruct obj;
-    vmstate_load_state(loading, &vmstate_simple, &obj, 1);
+    loading = open_test_file(false);
+    TestSimple obj;
+    SUCCESS(vmstate_load_state(loading, &vmstate_simple_primitive, &obj, 1));
     g_assert(!qemu_file_get_error(loading));
-    g_assert_cmpint(obj.a, ==, 10);
-    g_assert_cmpint(obj.b, ==, 20);
-    g_assert_cmpint(obj.c, ==, 30);
-    g_assert_cmpint(obj.d, ==, 40);
+
+#define FIELD_ASSERT(name)   g_assert_cmpint(obj.name, ==, obj_simple.name)
+    FIELD_ASSERT(b_1);
+    FIELD_ASSERT(b_2);
+    FIELD_ASSERT(u8_1);
+    FIELD_ASSERT(u16_1);
+    FIELD_ASSERT(u32_1);

tests/test-vmstate.c static QEMUFile *open_test_file(bool write) · line 212

Quoted 10 lines
tests/test-vmstate.c +10 -0
+    FIELD_ASSERT(u64_1);
+    FIELD_ASSERT(i8_1);
+    FIELD_ASSERT(i8_2);
+    FIELD_ASSERT(i16_1);
+    FIELD_ASSERT(i16_2);
+    FIELD_ASSERT(i32_1);
+    FIELD_ASSERT(i32_2);
+    FIELD_ASSERT(i64_1);
+    FIELD_ASSERT(i64_2);
+#undef FIELD_ASSERT

I wonder if we could do something to allow us to safely simplify this to use memcmp(). Looks good, anyway.

tests/test-vmstate.c static QEMUFile *open_test_file(bool write) · line 219

Quoted 7 lines
tests/test-vmstate.c +7 -0
+
+    /* We save the file again.  We want the EOF this time */
+
+    fsave = open_test_file(true);
+    /* this time we don't write the whole file */
+    qemu_put_buffer(fsave, wire_simple_primitive, 10);
+    qemu_fclose(fsave);

What about not just testing if it fails with 10 bytes, but checking all possible lengths from 0 to N-1 bytes? With this check we are only testing if the u64 loader handles EOF as expected. If subtle bugs are going to be introduced in EOF checking, I find them more likely in corner cases such as length==0, length==1 and lenght==N-1.

Quoted 44 lines
tests/test-vmstate.c +15 -4
+
+    loading = open_test_file(false);
+    FAILURE(vmstate_load_state(loading, &vmstate_simple_primitive, &obj, 1));
+
+    /* Now it has to have an error */
+    g_assert(qemu_file_get_error(loading));
     qemu_fclose(loading);
 }
 
+typedef struct TestStruct {
+    uint32_t a, b, c, e;
+    uint64_t d, f;
+    bool skip_c_e;
+} TestStruct;
+
 static const VMStateDescription vmstate_versioned = {
-    .name = "test",
+    .name = "test/versioned",
     .version_id = 2,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
@@ -202,7 +308,7 @@ static bool test_skip(void *opaque, int version_id)
 }
 
 static const VMStateDescription vmstate_skipping = {
-    .name = "test",
+    .name = "test/skip",
     .version_id = 2,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
@@ -337,8 +443,7 @@ int main(int argc, char **argv)
     temp_fd = mkstemp(temp_file);
 
     g_test_init(&argc, &argv, NULL);
-    g_test_add_func("/vmstate/simple/save", test_simple_save);
-    g_test_add_func("/vmstate/simple/load", test_simple_load);
+    g_test_add_func("/vmstate/simple/primitive", test_simple_primitive);
     g_test_add_func("/vmstate/versioned/load/v1", test_load_v1);
     g_test_add_func("/vmstate/versioned/load/v2", test_load_v2);
     g_test_add_func("/vmstate/field_exists/load/noskip", test_load_noskip);
Signature · 1 line
1.9.0
Signature · 1 line
Eduardo
#17 lore raw

PATCH 7/97 vmstate: create test functions for versions until 15

In reply to Juan Quintela

Using macros, just to avoid repeating code.

---
 include/migration/vmstate.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
include/migration/vmstate.h +22 -0
index e7e1705..001ff76 100644
@@ -769,4 +769,26 @@ void vmstate_register_ram(struct MemoryRegion *memory, DeviceState *dev);
 void vmstate_unregister_ram(struct MemoryRegion *memory, DeviceState *dev);
 void vmstate_register_ram_global(struct MemoryRegion *memory);
 
+/* version is X or bigger */
+#define VMSTATE_X_PLUS(X)\
+static inline bool vmstate_##X##_plus(void *opaque, int version_id)\
+{\
+    return version_id >= X;\
+}
+
+VMSTATE_X_PLUS(2)
+VMSTATE_X_PLUS(3)
+VMSTATE_X_PLUS(4)
+VMSTATE_X_PLUS(5)
+VMSTATE_X_PLUS(6)
+VMSTATE_X_PLUS(7)
+VMSTATE_X_PLUS(8)
+VMSTATE_X_PLUS(9)
+VMSTATE_X_PLUS(10)
+VMSTATE_X_PLUS(11)
+VMSTATE_X_PLUS(12)
+VMSTATE_X_PLUS(13)
+VMSTATE_X_PLUS(14)
+VMSTATE_X_PLUS(15)
+
 #endif
Signature · 1 line
1.9.0
#18 lore raw

PATCH 8/97 vmstate: Remove VMSTATE_UINTL_EQUAL_V

In reply to Juan Quintela

It was not used anywhere.

---
 include/hw/hw.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
include/hw/hw.h +4 -6
index 33bdb92..2b68ac3 100644
@@ -51,22 +51,20 @@ int qemu_boot_set(const char *boot_order);
 #if TARGET_LONG_BITS == 64
 #define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
     VMSTATE_UINT64_V(_f, _s, _v)
-#define VMSTATE_UINTTL_EQUAL_V(_f, _s, _v)                            \
-    VMSTATE_UINT64_EQUAL_V(_f, _s, _v)
+#define VMSTATE_UINTTL_EQUAL(_f, _s)                                  \
+    VMSTATE_UINT64_EQUAL(_f, _s)
 #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
     VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v)
 #else
 #define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
     VMSTATE_UINT32_V(_f, _s, _v)
-#define VMSTATE_UINTTL_EQUAL_V(_f, _s, _v)                            \
-    VMSTATE_UINT32_EQUAL_V(_f, _s, _v)
+#define VMSTATE_UINTTL_EQUAL(_f, _s)                                  \
+    VMSTATE_UINT32_EQUAL(_f, _s)
 #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
     VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)
 #endif
 #define VMSTATE_UINTTL(_f, _s)                                        \
     VMSTATE_UINTTL_V(_f, _s, 0)
-#define VMSTATE_UINTTL_EQUAL(_f, _s)                                  \
-    VMSTATE_UINTTL_EQUAL_V(_f, _s, 0)
 #define VMSTATE_UINTTL_ARRAY(_f, _s, _n)                              \
     VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0)
 
Signature · 1 line
1.9.0
#19 lore raw

PATCH 9/97 vmstate: Change VMSTATE_INTTL_V to VMSTATE_INTTL_TEST

In reply to Juan Quintela

And fix all users.
VMSTATE_UINT64_TEST don't exist. Create it.

---
 include/hw/hw.h             | 10 +++++-----
 include/migration/vmstate.h |  3 +++
 target-i386/machine.c       |  4 ++--
 3 files changed, 10 insertions(+), 7 deletions(-)
include/hw/hw.h +5 -5
index 2b68ac3..211eb8b 100644
@@ -49,22 +49,22 @@ int qemu_boot_set(const char *boot_order);
 
 #ifdef NEED_CPU_H
 #if TARGET_LONG_BITS == 64
-#define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
-    VMSTATE_UINT64_V(_f, _s, _v)
+#define VMSTATE_UINTTL_TEST(_f, _s, _t)                               \
+    VMSTATE_UINT64_TEST(_f, _s, _t)
 #define VMSTATE_UINTTL_EQUAL(_f, _s)                                  \
     VMSTATE_UINT64_EQUAL(_f, _s)
 #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
     VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v)
 #else
-#define VMSTATE_UINTTL_V(_f, _s, _v)                                  \
-    VMSTATE_UINT32_V(_f, _s, _v)
+#define VMSTATE_UINTTL_TEST(_f, _s, _t)                               \
+    VMSTATE_UINT32_TEST(_f, _s, _t)
 #define VMSTATE_UINTTL_EQUAL(_f, _s)                                  \
     VMSTATE_UINT32_EQUAL(_f, _s)
 #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
     VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)
 #endif
 #define VMSTATE_UINTTL(_f, _s)                                        \
-    VMSTATE_UINTTL_V(_f, _s, 0)
+    VMSTATE_UINTTL_TEST(_f, _s, NULL)
 #define VMSTATE_UINTTL_ARRAY(_f, _s, _n)                              \
     VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0)
 
include/migration/vmstate.h +3 -0
index 001ff76..e97ac2f 100644
@@ -604,6 +604,9 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT32_TEST(_f, _s, _t)                                  \
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint32, uint32_t)
 
+#define VMSTATE_UINT64_TEST(_f, _s, _t)                                  \
+    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint64, uint64_t)
+
 
 #define VMSTATE_FLOAT64_V(_f, _s, _v)                                 \
     VMSTATE_SINGLE(_f, _s, _v, vmstate_info_float64, float64)
target-i386/machine.c +2 -2
index fe3f024..838a5b0 100644
@@ -624,8 +624,8 @@ const VMStateDescription vmstate_x86_cpu = {
         /* Hack: In v7 size changed from 32 to 64 bits on x86_64 */
         VMSTATE_HACK_UINT32(env.sysenter_esp, X86CPU, less_than_7),
         VMSTATE_HACK_UINT32(env.sysenter_eip, X86CPU, less_than_7),
-        VMSTATE_UINTTL_V(env.sysenter_esp, X86CPU, 7),
-        VMSTATE_UINTTL_V(env.sysenter_eip, X86CPU, 7),
+        VMSTATE_UINTTL_TEST(env.sysenter_esp, X86CPU, vmstate_7_plus),
+        VMSTATE_UINTTL_TEST(env.sysenter_eip, X86CPU, vmstate_7_plus),
 #else
         VMSTATE_UINTTL(env.sysenter_esp, X86CPU),
         VMSTATE_UINTTL(env.sysenter_eip, X86CPU),
Signature · 1 line
1.9.0
#20 lore raw

PATCH 10/97 vmstate: Remove unused VMSTATE_UINTTL_ARRAY_V

In reply to Juan Quintela
---
 include/hw/hw.h | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
include/hw/hw.h +4 -7
index 211eb8b..2c19297 100644
@@ -53,21 +53,18 @@ int qemu_boot_set(const char *boot_order);
     VMSTATE_UINT64_TEST(_f, _s, _t)
 #define VMSTATE_UINTTL_EQUAL(_f, _s)                                  \
     VMSTATE_UINT64_EQUAL(_f, _s)
-#define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
-    VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v)
+#define VMSTATE_UINTTL_ARRAY(_f, _s, _n)                              \
+    VMSTATE_UINT64_ARRAY(_f, _s, _n)
 #else
 #define VMSTATE_UINTTL_TEST(_f, _s, _t)                               \
     VMSTATE_UINT32_TEST(_f, _s, _t)
 #define VMSTATE_UINTTL_EQUAL(_f, _s)                                  \
     VMSTATE_UINT32_EQUAL(_f, _s)
-#define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v)                        \
-    VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)
+#define VMSTATE_UINTTL_ARRAY(_f, _s, _n)                              \
+    VMSTATE_UINT32_ARRAY(_f, _s, _n)
 #endif
 #define VMSTATE_UINTTL(_f, _s)                                        \
     VMSTATE_UINTTL_TEST(_f, _s, NULL)
-#define VMSTATE_UINTTL_ARRAY(_f, _s, _n)                              \
-    VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0)
-
 #endif
 
 #endif
Signature · 1 line
1.9.0
#21 lore raw

PATCH 11/97 vmstate: Test for VMSTATE_BOOL_TEST

In reply to Juan Quintela

Remove VMSTATE_BOOL_V, we are removing versioning, would use only tests.

---
 include/migration/vmstate.h |  6 ++--
 tests/test-vmstate.c        | 75 ++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 77 insertions(+), 4 deletions(-)
include/migration/vmstate.h +3 -3
index e97ac2f..184d564 100644
@@ -526,8 +526,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, NULL, _version,   \
             _vmsd, _type)
 
-#define VMSTATE_BOOL_V(_f, _s, _v)                                    \
-    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_bool, bool)
+#define VMSTATE_BOOL_TEST(_f, _s, _t)                                 \
+    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_bool, bool)
 
 #define VMSTATE_INT8_V(_f, _s, _v)                                    \
     VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int8, int8_t)
@@ -548,7 +548,7 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint64, uint64_t)
 
 #define VMSTATE_BOOL(_f, _s)                                          \
-    VMSTATE_BOOL_V(_f, _s, 0)
+    VMSTATE_BOOL_TEST(_f, _s, NULL)
 
 #define VMSTATE_INT8(_f, _s)                                          \
     VMSTATE_INT8_V(_f, _s, 0)
tests/test-vmstate.c +74 -1

93 lines not on this page · raw message

Signature · 1 line
1.9.0
#22 lore raw

PATCH 12/97 vmstate: Test for VMSTATE_INT8_TEST

In reply to Juan Quintela

Remove VMSTATE_INT8_V, we are removing versioning, would use only tests.

---
 include/migration/vmstate.h | 6 +++---
 tests/test-vmstate.c        | 4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)
include/migration/vmstate.h +3 -3
index 184d564..70c89b3 100644
@@ -529,8 +529,8 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_BOOL_TEST(_f, _s, _t)                                 \
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_bool, bool)
 
-#define VMSTATE_INT8_V(_f, _s, _v)                                    \
-    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int8, int8_t)
+#define VMSTATE_INT8_TEST(_f, _s, _t)                                 \
+    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int8, int8_t)
 #define VMSTATE_INT16_V(_f, _s, _v)                                   \
     VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int16, int16_t)
 #define VMSTATE_INT32_V(_f, _s, _v)                                   \
@@ -551,7 +551,7 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_BOOL_TEST(_f, _s, NULL)
 
 #define VMSTATE_INT8(_f, _s)                                          \
-    VMSTATE_INT8_V(_f, _s, 0)
+    VMSTATE_INT8_TEST(_f, _s, NULL)
 #define VMSTATE_INT16(_f, _s)                                         \
     VMSTATE_INT16_V(_f, _s, 0)
 #define VMSTATE_INT32(_f, _s)                                         \
tests/test-vmstate.c +4 -0
index 7ca32af..476cef8 100644
@@ -243,12 +243,15 @@ static const VMStateDescription vmstate_simple_test = {
     .fields = (VMStateField[]) {
         VMSTATE_BOOL_TEST(b_1, TestSimple, test_true),
         VMSTATE_BOOL_TEST(b_2, TestSimple, test_false),
+        VMSTATE_INT8_TEST(i8_1, TestSimple, test_true),
+        VMSTATE_INT8_TEST(i8_2, TestSimple, test_false),
         VMSTATE_END_OF_LIST()
     }
 };
 
 uint8_t wire_simple_test[] = {
     /* b_1 */   0x01,
+    /* i8_1 */  0x41,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -293,6 +296,7 @@ static void test_simple_test(void)
     g_assert(!qemu_file_get_error(loading));
 
     FIELD_ASSERT(b_1);
+    FIELD_ASSERT(i8_1);
 
     qemu_fclose(loading);
 }
Signature · 1 line
1.9.0
#23 lore raw

PATCH 13/97 vmstate: Test for VMSTATE_INT16_TEST

In reply to Juan Quintela

Remove VMSTATES_INT16_V, we are removing versioning, would use only tests.

---
 include/migration/vmstate.h | 6 +++---
 tests/test-vmstate.c        | 4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)
include/migration/vmstate.h +3 -3
index 70c89b3..645316a 100644
@@ -531,8 +531,8 @@ extern const VMStateInfo vmstate_info_bitmap;
 
 #define VMSTATE_INT8_TEST(_f, _s, _t)                                 \
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int8, int8_t)
-#define VMSTATE_INT16_V(_f, _s, _v)                                   \
-    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int16, int16_t)
+#define VMSTATE_INT16_TEST(_f, _s, _t)                                \
+    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int16, int16_t)
 #define VMSTATE_INT32_V(_f, _s, _v)                                   \
     VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int32, int32_t)
 #define VMSTATE_INT64_V(_f, _s, _v)                                   \
@@ -553,7 +553,7 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_INT8(_f, _s)                                          \
     VMSTATE_INT8_TEST(_f, _s, NULL)
 #define VMSTATE_INT16(_f, _s)                                         \
-    VMSTATE_INT16_V(_f, _s, 0)
+    VMSTATE_INT16_TEST(_f, _s, NULL)
 #define VMSTATE_INT32(_f, _s)                                         \
     VMSTATE_INT32_V(_f, _s, 0)
 #define VMSTATE_INT64(_f, _s)                                         \
tests/test-vmstate.c +4 -0
index 476cef8..278df0e 100644
@@ -245,6 +245,8 @@ static const VMStateDescription vmstate_simple_test = {
         VMSTATE_BOOL_TEST(b_2, TestSimple, test_false),
         VMSTATE_INT8_TEST(i8_1, TestSimple, test_true),
         VMSTATE_INT8_TEST(i8_2, TestSimple, test_false),
+        VMSTATE_INT16_TEST(i16_1, TestSimple, test_true),
+        VMSTATE_INT16_TEST(i16_2, TestSimple, test_false),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -252,6 +254,7 @@ static const VMStateDescription vmstate_simple_test = {
 uint8_t wire_simple_test[] = {
     /* b_1 */   0x01,
     /* i8_1 */  0x41,
+    /* i16_1 */ 0x02, 0x00,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -297,6 +300,7 @@ static void test_simple_test(void)
 
     FIELD_ASSERT(b_1);
     FIELD_ASSERT(i8_1);
+    FIELD_ASSERT(i16_1);
 
     qemu_fclose(loading);
 }
Signature · 1 line
1.9.0
#24 lore raw

PATCH 14/97 vmstate: Test for VMSTATE_INT32_TEST

In reply to Juan Quintela

Remove VMSTATE_INT32_V, we are removing versioning. Move all users to use tests.

---
 hw/input/ps2.c              | 2 +-
 include/migration/vmstate.h | 6 +++---
 target-i386/machine.c       | 4 ++--
 tests/test-vmstate.c        | 4 ++++
 4 files changed, 10 insertions(+), 6 deletions(-)
hw/input/ps2.c +1 -1
index 0a0bd80..e05ff0d 100644
@@ -613,7 +613,7 @@ static const VMStateDescription vmstate_ps2_keyboard = {
         VMSTATE_STRUCT(common, PS2KbdState, 0, vmstate_ps2_common, PS2State),
         VMSTATE_INT32(scan_enabled, PS2KbdState),
         VMSTATE_INT32(translate, PS2KbdState),
-        VMSTATE_INT32_V(scancode_set, PS2KbdState,3),
+        VMSTATE_INT32_TEST(scancode_set, PS2KbdState, vmstate_3_plus),
         VMSTATE_END_OF_LIST()
     },
     .subsections = (VMStateSubsection []) {
include/migration/vmstate.h +3 -3
index 645316a..85356be 100644
@@ -533,8 +533,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int8, int8_t)
 #define VMSTATE_INT16_TEST(_f, _s, _t)                                \
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int16, int16_t)
-#define VMSTATE_INT32_V(_f, _s, _v)                                   \
-    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int32, int32_t)
+#define VMSTATE_INT32_TEST(_f, _s, _t)                                \
+    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int32, int32_t)
 #define VMSTATE_INT64_V(_f, _s, _v)                                   \
     VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int64, int64_t)
 
@@ -555,7 +555,7 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_INT16(_f, _s)                                         \
     VMSTATE_INT16_TEST(_f, _s, NULL)
 #define VMSTATE_INT32(_f, _s)                                         \
-    VMSTATE_INT32_V(_f, _s, 0)
+    VMSTATE_INT32_TEST(_f, _s, NULL)
 #define VMSTATE_INT64(_f, _s)                                         \
     VMSTATE_INT64_V(_f, _s, 0)
 
target-i386/machine.c +2 -2
index 838a5b0..2aecf5f 100644
@@ -671,10 +671,10 @@ const VMStateDescription vmstate_x86_cpu = {
         VMSTATE_UINT64_V(env.mtrr_deftype, X86CPU, 8),
         VMSTATE_MTRR_VARS(env.mtrr_var, X86CPU, 8, 8),
         /* KVM-related states */
-        VMSTATE_INT32_V(env.interrupt_injected, X86CPU, 9),
+        VMSTATE_INT32_TEST(env.interrupt_injected, X86CPU, vmstate_9_plus),
         VMSTATE_UINT32_V(env.mp_state, X86CPU, 9),
         VMSTATE_UINT64_V(env.tsc, X86CPU, 9),
-        VMSTATE_INT32_V(env.exception_injected, X86CPU, 11),
+        VMSTATE_INT32_TEST(env.exception_injected, X86CPU, vmstate_11_plus),
         VMSTATE_UINT8_V(env.soft_interrupt, X86CPU, 11),
         VMSTATE_UINT8_V(env.nmi_injected, X86CPU, 11),
         VMSTATE_UINT8_V(env.nmi_pending, X86CPU, 11),
tests/test-vmstate.c +4 -0
index 278df0e..75e5600 100644
@@ -247,6 +247,8 @@ static const VMStateDescription vmstate_simple_test = {
         VMSTATE_INT8_TEST(i8_2, TestSimple, test_false),
         VMSTATE_INT16_TEST(i16_1, TestSimple, test_true),
         VMSTATE_INT16_TEST(i16_2, TestSimple, test_false),
+        VMSTATE_INT32_TEST(i32_1, TestSimple, test_true),
+        VMSTATE_INT32_TEST(i32_2, TestSimple, test_false),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -255,6 +257,7 @@ uint8_t wire_simple_test[] = {
     /* b_1 */   0x01,
     /* i8_1 */  0x41,
     /* i16_1 */ 0x02, 0x00,
+    /* i32_1 */ 0x00, 0x01, 0x11, 0x70,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -301,6 +304,7 @@ static void test_simple_test(void)
     FIELD_ASSERT(b_1);
     FIELD_ASSERT(i8_1);
     FIELD_ASSERT(i16_1);
+    FIELD_ASSERT(i32_1);
 
     qemu_fclose(loading);
 }
Signature · 1 line
1.9.0
#25 lore raw

PATCH 15/97 vmstate: test for VMSTATE_INT64_TEST

In reply to Juan Quintela

Remove VMSTATE_INT64_V, we are removing versioning. Move all users to VMSTATE_INT64_TEST.

---
 cpus.c                      | 2 +-
 hw/timer/mc146818rtc.c      | 2 +-
 hw/usb/hcd-uhci.c           | 2 +-
 include/migration/vmstate.h | 6 +++---
 tests/test-vmstate.c        | 4 ++++
 5 files changed, 10 insertions(+), 6 deletions(-)
cpus.c +1 -1
index c510052..83aa302 100644
@@ -433,7 +433,7 @@ static const VMStateDescription vmstate_timers = {
     .fields = (VMStateField[]) {
         VMSTATE_INT64(cpu_ticks_offset, TimersState),
         VMSTATE_INT64(dummy, TimersState),
-        VMSTATE_INT64_V(cpu_clock_offset, TimersState, 2),
+        VMSTATE_INT64_TEST(cpu_clock_offset, TimersState, vmstate_2_plus),
         VMSTATE_END_OF_LIST()
     }
 };
hw/timer/mc146818rtc.c +1 -1
index 1822af2..8342749 100644
@@ -732,7 +732,7 @@ static const VMStateDescription vmstate_rtc = {
         VMSTATE_UINT32_V(period, RTCState, 2),
         VMSTATE_UINT64_V(base_rtc, RTCState, 3),
         VMSTATE_UINT64_V(last_update, RTCState, 3),
-        VMSTATE_INT64_V(offset, RTCState, 3),
+        VMSTATE_INT64_TEST(offset, RTCState, vmstate_3_plus),
         VMSTATE_TIMER_V(update_timer, RTCState, 3),
         VMSTATE_UINT64_V(next_alarm_time, RTCState, 3),
         VMSTATE_END_OF_LIST()
hw/usb/hcd-uhci.c +1 -1
index 9b1166b..5590e18 100644
@@ -457,7 +457,7 @@ static const VMStateDescription vmstate_uhci = {
         VMSTATE_UINT8(sof_timing, UHCIState),
         VMSTATE_UINT8(status2, UHCIState),
         VMSTATE_TIMER(frame_timer, UHCIState),
-        VMSTATE_INT64_V(expire_time, UHCIState, 2),
+        VMSTATE_INT64_TEST(expire_time, UHCIState, vmstate_3_plus),
         VMSTATE_UINT32_V(pending_int_mask, UHCIState, 3),
         VMSTATE_END_OF_LIST()
     }
include/migration/vmstate.h +3 -3
index 85356be..ba8b44d 100644
@@ -535,8 +535,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int16, int16_t)
 #define VMSTATE_INT32_TEST(_f, _s, _t)                                \
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int32, int32_t)
-#define VMSTATE_INT64_V(_f, _s, _v)                                   \
-    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_int64, int64_t)
+#define VMSTATE_INT64_TEST(_f, _s, _t)                                \
+    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int64, int64_t)
 
 #define VMSTATE_UINT8_V(_f, _s, _v)                                   \
     VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint8, uint8_t)
@@ -557,7 +557,7 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_INT32(_f, _s)                                         \
     VMSTATE_INT32_TEST(_f, _s, NULL)
 #define VMSTATE_INT64(_f, _s)                                         \
-    VMSTATE_INT64_V(_f, _s, 0)
+    VMSTATE_INT64_TEST(_f, _s, NULL)
 
 #define VMSTATE_UINT8(_f, _s)                                         \
     VMSTATE_UINT8_V(_f, _s, 0)
tests/test-vmstate.c +4 -0
index 75e5600..b8d1309 100644
@@ -249,6 +249,8 @@ static const VMStateDescription vmstate_simple_test = {
         VMSTATE_INT16_TEST(i16_2, TestSimple, test_false),
         VMSTATE_INT32_TEST(i32_1, TestSimple, test_true),
         VMSTATE_INT32_TEST(i32_2, TestSimple, test_false),
+        VMSTATE_INT64_TEST(i64_1, TestSimple, test_true),
+        VMSTATE_INT64_TEST(i64_2, TestSimple, test_false),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -258,6 +260,7 @@ uint8_t wire_simple_test[] = {
     /* i8_1 */  0x41,
     /* i16_1 */ 0x02, 0x00,
     /* i32_1 */ 0x00, 0x01, 0x11, 0x70,
+    /* i64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -305,6 +308,7 @@ static void test_simple_test(void)
     FIELD_ASSERT(i8_1);
     FIELD_ASSERT(i16_1);
     FIELD_ASSERT(i32_1);
+    FIELD_ASSERT(i64_1);
 
     qemu_fclose(loading);
 }
Signature · 1 line
1.9.0
#26 lore raw

PATCH 16/97 vmstate: Test for VMSTATE_UINT8_TEST

In reply to Juan Quintela

Remove VMSTATE_UINT8_V, we are removing versioning. Move all users to VMSTATE_UINT8_TEST.

---
 hw/char/serial.c            |  2 +-
 hw/ide/core.c               |  2 +-
 hw/net/ne2000.c             |  2 +-
 hw/timer/ds1338.c           |  2 +-
 hw/timer/hpet.c             |  2 +-
 include/migration/vmstate.h |  9 +++------
 target-i386/machine.c       | 10 +++++-----
 tests/test-vmstate.c        |  4 ++++
 8 files changed, 17 insertions(+), 16 deletions(-)
hw/char/serial.c +1 -1
index 16646d0..6243555 100644
@@ -610,7 +610,7 @@ const VMStateDescription vmstate_serial = {
         VMSTATE_UINT8(lsr, SerialState),
         VMSTATE_UINT8(msr, SerialState),
         VMSTATE_UINT8(scr, SerialState),
-        VMSTATE_UINT8_V(fcr_vmstate, SerialState, 3),
+        VMSTATE_UINT8_TEST(fcr_vmstate, SerialState, vmstate_3_plus),
         VMSTATE_END_OF_LIST()
     }
 };
hw/ide/core.c +1 -1
index ade1b89..b79cc9e 100644
@@ -2404,7 +2404,7 @@ const VMStateDescription vmstate_ide_drive = {
         VMSTATE_UINT8(lba48, IDEState),
         VMSTATE_UINT8(sense_key, IDEState),
         VMSTATE_UINT8(asc, IDEState),
-        VMSTATE_UINT8_V(cdrom_changed, IDEState, 3),
+        VMSTATE_UINT8_TEST(cdrom_changed, IDEState, vmstate_3_plus),
         VMSTATE_END_OF_LIST()
     },
     .subsections = (VMStateSubsection []) {
hw/net/ne2000.c +1 -1
index d558b8c..84745d64 100644
@@ -617,7 +617,7 @@ const VMStateDescription vmstate_ne2000 = {
     .minimum_version_id = 0,
     .post_load = ne2000_post_load,
     .fields = (VMStateField[]) {
-        VMSTATE_UINT8_V(rxcr, NE2000State, 2),
+        VMSTATE_UINT8_TEST(rxcr, NE2000State, vmstate_2_plus),
         VMSTATE_UINT8(cmd, NE2000State),
         VMSTATE_UINT32(start, NE2000State),
         VMSTATE_UINT32(stop, NE2000State),
hw/timer/ds1338.c +1 -1
index ec6dbee..78b8e7b 100644
@@ -43,7 +43,7 @@ static const VMStateDescription vmstate_ds1338 = {
     .fields = (VMStateField[]) {
         VMSTATE_I2C_SLAVE(parent_obj, DS1338State),
         VMSTATE_INT64(offset, DS1338State),
-        VMSTATE_UINT8_V(wday_offset, DS1338State, 2),
+        VMSTATE_UINT8_TEST(wday_offset, DS1338State, vmstate_2_plus),
         VMSTATE_UINT8_ARRAY(nvram, DS1338State, NVRAM_SIZE),
         VMSTATE_INT32(ptr, DS1338State),
         VMSTATE_BOOL(addr_byte, DS1338State),
hw/timer/hpet.c +1 -1
index fa590e3..2148568 100644
@@ -303,7 +303,7 @@ static const VMStateDescription vmstate_hpet = {
         VMSTATE_UINT64(config, HPETState),
         VMSTATE_UINT64(isr, HPETState),
         VMSTATE_UINT64(hpet_counter, HPETState),
-        VMSTATE_UINT8_V(num_timers, HPETState, 2),
+        VMSTATE_UINT8_TEST(num_timers, HPETState, vmstate_2_plus),
         VMSTATE_STRUCT_VARRAY_UINT8(timer, HPETState, num_timers, 0,
                                     vmstate_hpet_timer, HPETTimer),
         VMSTATE_END_OF_LIST()
include/migration/vmstate.h +3 -6
index ba8b44d..5d2b68d 100644
@@ -538,8 +538,8 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_INT64_TEST(_f, _s, _t)                                \
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int64, int64_t)
 
-#define VMSTATE_UINT8_V(_f, _s, _v)                                   \
-    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint8, uint8_t)
+#define VMSTATE_UINT8_TEST(_f, _s, _t)                                \
+    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint8, uint8_t)
 #define VMSTATE_UINT16_V(_f, _s, _v)                                  \
     VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16, uint16_t)
 #define VMSTATE_UINT32_V(_f, _s, _v)                                  \
@@ -560,7 +560,7 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_INT64_TEST(_f, _s, NULL)
 
 #define VMSTATE_UINT8(_f, _s)                                         \
-    VMSTATE_UINT8_V(_f, _s, 0)
+    VMSTATE_UINT8_TEST(_f, _s, NULL)
 #define VMSTATE_UINT16(_f, _s)                                        \
     VMSTATE_UINT16_V(_f, _s, 0)
 #define VMSTATE_UINT32(_f, _s)                                        \
@@ -595,9 +595,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_INT32_LE(_f, _s)                                   \
     VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
 
-#define VMSTATE_UINT8_TEST(_f, _s, _t)                               \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint8, uint8_t)
-
 #define VMSTATE_UINT16_TEST(_f, _s, _t)                               \
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16, uint16_t)
 
target-i386/machine.c +5 -5
index 2aecf5f..e4fd27c 100644
@@ -665,7 +665,7 @@ const VMStateDescription vmstate_x86_cpu = {
         VMSTATE_UINT16_V(env.intercept_dr_read, X86CPU, 5),
         VMSTATE_UINT16_V(env.intercept_dr_write, X86CPU, 5),
         VMSTATE_UINT32_V(env.intercept_exceptions, X86CPU, 5),
-        VMSTATE_UINT8_V(env.v_tpr, X86CPU, 5),
+        VMSTATE_UINT8_TEST(env.v_tpr, X86CPU, vmstate_5_plus),
         /* MTRRs */
         VMSTATE_UINT64_ARRAY_V(env.mtrr_fixed, X86CPU, 11, 8),
         VMSTATE_UINT64_V(env.mtrr_deftype, X86CPU, 8),
@@ -675,10 +675,10 @@ const VMStateDescription vmstate_x86_cpu = {
         VMSTATE_UINT32_V(env.mp_state, X86CPU, 9),
         VMSTATE_UINT64_V(env.tsc, X86CPU, 9),
         VMSTATE_INT32_TEST(env.exception_injected, X86CPU, vmstate_11_plus),
-        VMSTATE_UINT8_V(env.soft_interrupt, X86CPU, 11),
-        VMSTATE_UINT8_V(env.nmi_injected, X86CPU, 11),
-        VMSTATE_UINT8_V(env.nmi_pending, X86CPU, 11),
-        VMSTATE_UINT8_V(env.has_error_code, X86CPU, 11),
+        VMSTATE_UINT8_TEST(env.soft_interrupt, X86CPU, vmstate_11_plus),
+        VMSTATE_UINT8_TEST(env.nmi_injected, X86CPU, vmstate_11_plus),
+        VMSTATE_UINT8_TEST(env.nmi_pending, X86CPU, vmstate_11_plus),
+        VMSTATE_UINT8_TEST(env.has_error_code, X86CPU, vmstate_11_plus),
         VMSTATE_UINT32_V(env.sipi_vector, X86CPU, 11),
         /* MCE */
         VMSTATE_UINT64_V(env.mcg_cap, X86CPU, 10),
tests/test-vmstate.c +4 -0
index b8d1309..9af83a6 100644
@@ -251,6 +251,8 @@ static const VMStateDescription vmstate_simple_test = {
         VMSTATE_INT32_TEST(i32_2, TestSimple, test_false),
         VMSTATE_INT64_TEST(i64_1, TestSimple, test_true),
         VMSTATE_INT64_TEST(i64_2, TestSimple, test_false),
+        VMSTATE_UINT8_TEST(u8_1, TestSimple, test_true),
+        VMSTATE_UINT8_TEST(u8_2, TestSimple, test_false),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -261,6 +263,7 @@ uint8_t wire_simple_test[] = {
     /* i16_1 */ 0x02, 0x00,
     /* i32_1 */ 0x00, 0x01, 0x11, 0x70,
     /* i64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
+    /* u8_1 */  0x82,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -309,6 +312,7 @@ static void test_simple_test(void)
     FIELD_ASSERT(i16_1);
     FIELD_ASSERT(i32_1);
     FIELD_ASSERT(i64_1);
+    FIELD_ASSERT(u8_1);
 
     qemu_fclose(loading);
 }
Signature · 1 line
1.9.0
#27 lore raw

PATCH 17/97 vmstate: Test for VMSTATE_UINT16_TEST

In reply to Juan Quintela

Remove VMSTATE_UINT16_V, we are removing versioning. Move all users to VMSTATE_UINT16_TEST.

---
 hw/char/serial.c            | 2 +-
 hw/net/lan9118.c            | 4 ++--
 include/migration/vmstate.h | 9 +++------
 target-i386/machine.c       | 8 ++++----
 tests/test-vmstate.c        | 4 ++++
 5 files changed, 14 insertions(+), 13 deletions(-)
hw/char/serial.c +1 -1
index 6243555..57f2f0a 100644
@@ -601,7 +601,7 @@ const VMStateDescription vmstate_serial = {
     .pre_save = serial_pre_save,
     .post_load = serial_post_load,
     .fields = (VMStateField[]) {
-        VMSTATE_UINT16_V(divider, SerialState, 2),
+        VMSTATE_UINT16_TEST(divider, SerialState, vmstate_2_plus),
         VMSTATE_UINT8(rbr, SerialState),
         VMSTATE_UINT8(ier, SerialState),
         VMSTATE_UINT8(iir, SerialState),
hw/net/lan9118.c +2 -2
index e528290..fecbf8d 100644
@@ -310,8 +310,8 @@ static const VMStateDescription vmstate_lan9118 = {
         VMSTATE_INT32(rxp_pad, lan9118_state),
         VMSTATE_UINT32_V(write_word_prev_offset, lan9118_state, 2),
         VMSTATE_UINT32_V(write_word_n, lan9118_state, 2),
-        VMSTATE_UINT16_V(write_word_l, lan9118_state, 2),
-        VMSTATE_UINT16_V(write_word_h, lan9118_state, 2),
+        VMSTATE_UINT16_TEST(write_word_l, lan9118_state, vmstate_2_plus),
+        VMSTATE_UINT16_TEST(write_word_h, lan9118_state, vmstate_2_plus),
         VMSTATE_UINT32_V(read_word_prev_offset, lan9118_state, 2),
         VMSTATE_UINT32_V(read_word_n, lan9118_state, 2),
         VMSTATE_UINT32_V(read_long, lan9118_state, 2),
include/migration/vmstate.h +3 -6
index 5d2b68d..7f822c5 100644
@@ -540,8 +540,8 @@ extern const VMStateInfo vmstate_info_bitmap;
 
 #define VMSTATE_UINT8_TEST(_f, _s, _t)                                \
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint8, uint8_t)
-#define VMSTATE_UINT16_V(_f, _s, _v)                                  \
-    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16, uint16_t)
+#define VMSTATE_UINT16_TEST(_f, _s, _t)                               \
+    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16, uint16_t)
 #define VMSTATE_UINT32_V(_f, _s, _v)                                  \
     VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint32, uint32_t)
 #define VMSTATE_UINT64_V(_f, _s, _v)                                  \
@@ -562,7 +562,7 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT8(_f, _s)                                         \
     VMSTATE_UINT8_TEST(_f, _s, NULL)
 #define VMSTATE_UINT16(_f, _s)                                        \
-    VMSTATE_UINT16_V(_f, _s, 0)
+    VMSTATE_UINT16_TEST(_f, _s, NULL)
 #define VMSTATE_UINT32(_f, _s)                                        \
     VMSTATE_UINT32_V(_f, _s, 0)
 #define VMSTATE_UINT64(_f, _s)                                        \
@@ -595,9 +595,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_INT32_LE(_f, _s)                                   \
     VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
 
-#define VMSTATE_UINT16_TEST(_f, _s, _t)                               \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16, uint16_t)
-
 #define VMSTATE_UINT32_TEST(_f, _s, _t)                                  \
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint32, uint32_t)
 
target-i386/machine.c +4 -4
index e4fd27c..c05dc5a 100644
@@ -660,10 +660,10 @@ const VMStateDescription vmstate_x86_cpu = {
         VMSTATE_UINT64_V(env.vm_vmcb, X86CPU, 5),
         VMSTATE_UINT64_V(env.tsc_offset, X86CPU, 5),
         VMSTATE_UINT64_V(env.intercept, X86CPU, 5),
-        VMSTATE_UINT16_V(env.intercept_cr_read, X86CPU, 5),
-        VMSTATE_UINT16_V(env.intercept_cr_write, X86CPU, 5),
-        VMSTATE_UINT16_V(env.intercept_dr_read, X86CPU, 5),
-        VMSTATE_UINT16_V(env.intercept_dr_write, X86CPU, 5),
+        VMSTATE_UINT16_TEST(env.intercept_cr_read, X86CPU, vmstate_5_plus),
+        VMSTATE_UINT16_TEST(env.intercept_cr_write, X86CPU, vmstate_5_plus),
+        VMSTATE_UINT16_TEST(env.intercept_dr_read, X86CPU, vmstate_5_plus),
+        VMSTATE_UINT16_TEST(env.intercept_dr_write, X86CPU, vmstate_5_plus),
         VMSTATE_UINT32_V(env.intercept_exceptions, X86CPU, 5),
         VMSTATE_UINT8_TEST(env.v_tpr, X86CPU, vmstate_5_plus),
         /* MTRRs */
tests/test-vmstate.c +4 -0
index 9af83a6..018d8a2 100644
@@ -253,6 +253,8 @@ static const VMStateDescription vmstate_simple_test = {
         VMSTATE_INT64_TEST(i64_2, TestSimple, test_false),
         VMSTATE_UINT8_TEST(u8_1, TestSimple, test_true),
         VMSTATE_UINT8_TEST(u8_2, TestSimple, test_false),
+        VMSTATE_UINT16_TEST(u16_1, TestSimple, test_true),
+        VMSTATE_UINT16_TEST(u16_2, TestSimple, test_false),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -264,6 +266,7 @@ uint8_t wire_simple_test[] = {
     /* i32_1 */ 0x00, 0x01, 0x11, 0x70,
     /* i64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
     /* u8_1 */  0x82,
+    /* u16_1 */ 0x02, 0x00,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -313,6 +316,7 @@ static void test_simple_test(void)
     FIELD_ASSERT(i32_1);
     FIELD_ASSERT(i64_1);
     FIELD_ASSERT(u8_1);
+    FIELD_ASSERT(u16_1);
 
     qemu_fclose(loading);
 }
Signature · 1 line
1.9.0
#28 lore raw

PATCH 18/97 vmstate: Test for VMSTATE_UINT32_TEST

In reply to Juan Quintela

Remove VMSTATE_UINT32_V, we are removing versioning. Move all users to VMSTATE_UINT32_TEST.

---
 hw/arm/stellaris.c          |  2 +-
 hw/display/pl110.c          |  2 +-
 hw/gpio/pl061.c             |  2 +-
 hw/intc/ioapic_common.c     |  2 +-
 hw/misc/arm_sysctl.c        | 10 +++++-----
 hw/net/lan9118.c            | 14 ++++++++------
 hw/net/rtl8139.c            |  2 +-
 hw/nvram/fw_cfg.c           |  2 +-
 hw/timer/i8254_common.c     |  3 ++-
 hw/timer/mc146818rtc.c      |  4 ++--
 hw/usb/hcd-ehci.c           |  4 ++--
 hw/usb/hcd-uhci.c           |  2 +-
 include/migration/vmstate.h |  9 +++------
 target-i386/machine.c       | 10 +++++-----
 tests/test-vmstate.c        | 12 ++++++++----
 15 files changed, 42 insertions(+), 38 deletions(-)
hw/arm/stellaris.c +1 -1
index c7de9cf..a732ee9 100644
@@ -650,7 +650,7 @@ static const VMStateDescription vmstate_stellaris_sys = {
         VMSTATE_UINT32(int_status, ssys_state),
         VMSTATE_UINT32(resc, ssys_state),
         VMSTATE_UINT32(rcc, ssys_state),
-        VMSTATE_UINT32_V(rcc2, ssys_state, 2),
+        VMSTATE_UINT32_TEST(rcc2, ssys_state, vmstate_2_plus),
         VMSTATE_UINT32_ARRAY(rcgc, ssys_state, 3),
         VMSTATE_UINT32_ARRAY(scgc, ssys_state, 3),
         VMSTATE_UINT32_ARRAY(dcgc, ssys_state, 3),
hw/display/pl110.c +1 -1
index c574cf1..3405d02 100644
@@ -86,7 +86,7 @@ static const VMStateDescription vmstate_pl110 = {
         VMSTATE_INT32(invalidate, PL110State),
         VMSTATE_UINT32_ARRAY(palette, PL110State, 256),
         VMSTATE_UINT32_ARRAY(raw_palette, PL110State, 128),
-        VMSTATE_UINT32_V(mux_ctrl, PL110State, 2),
+        VMSTATE_UINT32_TEST(mux_ctrl, PL110State, vmstate_2_plus),
         VMSTATE_END_OF_LIST()
     }
 };
hw/gpio/pl061.c +1 -1
index dd4ea29..1f54b8f 100644
@@ -86,7 +86,7 @@ static const VMStateDescription vmstate_pl061 = {
         VMSTATE_UINT32(den, PL061State),
         VMSTATE_UINT32(cr, PL061State),
         VMSTATE_UINT32(float_high, PL061State),
-        VMSTATE_UINT32_V(amsel, PL061State, 2),
+        VMSTATE_UINT32_TEST(amsel, PL061State, vmstate_2_plus),
         VMSTATE_END_OF_LIST()
     }
 };
hw/intc/ioapic_common.c +1 -1
index 8b7d118..d4c0c8e 100644
@@ -92,7 +92,7 @@ static const VMStateDescription vmstate_ioapic_common = {
         VMSTATE_UINT8(id, IOAPICCommonState),
         VMSTATE_UINT8(ioregsel, IOAPICCommonState),
         VMSTATE_UNUSED_V(2, 8), /* to account for qemu-kvm's v2 format */
-        VMSTATE_UINT32_V(irr, IOAPICCommonState, 2),
+        VMSTATE_UINT32_TEST(irr, IOAPICCommonState, vmstate_2_plus),
         VMSTATE_UINT64_ARRAY(ioredtbl, IOAPICCommonState, IOAPIC_NUM_PINS),
         VMSTATE_END_OF_LIST()
     }
hw/misc/arm_sysctl.c +5 -5
index 3fad6f8..807d48e 100644
@@ -60,11 +60,11 @@ static const VMStateDescription vmstate_arm_sysctl = {
         VMSTATE_UINT32(flags, arm_sysctl_state),
         VMSTATE_UINT32(nvflags, arm_sysctl_state),
         VMSTATE_UINT32(resetlevel, arm_sysctl_state),
-        VMSTATE_UINT32_V(sys_mci, arm_sysctl_state, 2),
-        VMSTATE_UINT32_V(sys_cfgdata, arm_sysctl_state, 2),
-        VMSTATE_UINT32_V(sys_cfgctrl, arm_sysctl_state, 2),
-        VMSTATE_UINT32_V(sys_cfgstat, arm_sysctl_state, 2),
-        VMSTATE_UINT32_V(sys_clcd, arm_sysctl_state, 3),
+        VMSTATE_UINT32_TEST(sys_mci, arm_sysctl_state, vmstate_2_plus),
+        VMSTATE_UINT32_TEST(sys_cfgdata, arm_sysctl_state, vmstate_2_plus),
+        VMSTATE_UINT32_TEST(sys_cfgctrl, arm_sysctl_state, vmstate_2_plus),
+        VMSTATE_UINT32_TEST(sys_cfgstat, arm_sysctl_state, vmstate_2_plus),
+        VMSTATE_UINT32_TEST(sys_clcd, arm_sysctl_state, vmstate_3_plus),
         VMSTATE_UINT32_ARRAY_V(mb_clock, arm_sysctl_state, 6, 4),
         VMSTATE_VARRAY_UINT32(db_clock, arm_sysctl_state, db_num_clocks,
                               4, vmstate_info_uint32, uint32_t),
hw/net/lan9118.c +8 -6
index fecbf8d..fbba410 100644
@@ -308,14 +308,16 @@ static const VMStateDescription vmstate_lan9118 = {
         VMSTATE_INT32(rxp_offset, lan9118_state),
         VMSTATE_INT32(rxp_size, lan9118_state),
         VMSTATE_INT32(rxp_pad, lan9118_state),
-        VMSTATE_UINT32_V(write_word_prev_offset, lan9118_state, 2),
-        VMSTATE_UINT32_V(write_word_n, lan9118_state, 2),
+        VMSTATE_UINT32_TEST(write_word_prev_offset, lan9118_state,
+                            vmstate_2_plus),
+        VMSTATE_UINT32_TEST(write_word_n, lan9118_state, vmstate_2_plus),
         VMSTATE_UINT16_TEST(write_word_l, lan9118_state, vmstate_2_plus),
         VMSTATE_UINT16_TEST(write_word_h, lan9118_state, vmstate_2_plus),
-        VMSTATE_UINT32_V(read_word_prev_offset, lan9118_state, 2),
-        VMSTATE_UINT32_V(read_word_n, lan9118_state, 2),
-        VMSTATE_UINT32_V(read_long, lan9118_state, 2),
-        VMSTATE_UINT32_V(mode_16bit, lan9118_state, 2),
+        VMSTATE_UINT32_TEST(read_word_prev_offset, lan9118_state,
+                            vmstate_2_plus),
+        VMSTATE_UINT32_TEST(read_word_n, lan9118_state, vmstate_2_plus),
+        VMSTATE_UINT32_TEST(read_long, lan9118_state, vmstate_2_plus),
+        VMSTATE_UINT32_TEST(mode_16bit, lan9118_state, vmstate_2_plus),
         VMSTATE_END_OF_LIST()
     }
 };
hw/net/rtl8139.c +1 -1
index 90bc5ec..936adb0 100644
@@ -3363,7 +3363,7 @@ static const VMStateDescription vmstate_rtl8139 = {
         VMSTATE_STRUCT(tally_counters, RTL8139State, 0,
                        vmstate_tally_counters, RTL8139TallyCounters),
 
-        VMSTATE_UINT32_V(cplus_enabled, RTL8139State, 4),
+        VMSTATE_UINT32_TEST(cplus_enabled, RTL8139State, vmstate_4_plus),
         VMSTATE_END_OF_LIST()
     },
     .subsections = (VMStateSubsection []) {
hw/nvram/fw_cfg.c +1 -1
index b71d251..8ea3ac8 100644
@@ -380,7 +380,7 @@ static const VMStateDescription vmstate_fw_cfg = {
     .fields = (VMStateField[]) {
         VMSTATE_UINT16(cur_entry, FWCfgState),
         VMSTATE_UINT16_HACK(cur_offset, FWCfgState, is_version_1),
-        VMSTATE_UINT32_V(cur_offset, FWCfgState, 2),
+        VMSTATE_UINT32_TEST(cur_offset, FWCfgState, vmstate_2_plus),
         VMSTATE_END_OF_LIST()
     }
 };
hw/timer/i8254_common.c +2 -1
index 07345f6..f519864 100644
@@ -266,7 +266,8 @@ static const VMStateDescription vmstate_pit_common = {
     .pre_save = pit_dispatch_pre_save,
     .post_load = pit_dispatch_post_load,
     .fields = (VMStateField[]) {
-        VMSTATE_UINT32_V(channels[0].irq_disabled, PITCommonState, 3),
+        VMSTATE_UINT32_TEST(channels[0].irq_disabled, PITCommonState,
+            vmstate_3_plus),
         VMSTATE_STRUCT_ARRAY(channels, PITCommonState, 3, 2,
                              vmstate_pit_channel, PITChannelState),
         VMSTATE_INT64(channels[0].next_transition_time,
hw/timer/mc146818rtc.c +2 -2
index 8342749..079ae93 100644
@@ -728,8 +728,8 @@ static const VMStateDescription vmstate_rtc = {
         VMSTATE_TIMER(periodic_timer, RTCState),
         VMSTATE_INT64(next_periodic_time, RTCState),
         VMSTATE_UNUSED(3*8),
-        VMSTATE_UINT32_V(irq_coalesced, RTCState, 2),
-        VMSTATE_UINT32_V(period, RTCState, 2),
+        VMSTATE_UINT32_TEST(irq_coalesced, RTCState, vmstate_2_plus),
+        VMSTATE_UINT32_TEST(period, RTCState, vmstate_2_plus),
         VMSTATE_UINT64_V(base_rtc, RTCState, 3),
         VMSTATE_UINT64_V(last_update, RTCState, 3),
         VMSTATE_INT64_TEST(offset, RTCState, vmstate_3_plus),
hw/usb/hcd-ehci.c +2 -2
index a3ae9f2..da78296 100644
@@ -2496,8 +2496,8 @@ const VMStateDescription vmstate_ehci = {
         /* mmio registers */
         VMSTATE_UINT32(usbcmd, EHCIState),
         VMSTATE_UINT32(usbsts, EHCIState),
-        VMSTATE_UINT32_V(usbsts_pending, EHCIState, 2),
-        VMSTATE_UINT32_V(usbsts_frindex, EHCIState, 2),
+        VMSTATE_UINT32_TEST(usbsts_pending, EHCIState, vmstate_2_plus),
+        VMSTATE_UINT32_TEST(usbsts_frindex, EHCIState, vmstate_2_plus),
         VMSTATE_UINT32(usbintr, EHCIState),
         VMSTATE_UINT32(frindex, EHCIState),
         VMSTATE_UINT32(ctrldssegment, EHCIState),
hw/usb/hcd-uhci.c +1 -1
index 5590e18..eb6a448 100644
@@ -458,7 +458,7 @@ static const VMStateDescription vmstate_uhci = {
         VMSTATE_UINT8(status2, UHCIState),
         VMSTATE_TIMER(frame_timer, UHCIState),
         VMSTATE_INT64_TEST(expire_time, UHCIState, vmstate_3_plus),
-        VMSTATE_UINT32_V(pending_int_mask, UHCIState, 3),
+        VMSTATE_UINT32_TEST(pending_int_mask, UHCIState, vmstate_3_plus),
         VMSTATE_END_OF_LIST()
     }
 };
include/migration/vmstate.h +3 -6
index 7f822c5..aa99102 100644
@@ -542,8 +542,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint8, uint8_t)
 #define VMSTATE_UINT16_TEST(_f, _s, _t)                               \
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16, uint16_t)
-#define VMSTATE_UINT32_V(_f, _s, _v)                                  \
-    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint32, uint32_t)
+#define VMSTATE_UINT32_TEST(_f, _s, _t)                               \
+    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint32, uint32_t)
 #define VMSTATE_UINT64_V(_f, _s, _v)                                  \
     VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint64, uint64_t)
 
@@ -564,7 +564,7 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT16(_f, _s)                                        \
     VMSTATE_UINT16_TEST(_f, _s, NULL)
 #define VMSTATE_UINT32(_f, _s)                                        \
-    VMSTATE_UINT32_V(_f, _s, 0)
+    VMSTATE_UINT32_TEST(_f, _s, NULL)
 #define VMSTATE_UINT64(_f, _s)                                        \
     VMSTATE_UINT64_V(_f, _s, 0)
 
@@ -595,9 +595,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_INT32_LE(_f, _s)                                   \
     VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
 
-#define VMSTATE_UINT32_TEST(_f, _s, _t)                                  \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint32, uint32_t)
-
 #define VMSTATE_UINT64_TEST(_f, _s, _t)                                  \
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint64, uint64_t)
 
target-i386/machine.c +5 -5
index c05dc5a..42c9de0 100644
@@ -650,10 +650,10 @@ const VMStateDescription vmstate_x86_cpu = {
         VMSTATE_UINT64(env.fmask, X86CPU),
         VMSTATE_UINT64(env.kernelgsbase, X86CPU),
 #endif
-        VMSTATE_UINT32_V(env.smbase, X86CPU, 4),
+        VMSTATE_UINT32_TEST(env.smbase, X86CPU, vmstate_4_plus),
 
         VMSTATE_UINT64_V(env.pat, X86CPU, 5),
-        VMSTATE_UINT32_V(env.hflags2, X86CPU, 5),
+        VMSTATE_UINT32_TEST(env.hflags2, X86CPU, vmstate_5_plus),
 
         VMSTATE_UINT32_TEST(parent_obj.halted, X86CPU, version_is_5),
         VMSTATE_UINT64_V(env.vm_hsave, X86CPU, 5),
@@ -664,7 +664,7 @@ const VMStateDescription vmstate_x86_cpu = {
         VMSTATE_UINT16_TEST(env.intercept_cr_write, X86CPU, vmstate_5_plus),
         VMSTATE_UINT16_TEST(env.intercept_dr_read, X86CPU, vmstate_5_plus),
         VMSTATE_UINT16_TEST(env.intercept_dr_write, X86CPU, vmstate_5_plus),
-        VMSTATE_UINT32_V(env.intercept_exceptions, X86CPU, 5),
+        VMSTATE_UINT32_TEST(env.intercept_exceptions, X86CPU, vmstate_5_plus),
         VMSTATE_UINT8_TEST(env.v_tpr, X86CPU, vmstate_5_plus),
         /* MTRRs */
         VMSTATE_UINT64_ARRAY_V(env.mtrr_fixed, X86CPU, 11, 8),
@@ -672,14 +672,14 @@ const VMStateDescription vmstate_x86_cpu = {
         VMSTATE_MTRR_VARS(env.mtrr_var, X86CPU, 8, 8),
         /* KVM-related states */
         VMSTATE_INT32_TEST(env.interrupt_injected, X86CPU, vmstate_9_plus),
-        VMSTATE_UINT32_V(env.mp_state, X86CPU, 9),
+        VMSTATE_UINT32_TEST(env.mp_state, X86CPU, vmstate_9_plus),
         VMSTATE_UINT64_V(env.tsc, X86CPU, 9),
         VMSTATE_INT32_TEST(env.exception_injected, X86CPU, vmstate_11_plus),
         VMSTATE_UINT8_TEST(env.soft_interrupt, X86CPU, vmstate_11_plus),
         VMSTATE_UINT8_TEST(env.nmi_injected, X86CPU, vmstate_11_plus),
         VMSTATE_UINT8_TEST(env.nmi_pending, X86CPU, vmstate_11_plus),
         VMSTATE_UINT8_TEST(env.has_error_code, X86CPU, vmstate_11_plus),
-        VMSTATE_UINT32_V(env.sipi_vector, X86CPU, 11),
+        VMSTATE_UINT32_TEST(env.sipi_vector, X86CPU, vmstate_11_plus),
         /* MCE */
         VMSTATE_UINT64_V(env.mcg_cap, X86CPU, 10),
         VMSTATE_UINT64_V(env.mcg_status, X86CPU, 10),
tests/test-vmstate.c +8 -4
index 018d8a2..d1f45f8 100644
@@ -255,6 +255,8 @@ static const VMStateDescription vmstate_simple_test = {
         VMSTATE_UINT8_TEST(u8_2, TestSimple, test_false),
         VMSTATE_UINT16_TEST(u16_1, TestSimple, test_true),
         VMSTATE_UINT16_TEST(u16_2, TestSimple, test_false),
+        VMSTATE_UINT32_TEST(u32_1, TestSimple, test_true),
+        VMSTATE_UINT32_TEST(u32_2, TestSimple, test_false),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -267,6 +269,7 @@ uint8_t wire_simple_test[] = {
     /* i64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
     /* u8_1 */  0x82,
     /* u16_1 */ 0x02, 0x00,
+    /* u32_1 */ 0x00, 0x01, 0x11, 0x70,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -317,6 +320,7 @@ static void test_simple_test(void)
     FIELD_ASSERT(i64_1);
     FIELD_ASSERT(u8_1);
     FIELD_ASSERT(u16_1);
+    FIELD_ASSERT(u32_1);
 
     qemu_fclose(loading);
 }
@@ -334,12 +338,12 @@ static const VMStateDescription vmstate_versioned = {
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(a, TestStruct),
-        VMSTATE_UINT32_V(b, TestStruct, 2), /* Versioned field in the middle, so
-                                             * we catch bugs more easily.
-                                             */
+        /* Versioned field in the middle, so we catch bugs more easily. */
+        VMSTATE_UINT32_TEST(b, TestStruct, vmstate_2_plus),
+
         VMSTATE_UINT32(c, TestStruct),
         VMSTATE_UINT64(d, TestStruct),
-        VMSTATE_UINT32_V(e, TestStruct, 2),
+        VMSTATE_UINT32_TEST(e, TestStruct, vmstate_2_plus),
         VMSTATE_UINT64_V(f, TestStruct, 2),
         VMSTATE_END_OF_LIST()
     }
Signature · 1 line
1.9.0
#29 lore raw

PATCH 19/97 vmstate: Test for VMSTATE_UINT64_TEST

In reply to Juan Quintela

Remove VMSTATE_UINT64_V, we are removing versioning. Move all users to VMSTATE_UINT64_TEST.

---
 hw/timer/mc146818rtc.c      |  6 +++---
 include/migration/vmstate.h |  9 +++------
 target-i386/machine.c       | 30 +++++++++++++++---------------
 tests/test-vmstate.c        |  8 ++++++--
 4 files changed, 27 insertions(+), 26 deletions(-)
hw/timer/mc146818rtc.c +3 -3
index 079ae93..8446d48 100644
@@ -730,11 +730,11 @@ static const VMStateDescription vmstate_rtc = {
         VMSTATE_UNUSED(3*8),
         VMSTATE_UINT32_TEST(irq_coalesced, RTCState, vmstate_2_plus),
         VMSTATE_UINT32_TEST(period, RTCState, vmstate_2_plus),
-        VMSTATE_UINT64_V(base_rtc, RTCState, 3),
-        VMSTATE_UINT64_V(last_update, RTCState, 3),
+        VMSTATE_UINT64_TEST(base_rtc, RTCState, vmstate_3_plus),
+        VMSTATE_UINT64_TEST(last_update, RTCState, vmstate_3_plus),
         VMSTATE_INT64_TEST(offset, RTCState, vmstate_3_plus),
         VMSTATE_TIMER_V(update_timer, RTCState, 3),
-        VMSTATE_UINT64_V(next_alarm_time, RTCState, 3),
+        VMSTATE_UINT64_TEST(next_alarm_time, RTCState, vmstate_3_plus),
         VMSTATE_END_OF_LIST()
     }
 };
include/migration/vmstate.h +3 -6
index aa99102..25032ef 100644
@@ -544,8 +544,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16, uint16_t)
 #define VMSTATE_UINT32_TEST(_f, _s, _t)                               \
     VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint32, uint32_t)
-#define VMSTATE_UINT64_V(_f, _s, _v)                                  \
-    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint64, uint64_t)
+#define VMSTATE_UINT64_TEST(_f, _s, _t)                               \
+    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint64, uint64_t)
 
 #define VMSTATE_BOOL(_f, _s)                                          \
     VMSTATE_BOOL_TEST(_f, _s, NULL)
@@ -566,7 +566,7 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT32(_f, _s)                                        \
     VMSTATE_UINT32_TEST(_f, _s, NULL)
 #define VMSTATE_UINT64(_f, _s)                                        \
-    VMSTATE_UINT64_V(_f, _s, 0)
+    VMSTATE_UINT64_TEST(_f, _s, NULL)
 
 #define VMSTATE_UINT8_EQUAL(_f, _s)                                   \
     VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint8_equal, uint8_t)
@@ -595,9 +595,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_INT32_LE(_f, _s)                                   \
     VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
 
-#define VMSTATE_UINT64_TEST(_f, _s, _t)                                  \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint64, uint64_t)
-
 
 #define VMSTATE_FLOAT64_V(_f, _s, _v)                                 \
     VMSTATE_SINGLE(_f, _s, _v, vmstate_info_float64, float64)
target-i386/machine.c +15 -15
index 42c9de0..d4ffe8e 100644
@@ -652,14 +652,14 @@ const VMStateDescription vmstate_x86_cpu = {
 #endif
         VMSTATE_UINT32_TEST(env.smbase, X86CPU, vmstate_4_plus),
 
-        VMSTATE_UINT64_V(env.pat, X86CPU, 5),
+        VMSTATE_UINT64_TEST(env.pat, X86CPU, vmstate_5_plus),
         VMSTATE_UINT32_TEST(env.hflags2, X86CPU, vmstate_5_plus),
 
         VMSTATE_UINT32_TEST(parent_obj.halted, X86CPU, version_is_5),
-        VMSTATE_UINT64_V(env.vm_hsave, X86CPU, 5),
-        VMSTATE_UINT64_V(env.vm_vmcb, X86CPU, 5),
-        VMSTATE_UINT64_V(env.tsc_offset, X86CPU, 5),
-        VMSTATE_UINT64_V(env.intercept, X86CPU, 5),
+        VMSTATE_UINT64_TEST(env.vm_hsave, X86CPU, vmstate_5_plus),
+        VMSTATE_UINT64_TEST(env.vm_vmcb, X86CPU, vmstate_5_plus),
+        VMSTATE_UINT64_TEST(env.tsc_offset, X86CPU, vmstate_5_plus),
+        VMSTATE_UINT64_TEST(env.intercept, X86CPU, vmstate_5_plus),
         VMSTATE_UINT16_TEST(env.intercept_cr_read, X86CPU, vmstate_5_plus),
         VMSTATE_UINT16_TEST(env.intercept_cr_write, X86CPU, vmstate_5_plus),
         VMSTATE_UINT16_TEST(env.intercept_dr_read, X86CPU, vmstate_5_plus),
@@ -668,12 +668,12 @@ const VMStateDescription vmstate_x86_cpu = {
         VMSTATE_UINT8_TEST(env.v_tpr, X86CPU, vmstate_5_plus),
         /* MTRRs */
         VMSTATE_UINT64_ARRAY_V(env.mtrr_fixed, X86CPU, 11, 8),
-        VMSTATE_UINT64_V(env.mtrr_deftype, X86CPU, 8),
+        VMSTATE_UINT64_TEST(env.mtrr_deftype, X86CPU, vmstate_8_plus),
         VMSTATE_MTRR_VARS(env.mtrr_var, X86CPU, 8, 8),
         /* KVM-related states */
         VMSTATE_INT32_TEST(env.interrupt_injected, X86CPU, vmstate_9_plus),
         VMSTATE_UINT32_TEST(env.mp_state, X86CPU, vmstate_9_plus),
-        VMSTATE_UINT64_V(env.tsc, X86CPU, 9),
+        VMSTATE_UINT64_TEST(env.tsc, X86CPU, vmstate_9_plus),
         VMSTATE_INT32_TEST(env.exception_injected, X86CPU, vmstate_11_plus),
         VMSTATE_UINT8_TEST(env.soft_interrupt, X86CPU, vmstate_11_plus),
         VMSTATE_UINT8_TEST(env.nmi_injected, X86CPU, vmstate_11_plus),
@@ -681,18 +681,18 @@ const VMStateDescription vmstate_x86_cpu = {
         VMSTATE_UINT8_TEST(env.has_error_code, X86CPU, vmstate_11_plus),
         VMSTATE_UINT32_TEST(env.sipi_vector, X86CPU, vmstate_11_plus),
         /* MCE */
-        VMSTATE_UINT64_V(env.mcg_cap, X86CPU, 10),
-        VMSTATE_UINT64_V(env.mcg_status, X86CPU, 10),
-        VMSTATE_UINT64_V(env.mcg_ctl, X86CPU, 10),
+        VMSTATE_UINT64_TEST(env.mcg_cap, X86CPU, vmstate_10_plus),
+        VMSTATE_UINT64_TEST(env.mcg_status, X86CPU, vmstate_10_plus),
+        VMSTATE_UINT64_TEST(env.mcg_ctl, X86CPU, vmstate_10_plus),
         VMSTATE_UINT64_ARRAY_V(env.mce_banks, X86CPU, MCE_BANKS_DEF * 4, 10),
         /* rdtscp */
-        VMSTATE_UINT64_V(env.tsc_aux, X86CPU, 11),
+        VMSTATE_UINT64_TEST(env.tsc_aux, X86CPU, vmstate_11_plus),
         /* KVM pvclock msr */
-        VMSTATE_UINT64_V(env.system_time_msr, X86CPU, 11),
-        VMSTATE_UINT64_V(env.wall_clock_msr, X86CPU, 11),
+        VMSTATE_UINT64_TEST(env.system_time_msr, X86CPU, vmstate_11_plus),
+        VMSTATE_UINT64_TEST(env.wall_clock_msr, X86CPU, vmstate_11_plus),
         /* XSAVE related fields */
-        VMSTATE_UINT64_V(env.xcr0, X86CPU, 12),
-        VMSTATE_UINT64_V(env.xstate_bv, X86CPU, 12),
+        VMSTATE_UINT64_TEST(env.xcr0, X86CPU, vmstate_12_plus),
+        VMSTATE_UINT64_TEST(env.xstate_bv, X86CPU, vmstate_12_plus),
         VMSTATE_YMMH_REGS_VARS(env.ymmh_regs, X86CPU, CPU_NB_REGS, 12),
         VMSTATE_END_OF_LIST()
         /* The above list is not sorted /wrt version numbers, watch out! */
tests/test-vmstate.c +6 -2
index d1f45f8..632c7a7 100644
@@ -257,6 +257,8 @@ static const VMStateDescription vmstate_simple_test = {
         VMSTATE_UINT16_TEST(u16_2, TestSimple, test_false),
         VMSTATE_UINT32_TEST(u32_1, TestSimple, test_true),
         VMSTATE_UINT32_TEST(u32_2, TestSimple, test_false),
+        VMSTATE_UINT64_TEST(u64_1, TestSimple, test_true),
+        VMSTATE_UINT64_TEST(u64_2, TestSimple, test_false),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -270,6 +272,7 @@ uint8_t wire_simple_test[] = {
     /* u8_1 */  0x82,
     /* u16_1 */ 0x02, 0x00,
     /* u32_1 */ 0x00, 0x01, 0x11, 0x70,
+    /* u64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -321,6 +324,7 @@ static void test_simple_test(void)
     FIELD_ASSERT(u8_1);
     FIELD_ASSERT(u16_1);
     FIELD_ASSERT(u32_1);
+    FIELD_ASSERT(u64_1);
 
     qemu_fclose(loading);
 }
@@ -344,7 +348,7 @@ static const VMStateDescription vmstate_versioned = {
         VMSTATE_UINT32(c, TestStruct),
         VMSTATE_UINT64(d, TestStruct),
         VMSTATE_UINT32_TEST(e, TestStruct, vmstate_2_plus),
-        VMSTATE_UINT64_V(f, TestStruct, 2),
+        VMSTATE_UINT64_TEST(f, TestStruct, vmstate_2_plus),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -417,7 +421,7 @@ static const VMStateDescription vmstate_skipping = {
         VMSTATE_UINT32_TEST(c, TestStruct, test_skip),
         VMSTATE_UINT64(d, TestStruct),
         VMSTATE_UINT32_TEST(e, TestStruct, test_skip),
-        VMSTATE_UINT64_V(f, TestStruct, 2),
+        VMSTATE_UINT64_TEST(f, TestStruct, vmstate_2_plus),
         VMSTATE_END_OF_LIST()
     }
 };
Signature · 1 line
1.9.0
#30 lore raw

PATCH 20/97 vmstate: Test for VMSTATE_FLOAT64

In reply to Juan Quintela

Remove unused VMSTATE_FLOAT64_V.

---
 include/migration/vmstate.h | 5 +----
 tests/test-vmstate.c        | 5 +++++
 2 files changed, 6 insertions(+), 4 deletions(-)
include/migration/vmstate.h +1 -4
index 25032ef..eec4b13 100644
@@ -596,11 +596,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
 
 
-#define VMSTATE_FLOAT64_V(_f, _s, _v)                                 \
-    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_float64, float64)
-
 #define VMSTATE_FLOAT64(_f, _s)                                       \
-    VMSTATE_FLOAT64_V(_f, _s, 0)
+    VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_float64, float64)
 
 #define VMSTATE_TIMER_TEST(_f, _s, _test)                             \
     VMSTATE_POINTER_TEST(_f, _s, _test, vmstate_info_timer, QEMUTimer *)
tests/test-vmstate.c +5 -0
index 632c7a7..21f02ad 100644
@@ -66,6 +66,7 @@ typedef struct TestSimple {
     int16_t  i16_1, i16_2;
     int32_t  i32_1, i32_2;
     int64_t  i64_1, i64_2;
+    float64 f64;
 } TestSimple;
 
 /* Object instantiation, we are going to use it in more than one test */
@@ -89,6 +90,7 @@ TestSimple obj_simple = {
     .i32_2 = -70000,
     .i64_1 = 12121212,
     .i64_2 = -12121212,
+    .f64 = float64_pi,
 };
 
 /* Description of the values.  If you add a primitive type
@@ -113,6 +115,7 @@ static const VMStateDescription vmstate_simple_primitive = {
         VMSTATE_INT32(i32_2, TestSimple),
         VMSTATE_INT64(i64_1, TestSimple),
         VMSTATE_INT64(i64_2, TestSimple),
+        VMSTATE_FLOAT64(f64, TestSimple),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -144,6 +147,7 @@ uint8_t wire_simple_primitive[] = {
     /* i32_2 */ 0xff, 0xfe, 0xee, 0x90,
     /* i64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
     /* i64_2 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0x47, 0x0b, 0x84,
+    /* f64 */   0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -209,6 +213,7 @@ static void test_simple_primitive(void)
     FIELD_ASSERT(i32_2);
     FIELD_ASSERT(i64_1);
     FIELD_ASSERT(i64_2);
+    FIELD_ASSERT(f64);
 
     /* We save the file again.  We want the EOF this time */
 
Signature · 1 line
1.9.0
#31 lore raw

PATCH 21/97 vmstate: Test for VMSTATE_UNUSED

In reply to Juan Quintela

Remove VMSTATE_UNUSED_V and fix only user.

---
 hw/intc/ioapic_common.c     |  3 ++-
 include/migration/vmstate.h | 11 ++---------
 tests/test-vmstate.c        |  5 +++++
 3 files changed, 9 insertions(+), 10 deletions(-)
hw/intc/ioapic_common.c +2 -1
index d4c0c8e..ae81d3f 100644
@@ -91,7 +91,8 @@ static const VMStateDescription vmstate_ioapic_common = {
     .fields = (VMStateField[]) {
         VMSTATE_UINT8(id, IOAPICCommonState),
         VMSTATE_UINT8(ioregsel, IOAPICCommonState),
-        VMSTATE_UNUSED_V(2, 8), /* to account for qemu-kvm's v2 format */
+        /* to account for qemu-kvm's v2 format */
+        VMSTATE_UNUSED_TEST(vmstate_2_plus, 8),
         VMSTATE_UINT32_TEST(irr, IOAPICCommonState, vmstate_2_plus),
         VMSTATE_UINT64_ARRAY(ioredtbl, IOAPICCommonState, IOAPIC_NUM_PINS),
         VMSTATE_END_OF_LIST()
include/migration/vmstate.h +2 -9
index eec4b13..b350eac 100644
@@ -482,10 +482,9 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset     = offsetof(_state, _field),                          \
 }
 
-#define VMSTATE_UNUSED_BUFFER(_test, _version, _size) {              \
+#define VMSTATE_UNUSED_TEST(_test, _size) {                          \
     .name         = "unused",                                        \
     .field_exists = (_test),                                         \
-    .version_id   = (_version),                                      \
     .size         = (_size),                                         \
     .info         = &vmstate_info_unused_buffer,                     \
     .flags        = VMS_BUFFER,                                      \
@@ -719,14 +718,8 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_BUFFER_UNSAFE(_field, _state, _version, _size)        \
     VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, vmstate_info_buffer, _size)
 
-#define VMSTATE_UNUSED_V(_v, _size)                                   \
-    VMSTATE_UNUSED_BUFFER(NULL, _v, _size)
-
 #define VMSTATE_UNUSED(_size)                                         \
-    VMSTATE_UNUSED_V(0, _size)
-
-#define VMSTATE_UNUSED_TEST(_test, _size)                             \
-    VMSTATE_UNUSED_BUFFER(_test, 0, _size)
+    VMSTATE_UNUSED_TEST(NULL, _size)
 
 #define VMSTATE_END_OF_LIST()                                         \
     {}
tests/test-vmstate.c +5 -0
index 21f02ad..e4096f7 100644
@@ -116,6 +116,7 @@ static const VMStateDescription vmstate_simple_primitive = {
         VMSTATE_INT64(i64_1, TestSimple),
         VMSTATE_INT64(i64_2, TestSimple),
         VMSTATE_FLOAT64(f64, TestSimple),
+        VMSTATE_UNUSED(5),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -148,6 +149,7 @@ uint8_t wire_simple_primitive[] = {
     /* i64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
     /* i64_2 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0x47, 0x0b, 0x84,
     /* f64 */   0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18,
+    /* unused */0x00, 0x00, 0x00, 0x00, 0x00,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -264,6 +266,8 @@ static const VMStateDescription vmstate_simple_test = {
         VMSTATE_UINT32_TEST(u32_2, TestSimple, test_false),
         VMSTATE_UINT64_TEST(u64_1, TestSimple, test_true),
         VMSTATE_UINT64_TEST(u64_2, TestSimple, test_false),
+        VMSTATE_UNUSED_TEST(test_true, 5),
+        VMSTATE_UNUSED_TEST(test_false, 5),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -278,6 +282,7 @@ uint8_t wire_simple_test[] = {
     /* u16_1 */ 0x02, 0x00,
     /* u32_1 */ 0x00, 0x01, 0x11, 0x70,
     /* u64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
+    /* unused */0x00, 0x00, 0x00, 0x00, 0x00,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
Signature · 1 line
1.9.0
#32 lore raw

PATCH 22/97 vmstate: Test for VMSTATE_BITMAP

In reply to Juan Quintela

Remove the unused version field (was unused).

---
 hw/sd/sd.c                  |  2 +-
 include/migration/vmstate.h |  4 +-
 tests/test-vmstate.c        | 90 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 93 insertions(+), 3 deletions(-)
hw/sd/sd.c +1 -1
index 4502ad1..7ee8c24 100644
@@ -467,7 +467,7 @@ static const VMStateDescription sd_vmstate = {
         VMSTATE_UINT32(card_status, SDState),
         VMSTATE_PARTIAL_BUFFER(sd_status, SDState, 1),
         VMSTATE_UINT32(vhs, SDState),
-        VMSTATE_BITMAP(wp_groups, SDState, 0, wpgrps_size),
+        VMSTATE_BITMAP(wp_groups, SDState, wpgrps_size),
         VMSTATE_UINT32(blk_len, SDState),
         VMSTATE_UINT32(erase_start, SDState),
         VMSTATE_UINT32(erase_end, SDState),
include/migration/vmstate.h +2 -2
index b350eac..9cfc356 100644
@@ -493,9 +493,9 @@ extern const VMStateInfo vmstate_info_bitmap;
 /* _field_size should be a int32_t field in the _state struct giving the
  * size of the bitmap _field in bits.
  */
-#define VMSTATE_BITMAP(_field, _state, _version, _field_size) {      \
+#define VMSTATE_BITMAP(_field, _state, _field_size) {                \
     .name         = (stringify(_field)),                             \
-    .version_id   = (_version),                                      \
+    .version_id   = 0,                                               \
     .size_offset  = vmstate_offset_value(_state, _field_size, int32_t),\
     .info         = &vmstate_info_bitmap,                            \
     .flags        = VMS_VBUFFER|VMS_POINTER,                         \
tests/test-vmstate.c +90 -0

108 lines not on this page · raw message

Signature · 1 line
1.9.0
#33 lore raw

PATCH 23/97 vmstate: Test for VMSTATE_UINT8_EQUAL

In reply to Juan Quintela

We intruduce another full test.

---
 include/migration/vmstate.h |  2 +-
 tests/test-vmstate.c        | 71 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 1 deletion(-)
include/migration/vmstate.h +1 -1
index 9cfc356..2c7f150 100644
@@ -568,7 +568,7 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_UINT64_TEST(_f, _s, NULL)
 
 #define VMSTATE_UINT8_EQUAL(_f, _s)                                   \
-    VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint8_equal, uint8_t)
+    VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_uint8_equal, uint8_t)
 
 #define VMSTATE_UINT16_EQUAL(_f, _s)                                  \
     VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint16_equal, uint16_t)
tests/test-vmstate.c +71 -0

89 lines not on this page · raw message

Signature · 1 line
1.9.0
#34 lore raw

PATCH 24/97 vmstate: Test for VMSTATE_UINT16_EQUAL

In reply to Juan Quintela

We change only user of VMSTATE_UINT16_EQUAL_V to VMSTATE_UINT16_EQUAL_TEST.

---
 hw/nvram/eeprom93xx.c       | 7 ++++++-
 include/migration/vmstate.h | 8 ++++----
 tests/test-vmstate.c        | 8 +++++++-
 3 files changed, 17 insertions(+), 6 deletions(-)
hw/nvram/eeprom93xx.c +6 -1
index 0af4d67..d07bafb 100644
@@ -121,6 +121,11 @@ static bool is_old_eeprom_version(void *opaque, int version_id)
     return version_id == OLD_EEPROM_VERSION;
 }
 
+static bool is_eeprom_version(void *opaque, int version_id)
+{
+    return version_id == EEPROM_VERSION;
+}
+
 static const VMStateDescription vmstate_eeprom = {
     .name = "eeprom",
     .version_id = EEPROM_VERSION,
@@ -138,7 +143,7 @@ static const VMStateDescription vmstate_eeprom = {
         VMSTATE_UINT8(addrbits, eeprom_t),
         VMSTATE_UINT16_HACK_TEST(size, eeprom_t, is_old_eeprom_version),
         VMSTATE_UNUSED_TEST(is_old_eeprom_version, 1),
-        VMSTATE_UINT16_EQUAL_V(size, eeprom_t, EEPROM_VERSION),
+        VMSTATE_UINT16_EQUAL_TEST(size, eeprom_t, is_eeprom_version),
         VMSTATE_UINT16(data, eeprom_t),
         VMSTATE_VARRAY_UINT16_UNSAFE(contents, eeprom_t, size, 0,
                                      vmstate_info_uint16, uint16_t),
include/migration/vmstate.h +4 -4
index 2c7f150..e6f6a46 100644
@@ -570,11 +570,11 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT8_EQUAL(_f, _s)                                   \
     VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_uint8_equal, uint8_t)
 
-#define VMSTATE_UINT16_EQUAL(_f, _s)                                  \
-    VMSTATE_SINGLE(_f, _s, 0, vmstate_info_uint16_equal, uint16_t)
+#define VMSTATE_UINT16_EQUAL_TEST(_f, _s, _t)                         \
+    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16_equal, uint16_t)
 
-#define VMSTATE_UINT16_EQUAL_V(_f, _s, _v)                            \
-    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16_equal, uint16_t)
+#define VMSTATE_UINT16_EQUAL(_f, _s)                                  \
+    VMSTATE_UINT16_EQUAL_TEST(_f, _s, NULL)
 
 #define VMSTATE_INT32_EQUAL(_f, _s)                                   \
     VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_equal, int32_t)
tests/test-vmstate.c +7 -1
index c6e4b67..bd13723 100644
@@ -60,7 +60,7 @@ static QEMUFile *open_test_file(bool write)
 typedef struct TestSimple {
     bool     b_1,   b_2;
     uint8_t  u8_1,  u8_2;
-    uint16_t u16_1, u16_2;
+    uint16_t u16_1, u16_2, u16_3;
     uint32_t u32_1, u32_2;
     uint64_t u64_1, u64_2;
     int8_t   i8_1,  i8_2;
@@ -79,6 +79,7 @@ TestSimple obj_simple = {
     .u8_1 = 130,
     .u16_1 = 512,
     .u16_2 = 45000,
+    .u16_3 = 512,
     .u32_1 = 70000,
     .u32_2 = 100000,
     .u64_1 = 12121212,
@@ -347,12 +348,17 @@ static const VMStateDescription vmstate_simple_compare = {
     .minimum_version_id_old = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT8_EQUAL(u8_1, TestSimple),
+        VMSTATE_UINT16_EQUAL(u16_1, TestSimple),
+        VMSTATE_UINT16_EQUAL_TEST(u16_2, TestSimple, test_false),
+        VMSTATE_UINT16_EQUAL_TEST(u16_3, TestSimple, test_true),
         VMSTATE_END_OF_LIST()
     }
 };
 
 uint8_t wire_simple_compare[] = {
     /* u8_1 */  0x82,
+    /* u16_1 */ 0x02, 0x00,
+    /* u16_3 */ 0x02, 0x00,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
Signature · 1 line
1.9.0
#35 lore raw

PATCH 25/97 vmstate: Test for VMSTATE_UINT32_EQUAL

In reply to Juan Quintela

Remove unused VMSTATE_UINT32_EQUAL_V.

---
 include/migration/vmstate.h | 9 +++------
 tests/test-vmstate.c        | 2 ++
 2 files changed, 5 insertions(+), 6 deletions(-)
include/migration/vmstate.h +3 -6
index e6f6a46..267ce4e 100644
@@ -576,15 +576,12 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT16_EQUAL(_f, _s)                                  \
     VMSTATE_UINT16_EQUAL_TEST(_f, _s, NULL)
 
+#define VMSTATE_UINT32_EQUAL(_f, _s)                                  \
+    VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_uint32_equal, uint32_t)
+
 #define VMSTATE_INT32_EQUAL(_f, _s)                                   \
     VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_equal, int32_t)
 
-#define VMSTATE_UINT32_EQUAL_V(_f, _s, _v)                            \
-    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint32_equal, uint32_t)
-
-#define VMSTATE_UINT32_EQUAL(_f, _s)                                  \
-    VMSTATE_UINT32_EQUAL_V(_f, _s, 0)
-
 #define VMSTATE_UINT64_EQUAL_V(_f, _s, _v)                            \
     VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint64_equal, uint64_t)
 
tests/test-vmstate.c +2 -0
index bd13723..f913b57 100644
@@ -351,6 +351,7 @@ static const VMStateDescription vmstate_simple_compare = {
         VMSTATE_UINT16_EQUAL(u16_1, TestSimple),
         VMSTATE_UINT16_EQUAL_TEST(u16_2, TestSimple, test_false),
         VMSTATE_UINT16_EQUAL_TEST(u16_3, TestSimple, test_true),
+        VMSTATE_UINT32_EQUAL(u32_1, TestSimple),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -359,6 +360,7 @@ uint8_t wire_simple_compare[] = {
     /* u8_1 */  0x82,
     /* u16_1 */ 0x02, 0x00,
     /* u16_3 */ 0x02, 0x00,
+    /* u32_1 */ 0x00, 0x01, 0x11, 0x70,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
Signature · 1 line
1.9.0
#36 lore raw

PATCH 26/97 vmstate: Test for VMSTATE_UINT64_EQUAL

In reply to Juan Quintela

Remove unused VMSTATE_UINT64_EQUAL_V.

---
 include/migration/vmstate.h | 9 +++------
 tests/test-vmstate.c        | 2 ++
 2 files changed, 5 insertions(+), 6 deletions(-)
include/migration/vmstate.h +3 -6
index 267ce4e..55750f4 100644
@@ -579,15 +579,12 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT32_EQUAL(_f, _s)                                  \
     VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_uint32_equal, uint32_t)
 
+#define VMSTATE_UINT64_EQUAL(_f, _s)                                  \
+    VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_uint64_equal, uint64_t)
+
 #define VMSTATE_INT32_EQUAL(_f, _s)                                   \
     VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_equal, int32_t)
 
-#define VMSTATE_UINT64_EQUAL_V(_f, _s, _v)                            \
-    VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint64_equal, uint64_t)
-
-#define VMSTATE_UINT64_EQUAL(_f, _s)                                  \
-    VMSTATE_UINT64_EQUAL_V(_f, _s, 0)
-
 #define VMSTATE_INT32_LE(_f, _s)                                   \
     VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
 
tests/test-vmstate.c +2 -0
index f913b57..0ac816d 100644
@@ -352,6 +352,7 @@ static const VMStateDescription vmstate_simple_compare = {
         VMSTATE_UINT16_EQUAL_TEST(u16_2, TestSimple, test_false),
         VMSTATE_UINT16_EQUAL_TEST(u16_3, TestSimple, test_true),
         VMSTATE_UINT32_EQUAL(u32_1, TestSimple),
+        VMSTATE_UINT64_EQUAL(u64_1, TestSimple),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -361,6 +362,7 @@ uint8_t wire_simple_compare[] = {
     /* u16_1 */ 0x02, 0x00,
     /* u16_3 */ 0x02, 0x00,
     /* u32_1 */ 0x00, 0x01, 0x11, 0x70,
+    /* u64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
Signature · 1 line
1.9.0
#37 lore raw

PATCH 27/97 vmstate: Test for VMSTATE_INT32_EQUAL

In reply to Juan Quintela
---
 include/migration/vmstate.h | 2 +-
 tests/test-vmstate.c        | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
include/migration/vmstate.h +1 -1
index 55750f4..9eec546 100644
@@ -583,7 +583,7 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_uint64_equal, uint64_t)
 
 #define VMSTATE_INT32_EQUAL(_f, _s)                                   \
-    VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_equal, int32_t)
+    VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_int32_equal, int32_t)
 
 #define VMSTATE_INT32_LE(_f, _s)                                   \
     VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
tests/test-vmstate.c +2 -0
index 0ac816d..70f27f8 100644
@@ -353,6 +353,7 @@ static const VMStateDescription vmstate_simple_compare = {
         VMSTATE_UINT16_EQUAL_TEST(u16_3, TestSimple, test_true),
         VMSTATE_UINT32_EQUAL(u32_1, TestSimple),
         VMSTATE_UINT64_EQUAL(u64_1, TestSimple),
+        VMSTATE_INT32_EQUAL(i32_1, TestSimple),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -363,6 +364,7 @@ uint8_t wire_simple_compare[] = {
     /* u16_3 */ 0x02, 0x00,
     /* u32_1 */ 0x00, 0x01, 0x11, 0x70,
     /* u64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
+    /* i32_1 */ 0x00, 0x01, 0x11, 0x70,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
Signature · 1 line
1.9.0
#38 lore raw

PATCH 28/97 vmstate: Test for VMSTATE_INT32_LE

In reply to Juan Quintela

Add tests for less/more than the value on destination.

---
 include/migration/vmstate.h |  4 ++--
 tests/test-vmstate.c        | 25 ++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 3 deletions(-)
include/migration/vmstate.h +2 -2
index 9eec546..8707c4f 100644
@@ -585,8 +585,8 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_INT32_EQUAL(_f, _s)                                   \
     VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_int32_equal, int32_t)
 
-#define VMSTATE_INT32_LE(_f, _s)                                   \
-    VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
+#define VMSTATE_INT32_LE(_f, _s)                                      \
+    VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_int32_le, int32_t)
 
 
 #define VMSTATE_FLOAT64(_f, _s)                                       \
tests/test-vmstate.c +24 -1
index 70f27f8..d52f722 100644
@@ -353,7 +353,8 @@ static const VMStateDescription vmstate_simple_compare = {
         VMSTATE_UINT16_EQUAL_TEST(u16_3, TestSimple, test_true),
         VMSTATE_UINT32_EQUAL(u32_1, TestSimple),
         VMSTATE_UINT64_EQUAL(u64_1, TestSimple),
-        VMSTATE_INT32_EQUAL(i32_1, TestSimple),
+        VMSTATE_INT32_EQUAL(i32_2, TestSimple),
+        VMSTATE_INT32_LE(i32_1, TestSimple),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -364,6 +365,7 @@ uint8_t wire_simple_compare[] = {
     /* u16_3 */ 0x02, 0x00,
     /* u32_1 */ 0x00, 0x01, 0x11, 0x70,
     /* u64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
+    /* i32_2 */ 0xff, 0xfe, 0xee, 0x90,
     /* i32_1 */ 0x00, 0x01, 0x11, 0x70,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
@@ -419,6 +421,27 @@ static void test_simple_compare(void)
     FAILURE(vmstate_load_state(loading, &vmstate_simple_compare, &obj, 1));
     g_assert(!qemu_file_get_error(loading));
     qemu_fclose(loading);
+
+    /* testing less equal */
+
+    loading = open_test_file(false);
+    memcpy(&obj, &obj_simple, sizeof(obj));
+    /* value on the wire is bigger, so fail */
+    obj.i32_1 = 8000;
+
+    FAILURE(vmstate_load_state(loading, &vmstate_simple_compare, &obj, 1));
+    g_assert(!qemu_file_get_error(loading));
+    qemu_fclose(loading);
+
+    loading = open_test_file(false);
+    memcpy(&obj, &obj_simple, sizeof(obj));
+    /* value on the wire is lower, so success */
+    obj.i32_1 = 80000;
+
+    SUCCESS(vmstate_load_state(loading, &vmstate_simple_compare, &obj, 1));
+    g_assert(!qemu_file_get_error(loading));
+    qemu_fclose(loading);
+
 }
 #undef FIELD_ASSERT
 
Signature · 1 line
1.9.0
#39 lore raw

PATCH 29/97 vmstate: s/VMSTATE_INT32_LE/VMSTATE_INT32_POSITIVE_LE/

In reply to Juan Quintela

From: "Michael S. Tsirkin" <[email protected]>

As the macro verifies the value is positive, rename it to make the function clearer.

---
 hw/pci/pci.c                | 4 ++--
 include/migration/vmstate.h | 3 +--
 target-arm/machine.c        | 2 +-
 tests/test-vmstate.c        | 2 +-
 4 files changed, 5 insertions(+), 6 deletions(-)
hw/pci/pci.c +2 -2
index d4375b6..2ba6b30 100644
@@ -473,7 +473,7 @@ const VMStateDescription vmstate_pci_device = {
     .version_id = 2,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_INT32_LE(version_id, PCIDevice),
+        VMSTATE_INT32_POSITIVE_LE(version_id, PCIDevice),
         VMSTATE_BUFFER_UNSAFE_INFO(config, PCIDevice, 0,
                                    vmstate_info_pci_config,
                                    PCI_CONFIG_SPACE_SIZE),
@@ -489,7 +489,7 @@ const VMStateDescription vmstate_pcie_device = {
     .version_id = 2,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_INT32_LE(version_id, PCIDevice),
+        VMSTATE_INT32_POSITIVE_LE(version_id, PCIDevice),
         VMSTATE_BUFFER_UNSAFE_INFO(config, PCIDevice, 0,
                                    vmstate_info_pci_config,
                                    PCIE_CONFIG_SPACE_SIZE),
include/migration/vmstate.h +1 -2
index 8707c4f..f6bec36 100644
@@ -585,10 +585,9 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_INT32_EQUAL(_f, _s)                                   \
     VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_int32_equal, int32_t)
 
-#define VMSTATE_INT32_LE(_f, _s)                                      \
+#define VMSTATE_INT32_POSITIVE_LE(_f, _s)                             \
     VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_int32_le, int32_t)
 
-
 #define VMSTATE_FLOAT64(_f, _s)                                       \
     VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_float64, float64)
 
target-arm/machine.c +1 -1
index ee67b67..3f4fd42 100644
@@ -241,7 +241,7 @@ const VMStateDescription vmstate_arm_cpu = {
         /* The length-check must come before the arrays to avoid
          * incoming data possibly overflowing the array.
          */
-        VMSTATE_INT32_LE(cpreg_vmstate_array_len, ARMCPU),
+        VMSTATE_INT32_POSITIVE_LE(cpreg_vmstate_array_len, ARMCPU),
         VMSTATE_VARRAY_INT32(cpreg_vmstate_indexes, ARMCPU,
                              cpreg_vmstate_array_len,
                              0, vmstate_info_uint64, uint64_t),
tests/test-vmstate.c +1 -1
index d52f722..846ed39 100644
@@ -354,7 +354,7 @@ static const VMStateDescription vmstate_simple_compare = {
         VMSTATE_UINT32_EQUAL(u32_1, TestSimple),
         VMSTATE_UINT64_EQUAL(u64_1, TestSimple),
         VMSTATE_INT32_EQUAL(i32_2, TestSimple),
-        VMSTATE_INT32_LE(i32_1, TestSimple),
+        VMSTATE_INT32_POSITIVE_LE(i32_1, TestSimple),
         VMSTATE_END_OF_LIST()
     }
 };
Signature · 1 line
1.9.0
#40 lore raw

PATCH 30/97 vmstate: Move VMSTATE_TIMER_V to VMSTATE_TIMER_TEST

In reply to Juan Quintela

No test created, because it is basically imposible to create a timer by hand :-(

---
 hw/timer/mc146818rtc.c      | 2 +-
 include/migration/vmstate.h | 7 ++-----
 2 files changed, 3 insertions(+), 6 deletions(-)
hw/timer/mc146818rtc.c +1 -1
index 8446d48..f3dc2fe 100644
@@ -733,7 +733,7 @@ static const VMStateDescription vmstate_rtc = {
         VMSTATE_UINT64_TEST(base_rtc, RTCState, vmstate_3_plus),
         VMSTATE_UINT64_TEST(last_update, RTCState, vmstate_3_plus),
         VMSTATE_INT64_TEST(offset, RTCState, vmstate_3_plus),
-        VMSTATE_TIMER_V(update_timer, RTCState, 3),
+        VMSTATE_TIMER_TEST(update_timer, RTCState, vmstate_3_plus),
         VMSTATE_UINT64_TEST(next_alarm_time, RTCState, vmstate_3_plus),
         VMSTATE_END_OF_LIST()
     }
include/migration/vmstate.h +2 -5
index f6bec36..956a358 100644
@@ -594,13 +594,10 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_TIMER_TEST(_f, _s, _test)                             \
     VMSTATE_POINTER_TEST(_f, _s, _test, vmstate_info_timer, QEMUTimer *)
 
-#define VMSTATE_TIMER_V(_f, _s, _v)                                   \
-    VMSTATE_POINTER(_f, _s, _v, vmstate_info_timer, QEMUTimer *)
-
 #define VMSTATE_TIMER(_f, _s)                                         \
-    VMSTATE_TIMER_V(_f, _s, 0)
+    VMSTATE_TIMER_TEST(_f, _s, NULL)
 
-#define VMSTATE_TIMER_ARRAY(_f, _s, _n)                              \
+#define VMSTATE_TIMER_ARRAY(_f, _s, _n)                               \
     VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer *)
 
 #define VMSTATE_BOOL_ARRAY_V(_f, _s, _n, _v)                         \
Signature · 1 line
1.9.0
#41 lore raw

PATCH 31/97 vmstate: Test for VMSTATE_ARRAY_BOOL_TEST

In reply to Juan Quintela

We add all the boilerplate code for testing arrays.
We change only user of VMSTATE_ARRAY_BOOL_V to VMSTATE_ARRAY_BOOL_TEST.

---
 hw/audio/hda-codec.c        |   3 +-
 include/migration/vmstate.h |   8 +--
 tests/test-vmstate.c        | 171 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 177 insertions(+), 5 deletions(-)
hw/audio/hda-codec.c +2 -1
index 09559ef..1c1a138 100644
@@ -603,7 +603,8 @@ static const VMStateDescription vmstate_hda_audio = {
                              vmstate_hda_audio_stream,
                              HDAAudioStream),
         VMSTATE_BOOL_ARRAY(running_compat, HDAAudioState, 16),
-        VMSTATE_BOOL_ARRAY_V(running_real, HDAAudioState, 2 * 16, 2),
+        VMSTATE_BOOL_ARRAY_TEST(running_real, HDAAudioState, 2 * 16,
+                                vmstate_2_plus),
         VMSTATE_END_OF_LIST()
     }
 };
include/migration/vmstate.h +4 -4
index 956a358..ac5a939 100644
@@ -600,11 +600,11 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_TIMER_ARRAY(_f, _s, _n)                               \
     VMSTATE_ARRAY_OF_POINTER(_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)
+#define VMSTATE_BOOL_ARRAY_TEST(_f, _s, _n, _t)                       \
+    VMSTATE_ARRAY_TEST(_f, _s, _n, _t, vmstate_info_bool, bool)
 
-#define VMSTATE_BOOL_ARRAY(_f, _s, _n)                               \
-    VMSTATE_BOOL_ARRAY_V(_f, _s, _n, 0)
+#define VMSTATE_BOOL_ARRAY(_f, _s, _n)                                \
+    VMSTATE_BOOL_ARRAY_TEST(_f, _s, _n, NULL)
 
 #define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v)                         \
     VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t)
tests/test-vmstate.c +171 -0

183 lines not on this page · raw message

Signature · 1 line
1.9.0
#42 lore raw

PATCH 32/97 vmstate: Test for VMSTATE_UINT8_ARRAY

In reply to Juan Quintela

Remove VMSTATE_UINT8_ARRAY_V that was unused.

---
 include/migration/vmstate.h |  9 +++------
 tests/test-vmstate.c        | 11 +++++++++++
 2 files changed, 14 insertions(+), 6 deletions(-)
include/migration/vmstate.h +3 -6
index ac5a939..c74cdf3 100644
@@ -606,6 +606,9 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_BOOL_ARRAY(_f, _s, _n)                                \
     VMSTATE_BOOL_ARRAY_TEST(_f, _s, _n, NULL)
 
+#define VMSTATE_UINT8_ARRAY(_f, _s, _n)                               \
+    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_uint8, uint8_t)
+
 #define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v)                         \
     VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t)
 
@@ -621,12 +624,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT8_2DARRAY_V(_f, _s, _n1, _n2, _v)                 \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint8, uint8_t)
 
-#define VMSTATE_UINT8_ARRAY_V(_f, _s, _n, _v)                         \
-    VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint8, uint8_t)
-
-#define VMSTATE_UINT8_ARRAY(_f, _s, _n)                               \
-    VMSTATE_UINT8_ARRAY_V(_f, _s, _n, 0)
-
 #define VMSTATE_UINT8_SUB_ARRAY(_f, _s, _start, _num)                \
     VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint8, uint8_t)
 
tests/test-vmstate.c +11 -0
index 656e563..8a73d4c 100644
@@ -540,12 +540,16 @@ typedef struct TestArray {
     int32_t  size;
     bool     b_1[VMSTATE_ARRAY_SIZE];
     bool     b_2[VMSTATE_ARRAY_SIZE];
+    uint8_t  u8_1[VMSTATE_ARRAY_SIZE];
+    uint8_t  u8_2[VMSTATE_ARRAY_SIZE];
 } TestArray;
 
 TestArray obj_array = {
     .size = VMSTATE_ARRAY_SIZE,
     .b_1 = { false, true, false, true, false},
     .b_2 = { true, false, true, false, true},
+    .u8_1 = { 1, 2, 3, 4, 5},
+    .u8_2 = { 5, 4, 3, 2, 1},
 };
 
 static const VMStateDescription vmstate_array_primitive = {
@@ -556,6 +560,7 @@ static const VMStateDescription vmstate_array_primitive = {
     .fields = (VMStateField[]) {
         VMSTATE_INT32(size, TestArray),
         VMSTATE_BOOL_ARRAY(b_1, TestArray, VMSTATE_ARRAY_SIZE),
+        VMSTATE_UINT8_ARRAY(u8_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -563,6 +568,7 @@ static const VMStateDescription vmstate_array_primitive = {
 uint8_t wire_array_primitive[] = {
     /* size */  0x00, 0x00, 0x00, 0x05,
     /* b_1 */   0x00, 0x01, 0x00, 0x01, 0x00,
+    /* u8_1 */  0x01, 0x02, 0x03, 0x04, 0x05,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -611,10 +617,14 @@ static void test_array_primitive(void)
 #define FIELD_ASSERT(name)   g_assert_cmpint(obj.name, ==, obj_array.name)
 #define ELEM_ASSERT(name, i) \
     g_assert_cmpint(obj.name[i], ==, obj_array.name[i])
+#define ELEM_NOT_ASSERT(name, i) \
+    g_assert_cmpint(obj.name[i], !=, obj_array.name[i])
 
     FIELD_ASSERT(size);
     for (i = 0; i < VMSTATE_ARRAY_SIZE; i++) {
         ELEM_ASSERT(b_1, i);
+        ELEM_ASSERT(u8_1, i);
+        ELEM_NOT_ASSERT(u8_2, i);
     }
 
     /* We save the file again.  We want the EOF this time */
@@ -701,6 +711,7 @@ static void test_array_test(void)
 }
 #undef FIELD_ASSERT
 #undef ELEM_ASSERT
+#undef ELEM_NOT_ASSERT
 
 
 typedef struct TestStruct {
Signature · 1 line
1.9.0
#43 lore raw

PATCH 33/97 vmstate: Test for VMSTATE_UINT16_ARRAY

In reply to Juan Quintela

Remove unused VMSTATE_UINT16_ARRAY_V.

---
 include/migration/vmstate.h | 7 ++-----
 tests/test-vmstate.c        | 5 +++++
 2 files changed, 7 insertions(+), 5 deletions(-)
include/migration/vmstate.h +2 -5
index c74cdf3..2579c4f 100644
@@ -609,15 +609,12 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT8_ARRAY(_f, _s, _n)                               \
     VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_uint8, uint8_t)
 
-#define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v)                         \
-    VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t)
+#define VMSTATE_UINT16_ARRAY(_f, _s, _n)                              \
+    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_uint16, uint16_t)
 
 #define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v)                \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t)
 
-#define VMSTATE_UINT16_ARRAY(_f, _s, _n)                               \
-    VMSTATE_UINT16_ARRAY_V(_f, _s, _n, 0)
-
 #define VMSTATE_UINT16_2DARRAY(_f, _s, _n1, _n2)                      \
     VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, 0)
 
tests/test-vmstate.c +5 -0
index 8a73d4c..ae0421e 100644
@@ -542,6 +542,7 @@ typedef struct TestArray {
     bool     b_2[VMSTATE_ARRAY_SIZE];
     uint8_t  u8_1[VMSTATE_ARRAY_SIZE];
     uint8_t  u8_2[VMSTATE_ARRAY_SIZE];
+    uint16_t u16_1[VMSTATE_ARRAY_SIZE];
 } TestArray;
 
 TestArray obj_array = {
@@ -550,6 +551,7 @@ TestArray obj_array = {
     .b_2 = { true, false, true, false, true},
     .u8_1 = { 1, 2, 3, 4, 5},
     .u8_2 = { 5, 4, 3, 2, 1},
+    .u16_1 = {11, 12, 13, 14, 15},
 };
 
 static const VMStateDescription vmstate_array_primitive = {
@@ -561,6 +563,7 @@ static const VMStateDescription vmstate_array_primitive = {
         VMSTATE_INT32(size, TestArray),
         VMSTATE_BOOL_ARRAY(b_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_UINT8_ARRAY(u8_1, TestArray, VMSTATE_ARRAY_SIZE),
+        VMSTATE_UINT16_ARRAY(u16_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -569,6 +572,7 @@ uint8_t wire_array_primitive[] = {
     /* size */  0x00, 0x00, 0x00, 0x05,
     /* b_1 */   0x00, 0x01, 0x00, 0x01, 0x00,
     /* u8_1 */  0x01, 0x02, 0x03, 0x04, 0x05,
+    /* u16_1 */ 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x0d, 0x00, 0x0e, 0x00, 0x0f,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -625,6 +629,7 @@ static void test_array_primitive(void)
         ELEM_ASSERT(b_1, i);
         ELEM_ASSERT(u8_1, i);
         ELEM_NOT_ASSERT(u8_2, i);
+        ELEM_ASSERT(u16_1, i);
     }
 
     /* We save the file again.  We want the EOF this time */
Signature · 1 line
1.9.0
#44 lore raw

PATCH 34/97 vmstate: Test for VMSTATE_UINT32_ARRAY{_TEST}

In reply to Juan Quintela

Once there, change only user of VMSTATE_UInT32_ARRAY_V.

---
 hw/misc/arm_sysctl.c        |  3 ++-
 include/migration/vmstate.h | 15 ++++++---------
 tests/test-vmstate.c        | 18 ++++++++++++++++++
 3 files changed, 26 insertions(+), 10 deletions(-)
hw/misc/arm_sysctl.c +2 -1
index 807d48e..0f61241 100644
@@ -65,7 +65,8 @@ static const VMStateDescription vmstate_arm_sysctl = {
         VMSTATE_UINT32_TEST(sys_cfgctrl, arm_sysctl_state, vmstate_2_plus),
         VMSTATE_UINT32_TEST(sys_cfgstat, arm_sysctl_state, vmstate_2_plus),
         VMSTATE_UINT32_TEST(sys_clcd, arm_sysctl_state, vmstate_3_plus),
-        VMSTATE_UINT32_ARRAY_V(mb_clock, arm_sysctl_state, 6, 4),
+        VMSTATE_UINT32_ARRAY_TEST(mb_clock, arm_sysctl_state, 6,
+                                  vmstate_4_plus),
         VMSTATE_VARRAY_UINT32(db_clock, arm_sysctl_state, db_num_clocks,
                               4, vmstate_info_uint32, uint32_t),
         VMSTATE_END_OF_LIST()
include/migration/vmstate.h +6 -9
index 2579c4f..703f07b 100644
@@ -612,6 +612,12 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT16_ARRAY(_f, _s, _n)                              \
     VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_uint16, uint16_t)
 
+#define VMSTATE_UINT32_ARRAY_TEST(_f, _s, _n, _t)                     \
+    VMSTATE_ARRAY_TEST(_f, _s, _n, _t, vmstate_info_uint32, uint32_t)
+
+#define VMSTATE_UINT32_ARRAY(_f, _s, _n)                              \
+    VMSTATE_UINT32_ARRAY_TEST(_f, _s, _n, NULL)
+
 #define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v)                \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t)
 
@@ -627,15 +633,9 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT8_2DARRAY(_f, _s, _n1, _n2)                       \
     VMSTATE_UINT8_2DARRAY_V(_f, _s, _n1, _n2, 0)
 
-#define VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)                        \
-    VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint32, uint32_t)
-
 #define VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, _v)                \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint32, uint32_t)
 
-#define VMSTATE_UINT32_ARRAY(_f, _s, _n)                              \
-    VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0)
-
 #define VMSTATE_UINT32_2DARRAY(_f, _s, _n1, _n2)                      \
     VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, 0)
 
@@ -660,9 +660,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num)                \
     VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t)
 
-#define VMSTATE_UINT32_ARRAY(_f, _s, _n)                              \
-    VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0)
-
 #define VMSTATE_INT64_ARRAY_V(_f, _s, _n, _v)                         \
     VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int64, int64_t)
 
tests/test-vmstate.c +18 -0
index ae0421e..76ad401 100644
@@ -543,6 +543,8 @@ typedef struct TestArray {
     uint8_t  u8_1[VMSTATE_ARRAY_SIZE];
     uint8_t  u8_2[VMSTATE_ARRAY_SIZE];
     uint16_t u16_1[VMSTATE_ARRAY_SIZE];
+    uint32_t u32_1[VMSTATE_ARRAY_SIZE];
+    uint32_t u32_2[VMSTATE_ARRAY_SIZE];
 } TestArray;
 
 TestArray obj_array = {
@@ -552,6 +554,8 @@ TestArray obj_array = {
     .u8_1 = { 1, 2, 3, 4, 5},
     .u8_2 = { 5, 4, 3, 2, 1},
     .u16_1 = {11, 12, 13, 14, 15},
+    .u32_1 = {21, 22, 23, 24, 25},
+    .u32_2 = {25, 24, 23, 22, 21},
 };
 
 static const VMStateDescription vmstate_array_primitive = {
@@ -564,6 +568,7 @@ static const VMStateDescription vmstate_array_primitive = {
         VMSTATE_BOOL_ARRAY(b_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_UINT8_ARRAY(u8_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_UINT16_ARRAY(u16_1, TestArray, VMSTATE_ARRAY_SIZE),
+        VMSTATE_UINT32_ARRAY(u32_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -573,6 +578,9 @@ uint8_t wire_array_primitive[] = {
     /* b_1 */   0x00, 0x01, 0x00, 0x01, 0x00,
     /* u8_1 */  0x01, 0x02, 0x03, 0x04, 0x05,
     /* u16_1 */ 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x0d, 0x00, 0x0e, 0x00, 0x0f,
+    /* u32_1 */ 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x16,
+                0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x18,
+                0x00, 0x00, 0x00, 0x19,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -630,6 +638,7 @@ static void test_array_primitive(void)
         ELEM_ASSERT(u8_1, i);
         ELEM_NOT_ASSERT(u8_2, i);
         ELEM_ASSERT(u16_1, i);
+        ELEM_ASSERT(u32_1, i);
     }
 
     /* We save the file again.  We want the EOF this time */
@@ -656,6 +665,10 @@ static const VMStateDescription vmstate_array_test = {
         VMSTATE_INT32(size, TestArray),
         VMSTATE_BOOL_ARRAY_TEST(b_1, TestArray, VMSTATE_ARRAY_SIZE, test_true),
         VMSTATE_BOOL_ARRAY_TEST(b_2, TestArray, VMSTATE_ARRAY_SIZE, test_false),
+        VMSTATE_UINT32_ARRAY_TEST(u32_1, TestArray, VMSTATE_ARRAY_SIZE,
+                                  test_true),
+        VMSTATE_UINT32_ARRAY_TEST(u32_2, TestArray, VMSTATE_ARRAY_SIZE,
+                                  test_false),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -663,6 +676,9 @@ static const VMStateDescription vmstate_array_test = {
 uint8_t wire_array_test[] = {
     /* size */  0x00, 0x00, 0x00, 0x05,
     /* b_1 */   0x00, 0x01, 0x00, 0x01, 0x00,
+    /* u32_1 */ 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x16,
+                0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x18,
+                0x00, 0x00, 0x00, 0x19,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -712,6 +728,8 @@ static void test_array_test(void)
     FIELD_ASSERT(size);
     for (i = 0; i < VMSTATE_ARRAY_SIZE; i++) {
         ELEM_ASSERT(b_1, i);
+        ELEM_ASSERT(u32_1, i);
+        ELEM_NOT_ASSERT(u32_2, i);
     }
 }
 #undef FIELD_ASSERT
Signature · 1 line
1.9.0
#45 lore raw

PATCH 35/97 vmstate: Test for VMSTATE_UINT64_ARRAY{_TEST}

In reply to Juan Quintela

CHange users of _V to _TEST.

---
 include/migration/vmstate.h | 12 ++++++------
 target-i386/machine.c       |  5 +++--
 tests/test-vmstate.c        | 22 ++++++++++++++++++++++
 3 files changed, 31 insertions(+), 8 deletions(-)
include/migration/vmstate.h +6 -6
index 703f07b..3271114 100644
@@ -618,6 +618,12 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT32_ARRAY(_f, _s, _n)                              \
     VMSTATE_UINT32_ARRAY_TEST(_f, _s, _n, NULL)
 
+#define VMSTATE_UINT64_ARRAY_TEST(_f, _s, _n, _t)                     \
+    VMSTATE_ARRAY_TEST(_f, _s, _n, _t, vmstate_info_uint64, uint64_t)
+
+#define VMSTATE_UINT64_ARRAY(_f, _s, _n)                              \
+    VMSTATE_UINT64_ARRAY_TEST(_f, _s, _n, NULL)
+
 #define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v)                \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t)
 
@@ -639,12 +645,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT32_2DARRAY(_f, _s, _n1, _n2)                      \
     VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, 0)
 
-#define VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v)                        \
-    VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint64, uint64_t)
-
-#define VMSTATE_UINT64_ARRAY(_f, _s, _n)                              \
-    VMSTATE_UINT64_ARRAY_V(_f, _s, _n, 0)
-
 #define VMSTATE_INT16_ARRAY_V(_f, _s, _n, _v)                         \
     VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int16, int16_t)
 
target-i386/machine.c +3 -2
index d4ffe8e..1b8e3c4 100644
@@ -667,7 +667,7 @@ const VMStateDescription vmstate_x86_cpu = {
         VMSTATE_UINT32_TEST(env.intercept_exceptions, X86CPU, vmstate_5_plus),
         VMSTATE_UINT8_TEST(env.v_tpr, X86CPU, vmstate_5_plus),
         /* MTRRs */
-        VMSTATE_UINT64_ARRAY_V(env.mtrr_fixed, X86CPU, 11, 8),
+        VMSTATE_UINT64_ARRAY_TEST(env.mtrr_fixed, X86CPU, 11, vmstate_8_plus),
         VMSTATE_UINT64_TEST(env.mtrr_deftype, X86CPU, vmstate_8_plus),
         VMSTATE_MTRR_VARS(env.mtrr_var, X86CPU, 8, 8),
         /* KVM-related states */
@@ -684,7 +684,8 @@ const VMStateDescription vmstate_x86_cpu = {
         VMSTATE_UINT64_TEST(env.mcg_cap, X86CPU, vmstate_10_plus),
         VMSTATE_UINT64_TEST(env.mcg_status, X86CPU, vmstate_10_plus),
         VMSTATE_UINT64_TEST(env.mcg_ctl, X86CPU, vmstate_10_plus),
-        VMSTATE_UINT64_ARRAY_V(env.mce_banks, X86CPU, MCE_BANKS_DEF * 4, 10),
+        VMSTATE_UINT64_ARRAY_TEST(env.mce_banks, X86CPU, MCE_BANKS_DEF * 4,
+                                  vmstate_10_plus),
         /* rdtscp */
         VMSTATE_UINT64_TEST(env.tsc_aux, X86CPU, vmstate_11_plus),
         /* KVM pvclock msr */
tests/test-vmstate.c +22 -0
index 76ad401..1f50948 100644
@@ -545,6 +545,8 @@ typedef struct TestArray {
     uint16_t u16_1[VMSTATE_ARRAY_SIZE];
     uint32_t u32_1[VMSTATE_ARRAY_SIZE];
     uint32_t u32_2[VMSTATE_ARRAY_SIZE];
+    uint64_t u64_1[VMSTATE_ARRAY_SIZE];
+    uint64_t u64_2[VMSTATE_ARRAY_SIZE];
 } TestArray;
 
 TestArray obj_array = {
@@ -556,6 +558,8 @@ TestArray obj_array = {
     .u16_1 = {11, 12, 13, 14, 15},
     .u32_1 = {21, 22, 23, 24, 25},
     .u32_2 = {25, 24, 23, 22, 21},
+    .u64_1 = {31, 32, 33, 34, 35},
+    .u64_2 = {35, 34, 33, 32, 31},
 };
 
 static const VMStateDescription vmstate_array_primitive = {
@@ -569,6 +573,7 @@ static const VMStateDescription vmstate_array_primitive = {
         VMSTATE_UINT8_ARRAY(u8_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_UINT16_ARRAY(u16_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_UINT32_ARRAY(u32_1, TestArray, VMSTATE_ARRAY_SIZE),
+        VMSTATE_UINT64_ARRAY(u64_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -581,6 +586,11 @@ uint8_t wire_array_primitive[] = {
     /* u32_1 */ 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x16,
                 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x18,
                 0x00, 0x00, 0x00, 0x19,
+    /* u64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -639,6 +649,7 @@ static void test_array_primitive(void)
         ELEM_NOT_ASSERT(u8_2, i);
         ELEM_ASSERT(u16_1, i);
         ELEM_ASSERT(u32_1, i);
+        ELEM_ASSERT(u64_1, i);
     }
 
     /* We save the file again.  We want the EOF this time */
@@ -669,6 +680,10 @@ static const VMStateDescription vmstate_array_test = {
                                   test_true),
         VMSTATE_UINT32_ARRAY_TEST(u32_2, TestArray, VMSTATE_ARRAY_SIZE,
                                   test_false),
+        VMSTATE_UINT64_ARRAY_TEST(u64_1, TestArray, VMSTATE_ARRAY_SIZE,
+                                  test_true),
+        VMSTATE_UINT64_ARRAY_TEST(u64_2, TestArray, VMSTATE_ARRAY_SIZE,
+                                  test_false),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -679,6 +694,11 @@ uint8_t wire_array_test[] = {
     /* u32_1 */ 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x16,
                 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x18,
                 0x00, 0x00, 0x00, 0x19,
+    /* u64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -730,6 +750,8 @@ static void test_array_test(void)
         ELEM_ASSERT(b_1, i);
         ELEM_ASSERT(u32_1, i);
         ELEM_NOT_ASSERT(u32_2, i);
+        ELEM_ASSERT(u64_1, i);
+        ELEM_NOT_ASSERT(u64_2, i);
     }
 }
 #undef FIELD_ASSERT
Signature · 1 line
1.9.0
#46 lore raw

PATCH 36/97 vmstate: Test for VMSTATE_INT16_ARRAY

In reply to Juan Quintela

Remove unused VMSTATE_INT16_ARRAY_V

---
 include/migration/vmstate.h | 9 +++------
 tests/test-vmstate.c        | 5 +++++
 2 files changed, 8 insertions(+), 6 deletions(-)
include/migration/vmstate.h +3 -6
index 3271114..5e62206 100644
@@ -624,6 +624,9 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT64_ARRAY(_f, _s, _n)                              \
     VMSTATE_UINT64_ARRAY_TEST(_f, _s, _n, NULL)
 
+#define VMSTATE_INT16_ARRAY(_f, _s, _n)                               \
+    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_int16, int16_t)
+
 #define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v)                \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t)
 
@@ -645,12 +648,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT32_2DARRAY(_f, _s, _n1, _n2)                      \
     VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, 0)
 
-#define VMSTATE_INT16_ARRAY_V(_f, _s, _n, _v)                         \
-    VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int16, int16_t)
-
-#define VMSTATE_INT16_ARRAY(_f, _s, _n)                               \
-    VMSTATE_INT16_ARRAY_V(_f, _s, _n, 0)
-
 #define VMSTATE_INT32_ARRAY_V(_f, _s, _n, _v)                         \
     VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int32, int32_t)
 
tests/test-vmstate.c +5 -0
index 1f50948..e800be0 100644
@@ -547,6 +547,7 @@ typedef struct TestArray {
     uint32_t u32_2[VMSTATE_ARRAY_SIZE];
     uint64_t u64_1[VMSTATE_ARRAY_SIZE];
     uint64_t u64_2[VMSTATE_ARRAY_SIZE];
+    int16_t i16_1[VMSTATE_ARRAY_SIZE];
 } TestArray;
 
 TestArray obj_array = {
@@ -560,6 +561,7 @@ TestArray obj_array = {
     .u32_2 = {25, 24, 23, 22, 21},
     .u64_1 = {31, 32, 33, 34, 35},
     .u64_2 = {35, 34, 33, 32, 31},
+    .i16_1 = {41, 42, 43, 44, 45},
 };
 
 static const VMStateDescription vmstate_array_primitive = {
@@ -574,6 +576,7 @@ static const VMStateDescription vmstate_array_primitive = {
         VMSTATE_UINT16_ARRAY(u16_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_UINT32_ARRAY(u32_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_UINT64_ARRAY(u64_1, TestArray, VMSTATE_ARRAY_SIZE),
+        VMSTATE_INT16_ARRAY(i16_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -591,6 +594,7 @@ uint8_t wire_array_primitive[] = {
                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21,
                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23,
+    /* i16_1 */ 0x00, 0x29, 0x00, 0x2a, 0x00, 0x2b, 0x00, 0x2c, 0x00, 0x2d,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -650,6 +654,7 @@ static void test_array_primitive(void)
         ELEM_ASSERT(u16_1, i);
         ELEM_ASSERT(u32_1, i);
         ELEM_ASSERT(u64_1, i);
+        ELEM_ASSERT(i16_1, i);
     }
 
     /* We save the file again.  We want the EOF this time */
Signature · 1 line
1.9.0
#47 lore raw

PATCH 37/97 vmstate: Test for VMSTATE_INT32_ARRAY{_TEST}

In reply to Juan Quintela

Change only user of _V to _TEST.

---
 hw/pci-host/piix.c          |  4 ++--
 include/migration/vmstate.h | 12 ++++++------
 tests/test-vmstate.c        | 18 ++++++++++++++++++
 3 files changed, 26 insertions(+), 8 deletions(-)
hw/pci-host/piix.c +2 -2
index e0e0946..a6c6834 100644
@@ -567,8 +567,8 @@ static const VMStateDescription vmstate_piix3 = {
     .pre_save = piix3_pre_save,
     .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, PIIX3State),
-        VMSTATE_INT32_ARRAY_V(pci_irq_levels_vmstate, PIIX3State,
-                              PIIX_NUM_PIRQS, 3),
+        VMSTATE_INT32_ARRAY_TEST(pci_irq_levels_vmstate, PIIX3State,
+                                 PIIX_NUM_PIRQS, vmstate_3_plus),
         VMSTATE_END_OF_LIST()
     },
     .subsections = (VMStateSubsection[]) {
include/migration/vmstate.h +6 -6
index 5e62206..20062ff 100644
@@ -627,6 +627,12 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_INT16_ARRAY(_f, _s, _n)                               \
     VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_int16, int16_t)
 
+#define VMSTATE_INT32_ARRAY_TEST(_f, _s, _n, _t)                      \
+    VMSTATE_ARRAY_TEST(_f, _s, _n, _t, vmstate_info_int32, int32_t)
+
+#define VMSTATE_INT32_ARRAY(_f, _s, _n)                               \
+    VMSTATE_INT32_ARRAY_TEST(_f, _s, _n, NULL)
+
 #define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v)                \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t)
 
@@ -648,12 +654,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT32_2DARRAY(_f, _s, _n1, _n2)                      \
     VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, 0)
 
-#define VMSTATE_INT32_ARRAY_V(_f, _s, _n, _v)                         \
-    VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int32, int32_t)
-
-#define VMSTATE_INT32_ARRAY(_f, _s, _n)                               \
-    VMSTATE_INT32_ARRAY_V(_f, _s, _n, 0)
-
 #define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num)                \
     VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t)
 
tests/test-vmstate.c +18 -0
index e800be0..348851d 100644
@@ -548,6 +548,8 @@ typedef struct TestArray {
     uint64_t u64_1[VMSTATE_ARRAY_SIZE];
     uint64_t u64_2[VMSTATE_ARRAY_SIZE];
     int16_t i16_1[VMSTATE_ARRAY_SIZE];
+    int32_t i32_1[VMSTATE_ARRAY_SIZE];
+    int32_t i32_2[VMSTATE_ARRAY_SIZE];
 } TestArray;
 
 TestArray obj_array = {
@@ -562,6 +564,8 @@ TestArray obj_array = {
     .u64_1 = {31, 32, 33, 34, 35},
     .u64_2 = {35, 34, 33, 32, 31},
     .i16_1 = {41, 42, 43, 44, 45},
+    .i32_1 = {51, 52, 53, 54, 55},
+    .i32_2 = {55, 54, 53, 52, 51},
 };
 
 static const VMStateDescription vmstate_array_primitive = {
@@ -577,6 +581,7 @@ static const VMStateDescription vmstate_array_primitive = {
         VMSTATE_UINT32_ARRAY(u32_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_UINT64_ARRAY(u64_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_INT16_ARRAY(i16_1, TestArray, VMSTATE_ARRAY_SIZE),
+        VMSTATE_INT32_ARRAY(i32_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -595,6 +600,9 @@ uint8_t wire_array_primitive[] = {
                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23,
     /* i16_1 */ 0x00, 0x29, 0x00, 0x2a, 0x00, 0x2b, 0x00, 0x2c, 0x00, 0x2d,
+    /* i32_1 */ 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x34,
+                0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x36,
+                0x00, 0x00, 0x00, 0x37,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -655,6 +663,7 @@ static void test_array_primitive(void)
         ELEM_ASSERT(u32_1, i);
         ELEM_ASSERT(u64_1, i);
         ELEM_ASSERT(i16_1, i);
+        ELEM_ASSERT(i32_1, i);
     }
 
     /* We save the file again.  We want the EOF this time */
@@ -689,6 +698,10 @@ static const VMStateDescription vmstate_array_test = {
                                   test_true),
         VMSTATE_UINT64_ARRAY_TEST(u64_2, TestArray, VMSTATE_ARRAY_SIZE,
                                   test_false),
+        VMSTATE_INT32_ARRAY_TEST(i32_1, TestArray, VMSTATE_ARRAY_SIZE,
+                                 test_true),
+        VMSTATE_INT32_ARRAY_TEST(i32_2, TestArray, VMSTATE_ARRAY_SIZE,
+                                 test_false),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -704,6 +717,9 @@ uint8_t wire_array_test[] = {
                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21,
                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23,
+    /* i32_1 */ 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x34,
+                0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x36,
+                0x00, 0x00, 0x00, 0x37,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -757,6 +773,8 @@ static void test_array_test(void)
         ELEM_NOT_ASSERT(u32_2, i);
         ELEM_ASSERT(u64_1, i);
         ELEM_NOT_ASSERT(u64_2, i);
+        ELEM_ASSERT(i32_1, i);
+        ELEM_NOT_ASSERT(i32_2, i);
     }
 }
 #undef FIELD_ASSERT
Signature · 1 line
1.9.0
#48 lore raw

PATCH 38/97 vmstate: Test for VMSTATE_INT64_ARRAY

In reply to Juan Quintela

Remove unused VMSTATE_INT64_ARRAY_V.

---
 include/migration/vmstate.h | 9 +++------
 tests/test-vmstate.c        | 9 +++++++++
 2 files changed, 12 insertions(+), 6 deletions(-)
include/migration/vmstate.h +3 -6
index 20062ff..35c7bef 100644
@@ -633,6 +633,9 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_INT32_ARRAY(_f, _s, _n)                               \
     VMSTATE_INT32_ARRAY_TEST(_f, _s, _n, NULL)
 
+#define VMSTATE_INT64_ARRAY(_f, _s, _n)                               \
+    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_int64, int64_t)
+
 #define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v)                \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t)
 
@@ -657,12 +660,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num)                \
     VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t)
 
-#define VMSTATE_INT64_ARRAY_V(_f, _s, _n, _v)                         \
-    VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int64, int64_t)
-
-#define VMSTATE_INT64_ARRAY(_f, _s, _n)                               \
-    VMSTATE_INT64_ARRAY_V(_f, _s, _n, 0)
-
 #define VMSTATE_FLOAT64_ARRAY_V(_f, _s, _n, _v)                       \
     VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_float64, float64)
 
tests/test-vmstate.c +9 -0
index 348851d..d33fa77 100644
@@ -550,6 +550,7 @@ typedef struct TestArray {
     int16_t i16_1[VMSTATE_ARRAY_SIZE];
     int32_t i32_1[VMSTATE_ARRAY_SIZE];
     int32_t i32_2[VMSTATE_ARRAY_SIZE];
+    int64_t i64_1[VMSTATE_ARRAY_SIZE];
 } TestArray;
 
 TestArray obj_array = {
@@ -566,6 +567,7 @@ TestArray obj_array = {
     .i16_1 = {41, 42, 43, 44, 45},
     .i32_1 = {51, 52, 53, 54, 55},
     .i32_2 = {55, 54, 53, 52, 51},
+    .i64_1 = {61, 62, 63, 64, 65},
 };
 
 static const VMStateDescription vmstate_array_primitive = {
@@ -582,6 +584,7 @@ static const VMStateDescription vmstate_array_primitive = {
         VMSTATE_UINT64_ARRAY(u64_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_INT16_ARRAY(i16_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_INT32_ARRAY(i32_1, TestArray, VMSTATE_ARRAY_SIZE),
+        VMSTATE_INT64_ARRAY(i64_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -603,6 +606,11 @@ uint8_t wire_array_primitive[] = {
     /* i32_1 */ 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x34,
                 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x36,
                 0x00, 0x00, 0x00, 0x37,
+    /* u64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -664,6 +672,7 @@ static void test_array_primitive(void)
         ELEM_ASSERT(u64_1, i);
         ELEM_ASSERT(i16_1, i);
         ELEM_ASSERT(i32_1, i);
+        ELEM_ASSERT(i64_1, i);
     }
 
     /* We save the file again.  We want the EOF this time */
Signature · 1 line
1.9.0
#49 lore raw

PATCH 39/97 vmstate: Test for VMSTATE_FLOAT64_ARRAY

In reply to Juan Quintela

Remove unused VMSTATE_FLOAT64_ARRAY_V.

---
 include/migration/vmstate.h |  9 +++------
 tests/test-vmstate.c        | 10 ++++++++++
 2 files changed, 13 insertions(+), 6 deletions(-)
include/migration/vmstate.h +3 -6
index 35c7bef..f925cc6 100644
@@ -636,6 +636,9 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_INT64_ARRAY(_f, _s, _n)                               \
     VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_int64, int64_t)
 
+#define VMSTATE_FLOAT64_ARRAY(_f, _s, _n)                             \
+    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_float64, float64)
+
 #define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v)                \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t)
 
@@ -660,12 +663,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num)                \
     VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t)
 
-#define VMSTATE_FLOAT64_ARRAY_V(_f, _s, _n, _v)                       \
-    VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_float64, float64)
-
-#define VMSTATE_FLOAT64_ARRAY(_f, _s, _n)                             \
-    VMSTATE_FLOAT64_ARRAY_V(_f, _s, _n, 0)
-
 #define VMSTATE_BUFFER_V(_f, _s, _v)                                  \
     VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))
 
tests/test-vmstate.c +10 -0
index d33fa77..e64706f 100644
@@ -551,6 +551,7 @@ typedef struct TestArray {
     int32_t i32_1[VMSTATE_ARRAY_SIZE];
     int32_t i32_2[VMSTATE_ARRAY_SIZE];
     int64_t i64_1[VMSTATE_ARRAY_SIZE];
+    float64 f64_1[VMSTATE_ARRAY_SIZE];
 } TestArray;
 
 TestArray obj_array = {
@@ -568,6 +569,8 @@ TestArray obj_array = {
     .i32_1 = {51, 52, 53, 54, 55},
     .i32_2 = {55, 54, 53, 52, 51},
     .i64_1 = {61, 62, 63, 64, 65},
+    .f64_1 = {float64_zero, float64_one, float64_ln2, float64_pi,
+              float64_infinity},
 };
 
 static const VMStateDescription vmstate_array_primitive = {
@@ -585,6 +588,7 @@ static const VMStateDescription vmstate_array_primitive = {
         VMSTATE_INT16_ARRAY(i16_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_INT32_ARRAY(i32_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_INT64_ARRAY(i64_1, TestArray, VMSTATE_ARRAY_SIZE),
+        VMSTATE_FLOAT64_ARRAY(f64_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -611,6 +615,11 @@ uint8_t wire_array_primitive[] = {
                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f,
                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41,
+    /* f64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                0x3f, 0xe6, 0x2e, 0x42, 0xfe, 0xfa, 0x39, 0xef,
+                0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18,
+                0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -673,6 +682,7 @@ static void test_array_primitive(void)
         ELEM_ASSERT(i16_1, i);
         ELEM_ASSERT(i32_1, i);
         ELEM_ASSERT(i64_1, i);
+        ELEM_ASSERT(f64_1, i);
     }
 
     /* We save the file again.  We want the EOF this time */
Signature · 1 line
1.9.0
#50 lore raw

PATCH 40/97 vmstate: Test for VMSTATE_UINT8_2DARRAY

In reply to Juan Quintela

Remove unused _V version.

---
 include/migration/vmstate.h |  9 +++------
 tests/test-vmstate.c        | 19 ++++++++++++++++++-
 2 files changed, 21 insertions(+), 7 deletions(-)
include/migration/vmstate.h +3 -6
index f925cc6..24f2bcf 100644
@@ -639,21 +639,18 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_FLOAT64_ARRAY(_f, _s, _n)                             \
     VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_float64, float64)
 
+#define VMSTATE_UINT8_2DARRAY(_f, _s, _n1, _n2)                       \
+    VMSTATE_2DARRAY(_f, _s, _n1, _n2, 0, vmstate_info_uint8, uint8_t)
+
 #define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v)                \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t)
 
 #define VMSTATE_UINT16_2DARRAY(_f, _s, _n1, _n2)                      \
     VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, 0)
 
-#define VMSTATE_UINT8_2DARRAY_V(_f, _s, _n1, _n2, _v)                 \
-    VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint8, uint8_t)
-
 #define VMSTATE_UINT8_SUB_ARRAY(_f, _s, _start, _num)                \
     VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint8, uint8_t)
 
-#define VMSTATE_UINT8_2DARRAY(_f, _s, _n1, _n2)                       \
-    VMSTATE_UINT8_2DARRAY_V(_f, _s, _n1, _n2, 0)
-
 #define VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, _v)                \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint32, uint32_t)
 
tests/test-vmstate.c +18 -1
index e64706f..e029960 100644
@@ -535,6 +535,7 @@ static void test_simple_bitmap(void)
 #undef FIELD_ASSERT
 
 #define VMSTATE_ARRAY_SIZE 5
+#define VMSTATE_2D_SIZE 3
 
 typedef struct TestArray {
     int32_t  size;
@@ -552,6 +553,7 @@ typedef struct TestArray {
     int32_t i32_2[VMSTATE_ARRAY_SIZE];
     int64_t i64_1[VMSTATE_ARRAY_SIZE];
     float64 f64_1[VMSTATE_ARRAY_SIZE];
+    uint8_t u8_1d[VMSTATE_2D_SIZE][VMSTATE_2D_SIZE];
 } TestArray;
 
 TestArray obj_array = {
@@ -571,6 +573,9 @@ TestArray obj_array = {
     .i64_1 = {61, 62, 63, 64, 65},
     .f64_1 = {float64_zero, float64_one, float64_ln2, float64_pi,
               float64_infinity},
+    .u8_1d = { {71, 72, 73},
+               {74, 75, 76},
+               {77, 78, 79} },
 };
 
 static const VMStateDescription vmstate_array_primitive = {
@@ -589,6 +594,8 @@ static const VMStateDescription vmstate_array_primitive = {
         VMSTATE_INT32_ARRAY(i32_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_INT64_ARRAY(i64_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_FLOAT64_ARRAY(f64_1, TestArray, VMSTATE_ARRAY_SIZE),
+        VMSTATE_UINT8_2DARRAY(u8_1d, TestArray, VMSTATE_2D_SIZE,
+                              VMSTATE_2D_SIZE),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -620,13 +627,16 @@ uint8_t wire_array_primitive[] = {
                 0x3f, 0xe6, 0x2e, 0x42, 0xfe, 0xfa, 0x39, 0xef,
                 0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18,
                 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    /* u8_1d */ 0x47, 0x48, 0x49,
+                0x4a, 0x4b, 0x4c,
+                0x4d, 0x4e, 0x4f,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
 static void test_array_primitive(void)
 {
     QEMUFile *fsave = open_test_file(true);
-    int i;
+    int i, j;
 
     /* Save file with vmstate */
     vmstate_save_state(fsave, &vmstate_array_primitive, &obj_array);
@@ -668,6 +678,8 @@ static void test_array_primitive(void)
 #define FIELD_ASSERT(name)   g_assert_cmpint(obj.name, ==, obj_array.name)
 #define ELEM_ASSERT(name, i) \
     g_assert_cmpint(obj.name[i], ==, obj_array.name[i])
+#define ELEM_ASSERT_2D(name, i, j)                        \
+    g_assert_cmpint(obj.name[i][j], ==, obj_array.name[i][j])
 #define ELEM_NOT_ASSERT(name, i) \
     g_assert_cmpint(obj.name[i], !=, obj_array.name[i])
 
@@ -684,6 +696,11 @@ static void test_array_primitive(void)
         ELEM_ASSERT(i64_1, i);
         ELEM_ASSERT(f64_1, i);
     }
+    for (i = 0; i < VMSTATE_2D_SIZE; i++) {
+        for (j = 0; j < VMSTATE_2D_SIZE; j++) {
+            ELEM_ASSERT_2D(u8_1d, i, j);
+        }
+    }
 
     /* We save the file again.  We want the EOF this time */
 
Signature · 1 line
1.9.0
#51 lore raw

PATCH 41/97 vmstate: Test for VMSTATE_UINT16_2DARRAY.

In reply to Juan Quintela

Remove unused _V version.

---
 include/migration/vmstate.h |  5 +----
 tests/test-vmstate.c        | 10 ++++++++++
 2 files changed, 11 insertions(+), 4 deletions(-)
include/migration/vmstate.h +1 -4
index 24f2bcf..14c905a 100644
@@ -642,11 +642,8 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT8_2DARRAY(_f, _s, _n1, _n2)                       \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, 0, vmstate_info_uint8, uint8_t)
 
-#define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v)                \
-    VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t)
-
 #define VMSTATE_UINT16_2DARRAY(_f, _s, _n1, _n2)                      \
-    VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, 0)
+    VMSTATE_2DARRAY(_f, _s, _n1, _n2, 0, vmstate_info_uint16, uint16_t)
 
 #define VMSTATE_UINT8_SUB_ARRAY(_f, _s, _start, _num)                \
     VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint8, uint8_t)
tests/test-vmstate.c +10 -0
index e029960..d0f6d4b 100644
@@ -554,6 +554,7 @@ typedef struct TestArray {
     int64_t i64_1[VMSTATE_ARRAY_SIZE];
     float64 f64_1[VMSTATE_ARRAY_SIZE];
     uint8_t u8_1d[VMSTATE_2D_SIZE][VMSTATE_2D_SIZE];
+    uint16_t u16_1d[VMSTATE_2D_SIZE][VMSTATE_2D_SIZE];
 } TestArray;
 
 TestArray obj_array = {
@@ -576,6 +577,9 @@ TestArray obj_array = {
     .u8_1d = { {71, 72, 73},
                {74, 75, 76},
                {77, 78, 79} },
+    .u16_1d = { {81, 82, 83},
+                {84, 85, 86},
+                {87, 88, 89} },
 };
 
 static const VMStateDescription vmstate_array_primitive = {
@@ -596,6 +600,8 @@ static const VMStateDescription vmstate_array_primitive = {
         VMSTATE_FLOAT64_ARRAY(f64_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_UINT8_2DARRAY(u8_1d, TestArray, VMSTATE_2D_SIZE,
                               VMSTATE_2D_SIZE),
+        VMSTATE_UINT16_2DARRAY(u16_1d, TestArray, VMSTATE_2D_SIZE,
+                               VMSTATE_2D_SIZE),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -630,6 +636,9 @@ uint8_t wire_array_primitive[] = {
     /* u8_1d */ 0x47, 0x48, 0x49,
                 0x4a, 0x4b, 0x4c,
                 0x4d, 0x4e, 0x4f,
+    /* u16_1d */0x00, 0x51, 0x00, 0x52, 0x00, 0x53,
+                0x00, 0x54, 0x00, 0x55, 0x00, 0x56,
+                0x00, 0x57, 0x00, 0x58, 0x00, 0x59,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -699,6 +708,7 @@ static void test_array_primitive(void)
     for (i = 0; i < VMSTATE_2D_SIZE; i++) {
         for (j = 0; j < VMSTATE_2D_SIZE; j++) {
             ELEM_ASSERT_2D(u8_1d, i, j);
+            ELEM_ASSERT_2D(u16_1d, i, j);
         }
     }
 
Signature · 1 line
1.9.0
#52 lore raw

PATCH 42/97 vmstate: Test for VMSTATE_UINT32_2DARRAY

In reply to Juan Quintela

Remove unused _V version.

---
 include/migration/vmstate.h |  9 +++------
 tests/test-vmstate.c        | 16 ++++++++++++++++
 2 files changed, 19 insertions(+), 6 deletions(-)
include/migration/vmstate.h +3 -6
index 14c905a..e7ceb59 100644
@@ -645,15 +645,12 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT16_2DARRAY(_f, _s, _n1, _n2)                      \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, 0, vmstate_info_uint16, uint16_t)
 
+#define VMSTATE_UINT32_2DARRAY(_f, _s, _n1, _n2)                      \
+    VMSTATE_2DARRAY(_f, _s, _n1, _n2, 0, vmstate_info_uint32, uint32_t)
+
 #define VMSTATE_UINT8_SUB_ARRAY(_f, _s, _start, _num)                \
     VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint8, uint8_t)
 
-#define VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, _v)                \
-    VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint32, uint32_t)
-
-#define VMSTATE_UINT32_2DARRAY(_f, _s, _n1, _n2)                      \
-    VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, 0)
-
 #define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num)                \
     VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t)
 
tests/test-vmstate.c +16 -0
index d0f6d4b..f51c887 100644
@@ -555,6 +555,7 @@ typedef struct TestArray {
     float64 f64_1[VMSTATE_ARRAY_SIZE];
     uint8_t u8_1d[VMSTATE_2D_SIZE][VMSTATE_2D_SIZE];
     uint16_t u16_1d[VMSTATE_2D_SIZE][VMSTATE_2D_SIZE];
+    uint32_t u32_1d[VMSTATE_2D_SIZE][VMSTATE_2D_SIZE];
 } TestArray;
 
 TestArray obj_array = {
@@ -580,6 +581,9 @@ TestArray obj_array = {
     .u16_1d = { {81, 82, 83},
                 {84, 85, 86},
                 {87, 88, 89} },
+    .u32_1d = { {91, 92, 93},
+                {94, 95, 96},
+                {97, 98, 99} },
 };
 
 static const VMStateDescription vmstate_array_primitive = {
@@ -602,6 +606,8 @@ static const VMStateDescription vmstate_array_primitive = {
                               VMSTATE_2D_SIZE),
         VMSTATE_UINT16_2DARRAY(u16_1d, TestArray, VMSTATE_2D_SIZE,
                                VMSTATE_2D_SIZE),
+        VMSTATE_UINT32_2DARRAY(u32_1d, TestArray, VMSTATE_2D_SIZE,
+                               VMSTATE_2D_SIZE),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -639,6 +645,15 @@ uint8_t wire_array_primitive[] = {
     /* u16_1d */0x00, 0x51, 0x00, 0x52, 0x00, 0x53,
                 0x00, 0x54, 0x00, 0x55, 0x00, 0x56,
                 0x00, 0x57, 0x00, 0x58, 0x00, 0x59,
+    /* u16_1d */0x00, 0x00, 0x00, 0x5b,
+                0x00, 0x00, 0x00, 0x5c,
+                0x00, 0x00, 0x00, 0x5d,
+                0x00, 0x00, 0x00, 0x5e,
+                0x00, 0x00, 0x00, 0x5f,
+                0x00, 0x00, 0x00, 0x60,
+                0x00, 0x00, 0x00, 0x61,
+                0x00, 0x00, 0x00, 0x62,
+                0x00, 0x00, 0x00, 0x63,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };
 
@@ -709,6 +724,7 @@ static void test_array_primitive(void)
         for (j = 0; j < VMSTATE_2D_SIZE; j++) {
             ELEM_ASSERT_2D(u8_1d, i, j);
             ELEM_ASSERT_2D(u16_1d, i, j);
+            ELEM_ASSERT_2D(u32_1d, i, j);
         }
     }
 
Signature · 1 line
1.9.0
#53 lore raw

PATCH 43/97 vmstate: Remove unused VMSTATE_BUFFER_V

In reply to Juan Quintela
---
 include/migration/vmstate.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
include/migration/vmstate.h +1 -4
index e7ceb59..fbf7dbe 100644
@@ -654,11 +654,8 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num)                \
     VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t)
 
-#define VMSTATE_BUFFER_V(_f, _s, _v)                                  \
-    VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))
-
 #define VMSTATE_BUFFER(_f, _s)                                        \
-    VMSTATE_BUFFER_V(_f, _s, 0)
+    VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, 0, sizeof(typeof_field(_s, _f)))
 
 #define VMSTATE_PARTIAL_BUFFER(_f, _s, _size)                         \
     VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, 0, _size)
Signature · 1 line
1.9.0
#54 lore raw

PATCH 44/97 vmstate: Remove version from VMSTATE_BUFFER_UNSAFE

In reply to Juan Quintela

All users used 0 anyways. Rename VMSTATE_BUFFER_UNSAFE_INFO to VMSTATE_BUFFER_UNSAFE_TEST to be consistent with rest of fields.

---
 hw/display/g364fb.c         |  4 ++--
 hw/net/smc91c111.c          |  2 +-
 hw/pci/pci.c                | 10 ++++++----
 hw/scsi/esp-pci.c           |  2 +-
 hw/scsi/lsi53c895a.c        |  4 ++--
 include/hw/pci/shpc.h       |  2 +-
 include/migration/vmstate.h | 18 +++++++++---------
 7 files changed, 22 insertions(+), 20 deletions(-)
hw/display/g364fb.c +2 -2
index 46f7b41..9f6717e 100644
@@ -462,8 +462,8 @@ static const VMStateDescription vmstate_g364fb = {
     .post_load = g364fb_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_VBUFFER_UINT32(vram, G364State, 1, NULL, 0, vram_size),
-        VMSTATE_BUFFER_UNSAFE(color_palette, G364State, 0, 256 * 3),
-        VMSTATE_BUFFER_UNSAFE(cursor_palette, G364State, 0, 9),
+        VMSTATE_BUFFER_UNSAFE(color_palette, G364State, 256 * 3),
+        VMSTATE_BUFFER_UNSAFE(cursor_palette, G364State, 9),
         VMSTATE_UINT16_ARRAY(cursor, G364State, 512),
         VMSTATE_UINT32(cursor_position, G364State),
         VMSTATE_UINT32(ctla, G364State),
hw/net/smc91c111.c +1 -1
index d1dca8f..e74142e 100644
@@ -72,7 +72,7 @@ static const VMStateDescription vmstate_smc91c111 = {
         VMSTATE_INT32_ARRAY(rx_fifo, smc91c111_state, NUM_PACKETS),
         VMSTATE_INT32(tx_fifo_done_len, smc91c111_state),
         VMSTATE_INT32_ARRAY(tx_fifo_done, smc91c111_state, NUM_PACKETS),
-        VMSTATE_BUFFER_UNSAFE(data, smc91c111_state, 0, NUM_PACKETS * 2048),
+        VMSTATE_BUFFER_UNSAFE(data, smc91c111_state, NUM_PACKETS * 2048),
         VMSTATE_UINT8(int_level, smc91c111_state),
         VMSTATE_UINT8(int_mask, smc91c111_state),
         VMSTATE_END_OF_LIST()
hw/pci/pci.c +6 -4
index 2ba6b30..828df53 100644
@@ -474,10 +474,11 @@ const VMStateDescription vmstate_pci_device = {
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_INT32_POSITIVE_LE(version_id, PCIDevice),
-        VMSTATE_BUFFER_UNSAFE_INFO(config, PCIDevice, 0,
+        VMSTATE_BUFFER_UNSAFE_TEST(config, PCIDevice, NULL,
                                    vmstate_info_pci_config,
                                    PCI_CONFIG_SPACE_SIZE),
-        VMSTATE_BUFFER_UNSAFE_INFO(irq_state, PCIDevice, 2,
+        VMSTATE_BUFFER_UNSAFE_TEST(irq_state, PCIDevice,
+                                   vmstate_2_plus,
 				   vmstate_info_pci_irq_state,
 				   PCI_NUM_PINS * sizeof(int32_t)),
         VMSTATE_END_OF_LIST()
@@ -490,10 +491,11 @@ const VMStateDescription vmstate_pcie_device = {
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_INT32_POSITIVE_LE(version_id, PCIDevice),
-        VMSTATE_BUFFER_UNSAFE_INFO(config, PCIDevice, 0,
+        VMSTATE_BUFFER_UNSAFE_TEST(config, PCIDevice, NULL,
                                    vmstate_info_pci_config,
                                    PCIE_CONFIG_SPACE_SIZE),
-        VMSTATE_BUFFER_UNSAFE_INFO(irq_state, PCIDevice, 2,
+        VMSTATE_BUFFER_UNSAFE_TEST(irq_state, PCIDevice,
+                                   vmstate_2_plus,
 				   vmstate_info_pci_irq_state,
 				   PCI_NUM_PINS * sizeof(int32_t)),
         VMSTATE_END_OF_LIST()
hw/scsi/esp-pci.c +1 -1
index 9971bbf..e592d81 100644
@@ -312,7 +312,7 @@ static const VMStateDescription vmstate_esp_pci_scsi = {
     .minimum_version_id = 0,
     .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, PCIESPState),
-        VMSTATE_BUFFER_UNSAFE(dma_regs, PCIESPState, 0, 8 * sizeof(uint32_t)),
+        VMSTATE_BUFFER_UNSAFE(dma_regs, PCIESPState, 8 * sizeof(uint32_t)),
         VMSTATE_STRUCT(esp, PCIESPState, 0, vmstate_esp, ESPState),
         VMSTATE_END_OF_LIST()
     }
hw/scsi/lsi53c895a.c +2 -2
index 786d848..4f9bf29 100644
@@ -2064,10 +2064,10 @@ static const VMStateDescription vmstate_lsi_scsi = {
         VMSTATE_UINT32(ia, LSIState),
         VMSTATE_UINT32(sbc, LSIState),
         VMSTATE_UINT32(csbc, LSIState),
-        VMSTATE_BUFFER_UNSAFE(scratch, LSIState, 0, 18 * sizeof(uint32_t)),
+        VMSTATE_BUFFER_UNSAFE(scratch, LSIState, 18 * sizeof(uint32_t)),
         VMSTATE_UINT8(sbr, LSIState),
 
-        VMSTATE_BUFFER_UNSAFE(script_ram, LSIState, 0, 2048 * sizeof(uint32_t)),
+        VMSTATE_BUFFER_UNSAFE(script_ram, LSIState, 2048 * sizeof(uint32_t)),
         VMSTATE_END_OF_LIST()
     }
 };
include/hw/pci/shpc.h +1 -1
index eef1a1a..5925100 100644
@@ -51,6 +51,6 @@ void shpc_device_hot_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
 
 extern VMStateInfo shpc_vmstate_info;
 #define SHPC_VMSTATE(_field, _type) \
-    VMSTATE_BUFFER_UNSAFE_INFO(_field, _type, 0, shpc_vmstate_info, 0)
+    VMSTATE_BUFFER_UNSAFE_TEST(_field, _type, 0, shpc_vmstate_info, 0)
 
 #endif
include/migration/vmstate.h +9 -9
index fbf7dbe..3f2084b 100644
@@ -464,13 +464,13 @@ extern const VMStateInfo vmstate_info_bitmap;
     .start        = (_start),                                        \
 }
 
-#define VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, _info, _size) { \
-    .name       = (stringify(_field)),                               \
-    .version_id = (_version),                                        \
-    .size       = (_size),                                           \
-    .info       = &(_info),                                          \
-    .flags      = VMS_BUFFER,                                        \
-    .offset     = offsetof(_state, _field),                          \
+#define VMSTATE_BUFFER_UNSAFE_TEST(_field, _state, _test, _info, _size) { \
+    .name         = (stringify(_field)),                             \
+    .field_exists = (_test),                                         \
+    .size         = (_size),                                         \
+    .info         = &(_info),                                        \
+    .flags        = VMS_BUFFER,                                      \
+    .offset       = offsetof(_state, _field),                        \
 }
 
 #define VMSTATE_BUFFER_POINTER_UNSAFE(_field, _state, _version, _size) { \
@@ -675,8 +675,8 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_BUFFER_TEST(_f, _s, _test)                            \
     VMSTATE_STATIC_BUFFER(_f, _s, 0, _test, 0, sizeof(typeof_field(_s, _f)))
 
-#define VMSTATE_BUFFER_UNSAFE(_field, _state, _version, _size)        \
-    VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, vmstate_info_buffer, _size)
+#define VMSTATE_BUFFER_UNSAFE(_field, _state,  _size)                 \
+    VMSTATE_BUFFER_UNSAFE_TEST(_field, _state, NULL, vmstate_info_buffer, _size)
 
 #define VMSTATE_UNUSED(_size)                                         \
     VMSTATE_UNUSED_TEST(NULL, _size)
Signature · 1 line
1.9.0
#55 lore raw

PATCH 45/97 vmstate: Remove unused version fields from ARM

In reply to Juan Quintela
---
 target-ppc/machine.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
target-ppc/machine.c +4 -10
index d7807f8..4540fe2 100644
@@ -120,11 +120,8 @@ static const VMStateInfo vmstate_info_avr = {
     .put  = put_avr,
 };
 
-#define VMSTATE_AVR_ARRAY_V(_f, _s, _n, _v)                       \
-    VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_avr, ppc_avr_t)
-
-#define VMSTATE_AVR_ARRAY(_f, _s, _n)                             \
-    VMSTATE_AVR_ARRAY_V(_f, _s, _n, 0)
+#define VMSTATE_AVR_ARRAY(_f, _s, _n)                                 \
+    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_avr, ppc_avr_t)
 
 static void cpu_pre_save(void *opaque)
 {
@@ -290,11 +287,8 @@ static const VMStateInfo vmstate_info_slbe = {
     .put  = put_slbe,
 };
 
-#define VMSTATE_SLB_ARRAY_V(_f, _s, _n, _v)                       \
-    VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_slbe, ppc_slb_t)
-
-#define VMSTATE_SLB_ARRAY(_f, _s, _n)                             \
-    VMSTATE_SLB_ARRAY_V(_f, _s, _n, 0)
+#define VMSTATE_SLB_ARRAY(_f, _s, _n)                                 \
+    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_slbe, ppc_slb_t)
 
 static bool slb_needed(void *opaque)
 {
Signature · 1 line
1.9.0
#56 lore raw

PATCH 46/97 vmstate: All ptimers users were at least at version 1 or more

In reply to Juan Quintela

So we can remove the version field.

---
 include/hw/ptimer.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/ptimer.h +1 -1
index 8ebacbb..ef852bf 100644
@@ -28,7 +28,7 @@ void ptimer_stop(ptimer_state *s);
 extern const VMStateDescription vmstate_ptimer;
 
 #define VMSTATE_PTIMER(_field, _state) \
-    VMSTATE_STRUCT_POINTER_V(_field, _state, 1, vmstate_ptimer, ptimer_state)
+    VMSTATE_STRUCT_POINTER(_field, _state, vmstate_ptimer, ptimer_state)
 
 #define VMSTATE_PTIMER_ARRAY(_f, _s, _n)                                \
     VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(_f, _s, _n, 0,                   \
Signature · 1 line
1.9.0
#57 lore raw

PATCH 47/97 vmstate: remove version from all variants of VMSTATE_STRUCT_POINTER*

In reply to Juan Quintela

There were no more users of them.

---
 include/migration/vmstate.h | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)
include/migration/vmstate.h +2 -15
index 3f2084b..61d677e 100644
@@ -310,18 +310,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset       = vmstate_offset_value(_state, _field, _type),     \
 }
 
-#define VMSTATE_STRUCT_POINTER_V(_field, _state, _version, _vmsd, _type) { \
+#define VMSTATE_STRUCT_POINTER_TEST(_field, _state, _test, _vmsd, _type) { \
     .name         = (stringify(_field)),                             \
-    .version_id   = (_version),                                        \
-    .vmsd         = &(_vmsd),                                        \
-    .size         = sizeof(_type *),                                 \
-    .flags        = VMS_STRUCT|VMS_POINTER,                          \
-    .offset       = vmstate_offset_pointer(_state, _field, _type),   \
-}
-
-#define VMSTATE_STRUCT_POINTER_TEST_V(_field, _state, _test, _version, _vmsd, _type) { \
-    .name         = (stringify(_field)),                             \
-    .version_id   = (_version),                                        \
     .field_exists = (_test),                                         \
     .vmsd         = &(_vmsd),                                        \
     .size         = sizeof(_type *),                                 \
@@ -516,10 +506,7 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_STRUCT_TEST(_field, _state, NULL, _version, _vmsd, _type)
 
 #define VMSTATE_STRUCT_POINTER(_field, _state, _vmsd, _type)          \
-    VMSTATE_STRUCT_POINTER_V(_field, _state, 0, _vmsd, _type)
-
-#define VMSTATE_STRUCT_POINTER_TEST(_field, _state, _test, _vmsd, _type)     \
-    VMSTATE_STRUCT_POINTER_TEST_V(_field, _state, _test, 0, _vmsd, _type)
+    VMSTATE_STRUCT_POINTER_TEST(_field, _state, NULL, _vmsd, _type)
 
 #define VMSTATE_STRUCT_ARRAY(_field, _state, _num, _version, _vmsd, _type) \
     VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, NULL, _version,   \
Signature · 1 line
1.9.0
#58 lore raw

PATCH 48/97 vmstate: Port last 3 users of VMSTATE_ARRAY to VMSTATE_ARRAY_TEST

In reply to Juan Quintela

And then remove VMSTATE_ARRAY.

---
 hw/net/vmxnet3.c            | 13 +++++++------
 include/migration/vmstate.h | 10 ----------
 2 files changed, 7 insertions(+), 16 deletions(-)
hw/net/vmxnet3.c +7 -6
index 781b06a..0c4d055 100644
@@ -2405,14 +2405,15 @@ static const VMStateDescription vmstate_vmxnet3 = {
             VMSTATE_UINT64(drv_shmem, VMXNET3State),
             VMSTATE_UINT64(temp_shared_guest_driver_memory, VMXNET3State),
 
-            VMSTATE_ARRAY(txq_descr, VMXNET3State,
-                VMXNET3_DEVICE_MAX_TX_QUEUES, 0, txq_descr_info,
+            VMSTATE_ARRAY_TEST(txq_descr, VMXNET3State,
+                VMXNET3_DEVICE_MAX_TX_QUEUES, NULL, txq_descr_info,
                 Vmxnet3TxqDescr),
-            VMSTATE_ARRAY(rxq_descr, VMXNET3State,
-                VMXNET3_DEVICE_MAX_RX_QUEUES, 0, rxq_descr_info,
+            VMSTATE_ARRAY_TEST(rxq_descr, VMXNET3State,
+                VMXNET3_DEVICE_MAX_RX_QUEUES, NULL, rxq_descr_info,
                 Vmxnet3RxqDescr),
-            VMSTATE_ARRAY(interrupt_states, VMXNET3State, VMXNET3_MAX_INTRS,
-                0, int_state_info, Vmxnet3IntState),
+            VMSTATE_ARRAY_TEST(interrupt_states, VMXNET3State,
+                VMXNET3_MAX_INTRS, NULL, int_state_info,
+                Vmxnet3IntState),
 
             VMSTATE_END_OF_LIST()
     },
include/migration/vmstate.h +0 -10
index 61d677e..b98527c 100644
@@ -221,16 +221,6 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset     = vmstate_offset_value(_state, _field, _type),       \
 }
 
-#define VMSTATE_ARRAY(_field, _state, _num, _version, _info, _type) {\
-    .name       = (stringify(_field)),                               \
-    .version_id = (_version),                                        \
-    .num        = (_num),                                            \
-    .info       = &(_info),                                          \
-    .size       = sizeof(_type),                                     \
-    .flags      = VMS_ARRAY,                                         \
-    .offset     = vmstate_offset_array(_state, _field, _type, _num), \
-}
-
 #define VMSTATE_2DARRAY(_field, _state, _n1, _n2, _version, _info, _type) { \
     .name       = (stringify(_field)),                                      \
     .version_id = (_version),                                               \
Signature · 1 line
1.9.0
#59 lore raw

PATCH 49/97 vmstate: Port last user of VMSTATE_SINGLE to VMSTATE_SINGLE_TEST

In reply to Juan Quintela
---
 hw/timer/twl92230.c         | 2 +-
 include/migration/vmstate.h | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)
hw/timer/twl92230.c +1 -1
index 7ded4ba..3aacaeb 100644
@@ -765,7 +765,7 @@ static const VMStateInfo vmstate_hack_int32_as_uint16 = {
 };
 
 #define VMSTATE_UINT16_HACK(_f, _s)                                  \
-    VMSTATE_SINGLE(_f, _s, 0, vmstate_hack_int32_as_uint16, int32_t)
+    VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_hack_int32_as_uint16, int32_t)
 
 
 static const VMStateDescription vmstate_menelaus_tm = {
include/migration/vmstate.h +0 -3
index b98527c..c9e72bb 100644
@@ -489,9 +489,6 @@ extern const VMStateInfo vmstate_info_bitmap;
    _v : version
 */
 
-#define VMSTATE_SINGLE(_field, _state, _version, _info, _type)        \
-    VMSTATE_SINGLE_TEST(_field, _state, NULL, _version, _info, _type)
-
 #define VMSTATE_STRUCT(_field, _state, _version, _vmsd, _type)        \
     VMSTATE_STRUCT_TEST(_field, _state, NULL, _version, _vmsd, _type)
 
Signature · 1 line
1.9.0
#60 lore raw

PATCH 50/97 vmstate: Remove unused VMSTATE_POINTER

In reply to Juan Quintela
---
 include/migration/vmstate.h | 9 ---------
 1 file changed, 9 deletions(-)
include/migration/vmstate.h +0 -9
index c9e72bb..141187c 100644
@@ -203,15 +203,6 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset       = vmstate_offset_value(_state, _field, _type),     \
 }
 
-#define VMSTATE_POINTER(_field, _state, _version, _info, _type) {    \
-    .name       = (stringify(_field)),                               \
-    .version_id = (_version),                                        \
-    .info       = &(_info),                                          \
-    .size       = sizeof(_type),                                     \
-    .flags      = VMS_SINGLE|VMS_POINTER,                            \
-    .offset     = vmstate_offset_value(_state, _field, _type),       \
-}
-
 #define VMSTATE_POINTER_TEST(_field, _state, _test, _info, _type) {  \
     .name       = (stringify(_field)),                               \
     .info       = &(_info),                                          \
Signature · 1 line
1.9.0
#61 lore raw

PATCH 51/97 vmstate: Rename VMSTATE_SINGLE_TEST to VMSTATE_SINGLE

In reply to Juan Quintela

And as no user used the version_id, just remove the parameter.

---
 hw/nvram/eeprom93xx.c       |  2 +-
 hw/nvram/fw_cfg.c           |  2 +-
 hw/timer/twl92230.c         |  2 +-
 include/migration/vmstate.h | 36 +++++++++++++++++-------------------
 target-i386/machine.c       |  2 +-
 5 files changed, 21 insertions(+), 23 deletions(-)
hw/nvram/eeprom93xx.c +1 -1
index d07bafb..7e09037 100644
@@ -114,7 +114,7 @@ static const VMStateInfo vmstate_hack_uint16_from_uint8 = {
 };
 
 #define VMSTATE_UINT16_HACK_TEST(_f, _s, _t)                           \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_hack_uint16_from_uint8, uint16_t)
+    VMSTATE_SINGLE(_f, _s, _t, vmstate_hack_uint16_from_uint8, uint16_t)
 
 static bool is_old_eeprom_version(void *opaque, int version_id)
 {
hw/nvram/fw_cfg.c +1 -1
index 8ea3ac8..97218c7 100644
@@ -365,7 +365,7 @@ static const VMStateInfo vmstate_hack_uint32_as_uint16 = {
 };
 
 #define VMSTATE_UINT16_HACK(_f, _s, _t)                                    \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_hack_uint32_as_uint16, uint32_t)
+    VMSTATE_SINGLE(_f, _s, _t, vmstate_hack_uint32_as_uint16, uint32_t)
 
 
 static bool is_version_1(void *opaque, int version_id)
hw/timer/twl92230.c +1 -1
index 3aacaeb..26c6001 100644
@@ -765,7 +765,7 @@ static const VMStateInfo vmstate_hack_int32_as_uint16 = {
 };
 
 #define VMSTATE_UINT16_HACK(_f, _s)                                  \
-    VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_hack_int32_as_uint16, int32_t)
+    VMSTATE_SINGLE(_f, _s, NULL, vmstate_hack_int32_as_uint16, int32_t)
 
 
 static const VMStateDescription vmstate_menelaus_tm = {
include/migration/vmstate.h +17 -19
index 141187c..6d5073a 100644
@@ -193,9 +193,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     vmstate_offset_array(_state, _field, uint8_t,                    \
                          sizeof(typeof_field(_state, _field)))
 
-#define VMSTATE_SINGLE_TEST(_field, _state, _test, _version, _info, _type) { \
+#define VMSTATE_SINGLE(_field, _state, _test, _info, _type) {        \
     .name         = (stringify(_field)),                             \
-    .version_id   = (_version),                                      \
     .field_exists = (_test),                                         \
     .size         = sizeof(_type),                                   \
     .info         = &(_info),                                        \
@@ -491,25 +490,24 @@ extern const VMStateInfo vmstate_info_bitmap;
             _vmsd, _type)
 
 #define VMSTATE_BOOL_TEST(_f, _s, _t)                                 \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_bool, bool)
+    VMSTATE_SINGLE(_f, _s, _t, vmstate_info_bool, bool)
 
 #define VMSTATE_INT8_TEST(_f, _s, _t)                                 \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int8, int8_t)
+    VMSTATE_SINGLE(_f, _s, _t, vmstate_info_int8, int8_t)
 #define VMSTATE_INT16_TEST(_f, _s, _t)                                \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int16, int16_t)
+    VMSTATE_SINGLE(_f, _s, _t, vmstate_info_int16, int16_t)
 #define VMSTATE_INT32_TEST(_f, _s, _t)                                \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int32, int32_t)
+    VMSTATE_SINGLE(_f, _s, _t, vmstate_info_int32, int32_t)
 #define VMSTATE_INT64_TEST(_f, _s, _t)                                \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int64, int64_t)
-
+    VMSTATE_SINGLE(_f, _s, _t, vmstate_info_int64, int64_t)
 #define VMSTATE_UINT8_TEST(_f, _s, _t)                                \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint8, uint8_t)
+    VMSTATE_SINGLE(_f, _s, _t, vmstate_info_uint8, uint8_t)
 #define VMSTATE_UINT16_TEST(_f, _s, _t)                               \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16, uint16_t)
+    VMSTATE_SINGLE(_f, _s, _t, vmstate_info_uint16, uint16_t)
 #define VMSTATE_UINT32_TEST(_f, _s, _t)                               \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint32, uint32_t)
+    VMSTATE_SINGLE(_f, _s, _t, vmstate_info_uint32, uint32_t)
 #define VMSTATE_UINT64_TEST(_f, _s, _t)                               \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint64, uint64_t)
+    VMSTATE_SINGLE(_f, _s, _t, vmstate_info_uint64, uint64_t)
 
 #define VMSTATE_BOOL(_f, _s)                                          \
     VMSTATE_BOOL_TEST(_f, _s, NULL)
@@ -533,28 +531,28 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_UINT64_TEST(_f, _s, NULL)
 
 #define VMSTATE_UINT8_EQUAL(_f, _s)                                   \
-    VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_uint8_equal, uint8_t)
+    VMSTATE_SINGLE(_f, _s, NULL, vmstate_info_uint8_equal, uint8_t)
 
 #define VMSTATE_UINT16_EQUAL_TEST(_f, _s, _t)                         \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16_equal, uint16_t)
+    VMSTATE_SINGLE(_f, _s, _t, vmstate_info_uint16_equal, uint16_t)
 
 #define VMSTATE_UINT16_EQUAL(_f, _s)                                  \
     VMSTATE_UINT16_EQUAL_TEST(_f, _s, NULL)
 
 #define VMSTATE_UINT32_EQUAL(_f, _s)                                  \
-    VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_uint32_equal, uint32_t)
+    VMSTATE_SINGLE(_f, _s, NULL, vmstate_info_uint32_equal, uint32_t)
 
 #define VMSTATE_UINT64_EQUAL(_f, _s)                                  \
-    VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_uint64_equal, uint64_t)
+    VMSTATE_SINGLE(_f, _s, NULL, vmstate_info_uint64_equal, uint64_t)
 
 #define VMSTATE_INT32_EQUAL(_f, _s)                                   \
-    VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_int32_equal, int32_t)
+    VMSTATE_SINGLE(_f, _s, NULL, vmstate_info_int32_equal, int32_t)
 
 #define VMSTATE_INT32_POSITIVE_LE(_f, _s)                             \
-    VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_int32_le, int32_t)
+    VMSTATE_SINGLE(_f, _s, NULL, vmstate_info_int32_le, int32_t)
 
 #define VMSTATE_FLOAT64(_f, _s)                                       \
-    VMSTATE_SINGLE_TEST(_f, _s, NULL, 0, vmstate_info_float64, float64)
+    VMSTATE_SINGLE(_f, _s, NULL, vmstate_info_float64, float64)
 
 #define VMSTATE_TIMER_TEST(_f, _s, _test)                             \
     VMSTATE_POINTER_TEST(_f, _s, _test, vmstate_info_timer, QEMUTimer *)
target-i386/machine.c +1 -1
index 1b8e3c4..8e4a518 100644
@@ -245,7 +245,7 @@ static const VMStateInfo vmstate_hack_uint64_as_uint32 = {
 };
 
 #define VMSTATE_HACK_UINT32(_f, _s, _t)                                  \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_hack_uint64_as_uint32, uint64_t)
+    VMSTATE_SINGLE(_f, _s, _t, vmstate_hack_uint64_as_uint32, uint64_t)
 #endif
 
 static void cpu_pre_save(void *opaque)
Signature · 1 line
1.9.0
#62 lore raw

PATCH 52/97 vmstate: Move VMSTATE_2DARRAY to use _test

In reply to Juan Quintela

No user used versions, so easy to change.

---
 include/migration/vmstate.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
include/migration/vmstate.h +11 -11
index 6d5073a..db70163 100644
@@ -211,14 +211,14 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset     = vmstate_offset_value(_state, _field, _type),       \
 }
 
-#define VMSTATE_2DARRAY(_field, _state, _n1, _n2, _version, _info, _type) { \
-    .name       = (stringify(_field)),                                      \
-    .version_id = (_version),                                               \
-    .num        = (_n1) * (_n2),                                            \
-    .info       = &(_info),                                                 \
-    .size       = sizeof(_type),                                            \
-    .flags      = VMS_ARRAY,                                                \
-    .offset     = vmstate_offset_2darray(_state, _field, _type, _n1, _n2),  \
+#define VMSTATE_2DARRAY(_field, _state, _n1, _n2, _test, _info, _type) { \
+    .name         = (stringify(_field)),                                      \
+    .field_exists = (_test),                                                  \
+    .num          = (_n1) * (_n2),                                            \
+    .info         = &(_info),                                                 \
+    .size         = sizeof(_type),                                            \
+    .flags        = VMS_ARRAY,                                                \
+    .offset       = vmstate_offset_2darray(_state, _field, _type, _n1, _n2),  \
 }
 
 #define VMSTATE_ARRAY_TEST(_field, _state, _num, _test, _info, _type) {\
@@ -603,13 +603,13 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_float64, float64)
 
 #define VMSTATE_UINT8_2DARRAY(_f, _s, _n1, _n2)                       \
-    VMSTATE_2DARRAY(_f, _s, _n1, _n2, 0, vmstate_info_uint8, uint8_t)
+    VMSTATE_2DARRAY(_f, _s, _n1, _n2, NULL, vmstate_info_uint8, uint8_t)
 
 #define VMSTATE_UINT16_2DARRAY(_f, _s, _n1, _n2)                      \
-    VMSTATE_2DARRAY(_f, _s, _n1, _n2, 0, vmstate_info_uint16, uint16_t)
+    VMSTATE_2DARRAY(_f, _s, _n1, _n2, NULL, vmstate_info_uint16, uint16_t)
 
 #define VMSTATE_UINT32_2DARRAY(_f, _s, _n1, _n2)                      \
-    VMSTATE_2DARRAY(_f, _s, _n1, _n2, 0, vmstate_info_uint32, uint32_t)
+    VMSTATE_2DARRAY(_f, _s, _n1, _n2, NULL, vmstate_info_uint32, uint32_t)
 
 #define VMSTATE_UINT8_SUB_ARRAY(_f, _s, _start, _num)                \
     VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint8, uint8_t)
Signature · 1 line
1.9.0
#63 lore raw

PATCH 53/97 vmstate: Rename VMSTATE_POINTER_TEST without _TEST

In reply to Juan Quintela

The other didn't exist anymore.

---
 include/migration/vmstate.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
include/migration/vmstate.h +7 -7
index db70163..8dac300 100644
@@ -202,13 +202,13 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset       = vmstate_offset_value(_state, _field, _type),     \
 }
 
-#define VMSTATE_POINTER_TEST(_field, _state, _test, _info, _type) {  \
-    .name       = (stringify(_field)),                               \
-    .info       = &(_info),                                          \
+#define VMSTATE_POINTER(_field, _state, _test, _info, _type) {  \
+    .name         = (stringify(_field)),                             \
+    .info         = &(_info),                                        \
     .field_exists = (_test),                                         \
-    .size       = sizeof(_type),                                     \
-    .flags      = VMS_SINGLE|VMS_POINTER,                            \
-    .offset     = vmstate_offset_value(_state, _field, _type),       \
+    .size         = sizeof(_type),                                   \
+    .flags        = VMS_SINGLE|VMS_POINTER,                          \
+    .offset       = vmstate_offset_value(_state, _field, _type),     \
 }
 
 #define VMSTATE_2DARRAY(_field, _state, _n1, _n2, _test, _info, _type) { \
@@ -555,7 +555,7 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_SINGLE(_f, _s, NULL, vmstate_info_float64, float64)
 
 #define VMSTATE_TIMER_TEST(_f, _s, _test)                             \
-    VMSTATE_POINTER_TEST(_f, _s, _test, vmstate_info_timer, QEMUTimer *)
+    VMSTATE_POINTER(_f, _s, _test, vmstate_info_timer, QEMUTimer*)
 
 #define VMSTATE_TIMER(_f, _s)                                         \
     VMSTATE_TIMER_TEST(_f, _s, NULL)
Signature · 1 line
1.9.0
#64 lore raw

PATCH 54/97 vmstate: Rename VMSTATE_ARRAY_TEST to VMSTATE_ARRAY

In reply to Juan Quintela

VMSTATE_ARRAY is not being used anymore.

---
 hw/net/vmxnet3.c            |  9 ++++-----
 include/migration/vmstate.h | 20 ++++++++++----------
 target-i386/machine.c       |  6 +++---
 target-ppc/machine.c        |  4 ++--
 4 files changed, 19 insertions(+), 20 deletions(-)
hw/net/vmxnet3.c +4 -5
index 0c4d055..4140f9f 100644
@@ -2405,15 +2405,14 @@ static const VMStateDescription vmstate_vmxnet3 = {
             VMSTATE_UINT64(drv_shmem, VMXNET3State),
             VMSTATE_UINT64(temp_shared_guest_driver_memory, VMXNET3State),
 
-            VMSTATE_ARRAY_TEST(txq_descr, VMXNET3State,
+            VMSTATE_ARRAY(txq_descr, VMXNET3State,
                 VMXNET3_DEVICE_MAX_TX_QUEUES, NULL, txq_descr_info,
                 Vmxnet3TxqDescr),
-            VMSTATE_ARRAY_TEST(rxq_descr, VMXNET3State,
+            VMSTATE_ARRAY(rxq_descr, VMXNET3State,
                 VMXNET3_DEVICE_MAX_RX_QUEUES, NULL, rxq_descr_info,
                 Vmxnet3RxqDescr),
-            VMSTATE_ARRAY_TEST(interrupt_states, VMXNET3State,
-                VMXNET3_MAX_INTRS, NULL, int_state_info,
-                Vmxnet3IntState),
+            VMSTATE_ARRAY(interrupt_states, VMXNET3State, VMXNET3_MAX_INTRS,
+                NULL, int_state_info, Vmxnet3IntState),
 
             VMSTATE_END_OF_LIST()
     },
include/migration/vmstate.h +10 -10
index 8dac300..2a38743 100644
@@ -221,7 +221,7 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset       = vmstate_offset_2darray(_state, _field, _type, _n1, _n2),  \
 }
 
-#define VMSTATE_ARRAY_TEST(_field, _state, _num, _test, _info, _type) {\
+#define VMSTATE_ARRAY(_field, _state, _num, _test, _info, _type) {\
     .name         = (stringify(_field)),                              \
     .field_exists = (_test),                                          \
     .num          = (_num),                                           \
@@ -564,43 +564,43 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer *)
 
 #define VMSTATE_BOOL_ARRAY_TEST(_f, _s, _n, _t)                       \
-    VMSTATE_ARRAY_TEST(_f, _s, _n, _t, vmstate_info_bool, bool)
+    VMSTATE_ARRAY(_f, _s, _n, _t, vmstate_info_bool, bool)
 
 #define VMSTATE_BOOL_ARRAY(_f, _s, _n)                                \
     VMSTATE_BOOL_ARRAY_TEST(_f, _s, _n, NULL)
 
 #define VMSTATE_UINT8_ARRAY(_f, _s, _n)                               \
-    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_uint8, uint8_t)
+    VMSTATE_ARRAY(_f, _s, _n, NULL, vmstate_info_uint8, uint8_t)
 
 #define VMSTATE_UINT16_ARRAY(_f, _s, _n)                              \
-    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_uint16, uint16_t)
+    VMSTATE_ARRAY(_f, _s, _n, NULL, vmstate_info_uint16, uint16_t)
 
 #define VMSTATE_UINT32_ARRAY_TEST(_f, _s, _n, _t)                     \
-    VMSTATE_ARRAY_TEST(_f, _s, _n, _t, vmstate_info_uint32, uint32_t)
+    VMSTATE_ARRAY(_f, _s, _n, _t, vmstate_info_uint32, uint32_t)
 
 #define VMSTATE_UINT32_ARRAY(_f, _s, _n)                              \
     VMSTATE_UINT32_ARRAY_TEST(_f, _s, _n, NULL)
 
 #define VMSTATE_UINT64_ARRAY_TEST(_f, _s, _n, _t)                     \
-    VMSTATE_ARRAY_TEST(_f, _s, _n, _t, vmstate_info_uint64, uint64_t)
+    VMSTATE_ARRAY(_f, _s, _n, _t, vmstate_info_uint64, uint64_t)
 
 #define VMSTATE_UINT64_ARRAY(_f, _s, _n)                              \
     VMSTATE_UINT64_ARRAY_TEST(_f, _s, _n, NULL)
 
 #define VMSTATE_INT16_ARRAY(_f, _s, _n)                               \
-    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_int16, int16_t)
+    VMSTATE_ARRAY(_f, _s, _n, NULL, vmstate_info_int16, int16_t)
 
 #define VMSTATE_INT32_ARRAY_TEST(_f, _s, _n, _t)                      \
-    VMSTATE_ARRAY_TEST(_f, _s, _n, _t, vmstate_info_int32, int32_t)
+    VMSTATE_ARRAY(_f, _s, _n, _t, vmstate_info_int32, int32_t)
 
 #define VMSTATE_INT32_ARRAY(_f, _s, _n)                               \
     VMSTATE_INT32_ARRAY_TEST(_f, _s, _n, NULL)
 
 #define VMSTATE_INT64_ARRAY(_f, _s, _n)                               \
-    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_int64, int64_t)
+    VMSTATE_ARRAY(_f, _s, _n, NULL, vmstate_info_int64, int64_t)
 
 #define VMSTATE_FLOAT64_ARRAY(_f, _s, _n)                             \
-    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_float64, float64)
+    VMSTATE_ARRAY(_f, _s, _n, NULL, vmstate_info_float64, float64)
 
 #define VMSTATE_UINT8_2DARRAY(_f, _s, _n1, _n2)                       \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, NULL, vmstate_info_uint8, uint8_t)
target-i386/machine.c +3 -3
index 8e4a518..09c1f50 100644
@@ -210,9 +210,9 @@ static bool fpregs_is_1_no_mmx(void *opaque, int version_id)
 }
 
 #define VMSTATE_FP_REGS(_field, _state, _n)                               \
-    VMSTATE_ARRAY_TEST(_field, _state, _n, fpregs_is_0, vmstate_fpreg, FPReg), \
-    VMSTATE_ARRAY_TEST(_field, _state, _n, fpregs_is_1_mmx, vmstate_fpreg_1_mmx, FPReg), \
-    VMSTATE_ARRAY_TEST(_field, _state, _n, fpregs_is_1_no_mmx, vmstate_fpreg_1_no_mmx, FPReg)
+    VMSTATE_ARRAY(_field, _state, _n, fpregs_is_0, vmstate_fpreg, FPReg), \
+    VMSTATE_ARRAY(_field, _state, _n, fpregs_is_1_mmx, vmstate_fpreg_1_mmx, FPReg), \
+    VMSTATE_ARRAY(_field, _state, _n, fpregs_is_1_no_mmx, vmstate_fpreg_1_no_mmx, FPReg)
 
 static bool version_is_5(void *opaque, int version_id)
 {
target-ppc/machine.c +2 -2
index 4540fe2..8ec6580 100644
@@ -121,7 +121,7 @@ static const VMStateInfo vmstate_info_avr = {
 };
 
 #define VMSTATE_AVR_ARRAY(_f, _s, _n)                                 \
-    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_avr, ppc_avr_t)
+    VMSTATE_ARRAY(_f, _s, _n, NULL, vmstate_info_avr, ppc_avr_t)
 
 static void cpu_pre_save(void *opaque)
 {
@@ -288,7 +288,7 @@ static const VMStateInfo vmstate_info_slbe = {
 };
 
 #define VMSTATE_SLB_ARRAY(_f, _s, _n)                                 \
-    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_slbe, ppc_slb_t)
+    VMSTATE_ARRAY(_f, _s, _n, NULL, vmstate_info_slbe, ppc_slb_t)
 
 static bool slb_needed(void *opaque)
 {
Signature · 1 line
1.9.0
#65 lore raw

PATCH 55/97 vmstate: Remove version_id from VMSTATE_VBUFFER

In reply to Juan Quintela

None of its two users use it.

---
 include/migration/vmstate.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
include/migration/vmstate.h +3 -4
index 2a38743..553c909 100644
@@ -412,9 +412,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     .start        = (_start),                                        \
 }
 
-#define VMSTATE_VBUFFER(_field, _state, _version, _test, _start, _field_size) { \
+#define VMSTATE_VBUFFER(_field, _state, _test, _start, _field_size) { \
     .name         = (stringify(_field)),                             \
-    .version_id   = (_version),                                      \
     .field_exists = (_test),                                         \
     .size_offset  = vmstate_offset_value(_state, _field_size, int32_t),\
     .info         = &vmstate_info_buffer,                            \
@@ -627,13 +626,13 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, _start, sizeof(typeof_field(_s, _f)))
 
 #define VMSTATE_PARTIAL_VBUFFER(_f, _s, _size)                        \
-    VMSTATE_VBUFFER(_f, _s, 0, NULL, 0, _size)
+    VMSTATE_VBUFFER(_f, _s, NULL, 0, _size)
 
 #define VMSTATE_PARTIAL_VBUFFER_UINT32(_f, _s, _size)                        \
     VMSTATE_VBUFFER_UINT32(_f, _s, 0, NULL, 0, _size)
 
 #define VMSTATE_SUB_VBUFFER(_f, _s, _start, _size)                    \
-    VMSTATE_VBUFFER(_f, _s, 0, NULL, _start, _size)
+    VMSTATE_VBUFFER(_f, _s, NULL, _start, _size)
 
 #define VMSTATE_BUFFER_TEST(_f, _s, _test)                            \
     VMSTATE_STATIC_BUFFER(_f, _s, 0, _test, 0, sizeof(typeof_field(_s, _f)))
Signature · 1 line
1.9.0
#66 lore raw

PATCH 56/97 vmstate: Remove version_id fields that were not used

In reply to Juan Quintela
---
 include/migration/vmstate.h | 4 ----
 1 file changed, 4 deletions(-)
include/migration/vmstate.h +0 -4
index 553c909..95d0a9a 100644
@@ -342,7 +342,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 
 #define VMSTATE_STRUCT_VARRAY_POINTER_INT32(_field, _state, _field_num, _vmsd, _type) { \
     .name       = (stringify(_field)),                               \
-    .version_id = 0,                                                 \
     .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
     .size       = sizeof(_type),                                     \
     .vmsd       = &(_vmsd),                                          \
@@ -352,7 +351,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 
 #define VMSTATE_STRUCT_VARRAY_POINTER_UINT32(_field, _state, _field_num, _vmsd, _type) { \
     .name       = (stringify(_field)),                               \
-    .version_id = 0,                                                 \
     .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\
     .size       = sizeof(_type),                                     \
     .vmsd       = &(_vmsd),                                          \
@@ -362,7 +360,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 
 #define VMSTATE_STRUCT_VARRAY_POINTER_UINT16(_field, _state, _field_num, _vmsd, _type) { \
     .name       = (stringify(_field)),                               \
-    .version_id = 0,                                                 \
     .num_offset = vmstate_offset_value(_state, _field_num, uint16_t),\
     .size       = sizeof(_type),                                     \
     .vmsd       = &(_vmsd),                                          \
@@ -464,7 +461,6 @@ extern const VMStateInfo vmstate_info_bitmap;
  */
 #define VMSTATE_BITMAP(_field, _state, _field_size) {                \
     .name         = (stringify(_field)),                             \
-    .version_id   = 0,                                               \
     .size_offset  = vmstate_offset_value(_state, _field_size, int32_t),\
     .info         = &vmstate_info_bitmap,                            \
     .flags        = VMS_VBUFFER|VMS_POINTER,                         \
Signature · 1 line
1.9.0
#67 lore raw

PATCH 57/97 vmstate: Remove version_id from VMSTATE_SUB_ARRAY

In reply to Juan Quintela

None of its two users used it.

---
 include/migration/vmstate.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
include/migration/vmstate.h +3 -4
index 95d0a9a..59afc3e 100644
@@ -231,9 +231,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset       = vmstate_offset_array(_state, _field, _type, _num),\
 }
 
-#define VMSTATE_SUB_ARRAY(_field, _state, _start, _num, _version, _info, _type) { \
+#define VMSTATE_SUB_ARRAY(_field, _state, _start, _num, _info, _type) { \
     .name       = (stringify(_field)),                               \
-    .version_id = (_version),                                        \
     .num        = (_num),                                            \
     .info       = &(_info),                                          \
     .size       = sizeof(_type),                                     \
@@ -607,10 +606,10 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, NULL, vmstate_info_uint32, uint32_t)
 
 #define VMSTATE_UINT8_SUB_ARRAY(_f, _s, _start, _num)                \
-    VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint8, uint8_t)
+    VMSTATE_SUB_ARRAY(_f, _s, _start, _num, vmstate_info_uint8, uint8_t)
 
 #define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num)                \
-    VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t)
+    VMSTATE_SUB_ARRAY(_f, _s, _start, _num, vmstate_info_uint32, uint32_t)
 
 #define VMSTATE_BUFFER(_f, _s)                                        \
     VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, 0, sizeof(typeof_field(_s, _f)))
Signature · 1 line
1.9.0
#68 lore raw

PATCH 58/97 vmstate: Remove version parameter from VMSTATE_VARRAY_INT32

In reply to Juan Quintela
---
 docs/migration.txt          | 2 +-
 hw/block/fdc.c              | 2 +-
 hw/display/qxl.c            | 2 +-
 hw/display/vmware_vga.c     | 2 +-
 hw/ide/core.c               | 2 +-
 hw/pci/pci.c                | 3 +--
 include/migration/vmstate.h | 3 +--
 target-arm/machine.c        | 4 ++--
 8 files changed, 9 insertions(+), 11 deletions(-)
docs/migration.txt +1 -1
index 0492a45..794fa70 100644
@@ -259,7 +259,7 @@ const VMStateDescription vmstate_ide_drive_pio_state = {
     .post_load = ide_drive_pio_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_INT32(req_nb_sectors, IDEState),
-        VMSTATE_VARRAY_INT32(io_buffer, IDEState, io_buffer_total_len, 1,
+        VMSTATE_VARRAY_INT32(io_buffer, IDEState, io_buffer_total_len,
                              vmstate_info_uint8, uint8_t),
         VMSTATE_INT32(cur_io_buffer_offset, IDEState),
         VMSTATE_INT32(cur_io_buffer_len, IDEState),
hw/block/fdc.c +1 -1
index 490d127..ca973f4 100644
@@ -752,7 +752,7 @@ static const VMStateDescription vmstate_fdc = {
         VMSTATE_UINT8(status1, FDCtrl),
         VMSTATE_UINT8(status2, FDCtrl),
         /* Command FIFO */
-        VMSTATE_VARRAY_INT32(fifo, FDCtrl, fifo_size, 0, vmstate_info_uint8,
+        VMSTATE_VARRAY_INT32(fifo, FDCtrl, fifo_size, vmstate_info_uint8,
                              uint8_t),
         VMSTATE_UINT32(data_pos, FDCtrl),
         VMSTATE_UINT32(data_len, FDCtrl),
hw/display/qxl.c +1 -1
index 47bbf1f..9dd4e22 100644
@@ -2271,7 +2271,7 @@ static VMStateDescription qxl_vmstate = {
                        qxl_surface, QXLSurfaceCreate),
         VMSTATE_INT32_EQUAL(ssd.num_surfaces, PCIQXLDevice),
         VMSTATE_VARRAY_INT32(guest_surfaces.cmds, PCIQXLDevice,
-                             ssd.num_surfaces, 0,
+                             ssd.num_surfaces,
                              vmstate_info_uint64, uint64_t),
         VMSTATE_UINT64(guest_cursor, PCIQXLDevice),
         VMSTATE_END_OF_LIST()
hw/display/vmware_vga.c +1 -1
index 00bb385..90dfbf3 100644
@@ -1163,7 +1163,7 @@ static const VMStateDescription vmstate_vmware_vga_internal = {
         VMSTATE_INT32(cursor.on, struct vmsvga_state_s),
         VMSTATE_INT32(index, struct vmsvga_state_s),
         VMSTATE_VARRAY_INT32(scratch, struct vmsvga_state_s,
-                             scratch_size, 0, vmstate_info_uint32, uint32_t),
+                             scratch_size, vmstate_info_uint32, uint32_t),
         VMSTATE_INT32(new_width, struct vmsvga_state_s),
         VMSTATE_INT32(new_height, struct vmsvga_state_s),
         VMSTATE_UINT32(guest, struct vmsvga_state_s),
hw/ide/core.c +1 -1
index b79cc9e..d33f3f3 100644
@@ -2368,7 +2368,7 @@ static const VMStateDescription vmstate_ide_drive_pio_state = {
     .post_load = ide_drive_pio_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_INT32(req_nb_sectors, IDEState),
-        VMSTATE_VARRAY_INT32(io_buffer, IDEState, io_buffer_total_len, 1,
+        VMSTATE_VARRAY_INT32(io_buffer, IDEState, io_buffer_total_len,
 			     vmstate_info_uint8, uint8_t),
         VMSTATE_INT32(cur_io_buffer_offset, IDEState),
         VMSTATE_INT32(cur_io_buffer_len, IDEState),
hw/pci/pci.c +1 -2
index 828df53..a8d671c 100644
@@ -66,8 +66,7 @@ static const VMStateDescription vmstate_pcibus = {
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_INT32_EQUAL(nirq, PCIBus),
-        VMSTATE_VARRAY_INT32(irq_count, PCIBus,
-                             nirq, 0, vmstate_info_int32,
+        VMSTATE_VARRAY_INT32(irq_count, PCIBus, nirq, vmstate_info_int32,
                              int32_t),
         VMSTATE_END_OF_LIST()
     }
include/migration/vmstate.h +1 -2
index 59afc3e..905c19a 100644
@@ -249,9 +249,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset     = offsetof(_state, _field),                          \
 }
 
-#define VMSTATE_VARRAY_INT32(_field, _state, _field_num, _version, _info, _type) {\
+#define VMSTATE_VARRAY_INT32(_field, _state, _field_num, _info, _type) {\
     .name       = (stringify(_field)),                               \
-    .version_id = (_version),                                        \
     .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
     .info       = &(_info),                                          \
     .size       = sizeof(_type),                                     \
target-arm/machine.c +2 -2
index 3f4fd42..3f2c485 100644
@@ -244,10 +244,10 @@ const VMStateDescription vmstate_arm_cpu = {
         VMSTATE_INT32_POSITIVE_LE(cpreg_vmstate_array_len, ARMCPU),
         VMSTATE_VARRAY_INT32(cpreg_vmstate_indexes, ARMCPU,
                              cpreg_vmstate_array_len,
-                             0, vmstate_info_uint64, uint64_t),
+                             vmstate_info_uint64, uint64_t),
         VMSTATE_VARRAY_INT32(cpreg_vmstate_values, ARMCPU,
                              cpreg_vmstate_array_len,
-                             0, vmstate_info_uint64, uint64_t),
+                             vmstate_info_uint64, uint64_t),
         VMSTATE_UINT64(env.exclusive_addr, ARMCPU),
         VMSTATE_UINT64(env.exclusive_val, ARMCPU),
         VMSTATE_UINT64(env.exclusive_high, ARMCPU),
Signature · 1 line
1.9.0
#69 lore raw

PATCH 59/97 vmstate: Remove version_id from VMSTATE_VARRAY_UINT16_UNSAFE

In reply to Juan Quintela
---
 hw/nvram/eeprom93xx.c       | 2 +-
 include/migration/vmstate.h | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
hw/nvram/eeprom93xx.c +1 -1
index 7e09037..8f59509 100644
@@ -145,7 +145,7 @@ static const VMStateDescription vmstate_eeprom = {
         VMSTATE_UNUSED_TEST(is_old_eeprom_version, 1),
         VMSTATE_UINT16_EQUAL_TEST(size, eeprom_t, is_eeprom_version),
         VMSTATE_UINT16(data, eeprom_t),
-        VMSTATE_VARRAY_UINT16_UNSAFE(contents, eeprom_t, size, 0,
+        VMSTATE_VARRAY_UINT16_UNSAFE(contents, eeprom_t, size,
                                      vmstate_info_uint16, uint16_t),
         VMSTATE_END_OF_LIST()
     }
include/migration/vmstate.h +1 -2
index 905c19a..5a26b6a 100644
@@ -268,9 +268,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset     = vmstate_offset_pointer(_state, _field, _type),     \
 }
 
-#define VMSTATE_VARRAY_UINT16_UNSAFE(_field, _state, _field_num, _version, _info, _type) {\
+#define VMSTATE_VARRAY_UINT16_UNSAFE(_field, _state, _field_num, _info, _type) {\
     .name       = (stringify(_field)),                               \
-    .version_id = (_version),                                        \
     .num_offset = vmstate_offset_value(_state, _field_num, uint16_t),\
     .info       = &(_info),                                          \
     .size       = sizeof(_type),                                     \
Signature · 1 line
1.9.0
#70 lore raw

PATCH 60/97 vmstate: VMSTATE_ARRAY_OF_POINTER didn't used the version_id field

In reply to Juan Quintela
---
 include/migration/vmstate.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
include/migration/vmstate.h +2 -3
index 5a26b6a..6d064de 100644
@@ -296,9 +296,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset       = vmstate_offset_pointer(_state, _field, _type),   \
 }
 
-#define VMSTATE_ARRAY_OF_POINTER(_field, _state, _num, _version, _info, _type) {\
+#define VMSTATE_ARRAY_OF_POINTER(_field, _state, _num, _info, _type) {\
     .name       = (stringify(_field)),                               \
-    .version_id = (_version),                                        \
     .num        = (_num),                                            \
     .info       = &(_info),                                          \
     .size       = sizeof(_type),                                     \
@@ -553,7 +552,7 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_TIMER_TEST(_f, _s, NULL)
 
 #define VMSTATE_TIMER_ARRAY(_f, _s, _n)                               \
-    VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer *)
+    VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, vmstate_info_timer, QEMUTimer*)
 
 #define VMSTATE_BOOL_ARRAY_TEST(_f, _s, _n, _t)                       \
     VMSTATE_ARRAY(_f, _s, _n, _t, vmstate_info_bool, bool)
Signature · 1 line
1.9.0
#71 lore raw

PATCH 61/97 vmstate: remove version parameter from VMSTATE_BUFFER_POINTER_UNSAFE

In reply to Juan Quintela
---
 hw/block/onenand.c          | 2 +-
 hw/sd/sd.c                  | 2 +-
 include/migration/vmstate.h | 3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)
hw/block/onenand.c +1 -1
index 60d5311..87fbf00 100644
@@ -189,7 +189,7 @@ static const VMStateDescription vmstate_onenand = {
         VMSTATE_UINT8(ecc.cp, OneNANDState),
         VMSTATE_UINT16_ARRAY(ecc.lp, OneNANDState, 2),
         VMSTATE_UINT16(ecc.count, OneNANDState),
-        VMSTATE_BUFFER_POINTER_UNSAFE(otp, OneNANDState, 0,
+        VMSTATE_BUFFER_POINTER_UNSAFE(otp, OneNANDState,
             ((64 + 2) << PAGE_SHIFT)),
         VMSTATE_END_OF_LIST()
     }
hw/sd/sd.c +1 -1
index 7ee8c24..ac909f3 100644
@@ -480,7 +480,7 @@ static const VMStateDescription sd_vmstate = {
         VMSTATE_UINT64(data_start, SDState),
         VMSTATE_UINT32(data_offset, SDState),
         VMSTATE_UINT8_ARRAY(data, SDState, 512),
-        VMSTATE_BUFFER_POINTER_UNSAFE(buf, SDState, 1, 512),
+        VMSTATE_BUFFER_POINTER_UNSAFE(buf, SDState, 512),
         VMSTATE_BOOL(enable, SDState),
         VMSTATE_END_OF_LIST()
     }
include/migration/vmstate.h +1 -2
index 6d064de..a114d30 100644
@@ -435,9 +435,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset       = offsetof(_state, _field),                        \
 }
 
-#define VMSTATE_BUFFER_POINTER_UNSAFE(_field, _state, _version, _size) { \
+#define VMSTATE_BUFFER_POINTER_UNSAFE(_field, _state, _size) { \
     .name       = (stringify(_field)),                               \
-    .version_id = (_version),                                        \
     .size       = (_size),                                           \
     .info       = &vmstate_info_buffer,                              \
     .flags      = VMS_BUFFER|VMS_POINTER,                            \
Signature · 1 line
1.9.0
#72 lore raw

PATCH 62/97 vmstate: Remove version, test and start parameter from VMSTATE_VBUFFER_UINT32

In reply to Juan Quintela

None of its users use them.

---
 hw/char/exynos4210_uart.c   | 2 +-
 hw/display/g364fb.c         | 2 +-
 hw/dma/pl330.c              | 8 ++++----
 hw/intc/exynos4210_gic.c    | 2 +-
 hw/net/vmxnet3.c            | 3 +--
 hw/nvram/mac_nvram.c        | 2 +-
 hw/sd/sdhci.c               | 2 +-
 hw/timer/m48t59.c           | 2 +-
 include/migration/vmstate.h | 7 ++-----
 util/fifo8.c                | 2 +-
 10 files changed, 14 insertions(+), 18 deletions(-)
hw/char/exynos4210_uart.c +1 -1
index 7614e58..872bc99 100644
@@ -563,7 +563,7 @@ static const VMStateDescription vmstate_exynos4210_uart_fifo = {
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(sp, Exynos4210UartFIFO),
         VMSTATE_UINT32(rp, Exynos4210UartFIFO),
-        VMSTATE_VBUFFER_UINT32(data, Exynos4210UartFIFO, 1, NULL, 0, size),
+        VMSTATE_VBUFFER_UINT32(data, Exynos4210UartFIFO, size),
         VMSTATE_END_OF_LIST()
     }
 };
hw/display/g364fb.c +1 -1
index 9f6717e..b1a7985 100644
@@ -461,7 +461,7 @@ static const VMStateDescription vmstate_g364fb = {
     .minimum_version_id = 1,
     .post_load = g364fb_post_load,
     .fields = (VMStateField[]) {
-        VMSTATE_VBUFFER_UINT32(vram, G364State, 1, NULL, 0, vram_size),
+        VMSTATE_VBUFFER_UINT32(vram, G364State, vram_size),
         VMSTATE_BUFFER_UNSAFE(color_palette, G364State, 256 * 3),
         VMSTATE_BUFFER_UNSAFE(cursor_palette, G364State, 9),
         VMSTATE_UINT16_ARRAY(cursor, G364State, 512),
hw/dma/pl330.c +4 -4
index 6b6eaae..e4f8993 100644
@@ -170,8 +170,8 @@ static const VMStateDescription vmstate_pl330_fifo = {
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_VBUFFER_UINT32(buf, PL330Fifo, 1, NULL, 0, buf_size),
-        VMSTATE_VBUFFER_UINT32(tag, PL330Fifo, 1, NULL, 0, buf_size),
+        VMSTATE_VBUFFER_UINT32(buf, PL330Fifo, buf_size),
+        VMSTATE_VBUFFER_UINT32(tag, PL330Fifo, buf_size),
         VMSTATE_UINT32(head, PL330Fifo),
         VMSTATE_UINT32(num, PL330Fifo),
         VMSTATE_UINT32(buf_size, PL330Fifo),
@@ -279,8 +279,8 @@ static const VMStateDescription vmstate_pl330 = {
         VMSTATE_STRUCT(manager, PL330State, 0, vmstate_pl330_chan, PL330Chan),
         VMSTATE_STRUCT_VARRAY_UINT32(chan, PL330State, num_chnls, 0,
                                      vmstate_pl330_chan, PL330Chan),
-        VMSTATE_VBUFFER_UINT32(lo_seqn, PL330State, 1, NULL, 0, num_chnls),
-        VMSTATE_VBUFFER_UINT32(hi_seqn, PL330State, 1, NULL, 0, num_chnls),
+        VMSTATE_VBUFFER_UINT32(lo_seqn, PL330State, num_chnls),
+        VMSTATE_VBUFFER_UINT32(hi_seqn, PL330State, num_chnls),
         VMSTATE_STRUCT(fifo, PL330State, 0, vmstate_pl330_fifo, PL330Fifo),
         VMSTATE_STRUCT(read_queue, PL330State, 0, vmstate_pl330_queue,
                        PL330Queue),
hw/intc/exynos4210_gic.c +1 -1
index 0590d5d..4c1f095 100644
@@ -395,7 +395,7 @@ static const VMStateDescription vmstate_exynos4210_irq_gate = {
     .version_id = 2,
     .minimum_version_id = 2,
     .fields = (VMStateField[]) {
-        VMSTATE_VBUFFER_UINT32(level, Exynos4210IRQGateState, 1, NULL, 0, n_in),
+        VMSTATE_VBUFFER_UINT32(level, Exynos4210IRQGateState, n_in),
         VMSTATE_END_OF_LIST()
     }
 };
hw/net/vmxnet3.c +1 -2
index 4140f9f..1e90af4 100644
@@ -2176,8 +2176,7 @@ static const VMStateDescription vmxstate_vmxnet3_mcast_list = {
     .minimum_version_id = 1,
     .pre_load = vmxnet3_mcast_list_pre_load,
     .fields = (VMStateField[]) {
-        VMSTATE_VBUFFER_UINT32(mcast_list, VMXNET3State, 0, NULL, 0,
-            mcast_list_buff_size),
+        VMSTATE_VBUFFER_UINT32(mcast_list, VMXNET3State, mcast_list_buff_size),
         VMSTATE_END_OF_LIST()
     }
 };
hw/nvram/mac_nvram.c +1 -1
index 170b10b..c4b4a4e 100644
@@ -97,7 +97,7 @@ static const VMStateDescription vmstate_macio_nvram = {
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_VBUFFER_UINT32(data, MacIONVRAMState, 0, NULL, 0, size),
+        VMSTATE_VBUFFER_UINT32(data, MacIONVRAMState, size),
         VMSTATE_END_OF_LIST()
     }
 };
hw/sd/sdhci.c +1 -1
index e2951e6..d9c67a6 100644
@@ -1223,7 +1223,7 @@ const VMStateDescription sdhci_vmstate = {
         VMSTATE_UINT16(data_count, SDHCIState),
         VMSTATE_UINT64(admasysaddr, SDHCIState),
         VMSTATE_UINT8(stopped_state, SDHCIState),
-        VMSTATE_VBUFFER_UINT32(fifo_buffer, SDHCIState, 1, NULL, 0, buf_maxsz),
+        VMSTATE_VBUFFER_UINT32(fifo_buffer, SDHCIState, buf_maxsz),
         VMSTATE_TIMER(insert_timer, SDHCIState),
         VMSTATE_TIMER(transfer_timer, SDHCIState),
         VMSTATE_END_OF_LIST()
hw/timer/m48t59.c +1 -1
index 31509d5..3015a02 100644
@@ -598,7 +598,7 @@ static const VMStateDescription vmstate_m48t59 = {
     .fields = (VMStateField[]) {
         VMSTATE_UINT8(lock, M48t59State),
         VMSTATE_UINT16(addr, M48t59State),
-        VMSTATE_VBUFFER_UINT32(buffer, M48t59State, 0, NULL, 0, size),
+        VMSTATE_VBUFFER_UINT32(buffer, M48t59State, size),
         VMSTATE_END_OF_LIST()
     }
 };
include/migration/vmstate.h +2 -5
index a114d30..0498339 100644
@@ -415,15 +415,12 @@ extern const VMStateInfo vmstate_info_bitmap;
     .start        = (_start),                                        \
 }
 
-#define VMSTATE_VBUFFER_UINT32(_field, _state, _version, _test, _start, _field_size) { \
+#define VMSTATE_VBUFFER_UINT32(_field, _state, _field_size) { \
     .name         = (stringify(_field)),                             \
-    .version_id   = (_version),                                      \
-    .field_exists = (_test),                                         \
     .size_offset  = vmstate_offset_value(_state, _field_size, uint32_t),\
     .info         = &vmstate_info_buffer,                            \
     .flags        = VMS_VBUFFER|VMS_POINTER,                         \
     .offset       = offsetof(_state, _field),                        \
-    .start        = (_start),                                        \
 }
 
 #define VMSTATE_BUFFER_UNSAFE_TEST(_field, _state, _test, _info, _size) { \
@@ -620,7 +617,7 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_VBUFFER(_f, _s, NULL, 0, _size)
 
 #define VMSTATE_PARTIAL_VBUFFER_UINT32(_f, _s, _size)                        \
-    VMSTATE_VBUFFER_UINT32(_f, _s, 0, NULL, 0, _size)
+    VMSTATE_VBUFFER_UINT32(_f, _s, _size)
 
 #define VMSTATE_SUB_VBUFFER(_f, _s, _start, _size)                    \
     VMSTATE_VBUFFER(_f, _s, NULL, _start, _size)
util/fifo8.c +1 -1
index 0ea5ad9..2f0facd 100644
@@ -117,7 +117,7 @@ const VMStateDescription vmstate_fifo8 = {
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_VBUFFER_UINT32(data, Fifo8, 1, NULL, 0, capacity),
+        VMSTATE_VBUFFER_UINT32(data, Fifo8, capacity),
         VMSTATE_UINT32(head, Fifo8),
         VMSTATE_UINT32(num, Fifo8),
         VMSTATE_END_OF_LIST()
Signature · 1 line
1.9.0
#73 lore raw

PATCH 63/97 vmstate: Remove version paramenter from VMSTATE_ARRAY_OF_POINTER_TO_STRUCT

In reply to Juan Quintela
---
 include/hw/ptimer.h         | 2 +-
 include/migration/vmstate.h | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
include/hw/ptimer.h +1 -1
index ef852bf..57a65e6 100644
@@ -31,7 +31,7 @@ extern const VMStateDescription vmstate_ptimer;
     VMSTATE_STRUCT_POINTER(_field, _state, vmstate_ptimer, ptimer_state)
 
 #define VMSTATE_PTIMER_ARRAY(_f, _s, _n)                                \
-    VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(_f, _s, _n, 0,                   \
+    VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(_f, _s, _n,                      \
                                        vmstate_ptimer, ptimer_state)
 
 #endif
include/migration/vmstate.h +2 -3
index 0498339..ed70734 100644
@@ -305,12 +305,11 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset     = vmstate_offset_array(_state, _field, _type, _num), \
 }
 
-#define VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(_f, _s, _n, _v, _vmsd, _type) { \
+#define VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(_f, _s, _n, _vmsd, _type) { \
     .name       = (stringify(_f)),                                   \
-    .version_id = (_v),                                              \
     .num        = (_n),                                              \
     .vmsd       = &(_vmsd),                                          \
-    .size       = sizeof(_type *),                                    \
+    .size       = sizeof(_type *),                                   \
     .flags      = VMS_ARRAY|VMS_STRUCT|VMS_ARRAY_OF_POINTER,         \
     .offset     = vmstate_offset_array(_s, _f, _type*, _n),          \
 }
Signature · 1 line
1.9.0
#74 lore raw

PATCH 64/97 vmstate: Remove VMSTATE_BUFFER_MULTIPLY

In reply to Juan Quintela

It was unused.

---
 include/migration/vmstate.h | 13 -------------
 vmstate.c                   |  3 ---
 2 files changed, 16 deletions(-)
include/migration/vmstate.h +0 -13
index ed70734..b9d5a28 100644
@@ -97,7 +97,6 @@ enum VMStateFlags {
     VMS_ARRAY_OF_POINTER = 0x040,
     VMS_VARRAY_UINT16    = 0x080,  /* Array with size in uint16_t field */
     VMS_VBUFFER          = 0x100,  /* Buffer with size in int32_t field */
-    VMS_MULTIPLY         = 0x200,  /* multiply "size" field by field_size */
     VMS_VARRAY_UINT8     = 0x400,  /* Array with size in uint8_t field*/
     VMS_VARRAY_UINT32    = 0x800,  /* Array with size in uint32_t field*/
 };
@@ -392,18 +391,6 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset       = vmstate_offset_buffer(_state, _field) + _start,  \
 }
 
-#define VMSTATE_VBUFFER_MULTIPLY(_field, _state, _version, _test, _start, _field_size, _multiply) { \
-    .name         = (stringify(_field)),                             \
-    .version_id   = (_version),                                      \
-    .field_exists = (_test),                                         \
-    .size_offset  = vmstate_offset_value(_state, _field_size, uint32_t),\
-    .size         = (_multiply),                                      \
-    .info         = &vmstate_info_buffer,                            \
-    .flags        = VMS_VBUFFER|VMS_POINTER|VMS_MULTIPLY,            \
-    .offset       = offsetof(_state, _field),                        \
-    .start        = (_start),                                        \
-}
-
 #define VMSTATE_VBUFFER(_field, _state, _test, _start, _field_size) { \
     .name         = (stringify(_field)),                             \
     .field_exists = (_test),                                         \
vmstate.c +0 -3
index cb0af5e..ce197d2 100644
@@ -35,9 +35,6 @@ static int vmstate_size(void *opaque, VMStateField *field)
 
     if (field->flags & VMS_VBUFFER) {
         size = *(int32_t *)(opaque+field->size_offset);
-        if (field->flags & VMS_MULTIPLY) {
-            size *= field->size;
-        }
     }
 
     return size;
Signature · 1 line
1.9.0
#75 lore raw

PATCH 65/97 vmstate: Remove version parameter from VMSTATE_STATIC_BUFFER

In reply to Juan Quintela

No user for it.

---
 include/migration/vmstate.h | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
include/migration/vmstate.h +5 -6
index b9d5a28..95e4e17 100644
@@ -381,9 +381,8 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset     = offsetof(_state, _field),                          \
 }
 
-#define VMSTATE_STATIC_BUFFER(_field, _state, _version, _test, _start, _size) { \
+#define VMSTATE_STATIC_BUFFER(_field, _state, _test, _start, _size) { \
     .name         = (stringify(_field)),                             \
-    .version_id   = (_version),                                      \
     .field_exists = (_test),                                         \
     .size         = (_size - _start),                                \
     .info         = &vmstate_info_buffer,                            \
@@ -591,13 +590,13 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_SUB_ARRAY(_f, _s, _start, _num, vmstate_info_uint32, uint32_t)
 
 #define VMSTATE_BUFFER(_f, _s)                                        \
-    VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, 0, sizeof(typeof_field(_s, _f)))
+    VMSTATE_STATIC_BUFFER(_f, _s, NULL, 0, sizeof(typeof_field(_s, _f)))
 
 #define VMSTATE_PARTIAL_BUFFER(_f, _s, _size)                         \
-    VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, 0, _size)
+    VMSTATE_STATIC_BUFFER(_f, _s, NULL, 0, _size)
 
 #define VMSTATE_BUFFER_START_MIDDLE(_f, _s, _start) \
-    VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, _start, sizeof(typeof_field(_s, _f)))
+    VMSTATE_STATIC_BUFFER(_f, _s, NULL, _start, sizeof(typeof_field(_s, _f)))
 
 #define VMSTATE_PARTIAL_VBUFFER(_f, _s, _size)                        \
     VMSTATE_VBUFFER(_f, _s, NULL, 0, _size)
@@ -609,7 +608,7 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_VBUFFER(_f, _s, NULL, _start, _size)
 
 #define VMSTATE_BUFFER_TEST(_f, _s, _test)                            \
-    VMSTATE_STATIC_BUFFER(_f, _s, 0, _test, 0, sizeof(typeof_field(_s, _f)))
+    VMSTATE_STATIC_BUFFER(_f, _s, _test, 0, sizeof(typeof_field(_s, _f)))
 
 #define VMSTATE_BUFFER_UNSAFE(_field, _state,  _size)                 \
     VMSTATE_BUFFER_UNSAFE_TEST(_field, _state, NULL, vmstate_info_buffer, _size)
Signature · 1 line
1.9.0
#76 lore raw

PATCH 66/97 vmstate: Remove version field from VMSTATE_STRUCT_VARRAY_UINT32

In reply to Juan Quintela

No user of it.

---
 hw/dma/pl330.c              | 4 ++--
 hw/timer/a9gtimer.c         | 2 +-
 hw/timer/arm_mptimer.c      | 2 +-
 hw/usb/hcd-xhci.c           | 6 +++---
 include/migration/vmstate.h | 3 +--
 5 files changed, 8 insertions(+), 9 deletions(-)
hw/dma/pl330.c +2 -2
index e4f8993..9ba3108 100644
@@ -216,7 +216,7 @@ static const VMStateDescription vmstate_pl330_queue = {
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT_VARRAY_UINT32(queue, PL330Queue, queue_size, 1,
+        VMSTATE_STRUCT_VARRAY_UINT32(queue, PL330Queue, queue_size,
                                  vmstate_pl330_queue_entry, PL330QueueEntry),
         VMSTATE_END_OF_LIST()
     }
@@ -277,7 +277,7 @@ static const VMStateDescription vmstate_pl330 = {
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_STRUCT(manager, PL330State, 0, vmstate_pl330_chan, PL330Chan),
-        VMSTATE_STRUCT_VARRAY_UINT32(chan, PL330State, num_chnls, 0,
+        VMSTATE_STRUCT_VARRAY_UINT32(chan, PL330State, num_chnls,
                                      vmstate_pl330_chan, PL330Chan),
         VMSTATE_VBUFFER_UINT32(lo_seqn, PL330State, num_chnls),
         VMSTATE_VBUFFER_UINT32(hi_seqn, PL330State, num_chnls),
hw/timer/a9gtimer.c +1 -1
index a0656d5..e4ac695 100644
@@ -333,7 +333,7 @@ static const VMStateDescription vmstate_a9_gtimer = {
         VMSTATE_UINT64(ref_counter, A9GTimerState),
         VMSTATE_UINT64(cpu_ref_time, A9GTimerState),
         VMSTATE_STRUCT_VARRAY_UINT32(per_cpu, A9GTimerState, num_cpu,
-                                     1, vmstate_a9_gtimer_per_cpu,
+                                     vmstate_a9_gtimer_per_cpu,
                                      A9GTimerPerCPU),
         VMSTATE_END_OF_LIST()
     }
hw/timer/arm_mptimer.c +1 -1
index 35a0a23..b98a81e 100644
@@ -257,7 +257,7 @@ static const VMStateDescription vmstate_arm_mptimer = {
     .minimum_version_id = 2,
     .fields = (VMStateField[]) {
         VMSTATE_STRUCT_VARRAY_UINT32(timerblock, ARMMPTimerState, num_cpu,
-                                     2, vmstate_timerblock, TimerBlock),
+                                     vmstate_timerblock, TimerBlock),
         VMSTATE_END_OF_LIST()
     }
 };
hw/usb/hcd-xhci.c +3 -3
index ef3177a..a95bd30 100644
@@ -3752,11 +3752,11 @@ static const VMStateDescription vmstate_xhci = {
         VMSTATE_PCIE_DEVICE(parent_obj, XHCIState),
         VMSTATE_MSIX(parent_obj, XHCIState),
 
-        VMSTATE_STRUCT_VARRAY_UINT32(ports, XHCIState, numports, 1,
+        VMSTATE_STRUCT_VARRAY_UINT32(ports, XHCIState, numports,
                                      vmstate_xhci_port, XHCIPort),
-        VMSTATE_STRUCT_VARRAY_UINT32(slots, XHCIState, numslots, 1,
+        VMSTATE_STRUCT_VARRAY_UINT32(slots, XHCIState, numslots,
                                      vmstate_xhci_slot, XHCISlot),
-        VMSTATE_STRUCT_VARRAY_UINT32(intr, XHCIState, numintrs, 1,
+        VMSTATE_STRUCT_VARRAY_UINT32(intr, XHCIState, numintrs,
                                      vmstate_xhci_intr, XHCIInterrupter),
 
         /* Operational Registers */
include/migration/vmstate.h +1 -2
index 95e4e17..6076a35 100644
@@ -371,10 +371,9 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset     = offsetof(_state, _field),                          \
 }
 
-#define VMSTATE_STRUCT_VARRAY_UINT32(_field, _state, _field_num, _version, _vmsd, _type) { \
+#define VMSTATE_STRUCT_VARRAY_UINT32(_field, _state, _field_num, _vmsd, _type) { \
     .name       = (stringify(_field)),                               \
     .num_offset = vmstate_offset_value(_state, _field_num, uint32_t), \
-    .version_id = (_version),                                        \
     .vmsd       = &(_vmsd),                                          \
     .size       = sizeof(_type),                                     \
     .flags      = VMS_STRUCT|VMS_VARRAY_UINT32,                      \
Signature · 1 line
1.9.0
#77 lore raw

PATCH 67/97 vmstate: Move all users of versioning of VMSTATE_STRUCT_ARRAY to _TEST

In reply to Juan Quintela
---
 hw/char/escc.c          |  4 ++--
 hw/ide/internal.h       |  3 ++-
 hw/timer/i8254_common.c |  5 +++--
 target-i386/machine.c   | 15 +++++++++------
 4 files changed, 16 insertions(+), 11 deletions(-)
hw/char/escc.c +2 -2
index 4875a2b..dc5768f 100644
@@ -678,8 +678,8 @@ static const VMStateDescription vmstate_escc = {
     .version_id = 2,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT_ARRAY(chn, ESCCState, 2, 2, vmstate_escc_chn,
-                             ChannelState),
+        VMSTATE_STRUCT_ARRAY_TEST(chn, ESCCState, 2, vmstate_2_plus, 0,
+                                  vmstate_escc_chn, ChannelState),
         VMSTATE_END_OF_LIST()
     }
 };
hw/ide/internal.h +2 -1
index 0567a52..d771308 100644
@@ -526,7 +526,8 @@ extern const VMStateDescription vmstate_ide_bus;
 extern const VMStateDescription vmstate_ide_drive;
 
 #define VMSTATE_IDE_DRIVES(_field, _state) \
-    VMSTATE_STRUCT_ARRAY(_field, _state, 2, 3, vmstate_ide_drive, IDEState)
+    VMSTATE_STRUCT_ARRAY_TEST(_field, _state, 2, vmstate_3_plus, 0,\
+                              vmstate_ide_drive, IDEState)
 
 void ide_bus_reset(IDEBus *bus);
 int64_t ide_get_sector(IDEState *s);
hw/timer/i8254_common.c +3 -2
index f519864..b7bd908 100644
@@ -268,8 +268,9 @@ static const VMStateDescription vmstate_pit_common = {
     .fields = (VMStateField[]) {
         VMSTATE_UINT32_TEST(channels[0].irq_disabled, PITCommonState,
             vmstate_3_plus),
-        VMSTATE_STRUCT_ARRAY(channels, PITCommonState, 3, 2,
-                             vmstate_pit_channel, PITChannelState),
+        VMSTATE_STRUCT_ARRAY_TEST(channels, PITCommonState, 3,
+                                  vmstate_2_plus, 0, vmstate_pit_channel,
+                                  PITChannelState),
         VMSTATE_INT64(channels[0].next_transition_time,
                       PITCommonState), /* formerly irq_timer */
         VMSTATE_END_OF_LIST()
target-i386/machine.c +9 -6
index 09c1f50..ac9dde1 100644
@@ -57,8 +57,9 @@ static const VMStateDescription vmstate_ymmh_reg = {
     }
 };
 
-#define VMSTATE_YMMH_REGS_VARS(_field, _state, _n, _v)                         \
-    VMSTATE_STRUCT_ARRAY(_field, _state, _n, _v, vmstate_ymmh_reg, XMMReg)
+#define VMSTATE_YMMH_REGS_VARS(_field, _state, _n, _t)                         \
+    VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _n, _t, 0,\
+                              vmstate_ymmh_reg, XMMReg)
 
 static const VMStateDescription vmstate_bnd_regs = {
     .name = "bnd_regs",
@@ -85,8 +86,9 @@ static const VMStateDescription vmstate_mtrr_var = {
     }
 };
 
-#define VMSTATE_MTRR_VARS(_field, _state, _n, _v)                    \
-    VMSTATE_STRUCT_ARRAY(_field, _state, _n, _v, vmstate_mtrr_var, MTRRVar)
+#define VMSTATE_MTRR_VARS(_field, _state, _n, _t)                    \
+    VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _n, _t, 0,\
+                              vmstate_mtrr_var, MTRRVar)
 
 static void put_fpreg_error(QEMUFile *f, void *opaque, size_t size)
 {
@@ -669,7 +671,7 @@ const VMStateDescription vmstate_x86_cpu = {
         /* MTRRs */
         VMSTATE_UINT64_ARRAY_TEST(env.mtrr_fixed, X86CPU, 11, vmstate_8_plus),
         VMSTATE_UINT64_TEST(env.mtrr_deftype, X86CPU, vmstate_8_plus),
-        VMSTATE_MTRR_VARS(env.mtrr_var, X86CPU, 8, 8),
+        VMSTATE_MTRR_VARS(env.mtrr_var, X86CPU, 8, vmstate_8_plus),
         /* KVM-related states */
         VMSTATE_INT32_TEST(env.interrupt_injected, X86CPU, vmstate_9_plus),
         VMSTATE_UINT32_TEST(env.mp_state, X86CPU, vmstate_9_plus),
@@ -694,7 +696,8 @@ const VMStateDescription vmstate_x86_cpu = {
         /* XSAVE related fields */
         VMSTATE_UINT64_TEST(env.xcr0, X86CPU, vmstate_12_plus),
         VMSTATE_UINT64_TEST(env.xstate_bv, X86CPU, vmstate_12_plus),
-        VMSTATE_YMMH_REGS_VARS(env.ymmh_regs, X86CPU, CPU_NB_REGS, 12),
+        VMSTATE_YMMH_REGS_VARS(env.ymmh_regs, X86CPU, CPU_NB_REGS,
+                               vmstate_12_plus),
         VMSTATE_END_OF_LIST()
         /* The above list is not sorted /wrt version numbers, watch out! */
     },
Signature · 1 line
1.9.0
#78 lore raw

PATCH 68/97 vmstate: Remove version paramenter from VMSTATE_STRUCT_ARRAY

In reply to Juan Quintela

No users of that field left.

---
 hw/arm/musicpal.c             |  2 +-
 hw/audio/ac97.c               |  2 +-
 hw/audio/es1370.c             |  2 +-
 hw/audio/hda-codec.c          |  3 +--
 hw/audio/intel-hda.c          |  3 +--
 hw/block/fdc.c                |  2 +-
 hw/char/ipoctal232.c          |  4 ++--
 hw/char/serial-pci.c          |  2 +-
 hw/display/exynos4210_fimd.c  |  2 +-
 hw/display/pxa2xx_lcd.c       |  2 +-
 hw/display/qxl.c              |  2 +-
 hw/dma/i8257.c                |  2 +-
 hw/dma/pl080.c                |  2 +-
 hw/ide/internal.h             |  2 +-
 hw/ide/pci.c                  |  3 +--
 hw/input/hid.c                |  2 +-
 hw/intc/arm_gic_common.c      |  2 +-
 hw/intc/exynos4210_combiner.c |  2 +-
 hw/intc/heathrow_pic.c        |  2 +-
 hw/intc/slavio_intctl.c       |  2 +-
 hw/misc/macio/cuda.c          |  2 +-
 hw/misc/macio/mac_dbdma.c     |  2 +-
 hw/net/allwinner_emac.c       |  2 +-
 hw/pci-host/ppce500.c         |  4 ++--
 hw/ppc/ppc4xx_pci.c           | 10 ++++------
 hw/ppc/spapr_pci.c            |  4 ++--
 hw/timer/cadence_ttc.c        |  3 +--
 hw/timer/exynos4210_mct.c     |  2 +-
 hw/timer/exynos4210_pwm.c     |  4 ++--
 hw/timer/pxa2xx_timer.c       |  4 ++--
 hw/timer/slavio_timer.c       |  2 +-
 hw/usb/dev-hub.c              |  2 +-
 hw/usb/dev-smartcard-reader.c |  4 ++--
 hw/usb/hcd-uhci.c             |  2 +-
 hw/usb/redirect.c             |  2 +-
 include/migration/vmstate.h   |  5 ++---
 target-i386/machine.c         |  6 +++---
 37 files changed, 49 insertions(+), 56 deletions(-)
hw/arm/musicpal.c +1 -1
index 2a27a19..9ac05d8 100644
@@ -949,7 +949,7 @@ static const VMStateDescription mv88w8618_pit_vmsd = {
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT_ARRAY(timer, mv88w8618_pit_state, 4, 1,
+        VMSTATE_STRUCT_ARRAY(timer, mv88w8618_pit_state, 4,
                              mv88w8618_timer_vmsd, mv88w8618_timer_state),
         VMSTATE_END_OF_LIST()
     }
hw/audio/ac97.c +1 -1
index 45cb118..af00545 100644
@@ -1216,7 +1216,7 @@ static const VMStateDescription vmstate_ac97 = {
         VMSTATE_UINT32 (glob_cnt, AC97LinkState),
         VMSTATE_UINT32 (glob_sta, AC97LinkState),
         VMSTATE_UINT32 (cas, AC97LinkState),
-        VMSTATE_STRUCT_ARRAY (bm_regs, AC97LinkState, 3, 1,
+        VMSTATE_STRUCT_ARRAY (bm_regs, AC97LinkState, 3,
                               vmstate_ac97_bm_regs, AC97BusMasterRegs),
         VMSTATE_BUFFER (mixer_data, AC97LinkState),
         VMSTATE_UNUSED_TEST (is_version_2, 3),
hw/audio/es1370.c +1 -1
index 5dbf803..b4cfe5d 100644
@@ -999,7 +999,7 @@ static const VMStateDescription vmstate_es1370 = {
     .post_load = es1370_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE (dev, ES1370State),
-        VMSTATE_STRUCT_ARRAY (chan, ES1370State, NB_CHANNELS, 2,
+        VMSTATE_STRUCT_ARRAY (chan, ES1370State, NB_CHANNELS,
                               vmstate_es1370_channel, struct chan),
         VMSTATE_UINT32 (ctl, ES1370State),
         VMSTATE_UINT32 (status, ES1370State),
hw/audio/hda-codec.c +1 -2
index 1c1a138..76f4d3c 100644
@@ -599,8 +599,7 @@ static const VMStateDescription vmstate_hda_audio = {
     .version_id = 2,
     .post_load = hda_audio_post_load,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT_ARRAY(st, HDAAudioState, 4, 0,
-                             vmstate_hda_audio_stream,
+        VMSTATE_STRUCT_ARRAY(st, HDAAudioState, 4, vmstate_hda_audio_stream,
                              HDAAudioStream),
         VMSTATE_BOOL_ARRAY(running_compat, HDAAudioState, 16),
         VMSTATE_BOOL_ARRAY_TEST(running_real, HDAAudioState, 2 * 16,
hw/audio/intel-hda.c +1 -2
index 1c660a4..426d178 100644
@@ -1220,8 +1220,7 @@ static const VMStateDescription vmstate_intel_hda = {
         VMSTATE_UINT32(icw, IntelHDAState),
         VMSTATE_UINT32(irr, IntelHDAState),
         VMSTATE_UINT32(ics, IntelHDAState),
-        VMSTATE_STRUCT_ARRAY(st, IntelHDAState, 8, 0,
-                             vmstate_intel_hda_stream,
+        VMSTATE_STRUCT_ARRAY(st, IntelHDAState, 8, vmstate_intel_hda_stream,
                              IntelHDAStream),
 
         /* additional state info */
hw/block/fdc.c +1 -1
index ca973f4..9d8d5d5 100644
@@ -767,7 +767,7 @@ static const VMStateDescription vmstate_fdc = {
         VMSTATE_UINT8(lock, FDCtrl),
         VMSTATE_UINT8(pwrd, FDCtrl),
         VMSTATE_UINT8_EQUAL(num_floppies, FDCtrl),
-        VMSTATE_STRUCT_ARRAY(drives, FDCtrl, MAX_FD, 1,
+        VMSTATE_STRUCT_ARRAY(drives, FDCtrl, MAX_FD,
                              vmstate_fdrive, FDrive),
         VMSTATE_END_OF_LIST()
     }
hw/char/ipoctal232.c +2 -2
index c8d5cdb..9e53ee7 100644
@@ -153,9 +153,9 @@ static const VMStateDescription vmstate_ipoctal = {
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_IPACK_DEVICE(parent_obj, IPOctalState),
-        VMSTATE_STRUCT_ARRAY(ch, IPOctalState, N_CHANNELS, 1,
+        VMSTATE_STRUCT_ARRAY(ch, IPOctalState, N_CHANNELS,
                              vmstate_scc2698_channel, SCC2698Channel),
-        VMSTATE_STRUCT_ARRAY(blk, IPOctalState, N_BLOCKS, 1,
+        VMSTATE_STRUCT_ARRAY(blk, IPOctalState, N_BLOCKS,
                              vmstate_scc2698_block, SCC2698Block),
         VMSTATE_UINT8(irq_vector, IPOctalState),
         VMSTATE_END_OF_LIST()
hw/char/serial-pci.c +1 -1
index 44f50c3..25c930b 100644
@@ -169,7 +169,7 @@ static const VMStateDescription vmstate_pci_multi_serial = {
     .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, PCIMultiSerialState),
         VMSTATE_STRUCT_ARRAY(state, PCIMultiSerialState, PCI_SERIAL_MAX_PORTS,
-                             0, vmstate_serial, SerialState),
+                             vmstate_serial, SerialState),
         VMSTATE_UINT32_ARRAY(level, PCIMultiSerialState, PCI_SERIAL_MAX_PORTS),
         VMSTATE_END_OF_LIST()
     }
hw/display/exynos4210_fimd.c +1 -1
index 45c62af..d4afae9 100644
@@ -1893,7 +1893,7 @@ static const VMStateDescription exynos4210_fimd_vmstate = {
         VMSTATE_UINT32(hueoffset, Exynos4210fimdState),
         VMSTATE_UINT32_ARRAY(i80ifcmd, Exynos4210fimdState, 12),
         VMSTATE_UINT32(blendcon, Exynos4210fimdState),
-        VMSTATE_STRUCT_ARRAY(window, Exynos4210fimdState, 5, 1,
+        VMSTATE_STRUCT_ARRAY(window, Exynos4210fimdState, 5,
                 exynos4210_fimd_window_vmstate, Exynos4210fimdWindow),
         VMSTATE_END_OF_LIST()
     }
hw/display/pxa2xx_lcd.c +1 -1
index 80edb70..f9428d5 100644
@@ -972,7 +972,7 @@ static const VMStateDescription vmstate_pxa2xx_lcdc = {
         VMSTATE_UINT32(tcr, PXA2xxLCDState),
         VMSTATE_UINT32(liidr, PXA2xxLCDState),
         VMSTATE_UINT8(bscntr, PXA2xxLCDState),
-        VMSTATE_STRUCT_ARRAY(dma_ch, PXA2xxLCDState, 7, 0,
+        VMSTATE_STRUCT_ARRAY(dma_ch, PXA2xxLCDState, 7,
                              vmstate_dma_channel, struct DMAChannel),
         VMSTATE_END_OF_LIST()
     }
hw/display/qxl.c +1 -1
index 9dd4e22..4114427 100644
@@ -2265,7 +2265,7 @@ static VMStateDescription qxl_vmstate = {
         VMSTATE_UINT32(mode, PCIQXLDevice),
         VMSTATE_UINT32(ssd.unique, PCIQXLDevice),
         VMSTATE_INT32_EQUAL(num_memslots, PCIQXLDevice),
-        VMSTATE_STRUCT_ARRAY(guest_slots, PCIQXLDevice, NUM_MEMSLOTS, 0,
+        VMSTATE_STRUCT_ARRAY(guest_slots, PCIQXLDevice, NUM_MEMSLOTS,
                              qxl_memslot, struct guest_slots),
         VMSTATE_STRUCT(guest_primary.surface, PCIQXLDevice, 0,
                        qxl_surface, QXLSurfaceCreate),
hw/dma/i8257.c +1 -1
index dd370ed..775571b 100644
@@ -580,7 +580,7 @@ static const VMStateDescription vmstate_dma = {
         VMSTATE_UINT8(mask, struct dma_cont),
         VMSTATE_UINT8(flip_flop, struct dma_cont),
         VMSTATE_INT32(dshift, struct dma_cont),
-        VMSTATE_STRUCT_ARRAY(regs, struct dma_cont, 4, 1, vmstate_dma_regs, struct dma_regs),
+        VMSTATE_STRUCT_ARRAY(regs, struct dma_cont, 4, vmstate_dma_regs, struct dma_regs),
         VMSTATE_END_OF_LIST()
     }
 };
hw/dma/pl080.c +1 -1
index 741dd20..a71ab21 100644
@@ -89,7 +89,7 @@ static const VMStateDescription vmstate_pl080 = {
         VMSTATE_UINT8(tc_int, PL080State),
         VMSTATE_UINT8(tc_int, PL080State),
         VMSTATE_STRUCT_ARRAY(chan, PL080State, PL080_MAX_CHANNELS,
-                             1, vmstate_pl080_channel, pl080_channel),
+                             vmstate_pl080_channel, pl080_channel),
         VMSTATE_INT32(running, PL080State),
         VMSTATE_END_OF_LIST()
     }
hw/ide/internal.h +1 -1
index d771308..23330be 100644
@@ -521,7 +521,7 @@ extern const VMStateDescription vmstate_ide_bus;
     VMSTATE_STRUCT(_field, _state, 1, vmstate_ide_bus, IDEBus)
 
 #define VMSTATE_IDE_BUS_ARRAY(_field, _state, _num)              \
-    VMSTATE_STRUCT_ARRAY(_field, _state, _num, 1, vmstate_ide_bus, IDEBus)
+    VMSTATE_STRUCT_ARRAY(_field, _state, _num, vmstate_ide_bus, IDEBus)
 
 extern const VMStateDescription vmstate_ide_drive;
 
hw/ide/pci.c +1 -2
index 6257a21..9136ec9 100644
@@ -479,8 +479,7 @@ const VMStateDescription vmstate_ide_pci = {
     .post_load = ide_pci_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, PCIIDEState),
-        VMSTATE_STRUCT_ARRAY(bmdma, PCIIDEState, 2, 0,
-                             vmstate_bmdma, BMDMAState),
+        VMSTATE_STRUCT_ARRAY(bmdma, PCIIDEState, 2, vmstate_bmdma, BMDMAState),
         VMSTATE_IDE_BUS_ARRAY(bus, PCIIDEState, 2),
         VMSTATE_IDE_DRIVES(bus[0].ifs, PCIIDEState),
         VMSTATE_IDE_DRIVES(bus[1].ifs, PCIIDEState),
hw/input/hid.c +1 -1
index bb0fa6a..35ec26d 100644
@@ -468,7 +468,7 @@ const VMStateDescription vmstate_hid_ptr_device = {
     .minimum_version_id = 1,
     .post_load = hid_post_load,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT_ARRAY(ptr.queue, HIDState, QUEUE_LENGTH, 0,
+        VMSTATE_STRUCT_ARRAY(ptr.queue, HIDState, QUEUE_LENGTH,
                              vmstate_hid_ptr_queue, HIDPointerEvent),
         VMSTATE_UINT32(head, HIDState),
         VMSTATE_UINT32(n, HIDState),
hw/intc/arm_gic_common.c +1 -1
index 6d884ec..95ae9bc 100644
@@ -65,7 +65,7 @@ static const VMStateDescription vmstate_gic = {
     .fields = (VMStateField[]) {
         VMSTATE_BOOL(enabled, GICState),
         VMSTATE_BOOL_ARRAY(cpu_enabled, GICState, GIC_NCPU),
-        VMSTATE_STRUCT_ARRAY(irq_state, GICState, GIC_MAXIRQ, 1,
+        VMSTATE_STRUCT_ARRAY(irq_state, GICState, GIC_MAXIRQ,
                              vmstate_gic_irq_state, gic_irq_state),
         VMSTATE_UINT8_ARRAY(irq_target, GICState, GIC_MAXIRQ),
         VMSTATE_UINT8_2DARRAY(priority1, GICState, GIC_INTERNAL, GIC_NCPU),
hw/intc/exynos4210_combiner.c +1 -1
index a6b7028..b4efb45 100644
@@ -89,7 +89,7 @@ static const VMStateDescription vmstate_exynos4210_combiner = {
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT_ARRAY(group, Exynos4210CombinerState, IIC_NGRP, 0,
+        VMSTATE_STRUCT_ARRAY(group, Exynos4210CombinerState, IIC_NGRP,
                 vmstate_exynos4210_combiner_group_state, CombinerGroupState),
         VMSTATE_UINT32_ARRAY(reg_set, Exynos4210CombinerState,
                 IIC_REGSET_SIZE),
hw/intc/heathrow_pic.c +1 -1
index 9ff3119..8844231 100644
@@ -173,7 +173,7 @@ static const VMStateDescription vmstate_heathrow_pic = {
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT_ARRAY(pics, HeathrowPICS, 2, 1,
+        VMSTATE_STRUCT_ARRAY(pics, HeathrowPICS, 2,
                              vmstate_heathrow_pic_one, HeathrowPIC),
         VMSTATE_END_OF_LIST()
     }
hw/intc/slavio_intctl.c +1 -1
index f22aba0..47debaf 100644
@@ -393,7 +393,7 @@ static const VMStateDescription vmstate_intctl = {
     .minimum_version_id = 1,
     .post_load = vmstate_intctl_post_load,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT_ARRAY(slaves, SLAVIO_INTCTLState, MAX_CPUS, 1,
+        VMSTATE_STRUCT_ARRAY(slaves, SLAVIO_INTCTLState, MAX_CPUS,
                              vmstate_intctl_cpu, SLAVIO_CPUINTCTLState),
         VMSTATE_UINT32(intregm_pending, SLAVIO_INTCTLState),
         VMSTATE_UINT32(intregm_disabled, SLAVIO_INTCTLState),
hw/misc/macio/cuda.c +1 -1
index ff6051d..3c65d2b 100644
@@ -649,7 +649,7 @@ static const VMStateDescription vmstate_cuda = {
         VMSTATE_BUFFER(data_in, CUDAState),
         VMSTATE_BUFFER(data_out, CUDAState),
         VMSTATE_UINT32(tick_offset, CUDAState),
-        VMSTATE_STRUCT_ARRAY(timers, CUDAState, 2, 1,
+        VMSTATE_STRUCT_ARRAY(timers, CUDAState, 2,
                              vmstate_cuda_timer, CUDATimer),
         VMSTATE_END_OF_LIST()
     }
hw/misc/macio/mac_dbdma.c +1 -1
index 3335476..fa02282 100644
@@ -730,7 +730,7 @@ static const VMStateDescription vmstate_dbdma = {
     .version_id = 2,
     .minimum_version_id = 2,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT_ARRAY(channels, DBDMAState, DBDMA_CHANNELS, 1,
+        VMSTATE_STRUCT_ARRAY(channels, DBDMAState, DBDMA_CHANNELS,
                              vmstate_dbdma_channel, DBDMA_channel),
         VMSTATE_END_OF_LIST()
     }
hw/net/allwinner_emac.c +1 -1
index 469f2f0..0b3cf9a 100644
@@ -505,7 +505,7 @@ static const VMStateDescription vmstate_aw_emac = {
         VMSTATE_UINT32(rx_num_packets, AwEmacState),
         VMSTATE_UINT32(rx_packet_size, AwEmacState),
         VMSTATE_UINT32(rx_packet_pos, AwEmacState),
-        VMSTATE_STRUCT_ARRAY(tx_fifo, AwEmacState, NUM_TX_FIFOS, 1,
+        VMSTATE_STRUCT_ARRAY(tx_fifo, AwEmacState, NUM_TX_FIFOS,
                              vmstate_fifo8, Fifo8),
         VMSTATE_UINT32_ARRAY(tx_length, AwEmacState, NUM_TX_FIFOS),
         VMSTATE_UINT32(tx_channel, AwEmacState),
hw/pci-host/ppce500.c +2 -2
index e12d731..5c0e73c 100644
@@ -305,9 +305,9 @@ static const VMStateDescription vmstate_ppce500_pci = {
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT_ARRAY(pob, PPCE500PCIState, PPCE500_PCI_NR_POBS, 1,
+        VMSTATE_STRUCT_ARRAY(pob, PPCE500PCIState, PPCE500_PCI_NR_POBS,
                              vmstate_pci_outbound, struct pci_outbound),
-        VMSTATE_STRUCT_ARRAY(pib, PPCE500PCIState, PPCE500_PCI_NR_PIBS, 1,
+        VMSTATE_STRUCT_ARRAY(pib, PPCE500PCIState, PPCE500_PCI_NR_PIBS,
                              vmstate_pci_outbound, struct pci_inbound),
         VMSTATE_UINT32(gasket_time, PPCE500PCIState),
         VMSTATE_END_OF_LIST()
hw/ppc/ppc4xx_pci.c +4 -6
index 55a3cab..4672787 100644
@@ -319,12 +319,10 @@ static const VMStateDescription vmstate_ppc4xx_pci = {
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT_ARRAY(pmm, PPC4xxPCIState, PPC4xx_PCI_NR_PMMS, 1,
-                             vmstate_pci_master_map,
-                             struct PCIMasterMap),
-        VMSTATE_STRUCT_ARRAY(ptm, PPC4xxPCIState, PPC4xx_PCI_NR_PTMS, 1,
-                             vmstate_pci_target_map,
-                             struct PCITargetMap),
+        VMSTATE_STRUCT_ARRAY(pmm, PPC4xxPCIState, PPC4xx_PCI_NR_PMMS,
+                             vmstate_pci_master_map, struct PCIMasterMap),
+        VMSTATE_STRUCT_ARRAY(ptm, PPC4xxPCIState, PPC4xx_PCI_NR_PTMS,
+                             vmstate_pci_target_map, struct PCITargetMap),
         VMSTATE_END_OF_LIST()
     }
 };
hw/ppc/spapr_pci.c +2 -2
index a4a51d4..ac93f82 100644
@@ -690,9 +690,9 @@ static const VMStateDescription vmstate_spapr_pci = {
         VMSTATE_UINT64_EQUAL(mem_win_size, sPAPRPHBState),
         VMSTATE_UINT64_EQUAL(io_win_addr, sPAPRPHBState),
         VMSTATE_UINT64_EQUAL(io_win_size, sPAPRPHBState),
-        VMSTATE_STRUCT_ARRAY(lsi_table, sPAPRPHBState, PCI_NUM_PINS, 0,
+        VMSTATE_STRUCT_ARRAY(lsi_table, sPAPRPHBState, PCI_NUM_PINS,
                              vmstate_spapr_pci_lsi, struct spapr_pci_lsi),
-        VMSTATE_STRUCT_ARRAY(msi_table, sPAPRPHBState, SPAPR_MSIX_MAX_DEVS, 0,
+        VMSTATE_STRUCT_ARRAY(msi_table, sPAPRPHBState, SPAPR_MSIX_MAX_DEVS,
                              vmstate_spapr_pci_msi, struct spapr_pci_msi),
 
         VMSTATE_END_OF_LIST()
hw/timer/cadence_ttc.c +1 -2
index 19f89fc..2f7c168 100644
@@ -462,8 +462,7 @@ static const VMStateDescription vmstate_cadence_ttc = {
     .version_id = 1,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT_ARRAY(timer, CadenceTTCState, 3, 0,
-                            vmstate_cadence_timer,
+        VMSTATE_STRUCT_ARRAY(timer, CadenceTTCState, 3, vmstate_cadence_timer,
                             CadenceTimerState),
         VMSTATE_END_OF_LIST()
     }
hw/timer/exynos4210_mct.c +1 -1
index 01e750e..0fd8d24 100644
@@ -348,7 +348,7 @@ static const VMStateDescription vmstate_exynos4210_mct_state = {
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(reg_mct_cfg, Exynos4210MCTState),
-        VMSTATE_STRUCT_ARRAY(l_timer, Exynos4210MCTState, 2, 0,
+        VMSTATE_STRUCT_ARRAY(l_timer, Exynos4210MCTState, 2,
             vmstate_exynos4210_mct_lt, Exynos4210MCTLT),
         VMSTATE_STRUCT(g_timer, Exynos4210MCTState, 0,
             vmstate_exynos4210_mct_gt, Exynos4210MCTGT),
hw/timer/exynos4210_pwm.c +2 -2
index 1c1a2b8..34fd2b3 100644
@@ -139,8 +139,8 @@ static const VMStateDescription vmstate_exynos4210_pwm_state = {
         VMSTATE_UINT32(reg_tcon, Exynos4210PWMState),
         VMSTATE_UINT32(reg_tint_cstat, Exynos4210PWMState),
         VMSTATE_STRUCT_ARRAY(timer, Exynos4210PWMState,
-            EXYNOS4210_PWM_TIMERS_NUM, 0,
-        vmstate_exynos4210_pwm, Exynos4210PWM),
+                             EXYNOS4210_PWM_TIMERS_NUM,
+                             vmstate_exynos4210_pwm, Exynos4210PWM),
         VMSTATE_END_OF_LIST()
     }
 };
hw/timer/pxa2xx_timer.c +2 -2
index 130e9dc..393a792 100644
@@ -512,8 +512,8 @@ static const VMStateDescription vmstate_pxa2xx_timer_regs = {
         VMSTATE_INT32(clock, PXA2xxTimerInfo),
         VMSTATE_INT32(oldclock, PXA2xxTimerInfo),
         VMSTATE_UINT64(lastload, PXA2xxTimerInfo),
-        VMSTATE_STRUCT_ARRAY(timer, PXA2xxTimerInfo, 4, 1,
-                        vmstate_pxa2xx_timer0_regs, PXA2xxTimer0),
+        VMSTATE_STRUCT_ARRAY(timer, PXA2xxTimerInfo, 4,
+                             vmstate_pxa2xx_timer0_regs, PXA2xxTimer0),
         VMSTATE_UINT32(events, PXA2xxTimerInfo),
         VMSTATE_UINT32(irq_enabled, PXA2xxTimerInfo),
         VMSTATE_UINT32(reset3, PXA2xxTimerInfo),
hw/timer/slavio_timer.c +1 -1
index 45d97e6..1616bcb 100644
@@ -345,7 +345,7 @@ static const VMStateDescription vmstate_slavio_timer = {
     .version_id = 3,
     .minimum_version_id = 3,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT_ARRAY(cputimer, SLAVIO_TIMERState, MAX_CPUS + 1, 3,
+        VMSTATE_STRUCT_ARRAY(cputimer, SLAVIO_TIMERState, MAX_CPUS + 1,
                              vmstate_timer, CPUTimerState),
         VMSTATE_END_OF_LIST()
     }
hw/usb/dev-hub.c +1 -1
index 7492174..5756856 100644
@@ -553,7 +553,7 @@ static const VMStateDescription vmstate_usb_hub = {
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_USB_DEVICE(dev, USBHubState),
-        VMSTATE_STRUCT_ARRAY(ports, USBHubState, NUM_PORTS, 0,
+        VMSTATE_STRUCT_ARRAY(ports, USBHubState, NUM_PORTS,
                              vmstate_usb_hub_port, USBHubPort),
         VMSTATE_END_OF_LIST()
     }
hw/usb/dev-smartcard-reader.c +2 -2
index 470e69f..b72a578 100644
@@ -1419,11 +1419,11 @@ static VMStateDescription ccid_vmstate = {
         VMSTATE_BUFFER(abProtocolDataStructure.data, USBCCIDState),
         VMSTATE_UINT32(ulProtocolDataStructureSize, USBCCIDState),
         VMSTATE_STRUCT_ARRAY(bulk_in_pending, USBCCIDState,
-                       BULK_IN_PENDING_NUM, 1, bulk_in_vmstate, BulkIn),
+                       BULK_IN_PENDING_NUM, bulk_in_vmstate, BulkIn),
         VMSTATE_UINT32(bulk_in_pending_start, USBCCIDState),
         VMSTATE_UINT32(bulk_in_pending_end, USBCCIDState),
         VMSTATE_STRUCT_ARRAY(pending_answers, USBCCIDState,
-                        PENDING_ANSWERS_NUM, 1, answer_vmstate, Answer),
+                        PENDING_ANSWERS_NUM, answer_vmstate, Answer),
         VMSTATE_UINT32(pending_answers_num, USBCCIDState),
         VMSTATE_UINT8(migration_state, USBCCIDState),
         VMSTATE_UINT32(state_vmstate, USBCCIDState),
hw/usb/hcd-uhci.c +1 -1
index eb6a448..9133ff1 100644
@@ -447,7 +447,7 @@ static const VMStateDescription vmstate_uhci = {
     .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(dev, UHCIState),
         VMSTATE_UINT8_EQUAL(num_ports_vmstate, UHCIState),
-        VMSTATE_STRUCT_ARRAY(ports, UHCIState, NB_PORTS, 1,
+        VMSTATE_STRUCT_ARRAY(ports, UHCIState, NB_PORTS,
                              vmstate_uhci_port, UHCIPort),
         VMSTATE_UINT16(cmd, UHCIState),
         VMSTATE_UINT16(status, UHCIState),
hw/usb/redirect.c +1 -1
index 287a505..9eff1ac 100644
@@ -2321,7 +2321,7 @@ static const VMStateDescription usbredir_vmstate = {
             .flags        = VMS_SINGLE,
             .offset       = 0,
         },
-        VMSTATE_STRUCT_ARRAY(endpoint, USBRedirDevice, MAX_ENDPOINTS, 1,
+        VMSTATE_STRUCT_ARRAY(endpoint, USBRedirDevice, MAX_ENDPOINTS,
                              usbredir_ep_vmstate, struct endp_data),
         VMSTATE_STRUCT(cancelled, USBRedirDevice, 1,
                        usbredir_ep_packet_id_queue_vmstate,
include/migration/vmstate.h +2 -3
index 6076a35..b0e49f1 100644
@@ -456,9 +456,8 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_STRUCT_POINTER(_field, _state, _vmsd, _type)          \
     VMSTATE_STRUCT_POINTER_TEST(_field, _state, NULL, _vmsd, _type)
 
-#define VMSTATE_STRUCT_ARRAY(_field, _state, _num, _version, _vmsd, _type) \
-    VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, NULL, _version,   \
-            _vmsd, _type)
+#define VMSTATE_STRUCT_ARRAY(_field, _state, _num, _vmsd, _type) \
+    VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, NULL, 0, _vmsd, _type)
 
 #define VMSTATE_BOOL_TEST(_f, _s, _t)                                 \
     VMSTATE_SINGLE(_f, _s, _t, vmstate_info_bool, bool)
target-i386/machine.c +3 -3
index ac9dde1..0e91901 100644
@@ -29,7 +29,7 @@ static const VMStateDescription vmstate_segment = {
 }
 
 #define VMSTATE_SEGMENT_ARRAY(_field, _state, _n)                    \
-    VMSTATE_STRUCT_ARRAY(_field, _state, _n, 0, vmstate_segment, SegmentCache)
+    VMSTATE_STRUCT_ARRAY(_field, _state, _n, vmstate_segment, SegmentCache)
 
 static const VMStateDescription vmstate_xmm_reg = {
     .name = "xmm_reg",
@@ -43,7 +43,7 @@ static const VMStateDescription vmstate_xmm_reg = {
 };
 
 #define VMSTATE_XMM_REGS(_field, _state, _n)                         \
-    VMSTATE_STRUCT_ARRAY(_field, _state, _n, 0, vmstate_xmm_reg, XMMReg)
+    VMSTATE_STRUCT_ARRAY(_field, _state, _n, vmstate_xmm_reg, XMMReg)
 
 /* YMMH format is the same as XMM */
 static const VMStateDescription vmstate_ymmh_reg = {
@@ -73,7 +73,7 @@ static const VMStateDescription vmstate_bnd_regs = {
 };
 
 #define VMSTATE_BND_REGS(_field, _state, _n)          \
-    VMSTATE_STRUCT_ARRAY(_field, _state, _n, 0, vmstate_bnd_regs, BNDReg)
+    VMSTATE_STRUCT_ARRAY(_field, _state, _n, vmstate_bnd_regs, BNDReg)
 
 static const VMStateDescription vmstate_mtrr_var = {
     .name = "mtrr_var",
Signature · 1 line
1.9.0
#79 lore raw

PATCH 69/97 vmstate: Remove version parameter from VMSTATE_STRUCT_ARRAY_TEST

In reply to Juan Quintela

No users left.

---
 hw/char/escc.c              | 2 +-
 hw/ide/internal.h           | 2 +-
 hw/timer/i8254_common.c     | 2 +-
 hw/timer/pxa2xx_timer.c     | 2 +-
 hw/usb/hcd-xhci.c           | 2 +-
 include/hw/acpi/pcihp.h     | 2 +-
 include/migration/vmstate.h | 5 ++---
 target-i386/machine.c       | 6 ++----
 8 files changed, 10 insertions(+), 13 deletions(-)
hw/char/escc.c +1 -1
index dc5768f..99dcb04 100644
@@ -678,7 +678,7 @@ static const VMStateDescription vmstate_escc = {
     .version_id = 2,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT_ARRAY_TEST(chn, ESCCState, 2, vmstate_2_plus, 0,
+        VMSTATE_STRUCT_ARRAY_TEST(chn, ESCCState, 2, vmstate_2_plus,
                                   vmstate_escc_chn, ChannelState),
         VMSTATE_END_OF_LIST()
     }
hw/ide/internal.h +1 -1
index 23330be..a75e524 100644
@@ -526,7 +526,7 @@ extern const VMStateDescription vmstate_ide_bus;
 extern const VMStateDescription vmstate_ide_drive;
 
 #define VMSTATE_IDE_DRIVES(_field, _state) \
-    VMSTATE_STRUCT_ARRAY_TEST(_field, _state, 2, vmstate_3_plus, 0,\
+    VMSTATE_STRUCT_ARRAY_TEST(_field, _state, 2, vmstate_3_plus,\
                               vmstate_ide_drive, IDEState)
 
 void ide_bus_reset(IDEBus *bus);
hw/timer/i8254_common.c +1 -1
index b7bd908..9e36a93 100644
@@ -269,7 +269,7 @@ static const VMStateDescription vmstate_pit_common = {
         VMSTATE_UINT32_TEST(channels[0].irq_disabled, PITCommonState,
             vmstate_3_plus),
         VMSTATE_STRUCT_ARRAY_TEST(channels, PITCommonState, 3,
-                                  vmstate_2_plus, 0, vmstate_pit_channel,
+                                  vmstate_2_plus, vmstate_pit_channel,
                                   PITChannelState),
         VMSTATE_INT64(channels[0].next_transition_time,
                       PITCommonState), /* formerly irq_timer */
hw/timer/pxa2xx_timer.c +1 -1
index 393a792..a8af5a0 100644
@@ -519,7 +519,7 @@ static const VMStateDescription vmstate_pxa2xx_timer_regs = {
         VMSTATE_UINT32(reset3, PXA2xxTimerInfo),
         VMSTATE_UINT32(snapshot, PXA2xxTimerInfo),
         VMSTATE_STRUCT_ARRAY_TEST(tm4, PXA2xxTimerInfo, 8,
-                        pxa2xx_timer_has_tm4_test, 0,
+                        pxa2xx_timer_has_tm4_test,
                         vmstate_pxa2xx_timer4_regs, PXA2xxTimer4),
         VMSTATE_END_OF_LIST(),
     }
hw/usb/hcd-xhci.c +1 -1
index a95bd30..d1e4bd0 100644
@@ -3737,7 +3737,7 @@ static const VMStateDescription vmstate_xhci_intr = {
         VMSTATE_UINT32_TEST(ev_buffer_put, XHCIInterrupter, xhci_er_full),
         VMSTATE_UINT32_TEST(ev_buffer_get, XHCIInterrupter, xhci_er_full),
         VMSTATE_STRUCT_ARRAY_TEST(ev_buffer, XHCIInterrupter, EV_QUEUE,
-                                  xhci_er_full, 1,
+                                  xhci_er_full,
                                   vmstate_xhci_event, XHCIEvent),
 
         VMSTATE_END_OF_LIST()
include/hw/acpi/pcihp.h +1 -1
index 9323838..ac80832 100644
@@ -68,7 +68,7 @@ extern const VMStateDescription vmstate_acpi_pcihp_pci_status;
                             test_pcihp), \
         VMSTATE_STRUCT_ARRAY_TEST(pcihp.acpi_pcihp_pci_status, state, \
                                   ACPI_PCIHP_MAX_HOTPLUG_BUS, \
-                                  test_pcihp, 1, \
+                                  test_pcihp, \
                                   vmstate_acpi_pcihp_pci_status, \
                                   AcpiPciHpPciStatus)
 
include/migration/vmstate.h +2 -3
index b0e49f1..02b20b1 100644
@@ -313,11 +313,10 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset     = vmstate_offset_array(_s, _f, _type*, _n),          \
 }
 
-#define VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, _test, _version, _vmsd, _type) { \
+#define VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, _test, _vmsd, _type) { \
     .name         = (stringify(_field)),                             \
     .num          = (_num),                                          \
     .field_exists = (_test),                                         \
-    .version_id   = (_version),                                      \
     .vmsd         = &(_vmsd),                                        \
     .size         = sizeof(_type),                                   \
     .flags        = VMS_STRUCT|VMS_ARRAY,                            \
@@ -457,7 +456,7 @@ extern const VMStateInfo vmstate_info_bitmap;
     VMSTATE_STRUCT_POINTER_TEST(_field, _state, NULL, _vmsd, _type)
 
 #define VMSTATE_STRUCT_ARRAY(_field, _state, _num, _vmsd, _type) \
-    VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, NULL, 0, _vmsd, _type)
+    VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, NULL, _vmsd, _type)
 
 #define VMSTATE_BOOL_TEST(_f, _s, _t)                                 \
     VMSTATE_SINGLE(_f, _s, _t, vmstate_info_bool, bool)
target-i386/machine.c +2 -4
index 0e91901..15be22b 100644
@@ -58,8 +58,7 @@ static const VMStateDescription vmstate_ymmh_reg = {
 };
 
 #define VMSTATE_YMMH_REGS_VARS(_field, _state, _n, _t)                         \
-    VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _n, _t, 0,\
-                              vmstate_ymmh_reg, XMMReg)
+    VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _n, _t, vmstate_ymmh_reg, XMMReg)
 
 static const VMStateDescription vmstate_bnd_regs = {
     .name = "bnd_regs",
@@ -87,8 +86,7 @@ static const VMStateDescription vmstate_mtrr_var = {
 };
 
 #define VMSTATE_MTRR_VARS(_field, _state, _n, _t)                    \
-    VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _n, _t, 0,\
-                              vmstate_mtrr_var, MTRRVar)
+    VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _n, _t, vmstate_mtrr_var, MTRRVar)
 
 static void put_fpreg_error(QEMUFile *f, void *opaque, size_t size)
 {
Signature · 1 line
1.9.0
#80 lore raw

PATCH 70/97 vmstate: Remove unused version parameter from VMSTATE_STRUCT_VARRAY_INT32

In reply to Juan Quintela
---
 hw/input/stellaris_input.c  | 2 +-
 include/migration/vmstate.h | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
hw/input/stellaris_input.c +1 -1
index 0609e80..07e7856 100644
@@ -63,7 +63,7 @@ static const VMStateDescription vmstate_stellaris_gamepad = {
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_INT32(extension, gamepad_state),
-        VMSTATE_STRUCT_VARRAY_INT32(buttons, gamepad_state, num_buttons, 0,
+        VMSTATE_STRUCT_VARRAY_INT32(buttons, gamepad_state, num_buttons,
                               vmstate_stellaris_button, gamepad_button),
         VMSTATE_END_OF_LIST()
     }
include/migration/vmstate.h +1 -2
index 02b20b1..1322220 100644
@@ -360,10 +360,9 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset     = vmstate_offset_pointer(_state, _field, _type),     \
 }
 
-#define VMSTATE_STRUCT_VARRAY_INT32(_field, _state, _field_num, _version, _vmsd, _type) { \
+#define VMSTATE_STRUCT_VARRAY_INT32(_field, _state, _field_num, _vmsd, _type) { \
     .name       = (stringify(_field)),                               \
     .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
-    .version_id = (_version),                                        \
     .vmsd       = &(_vmsd),                                          \
     .size       = sizeof(_type),                                     \
     .flags      = VMS_STRUCT|VMS_VARRAY_INT32,                       \
Signature · 1 line
1.9.0
#81 lore raw

PATCH 71/97 vmstate: Remove unused version parameter from VMSTATE_STRUCT_VARRAY_UINT8

In reply to Juan Quintela
---
 hw/timer/hpet.c             | 2 +-
 include/migration/vmstate.h | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
hw/timer/hpet.c +1 -1
index 2148568..0fd2eb0 100644
@@ -304,7 +304,7 @@ static const VMStateDescription vmstate_hpet = {
         VMSTATE_UINT64(isr, HPETState),
         VMSTATE_UINT64(hpet_counter, HPETState),
         VMSTATE_UINT8_TEST(num_timers, HPETState, vmstate_2_plus),
-        VMSTATE_STRUCT_VARRAY_UINT8(timer, HPETState, num_timers, 0,
+        VMSTATE_STRUCT_VARRAY_UINT8(timer, HPETState, num_timers,
                                     vmstate_hpet_timer, HPETTimer),
         VMSTATE_END_OF_LIST()
     },
include/migration/vmstate.h +1 -2
index 1322220..47219ad 100644
@@ -323,10 +323,9 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset       = vmstate_offset_array(_state, _field, _type, _num),\
 }
 
-#define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \
+#define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _vmsd, _type) { \
     .name       = (stringify(_field)),                               \
     .num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \
-    .version_id = (_version),                                        \
     .vmsd       = &(_vmsd),                                          \
     .size       = sizeof(_type),                                     \
     .flags      = VMS_STRUCT|VMS_VARRAY_UINT8,                       \
Signature · 1 line
1.9.0
#82 lore raw

PATCH 72/97 vmstate: Introduce VMSTATE_VARRAY_UINT32_TEST

In reply to Juan Quintela

Use it on the only case were a version was used.

---
 hw/misc/arm_sysctl.c        | 5 +++--
 include/migration/vmstate.h | 7 +++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
hw/misc/arm_sysctl.c +3 -2
index 0f61241..668681f 100644
@@ -67,8 +67,9 @@ static const VMStateDescription vmstate_arm_sysctl = {
         VMSTATE_UINT32_TEST(sys_clcd, arm_sysctl_state, vmstate_3_plus),
         VMSTATE_UINT32_ARRAY_TEST(mb_clock, arm_sysctl_state, 6,
                                   vmstate_4_plus),
-        VMSTATE_VARRAY_UINT32(db_clock, arm_sysctl_state, db_num_clocks,
-                              4, vmstate_info_uint32, uint32_t),
+        VMSTATE_VARRAY_UINT32_TEST(db_clock, arm_sysctl_state, db_num_clocks,
+                                   vmstate_4_plus, vmstate_info_uint32,
+                                   uint32_t),
         VMSTATE_END_OF_LIST()
     }
 };
include/migration/vmstate.h +5 -2
index 47219ad..2a914ec 100644
@@ -257,9 +257,9 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset     = vmstate_offset_pointer(_state, _field, _type),     \
 }
 
-#define VMSTATE_VARRAY_UINT32(_field, _state, _field_num, _version, _info, _type) {\
+#define VMSTATE_VARRAY_UINT32_TEST(_field, _state, _field_num, _test, _info, _type) {\
     .name       = (stringify(_field)),                               \
-    .version_id = (_version),                                        \
+    .field_exists = (_test),                                         \
     .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\
     .info       = &(_info),                                          \
     .size       = sizeof(_type),                                     \
@@ -611,6 +611,9 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UNUSED(_size)                                         \
     VMSTATE_UNUSED_TEST(NULL, _size)
 
+#define VMSTATE_VARRAY_UINT32(_field, _state, _field_num, _version, _info, _type) \
+    VMSTATE_VARRAY_UINT32_TEST(_field, _state, _field_num, NULL, _info, _type)
+
 #define VMSTATE_END_OF_LIST()                                         \
     {}
 
Signature · 1 line
1.9.0
#83 lore raw

PATCH 73/97 vmstate: Remove version parameter from VMSTATE_VARRAY_UINT32

In reply to Juan Quintela
---
 hw/nvram/ds1225y.c          | 2 +-
 hw/ppc/spapr_iommu.c        | 3 ++-
 include/migration/vmstate.h | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)
hw/nvram/ds1225y.c +1 -1
index 332598b..cfedfa8 100644
@@ -97,7 +97,7 @@ static const VMStateDescription vmstate_nvram = {
     .minimum_version_id = 0,
     .post_load = nvram_post_load,
     .fields = (VMStateField[]) {
-        VMSTATE_VARRAY_UINT32(contents, NvRamState, chip_size, 0,
+        VMSTATE_VARRAY_UINT32(contents, NvRamState, chip_size,
                               vmstate_info_uint8, uint8_t),
         VMSTATE_END_OF_LIST()
     }
hw/ppc/spapr_iommu.c +2 -1
index ce15751..9fda2b3 100644
@@ -105,7 +105,8 @@ static const VMStateDescription vmstate_spapr_tce_table = {
 
         /* IOMMU state */
         VMSTATE_BOOL(bypass, sPAPRTCETable),
-        VMSTATE_VARRAY_UINT32(table, sPAPRTCETable, nb_table, 0, vmstate_info_uint64, uint64_t),
+        VMSTATE_VARRAY_UINT32(table, sPAPRTCETable, nb_table,
+                              vmstate_info_uint64, uint64_t),
 
         VMSTATE_END_OF_LIST()
     },
include/migration/vmstate.h +1 -1
index 2a914ec..7bbac50 100644
@@ -611,7 +611,7 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UNUSED(_size)                                         \
     VMSTATE_UNUSED_TEST(NULL, _size)
 
-#define VMSTATE_VARRAY_UINT32(_field, _state, _field_num, _version, _info, _type) \
+#define VMSTATE_VARRAY_UINT32(_field, _state, _field_num, _info, _type) \
     VMSTATE_VARRAY_UINT32_TEST(_field, _state, _field_num, NULL, _info, _type)
 
 #define VMSTATE_END_OF_LIST()                                         \
Signature · 1 line
1.9.0
#84 lore raw

PATCH 74/97 vmstate: Remove version parameter from VMSTATE_STRUCT_TEST

In reply to Juan Quintela

As we haven't yet moved everything that uses VMSTATE_STRUCT_TEST we create a temporary VMSTATE_STRUCT_INFO. This would allows us to not having to move fields to VMSTATE_STRUCT_TEST and then remove the version parameter.

---
 hw/acpi/piix4.c             | 2 +-
 include/migration/vmstate.h | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
hw/acpi/piix4.c +1 -1
index 252bbf2..091dca3 100644
@@ -270,7 +270,7 @@ static const VMStateDescription vmstate_acpi = {
             acpi_pci_hotplug.acpi_pcihp_pci_status[ACPI_PCIHP_BSEL_DEFAULT],
             PIIX4PMState,
             vmstate_test_no_use_acpi_pci_hotplug,
-            2, vmstate_pci_status,
+            vmstate_pci_status,
             struct AcpiPciHpPciStatus),
         VMSTATE_PCI_HOTPLUG(acpi_pci_hotplug, PIIX4PMState,
                             vmstate_test_use_acpi_pci_hotplug),
include/migration/vmstate.h +5 -2
index 7bbac50..c6590cb 100644
@@ -276,7 +276,7 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset     = offsetof(_state, _field),                          \
 }
 
-#define VMSTATE_STRUCT_TEST(_field, _state, _test, _version, _vmsd, _type) { \
+#define VMSTATE_STRUCT_INFO(_field, _state, _test, _version, _vmsd, _type) { \
     .name         = (stringify(_field)),                             \
     .version_id   = (_version),                                      \
     .field_exists = (_test),                                         \
@@ -447,8 +447,11 @@ extern const VMStateInfo vmstate_info_bitmap;
    _v : version
 */
 
+#define VMSTATE_STRUCT_TEST(_field, _state, _test, _vmsd, _type)        \
+    VMSTATE_STRUCT_INFO(_field, _state, _test, 0, _vmsd, _type)
+
 #define VMSTATE_STRUCT(_field, _state, _version, _vmsd, _type)        \
-    VMSTATE_STRUCT_TEST(_field, _state, NULL, _version, _vmsd, _type)
+    VMSTATE_STRUCT_INFO(_field, _state, NULL, _version, _vmsd, _type)
 
 #define VMSTATE_STRUCT_POINTER(_field, _state, _vmsd, _type)          \
     VMSTATE_STRUCT_POINTER_TEST(_field, _state, NULL, _vmsd, _type)
Signature · 1 line
1.9.0
#85 lore raw

PATCH 75/97 vmstate: Move all users of versioning to VMSTATE_STRUCT_TEST

In reply to Juan Quintela
---
 hw/usb/hcd-ehci-pci.c    | 3 ++-
 hw/usb/hcd-ehci-sysbus.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
hw/usb/hcd-ehci-pci.c +2 -1
index 505741a..6ada623 100644
@@ -110,7 +110,8 @@ static const VMStateDescription vmstate_ehci_pci = {
     .minimum_version_id  = 1,
     .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(pcidev, EHCIPCIState),
-        VMSTATE_STRUCT(ehci, EHCIPCIState, 2, vmstate_ehci, EHCIState),
+        VMSTATE_STRUCT_TEST(ehci, EHCIPCIState, vmstate_2_plus,
+                            vmstate_ehci, EHCIState),
         VMSTATE_END_OF_LIST()
     }
 };
hw/usb/hcd-ehci-sysbus.c +2 -1
index 19ed2c2..2c28555 100644
@@ -22,7 +22,8 @@ static const VMStateDescription vmstate_ehci_sysbus = {
     .version_id  = 2,
     .minimum_version_id  = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_STRUCT(ehci, EHCISysBusState, 2, vmstate_ehci, EHCIState),
+        VMSTATE_STRUCT_TEST(ehci, EHCISysBusState, vmstate_2_plus,
+                            vmstate_ehci, EHCIState),
         VMSTATE_END_OF_LIST()
     }
 };
Signature · 1 line
1.9.0