Add live migration unit tests
cover Add live migration unit tests
Here is a more sophisticated version of my patch from earlier today. Short summary is, this adds a 'make check-vmstate' that runs quickly, and would catch a large percentage of the live migration regressions we introduce.
I hope it also shows how we can add similar things to other subsystems and build a more rigorious unit test framework within QEMU.
PATCH 1/11 Add hard build dependency on glib
GLib is an extremely common library that has a portable thread implementation along with tons of other goodies.
GLib and GObject have a fantastic amount of infrastructure we can leverage in QEMU including an object oriented programming infrastructure.
Short term, it has a very nice thread pool implementation that we could leverage in something like virtio-9p. It also has a test harness implementation that this series will use.
--- Makefile | 2 ++ Makefile.objs | 2 ++ Makefile.target | 1 + configure | 13 +++++++++++++ 4 files changed, 18 insertions(+), 0 deletions(-)
Makefile +2 -0
@@ -104,6 +104,8 @@ audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS) QEMU_CFLAGS+=$(CURL_CFLAGS) +QEMU_CFLAGS+=$(GLIB_CFLAGS) + ui/cocoa.o: ui/cocoa.m ui/sdl.o audio/sdlaudio.o ui/sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS)
Makefile.objs +2 -0
@@ -323,3 +323,5 @@ vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) +vl.o: QEMU_CFLAGS+=$(GLIB_CFLAGS) +
Makefile.target +1 -0
@@ -204,6 +204,7 @@ QEMU_CFLAGS += $(VNC_TLS_CFLAGS) QEMU_CFLAGS += $(VNC_SASL_CFLAGS) QEMU_CFLAGS += $(VNC_JPEG_CFLAGS) QEMU_CFLAGS += $(VNC_PNG_CFLAGS) +QEMU_CFLAGS += $(GLIB_CFLAGS) # xen backend driver support obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o
configure +13 -0
@@ -1670,6 +1670,18 @@ EOF fi ########################################## +# glib support probe +if $pkg_config --modversion gthread-2.0 > /dev/null 2>&1 ; then + glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null` + glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null` + libs_softmmu="$glib_libs $libs_softmmu" + libs_tools="$glib_libs $libs_softmmu" +else + echo "glib-2.0 required to compile QEMU" + exit 1 +fi + +########################################## # kvm probe if test "$kvm" != "no" ; then cat > $TMPC <<EOF
@@ -2770,6 +2782,7 @@ if test "$bluez" = "yes" ; then echo "CONFIG_BLUEZ=y" >> $config_host_mak echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak fi +echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak if test "$xen" = "yes" ; then echo "CONFIG_XEN=y" >> $config_host_mak fi
Signature · 1 line
1.7.0.4
Re: [Qemu-devel] [PATCH 01/11] Add hard build dependency on glib
Quoted 10 lines · Anthony Liguori
GLib is an extremely common library that has a portable thread implementation along with tons of other goodies.
GLib and GObject have a fantastic amount of infrastructure we can leverage in QEMU including an object oriented programming infrastructure.
Short term, it has a very nice thread pool implementation that we could leverage in something like virtio-9p. It also has a test harness implementation that this series will use.
Quoted 7 lines
Signed-off-by Anthony Liguori <[email protected]>---
Makefile | 2 ++
Makefile.objs | 2 ++
Makefile.target | 1 +
configure | 13 +++++++++++++4 files changed, 18 insertions(+), 0 deletions(-)
Yes, please. I'd like to use glib to make simpletrace portable.
To paraphrase the saying about non-trivial C programs and LISP interpreters:
"In every cross-platform C program there is a glib."
Stefan
Re: [Qemu-devel] [PATCH 01/11] Add hard build dependency on glib
2011/3/23 Stefan Hajnoczi <[email protected]>:
Quoted 19 lines · Anthony Liguori
Quoted 10 lines
GLib is an extremely common library that has a portable thread implementation along with tons of other goodies.
GLib and GObject have a fantastic amount of infrastructure we can leverage in QEMU including an object oriented programming infrastructure.
Short term, it has a very nice thread pool implementation that we could leverage in something like virtio-9p. It also has a test harness implementation that this series will use.
Quoted 7 lines
Signed-off-by Anthony Liguori <[email protected]>---
Makefile | 2 ++
Makefile.objs | 2 ++
Makefile.target | 1 +
configure | 13 +++++++++++++4 files changed, 18 insertions(+), 0 deletions(-)
Quoted 9 lines
Yes, please. I'd like to use glib to make simpletrace portable.
To paraphrase the saying about non-trivial C programs and LISP interpreters:
"In every cross-platform C program there is a glib."
Stefan
So, breaking win32 support again?
Roy
Re: [Qemu-devel] [PATCH 01/11] Add hard build dependency on glib
Quoted 24 lines · Roy Tam
2011/3/23 Stefan Hajnoczi <[email protected]>:
Quoted 23 lines · Anthony Liguori
Quoted 10 lines
GLib is an extremely common library that has a portable thread implementation along with tons of other goodies.
GLib and GObject have a fantastic amount of infrastructure we can leverage in QEMU including an object oriented programming infrastructure.
Short term, it has a very nice thread pool implementation that we could leverage in something like virtio-9p. It also has a test harness implementation that this series will use.
Quoted 7 lines
Signed-off-by Anthony Liguori <[email protected]>---
Makefile | 2 ++
Makefile.objs | 2 ++
Makefile.target | 1 +
configure | 13 +++++++++++++4 files changed, 18 insertions(+), 0 deletions(-)Yes, please. I'd like to use glib to make simpletrace portable.
To paraphrase the saying about non-trivial C programs and LISP interpreters:
Quoted 7 lines
Quoted 5 lines
"In every cross-platform C program there is a glib."
Stefan
So, breaking win32 support again?
Can you please explain the win32 issue with glib?
Stefan
Re: [Qemu-devel] [PATCH 01/11] Add hard build dependency on glib
2011/3/23 Stefan Hajnoczi <[email protected]>:
Quoted 31 lines · Roy Tam
Quoted 30 lines
2011/3/23 Stefan Hajnoczi <[email protected]>:
Quoted 28 lines · Anthony Liguori
Quoted 10 lines
GLib is an extremely common library that has a portable thread implementation along with tons of other goodies.
GLib and GObject have a fantastic amount of infrastructure we can leverage in QEMU including an object oriented programming infrastructure.
Short term, it has a very nice thread pool implementation that we could leverage in something like virtio-9p. It also has a test harness implementation that this series will use.
Quoted 7 lines
Signed-off-by Anthony Liguori <[email protected]>---
Makefile | 2 ++
Makefile.objs | 2 ++
Makefile.target | 1 +
configure | 13 +++++++++++++4 files changed, 18 insertions(+), 0 deletions(-)Yes, please. I'd like to use glib to make simpletrace portable.
To paraphrase the saying about non-trivial C programs and LISP interpreters:
"In every cross-platform C program there is a glib."
Stefan
Quoted 6 lines
Quoted 1 line
So, breaking win32 support again?
Can you please explain the win32 issue with glib?
Stefan
I think I have to change my words. Glib works in win32, but adding Glib to QEMU will bloat the binary size. It adds more dependency on building and the result binary. I wonder if it is a must to add it.
Roy
[Qemu-devel] Re: [PATCH 01/11] Add hard build dependency on glib
Quoted 3 lines · Roy Tam
I think I have to change my words. Glib works in win32, but adding Glib to QEMU will bloat the binary size. It adds more dependency on building and the result binary. I wonder if it is a must to add it.
That's very far from my definition of "breaking".
Paolo
Re: [Qemu-devel] [PATCH 01/11] Add hard build dependency on glib
In reply to Roy TamQuoted 3 lines · Roy Tam
I think I have to change my words. Glib works in win32, but adding Glib to QEMU will bloat the binary size. It adds more dependency on building and the result binary. I wonder if it is a must to add it.
If we stick to re-implementing cross-platform wrappers then Windows support will always lag behind POSIX and developers will spend effort working around platform quirks rather than improving QEMU. Very few QEMU developers build on Windows, for example Paolo's latest Windows iothread support patches were tested under Wine.
Will introducing glib add a dependency and at worst some temporary breakage? Yes, there's a risk. But longer term this is great news for Windows because it gives it a chance of actually working on a level close to *nix.
Stefan
PATCH 2/11 vmstate: register all VMStateDescriptions
In reply to Anthony LiguoriThis is a purely mechanical change. It was generated with a simple python script and a little bit of hand tuning. Without this, we can only see VMStateDescriptions that are part of an active device which means that we have to test migration with a VM configured with every possible device.
--- hw/ac97.c | 8 ++++++ hw/acpi_piix4.c | 8 ++++++ hw/apb_pci.c | 8 ++++++ hw/apic.c | 8 ++++++ hw/arm_sysctl.c | 8 ++++++ hw/bonito.c | 8 ++++++ hw/cirrus_vga.c | 8 ++++++ hw/cs4231.c | 8 ++++++ hw/cs4231a.c | 8 ++++++ hw/dec_pci.c | 8 ++++++ hw/e1000.c | 8 ++++++ hw/eccmemctl.c | 8 ++++++ hw/eeprom93xx.c | 8 ++++++ hw/es1370.c | 8 ++++++ hw/escc.c | 8 ++++++ hw/esp.c | 8 ++++++ hw/fdc.c | 16 ++++++++++++ hw/fw_cfg.c | 8 ++++++ hw/gus.c | 8 ++++++ hw/hda-audio.c | 8 ++++++ hw/hpet.c | 8 ++++++ hw/hw.h | 3 ++ hw/i2c.c | 8 ++++++ hw/i8254.c | 8 ++++++ hw/i8259.c | 8 ++++++ hw/intel-hda.c | 8 ++++++ hw/ioapic.c | 8 ++++++ hw/ioh3420.c | 8 ++++++ hw/kvmclock.c | 8 ++++++ hw/lance.c | 8 ++++++ hw/lm32_juart.c | 8 ++++++ hw/lm32_pic.c | 8 ++++++ hw/lm32_sys.c | 8 ++++++ hw/lm32_timer.c | 8 ++++++ hw/lm32_uart.c | 8 ++++++ hw/lm832x.c | 8 ++++++ hw/lsi53c895a.c | 8 ++++++ hw/marvell_88w8618_audio.c | 8 ++++++ hw/max7310.c | 8 ++++++ hw/mc146818rtc.c | 8 ++++++ hw/mst_fpga.c | 8 ++++++ hw/musicpal.c | 56 ++++++++++++++++++++++++++++++++++++++++++++ hw/ne2000.c | 8 ++++++ hw/pc.c | 8 ++++++ hw/pci.c | 8 ++++++ hw/pckbd.c | 16 ++++++++++++ hw/pcnet-pci.c | 8 ++++++ hw/piix_pci.c | 8 ++++++ hw/pl031.c | 8 ++++++ hw/pl050.c | 16 ++++++++++++ hw/pl080.c | 16 ++++++++++++ hw/pl110.c | 16 ++++++++++++ hw/pl190.c | 8 ++++++ hw/ps2.c | 16 ++++++++++++ hw/pxa2xx.c | 16 ++++++++++++ hw/pxa2xx_dma.c | 8 ++++++ hw/pxa2xx_pic.c | 8 ++++++ hw/pxa2xx_timer.c | 16 ++++++++++++ hw/qxl.c | 16 ++++++++++++ hw/rtl8139.c | 16 ++++++++++++ hw/sb16.c | 8 ++++++ hw/sbi.c | 8 ++++++ hw/serial.c | 10 ++++++- hw/slavio_intctl.c | 8 ++++++ hw/slavio_misc.c | 8 ++++++ hw/slavio_timer.c | 8 ++++++ hw/smc91c111.c | 8 ++++++ hw/sparc32_dma.c | 8 ++++++ hw/spitz.c | 32 +++++++++++++++++++++++++ hw/ssd0303.c | 8 ++++++ hw/sun4c_intctl.c | 8 ++++++ hw/sun4m_iommu.c | 8 ++++++ hw/tcx.c | 8 ++++++ hw/tmp105.c | 8 ++++++ hw/twl92230.c | 8 ++++++ hw/usb-hid.c | 8 ++++++ hw/usb-hub.c | 8 ++++++ hw/usb-uhci.c | 8 ++++++ hw/versatilepb.c | 8 ++++++ hw/vga-isa.c | 8 ++++++ hw/vga-pci.c | 8 ++++++ hw/vmmouse.c | 8 ++++++ hw/vmware_vga.c | 8 ++++++ hw/vt82c686.c | 16 ++++++++++++ hw/wdt_i6300esb.c | 8 ++++++ hw/wdt_ib700.c | 8 ++++++ hw/wm8750.c | 8 ++++++ hw/xio3130_downstream.c | 8 ++++++ hw/xio3130_upstream.c | 8 ++++++ hw/zaurus.c | 8 ++++++ module.h | 2 + savevm.c | 4 +++ target-i386/machine.c | 8 ++++++ 93 files changed, 889 insertions(+), 2 deletions(-)
hw/ac97.c +8 -0
@@ -1343,6 +1343,14 @@ static PCIDeviceInfo ac97_info = { .init = ac97_initfn, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ac97); +} + +vmstate_init (init_vmstate_description_0); +static void ac97_register (void ) {pci_qdev_register (&ac97_info);
hw/acpi_piix4.c +8 -0
@@ -460,6 +460,14 @@ static PCIDeviceInfo piix4_pm_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_acpi); +} + +vmstate_init (init_vmstate_description_0); +static void piix4_pm_register (void ) {pci_qdev_register (&piix4_pm_info);
hw/apb_pci.c +8 -0
@@ -472,6 +472,14 @@ static PCIDeviceInfo pbm_pci_bridge_info = { .is_bridge = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pci_device); +} + +vmstate_init (init_vmstate_description_0); +static void pbm_register_devices (void ) {sysbus_register_withprop (&pbm_host_info);
hw/apic.c +8 -0
@@ -1025,6 +1025,14 @@ static SysBusDeviceInfo apic_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_apic); +} + +vmstate_init (init_vmstate_description_0); +static void apic_register_devices (void ) {sysbus_register_withprop (&apic_info);
hw/arm_sysctl.c +8 -0
@@ -363,6 +363,14 @@ static SysBusDeviceInfo arm_sysctl_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_arm_sysctl); +} + +vmstate_init (init_vmstate_description_0); +static void arm_sysctl_register_devices (void ) {sysbus_register_withprop (&arm_sysctl_info);
hw/bonito.c +8 -0
@@ -798,6 +798,14 @@ static PCIDeviceInfo bonito_info = { .init = bonito_initfn, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_bonito); +} + +vmstate_init (init_vmstate_description_0); +static SysBusDeviceInfo bonito_pcihost_info = { .init = bonito_pcihost_initfn, .qdev.name ="Bonito-pcihost" ,
hw/cirrus_vga.c +8 -0
@@ -3145,6 +3145,14 @@ static PCIDeviceInfo cirrus_vga_info = { .config_write = pci_cirrus_write_config, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pci_cirrus_vga); +} + +vmstate_init (init_vmstate_description_0); +static void cirrus_vga_register (void ) {pci_qdev_register (&cirrus_vga_info);
hw/cs4231.c +8 -0
@@ -167,6 +167,14 @@ static SysBusDeviceInfo cs4231_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_cs4231); +} + +vmstate_init (init_vmstate_description_0); +static void cs4231_register_devices (void ) {sysbus_register_withprop (&cs4231_info);
hw/cs4231a.c +8 -0
@@ -679,6 +679,14 @@ static ISADeviceInfo cs4231a_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_cs4231a); +} + +vmstate_init (init_vmstate_description_0); +static void cs4231a_register (void ) {isa_qdev_register (&cs4231a_info);
hw/dec_pci.c +8 -0
@@ -76,6 +76,14 @@ static PCIDeviceInfo dec_21154_pci_bridge_info = { .is_bridge = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pci_device); +} + +vmstate_init (init_vmstate_description_0); +PCIBus *pci_dec_21154_init (PCIBus *parent_bus,int devfn) {PCIDevice *dev;
hw/e1000.c +8 -0
@@ -1212,6 +1212,14 @@ static PCIDeviceInfo e1000_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_e1000); +} + +vmstate_init (init_vmstate_description_0); +static void e1000_register_devices (void ) {pci_qdev_register (&e1000_info);
hw/eccmemctl.c +8 -0
@@ -323,6 +323,14 @@ static SysBusDeviceInfo ecc_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ecc); +} + +vmstate_init (init_vmstate_description_0); +static void ecc_register_devices (void ) {
hw/eeprom93xx.c +8 -0
@@ -320,6 +320,14 @@ eeprom_t *eeprom93xx_new(DeviceState *dev, uint16_t nwords)return eeprom; } +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description (void ) +{ +register_vmstate_description (&vmstate_eeprom); +} + +vmstate_init (init_vmstate_description); +void eeprom93xx_free (DeviceState *dev,eeprom_t *eeprom) {/* Destroy EEPROM. */
hw/es1370.c +8 -0
@@ -1045,6 +1045,14 @@ static PCIDeviceInfo es1370_info = { .init = es1370_initfn, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_es1370); +} + +vmstate_init (init_vmstate_description_0); +static void es1370_register (void ) {pci_qdev_register (&es1370_info);
hw/escc.c +8 -0
@@ -953,6 +953,14 @@ static SysBusDeviceInfo escc_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_escc); +} + +vmstate_init (init_vmstate_description_0); +static void escc_register_devices (void ) {sysbus_register_withprop (&escc_info);
hw/esp.c +8 -0
@@ -743,6 +743,14 @@ static SysBusDeviceInfo esp_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_esp); +} + +vmstate_init (init_vmstate_description_0); +static void esp_register_devices (void ) {sysbus_register_withprop (&esp_info);
hw/fdc.c +16 -0
@@ -1938,6 +1938,14 @@ static ISADeviceInfo isa_fdc_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_isa_fdc); +} + +vmstate_init (init_vmstate_description_0); +static const VMStateDescription vmstate_sysbus_fdc ={ .name ="fdc" , .version_id =2 ,
@@ -1961,6 +1969,14 @@ static SysBusDeviceInfo sysbus_fdc_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_sysbus_fdc); +} + +vmstate_init (init_vmstate_description_1); +static SysBusDeviceInfo sun4m_fdc_info = { .init = sun4m_fdc_init1, .qdev.name ="SUNW,fdtwo" ,
hw/fw_cfg.c +8 -0
@@ -399,6 +399,14 @@ static SysBusDeviceInfo fw_cfg_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_fw_cfg); +} + +vmstate_init (init_vmstate_description_0); +static void fw_cfg_register_devices (void ) {sysbus_register_withprop (&fw_cfg_info);
hw/gus.c +8 -0
@@ -315,6 +315,14 @@ static ISADeviceInfo gus_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_gus); +} + +vmstate_init (init_vmstate_description_0); +static void gus_register (void ) {isa_qdev_register (&gus_info);
hw/hda-audio.c +8 -0
@@ -906,6 +906,14 @@ static HDACodecDeviceInfo hda_audio_info_output = { .stream = hda_audio_stream, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_hda_audio); +} + +vmstate_init (init_vmstate_description_0); +static HDACodecDeviceInfo hda_audio_info_duplex = { .qdev.name ="hda-duplex" , .qdev.desc ="HDA Audio Codec, duplex" ,
hw/hpet.c +8 -0
@@ -737,6 +737,14 @@ static SysBusDeviceInfo hpet_device_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_hpet); +} + +vmstate_init (init_vmstate_description_0); +static void hpet_register_device (void ) {sysbus_register_withprop (&hpet_device_info);
hw/hw.h +3 -0
@@ -914,4 +914,7 @@ int vmstate_register_with_alias_id(DeviceState *dev, int instance_id, int required_for_version);void vmstate_unregister (DeviceState *dev,const VMStateDescription *vmsd,void *opaque); + +void register_vmstate_description (const VMStateDescription *desc); +#endif
hw/i2c.c +8 -0
@@ -66,6 +66,14 @@ i2c_bus *i2c_init_bus(DeviceState *parent, const char *name)return bus; } +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description (void ) +{ +register_vmstate_description (&vmstate_i2c_bus); +} + +vmstate_init (init_vmstate_description); +void i2c_set_slave_address (i2c_slave *dev,uint8_t address) { dev->address = address;
hw/i8254.c +8 -0
@@ -539,6 +539,14 @@ static ISADeviceInfo pit_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pit); +} + +vmstate_init (init_vmstate_description_0); +static void pit_register (void ) {isa_qdev_register (&pit_info);
hw/i8259.c +8 -0
@@ -487,6 +487,14 @@ static void pic_init1(int io_addr, int elcr_addr, PicState *s)qemu_register_reset (pic_reset, s); } +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description (void ) +{ +register_vmstate_description (&vmstate_pic); +} + +vmstate_init (init_vmstate_description); +void pic_info (Monitor *mon) {int i;
hw/intel-hda.c +8 -0
@@ -1283,6 +1283,14 @@ static PCIDeviceInfo intel_hda_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_intel_hda); +} + +vmstate_init (init_vmstate_description_0); +static void intel_hda_register (void ) {pci_qdev_register (&intel_hda_info);
hw/ioapic.c +8 -0
@@ -350,6 +350,14 @@ static SysBusDeviceInfo ioapic_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ioapic); +} + +vmstate_init (init_vmstate_description_0); +static void ioapic_register_devices (void ) {sysbus_register_withprop (&ioapic_info);
hw/ioh3420.c +8 -0
@@ -229,6 +229,14 @@ static PCIDeviceInfo ioh3420_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ioh3420); +} + +vmstate_init (init_vmstate_description_0); +static void ioh3420_register (void ) {pci_qdev_register (&ioh3420_info);
hw/kvmclock.c +8 -0
@@ -99,6 +99,14 @@ static SysBusDeviceInfo kvmclock_info = { .init = kvmclock_init, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&kvmclock_vmsd); +} + +vmstate_init (init_vmstate_description_0); +/* Note: Must be called after VCPU initialization. */ void kvmclock_create (void ) {
hw/lance.c +8 -0
@@ -153,6 +153,14 @@ static SysBusDeviceInfo lance_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lance); +} + +vmstate_init (init_vmstate_description_0); +static void lance_register_devices (void ) {sysbus_register_withprop (&lance_info);
hw/lm32_juart.c +8 -0
@@ -142,6 +142,14 @@ static SysBusDeviceInfo lm32_juart_info = { .qdev.reset = juart_reset, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lm32_juart); +} + +vmstate_init (init_vmstate_description_0); +static void lm32_juart_register (void ) {sysbus_register_withprop (&lm32_juart_info);
hw/lm32_pic.c +8 -0
@@ -182,6 +182,14 @@ static SysBusDeviceInfo lm32_pic_info = { .qdev.reset = pic_reset, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lm32_pic); +} + +vmstate_init (init_vmstate_description_0); +static void lm32_pic_register (void ) {sysbus_register_withprop (&lm32_pic_info);
hw/lm32_sys.c +8 -0
@@ -153,6 +153,14 @@ static SysBusDeviceInfo lm32_sys_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lm32_sys); +} + +vmstate_init (init_vmstate_description_0); +static void lm32_sys_register (void ) {sysbus_register_withprop (&lm32_sys_info);
hw/lm32_timer.c +8 -0
@@ -214,6 +214,14 @@ static SysBusDeviceInfo lm32_timer_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lm32_timer); +} + +vmstate_init (init_vmstate_description_0); +static void lm32_timer_register (void ) {sysbus_register_withprop (&lm32_timer_info);
hw/lm32_uart.c +8 -0
@@ -280,6 +280,14 @@ static SysBusDeviceInfo lm32_uart_info = { .qdev.reset = uart_reset, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lm32_uart); +} + +vmstate_init (init_vmstate_description_0); +static void lm32_uart_register (void ) {sysbus_register_withprop (&lm32_uart_info);
hw/lm832x.c +8 -0
@@ -504,6 +504,14 @@ static I2CSlaveInfo lm8323_info = { .send = lm_i2c_tx }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lm_kbd); +} + +vmstate_init (init_vmstate_description_0); +static void lm832x_register_devices (void ) {i2c_register_slave (&lm8323_info);
hw/lsi53c895a.c +8 -0
@@ -2211,6 +2211,14 @@ static PCIDeviceInfo lsi_info = { .exit = lsi_scsi_uninit, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lsi_scsi); +} + +vmstate_init (init_vmstate_description_0); +static void lsi53c895a_register_devices (void ) {pci_qdev_register (&lsi_info);
hw/marvell_88w8618_audio.c +8 -0
@@ -291,6 +291,14 @@ static SysBusDeviceInfo mv88w8618_audio_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&mv88w8618_audio_vmsd); +} + +vmstate_init (init_vmstate_description_0); +static void mv88w8618_register_devices (void ) {sysbus_register_withprop (&mv88w8618_audio_info);
hw/max7310.c +8 -0
@@ -196,6 +196,14 @@ static I2CSlaveInfo max7310_info = { .send = max7310_tx }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_max7310); +} + +vmstate_init (init_vmstate_description_0); +static void max7310_register_devices (void ) {i2c_register_slave (&max7310_info);
hw/mc146818rtc.c +8 -0
@@ -650,6 +650,14 @@ static ISADeviceInfo mc146818rtc_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_rtc); +} + +vmstate_init (init_vmstate_description_0); +static void mc146818rtc_register (void ) {isa_qdev_register (&mc146818rtc_info);
hw/mst_fpga.c +8 -0
@@ -248,6 +248,14 @@ static SysBusDeviceInfo mst_fpga_info = { .qdev.vmsd = &vmstate_mst_fpga_regs, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_mst_fpga_regs); +} + +vmstate_init (init_vmstate_description_0); +static void mst_fpga_register (void ) {sysbus_register_withprop (&mst_fpga_info);
hw/musicpal.c +56 -0
98 lines not on this page · raw message
hw/ne2000.c +8 -0
@@ -773,6 +773,14 @@ static PCIDeviceInfo ne2000_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pci_ne2000); +} + +vmstate_init (init_vmstate_description_0); +static void ne2000_register_devices (void ) {pci_qdev_register (&ne2000_info);
hw/pc.c +8 -0
@@ -497,6 +497,14 @@ static ISADeviceInfo port92_info = { .init = port92_initfn, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_port92_isa); +} + +vmstate_init (init_vmstate_description_0); +static void port92_register (void ) {isa_qdev_register (&port92_info);
hw/pci.c +8 -0
@@ -269,6 +269,14 @@ void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,vmstate_register (NULL ,-1 , &vmstate_pcibus, bus); } +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description (void ) +{ +register_vmstate_description (&vmstate_pcibus); +} + +vmstate_init (init_vmstate_description); +PCIBus *pci_bus_new (DeviceState *parent,const char *name,int devfn_min) {PCIBus *bus;
hw/pckbd.c +16 -0
@@ -433,6 +433,14 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,qemu_register_reset (kbd_reset, s); } +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description (void ) +{ +register_vmstate_description (&vmstate_kbd); +} + +vmstate_init (init_vmstate_description); + typedef struct ISAKBDState { ISADevice dev; KBDState kbd;
@@ -492,6 +500,14 @@ static ISADeviceInfo i8042_info = { .init = i8042_initfn, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_kbd_isa); +} + +vmstate_init (init_vmstate_description_0); +static void i8042_register (void ) {isa_qdev_register (&i8042_info);
hw/pcnet-pci.c +8 -0
@@ -338,6 +338,14 @@ static PCIDeviceInfo pcnet_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pci_pcnet); +} + +vmstate_init (init_vmstate_description_0); +static void pci_pcnet_register_devices (void ) {pci_qdev_register (&pcnet_info);
hw/piix_pci.c +8 -0
@@ -364,6 +364,14 @@ static PCIDeviceInfo i440fx_info[] = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_piix3); +} + +vmstate_init (init_vmstate_description_0); +static SysBusDeviceInfo i440fx_pcihost_info = { .init = i440fx_pcihost_initfn, .qdev.name ="i440FX-pcihost" ,
hw/pl031.c +8 -0
@@ -229,6 +229,14 @@ static SysBusDeviceInfo pl031_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pl031); +} + +vmstate_init (init_vmstate_description_0); +static void pl031_register_devices (void ) {sysbus_register_withprop (&pl031_info);
hw/pl050.c +16 -0
@@ -171,6 +171,14 @@ static SysBusDeviceInfo pl050_kbd_info = { .qdev.vmsd = &vmstate_pl050, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pl050); +} + +vmstate_init (init_vmstate_description_0); +static SysBusDeviceInfo pl050_mouse_info = { .init = pl050_init_mouse, .qdev.name ="pl050_mouse" ,
@@ -178,6 +186,14 @@ static SysBusDeviceInfo pl050_mouse_info = { .qdev.vmsd = &vmstate_pl050, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_pl050); +} + +vmstate_init (init_vmstate_description_1); +static void pl050_register_devices (void ) {sysbus_register_withprop (&pl050_kbd_info);
hw/pl080.c +16 -0
@@ -388,6 +388,14 @@ static SysBusDeviceInfo pl080_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pl080); +} + +vmstate_init (init_vmstate_description_0); +static SysBusDeviceInfo pl081_info = { .init = pl081_init, .qdev.name ="pl081" ,
@@ -396,6 +404,14 @@ static SysBusDeviceInfo pl081_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_pl080); +} + +vmstate_init (init_vmstate_description_1); +/* The PL080 and PL081 are the same except for the number of channels they implement (8 and 2 respectively). */ static void pl080_register_devices (void )
hw/pl110.c +16 -0
@@ -405,6 +405,14 @@ static SysBusDeviceInfo pl110_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pl110); +} + +vmstate_init (init_vmstate_description_0); +static SysBusDeviceInfo pl110_versatile_info = { .init = pl110_versatile_init, .qdev.name ="pl110_versatile" ,
@@ -413,6 +421,14 @@ static SysBusDeviceInfo pl110_versatile_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_pl110); +} + +vmstate_init (init_vmstate_description_1); +static void pl110_register_devices (void ) {sysbus_register_withprop (&pl110_info);
hw/pl190.c +8 -0
@@ -270,6 +270,14 @@ static SysBusDeviceInfo pl190_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pl190); +} + +vmstate_init (init_vmstate_description_0); +static void pl190_register_devices (void ) {sysbus_register_withprop (&pl190_info);
hw/ps2.c +16 -0
@@ -615,6 +615,14 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg)return s; } +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ps2_keyboard); +} + +vmstate_init (init_vmstate_description_0); +void *ps2_mouse_init (void (*update_irq)(void *,int ),void *update_arg) {PS2MouseState *s = (PS2MouseState *)qemu_mallocz (sizeof (PS2MouseState));
@@ -626,3 +634,11 @@ void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg)qemu_register_reset (ps2_mouse_reset, s);return s; } + +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_ps2_mouse); +} + +vmstate_init (init_vmstate_description_1);
hw/pxa2xx.c +16 -0
@@ -1293,6 +1293,14 @@ static SysBusDeviceInfo pxa2xx_rtc_sysbus_info = { .qdev.vmsd = &vmstate_pxa2xx_rtc_regs, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pxa2xx_rtc_regs); +} + +vmstate_init (init_vmstate_description_0); +/* I2C Interface */ typedef struct { i2c_slave i2c;
@@ -1595,6 +1603,14 @@ static SysBusDeviceInfo pxa2xx_i2c_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_pxa2xx_i2c); +} + +vmstate_init (init_vmstate_description_1); +/* PXA Inter-IC Sound Controller */ static void pxa2xx_i2s_reset (PXA2xxI2SState *i2s) {
hw/pxa2xx_dma.c +8 -0
@@ -561,6 +561,14 @@ static SysBusDeviceInfo pxa2xx_dma_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pxa2xx_dma); +} + +vmstate_init (init_vmstate_description_0); +static void pxa2xx_dma_register (void ) {sysbus_register_withprop (&pxa2xx_dma_info);
hw/pxa2xx_pic.c +8 -0
@@ -309,6 +309,14 @@ static SysBusDeviceInfo pxa2xx_pic_info = { .qdev.vmsd = &vmstate_pxa2xx_pic_regs, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pxa2xx_pic_regs); +} + +vmstate_init (init_vmstate_description_0); +static void pxa2xx_pic_register (void ) {sysbus_register_withprop (&pxa2xx_pic_info);
hw/pxa2xx_timer.c +16 -0
@@ -496,6 +496,14 @@ static SysBusDeviceInfo pxa25x_timer_dev_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pxa2xx_timer_regs); +} + +vmstate_init (init_vmstate_description_0); +static SysBusDeviceInfo pxa27x_timer_dev_info = { .init = pxa2xx_timer_init, .qdev.name ="pxa27x-timer" ,
@@ -510,6 +518,14 @@ static SysBusDeviceInfo pxa27x_timer_dev_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_pxa2xx_timer_regs); +} + +vmstate_init (init_vmstate_description_1); +static void pxa2xx_timer_register (void ) {sysbus_register_withprop (&pxa25x_timer_dev_info);
hw/qxl.c +16 -0
@@ -1504,6 +1504,14 @@ static PCIDeviceInfo qxl_info_primary = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&qxl_vmstate); +} + +vmstate_init (init_vmstate_description_0); +static PCIDeviceInfo qxl_info_secondary = { .qdev.name ="qxl" , .qdev.desc ="Spice QXL GPU (secondary)" ,
@@ -1522,6 +1530,14 @@ static PCIDeviceInfo qxl_info_secondary = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&qxl_vmstate); +} + +vmstate_init (init_vmstate_description_1); +static void qxl_register (void ) {pci_qdev_register (&qxl_info_primary);
hw/rtl8139.c +16 -0
@@ -3269,6 +3269,14 @@ static const VMStateDescription vmstate_rtl8139 = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_rtl8139_hotplug_ready); +} + +vmstate_init (init_vmstate_description_0); +/***********************************************************/ /* PCI RTL8139 definitions */
@@ -3422,6 +3430,14 @@ static PCIDeviceInfo rtl8139_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_rtl8139); +} + +vmstate_init (init_vmstate_description_1); +static void rtl8139_register_devices (void ) {pci_qdev_register (&rtl8139_info);
hw/sb16.c +8 -0
@@ -1413,6 +1413,14 @@ static ISADeviceInfo sb16_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_sb16); +} + +vmstate_init (init_vmstate_description_0); +static void sb16_register (void ) {isa_qdev_register (&sb16_info);
hw/sbi.c +8 -0
@@ -140,6 +140,14 @@ static SysBusDeviceInfo sbi_info = { .qdev.reset = sbi_reset, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_sbi); +} + +vmstate_init (init_vmstate_description_0); +static void sbi_register_devices (void ) {sysbus_register_withprop (&sbi_info);
hw/serial.c +8 -2
@@ -804,8 +804,6 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase, s->chr = chr;serial_init_core (s); -vmstate_register (NULL , base, &vmstate_serial, s); -register_ioport_write (base,8 ,1 , serial_ioport_write, s);register_ioport_read (base,8 ,1 , serial_ioport_read, s);return s;
@@ -971,6 +969,14 @@ static ISADeviceInfo serial_isa_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_isa_serial); +} + +vmstate_init (init_vmstate_description_0); +static void serial_register_devices (void ) {isa_qdev_register (&serial_isa_info);
hw/slavio_intctl.c +8 -0
@@ -455,6 +455,14 @@ static SysBusDeviceInfo slavio_intctl_info = { .qdev.reset = slavio_intctl_reset, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_intctl); +} + +vmstate_init (init_vmstate_description_0); +static void slavio_intctl_register_devices (void ) {sysbus_register_withprop (&slavio_intctl_info);
hw/slavio_misc.c +8 -0
@@ -484,6 +484,14 @@ static SysBusDeviceInfo slavio_misc_info = { .qdev.reset = slavio_misc_reset, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_misc); +} + +vmstate_init (init_vmstate_description_0); +static SysBusDeviceInfo apc_info = { .init = apc_init1, .qdev.name ="apc" ,
hw/slavio_timer.c +8 -0
@@ -416,6 +416,14 @@ static SysBusDeviceInfo slavio_timer_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_slavio_timer); +} + +vmstate_init (init_vmstate_description_0); +static void slavio_timer_register_devices (void ) {sysbus_register_withprop (&slavio_timer_info);
hw/smc91c111.c +8 -0
@@ -774,6 +774,14 @@ static SysBusDeviceInfo smc91c111_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_smc91c111); +} + +vmstate_init (init_vmstate_description_0); +static void smc91c111_register_devices (void ) {sysbus_register_withprop (&smc91c111_info);
hw/sparc32_dma.c +8 -0
@@ -297,6 +297,14 @@ static SysBusDeviceInfo sparc32_dma_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_dma); +} + +vmstate_init (init_vmstate_description_0); +static void sparc32_dma_register_devices (void ) {sysbus_register_withprop (&sparc32_dma_info);
hw/spitz.c +32 -0
@@ -1043,6 +1043,14 @@ static SysBusDeviceInfo sl_nand_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_sl_nand_info); +} + +vmstate_init (init_vmstate_description_0); +static VMStateDescription vmstate_spitz_kbd = { .name ="spitz-keyboard" , .version_id =1 ,
@@ -1067,6 +1075,14 @@ static SysBusDeviceInfo spitz_keyboard_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_spitz_kbd); +} + +vmstate_init (init_vmstate_description_1); +static const VMStateDescription vmstate_corgi_ssp_regs = { .name ="corgi-ssp" , .version_id =1 ,
@@ -1086,6 +1102,14 @@ static SSISlaveInfo corgi_ssp_info = { .transfer = corgi_ssp_transfer }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_2 (void ) +{ +register_vmstate_description (&vmstate_corgi_ssp_regs); +} + +vmstate_init (init_vmstate_description_2); +static const VMStateDescription vmstate_spitz_lcdtg_regs = { .name ="spitz-lcdtg" , .version_id =1 ,
@@ -1106,6 +1130,14 @@ static SSISlaveInfo spitz_lcdtg_info = { .transfer = spitz_lcdtg_transfer }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_3 (void ) +{ +register_vmstate_description (&vmstate_spitz_lcdtg_regs); +} + +vmstate_init (init_vmstate_description_3); +static void spitz_register_devices (void ) {ssi_register_slave (&corgi_ssp_info);
hw/ssd0303.c +8 -0
@@ -304,6 +304,14 @@ static I2CSlaveInfo ssd0303_info = { .send = ssd0303_send }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ssd0303); +} + +vmstate_init (init_vmstate_description_0); +static void ssd0303_register_devices (void ) {i2c_register_slave (&ssd0303_info);
hw/sun4c_intctl.c +8 -0
@@ -216,6 +216,14 @@ static SysBusDeviceInfo sun4c_intctl_info = { .qdev.reset = sun4c_intctl_reset, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_sun4c_intctl); +} + +vmstate_init (init_vmstate_description_0); +static void sun4c_intctl_register_devices (void ) {sysbus_register_withprop (&sun4c_intctl_info);
hw/sun4m_iommu.c +8 -0
@@ -370,6 +370,14 @@ static SysBusDeviceInfo iommu_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_iommu); +} + +vmstate_init (init_vmstate_description_0); +static void iommu_register_devices (void ) {sysbus_register_withprop (&iommu_info);
hw/tcx.c +8 -0
@@ -643,6 +643,14 @@ static SysBusDeviceInfo tcx_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_tcx); +} + +vmstate_init (init_vmstate_description_0); +static void tcx_register_devices (void ) {sysbus_register_withprop (&tcx_info);
hw/tmp105.c +8 -0
@@ -236,6 +236,14 @@ static I2CSlaveInfo tmp105_info = { .send = tmp105_tx }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_tmp105); +} + +vmstate_init (init_vmstate_description_0); +static void tmp105_register_devices (void ) {i2c_register_slave (&tmp105_info);
hw/twl92230.c +8 -0
@@ -868,6 +868,14 @@ static I2CSlaveInfo twl92230_info = { .send = menelaus_tx }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_menelaus); +} + +vmstate_init (init_vmstate_description_0); +static void twl92230_register_devices (void ) {i2c_register_slave (&twl92230_info);
hw/usb-hid.c +8 -0
@@ -999,6 +999,14 @@ static struct USBDeviceInfo hid_info[] = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_usb_kbd); +} + +vmstate_init (init_vmstate_description_0); +static void usb_hid_register_devices (void ) {usb_qdev_register_many (hid_info);
hw/usb-hub.c +8 -0
@@ -583,6 +583,14 @@ static struct USBDeviceInfo hub_info = { .handle_destroy = usb_hub_handle_destroy, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_usb_hub); +} + +vmstate_init (init_vmstate_description_0); +static void usb_hub_register_devices (void ) {usb_qdev_register (&hub_info);
hw/usb-uhci.c +8 -0
@@ -1207,6 +1207,14 @@ static PCIDeviceInfo uhci_info[] = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_uhci); +} + +vmstate_init (init_vmstate_description_0); +static void uhci_register (void ) {pci_qdev_register_many (uhci_info);
hw/versatilepb.c +8 -0
@@ -354,6 +354,14 @@ static SysBusDeviceInfo vpb_sic_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_vpb_sic); +} + +vmstate_init (init_vmstate_description_0); +static void versatilepb_register_devices (void ) {sysbus_register_withprop (&vpb_sic_info);
hw/vga-isa.c +8 -0
@@ -81,6 +81,14 @@ static ISADeviceInfo vga_info = { .init = vga_initfn, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_vga_common); +} + +vmstate_init (init_vmstate_description_0); +static void vga_register (void ) {isa_qdev_register (&vga_info);
hw/vga-pci.c +8 -0
@@ -116,6 +116,14 @@ static PCIDeviceInfo vga_info = { .romfile = "vgabios-stdvga.bin", }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_vga_pci); +} + +vmstate_init (init_vmstate_description_0); +static void vga_register (void ) {pci_qdev_register (&vga_info);
hw/vmmouse.c +8 -0
@@ -282,6 +282,14 @@ static ISADeviceInfo vmmouse_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_vmmouse); +} + +vmstate_init (init_vmstate_description_0); +static void vmmouse_dev_register (void ) {isa_qdev_register (&vmmouse_info);
hw/vmware_vga.c +8 -0
@@ -1318,6 +1318,14 @@ static PCIDeviceInfo vmsvga_info = { .romfile = "vgabios-vmware.bin", }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_vmware_vga); +} + +vmstate_init (init_vmstate_description_0); +static void vmsvga_register (void ) {pci_qdev_register (&vmsvga_info);
hw/vt82c686.c +16 -0
@@ -522,6 +522,14 @@ static PCIDeviceInfo via_pm_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_acpi); +} + +vmstate_init (init_vmstate_description_0); +static void vt82c686b_pm_register (void ) {pci_qdev_register (&via_pm_info);
@@ -587,6 +595,14 @@ static PCIDeviceInfo via_info = { .config_write = vt82c686b_write_config, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_via); +} + +vmstate_init (init_vmstate_description_1); +static void vt82c686b_register (void ) {pci_qdev_register (&via_info);
hw/wdt_i6300esb.c +8 -0
@@ -439,6 +439,14 @@ static PCIDeviceInfo i6300esb_info = { .init = i6300esb_init, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_i6300esb); +} + +vmstate_init (init_vmstate_description_0); +static void i6300esb_register_devices (void ) {watchdog_add_model (&model);
hw/wdt_ib700.c +8 -0
@@ -128,6 +128,14 @@ static ISADeviceInfo wdt_ib700_info = { .init = wdt_ib700_init, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ib700); +} + +vmstate_init (init_vmstate_description_0); +static void wdt_ib700_register_devices (void ) {watchdog_add_model (&model);
hw/wm8750.c +8 -0
@@ -699,6 +699,14 @@ static I2CSlaveInfo wm8750_info = { .send = wm8750_tx }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_wm8750); +} + +vmstate_init (init_vmstate_description_0); +static void wm8750_register_devices (void ) {i2c_register_slave (&wm8750_info);
hw/xio3130_downstream.c +8 -0
@@ -194,6 +194,14 @@ static PCIDeviceInfo xio3130_downstream_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_xio3130_downstream); +} + +vmstate_init (init_vmstate_description_0); +static void xio3130_downstream_register (void ) {pci_qdev_register (&xio3130_downstream_info);
hw/xio3130_upstream.c +8 -0
@@ -168,6 +168,14 @@ static PCIDeviceInfo xio3130_upstream_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_xio3130_upstream); +} + +vmstate_init (init_vmstate_description_0); +static void xio3130_upstream_register (void ) {pci_qdev_register (&xio3130_upstream_info);
hw/zaurus.c +8 -0
@@ -236,6 +236,14 @@ static SysBusDeviceInfo scoop_sysbus_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_scoop_regs); +} + +vmstate_init (init_vmstate_description_0); +static void scoop_register (void ) {sysbus_register_withprop (&scoop_sysbus_info);
module.h +2 -0
@@ -24,12 +24,14 @@ typedef enum {MODULE_INIT_BLOCK ,MODULE_INIT_DEVICE ,MODULE_INIT_MACHINE , +MODULE_INIT_VMSTATE , MODULE_INIT_MAX } module_init_type;#define block_init (function) module_init(function, MODULE_INIT_BLOCK)#define device_init (function) module_init(function, MODULE_INIT_DEVICE)#define machine_init (function) module_init(function, MODULE_INIT_MACHINE) +#define vmstate_init (function) module_init(function, MODULE_INIT_MACHINE)void register_module_init (void (*fn)(void ),module_init_type type);
savevm.c +4 -0
@@ -1285,6 +1285,10 @@ void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd, } } +void register_vmstate_description (const VMStateDescription *desc) +{ +} +static void vmstate_subsection_save (QEMUFile *f,const VMStateDescription *vmsd,void *opaque); static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
target-i386/machine.c +8 -0
@@ -504,6 +504,14 @@ static const VMStateDescription vmstate_cpu = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description (void ) +{ +register_vmstate_description (&vmstate_cpu); +} + +vmstate_init (init_vmstate_description); +void cpu_save (QEMUFile *f,void *opaque) {vmstate_save_state (f, &vmstate_cpu, opaque);
Signature · 1 line
1.7.0.4
Re: [Qemu-devel] [PATCH 02/11] vmstate: register all VMStateDescriptions
Quoted 5 lines · Anthony Liguori
This is a purely mechanical change. It was generated with a simple python script and a little bit of hand tuning. Without this, we can only see VMStateDescriptions that are part of an active device which means that we have to test migration with a VM configured with every possible device.
Is it possible to make the names meaningful instead of numeric? you get a simpler script if you do that because you don't have to track the number, and it's guranteed unique because you start from unique function names. i.e. instead of
+static void init_vmstate_description_0(void)
+{
+ register_vmstate_description(&vmstate_ac97);
+}
+
+vmstate_init(init_vmstate_description_0);
+
Have
+static void init_vmstate_description_ac97(void)
+{
+ register_vmstate_description(&vmstate_ac97);
+}
+
+vmstate_init(init_vmstate_description_ac97);
+
Alon
Quoted 2,163 lines
Signed-off-by Anthony Liguori <[email protected]>--- hw/ac97.c | 8 ++++++ hw/acpi_piix4.c | 8 ++++++ hw/apb_pci.c | 8 ++++++ hw/apic.c | 8 ++++++ hw/arm_sysctl.c | 8 ++++++ hw/bonito.c | 8 ++++++ hw/cirrus_vga.c | 8 ++++++ hw/cs4231.c | 8 ++++++ hw/cs4231a.c | 8 ++++++ hw/dec_pci.c | 8 ++++++ hw/e1000.c | 8 ++++++ hw/eccmemctl.c | 8 ++++++ hw/eeprom93xx.c | 8 ++++++ hw/es1370.c | 8 ++++++ hw/escc.c | 8 ++++++ hw/esp.c | 8 ++++++ hw/fdc.c | 16 ++++++++++++ hw/fw_cfg.c | 8 ++++++ hw/gus.c | 8 ++++++ hw/hda-audio.c | 8 ++++++ hw/hpet.c | 8 ++++++ hw/hw.h | 3 ++ hw/i2c.c | 8 ++++++ hw/i8254.c | 8 ++++++ hw/i8259.c | 8 ++++++ hw/intel-hda.c | 8 ++++++ hw/ioapic.c | 8 ++++++ hw/ioh3420.c | 8 ++++++ hw/kvmclock.c | 8 ++++++ hw/lance.c | 8 ++++++ hw/lm32_juart.c | 8 ++++++ hw/lm32_pic.c | 8 ++++++ hw/lm32_sys.c | 8 ++++++ hw/lm32_timer.c | 8 ++++++ hw/lm32_uart.c | 8 ++++++ hw/lm832x.c | 8 ++++++ hw/lsi53c895a.c | 8 ++++++ hw/marvell_88w8618_audio.c | 8 ++++++ hw/max7310.c | 8 ++++++ hw/mc146818rtc.c | 8 ++++++ hw/mst_fpga.c | 8 ++++++ hw/musicpal.c | 56 ++++++++++++++++++++++++++++++++++++++++++++ hw/ne2000.c | 8 ++++++ hw/pc.c | 8 ++++++ hw/pci.c | 8 ++++++ hw/pckbd.c | 16 ++++++++++++ hw/pcnet-pci.c | 8 ++++++ hw/piix_pci.c | 8 ++++++ hw/pl031.c | 8 ++++++ hw/pl050.c | 16 ++++++++++++ hw/pl080.c | 16 ++++++++++++ hw/pl110.c | 16 ++++++++++++ hw/pl190.c | 8 ++++++ hw/ps2.c | 16 ++++++++++++ hw/pxa2xx.c | 16 ++++++++++++ hw/pxa2xx_dma.c | 8 ++++++ hw/pxa2xx_pic.c | 8 ++++++ hw/pxa2xx_timer.c | 16 ++++++++++++ hw/qxl.c | 16 ++++++++++++ hw/rtl8139.c | 16 ++++++++++++ hw/sb16.c | 8 ++++++ hw/sbi.c | 8 ++++++ hw/serial.c | 10 ++++++- hw/slavio_intctl.c | 8 ++++++ hw/slavio_misc.c | 8 ++++++ hw/slavio_timer.c | 8 ++++++ hw/smc91c111.c | 8 ++++++ hw/sparc32_dma.c | 8 ++++++ hw/spitz.c | 32 +++++++++++++++++++++++++ hw/ssd0303.c | 8 ++++++ hw/sun4c_intctl.c | 8 ++++++ hw/sun4m_iommu.c | 8 ++++++ hw/tcx.c | 8 ++++++ hw/tmp105.c | 8 ++++++ hw/twl92230.c | 8 ++++++ hw/usb-hid.c | 8 ++++++ hw/usb-hub.c | 8 ++++++ hw/usb-uhci.c | 8 ++++++ hw/versatilepb.c | 8 ++++++ hw/vga-isa.c | 8 ++++++ hw/vga-pci.c | 8 ++++++ hw/vmmouse.c | 8 ++++++ hw/vmware_vga.c | 8 ++++++ hw/vt82c686.c | 16 ++++++++++++ hw/wdt_i6300esb.c | 8 ++++++ hw/wdt_ib700.c | 8 ++++++ hw/wm8750.c | 8 ++++++ hw/xio3130_downstream.c | 8 ++++++ hw/xio3130_upstream.c | 8 ++++++ hw/zaurus.c | 8 ++++++ module.h | 2 + savevm.c | 4 +++ target-i386/machine.c | 8 ++++++ 93 files changed, 889 insertions(+), 2 deletions(-)hw/ac97.c +8
-0@@ -1343,6 +1343,14 @@ static PCIDeviceInfo ac97_info = { .init = ac97_initfn, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ac97); +} + +vmstate_init (init_vmstate_description_0); +static void ac97_register (void ) {pci_qdev_register (&ac97_info);hw/acpi_piix4.c +8
-0@@ -460,6 +460,14 @@ static PCIDeviceInfo piix4_pm_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_acpi); +} + +vmstate_init (init_vmstate_description_0); +static void piix4_pm_register (void ) {pci_qdev_register (&piix4_pm_info);hw/apb_pci.c +8
-0@@ -472,6 +472,14 @@ static PCIDeviceInfo pbm_pci_bridge_info = { .is_bridge = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pci_device); +} + +vmstate_init (init_vmstate_description_0); +static void pbm_register_devices (void ) {sysbus_register_withprop (&pbm_host_info);hw/apic.c +8
-0@@ -1025,6 +1025,14 @@ static SysBusDeviceInfo apic_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_apic); +} + +vmstate_init (init_vmstate_description_0); +static void apic_register_devices (void ) {sysbus_register_withprop (&apic_info);hw/arm_sysctl.c +8
-0@@ -363,6 +363,14 @@ static SysBusDeviceInfo arm_sysctl_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_arm_sysctl); +} + +vmstate_init (init_vmstate_description_0); +static void arm_sysctl_register_devices (void ) {sysbus_register_withprop (&arm_sysctl_info);hw/bonito.c +8
-0@@ -798,6 +798,14 @@ static PCIDeviceInfo bonito_info = { .init = bonito_initfn, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_bonito); +} + +vmstate_init (init_vmstate_description_0); +static SysBusDeviceInfo bonito_pcihost_info = { .init = bonito_pcihost_initfn, .qdev.name ="Bonito-pcihost" ,hw/cirrus_vga.c +8
-0@@ -3145,6 +3145,14 @@ static PCIDeviceInfo cirrus_vga_info = { .config_write = pci_cirrus_write_config, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pci_cirrus_vga); +} + +vmstate_init (init_vmstate_description_0); +static void cirrus_vga_register (void ) {pci_qdev_register (&cirrus_vga_info);hw/cs4231.c +8
-0@@ -167,6 +167,14 @@ static SysBusDeviceInfo cs4231_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_cs4231); +} + +vmstate_init (init_vmstate_description_0); +static void cs4231_register_devices (void ) {sysbus_register_withprop (&cs4231_info);hw/cs4231a.c +8
-0@@ -679,6 +679,14 @@ static ISADeviceInfo cs4231a_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_cs4231a); +} + +vmstate_init (init_vmstate_description_0); +static void cs4231a_register (void ) {isa_qdev_register (&cs4231a_info);hw/dec_pci.c +8
-0@@ -76,6 +76,14 @@ static PCIDeviceInfo dec_21154_pci_bridge_info = { .is_bridge = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pci_device); +} + +vmstate_init (init_vmstate_description_0); +PCIBus *pci_dec_21154_init (PCIBus *parent_bus,int devfn) {PCIDevice *dev;hw/e1000.c +8
-0@@ -1212,6 +1212,14 @@ static PCIDeviceInfo e1000_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_e1000); +} + +vmstate_init (init_vmstate_description_0); +static void e1000_register_devices (void ) {pci_qdev_register (&e1000_info);hw/eccmemctl.c +8
-0@@ -323,6 +323,14 @@ static SysBusDeviceInfo ecc_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ecc); +} + +vmstate_init (init_vmstate_description_0); +static void ecc_register_devices (void ) {hw/eeprom93xx.c +8
-0@@ -320,6 +320,14 @@ eeprom_t *eeprom93xx_new(DeviceState *dev, uint16_t nwords)return eeprom; } +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description (void ) +{ +register_vmstate_description (&vmstate_eeprom); +} + +vmstate_init (init_vmstate_description); +void eeprom93xx_free (DeviceState *dev,eeprom_t *eeprom) {/* Destroy EEPROM. */ hw/es1370.c +8
-0@@ -1045,6 +1045,14 @@ static PCIDeviceInfo es1370_info = { .init = es1370_initfn, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_es1370); +} + +vmstate_init (init_vmstate_description_0); +static void es1370_register (void ) {pci_qdev_register (&es1370_info);hw/escc.c +8
-0@@ -953,6 +953,14 @@ static SysBusDeviceInfo escc_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_escc); +} + +vmstate_init (init_vmstate_description_0); +static void escc_register_devices (void ) {sysbus_register_withprop (&escc_info);hw/esp.c +8
-0@@ -743,6 +743,14 @@ static SysBusDeviceInfo esp_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_esp); +} + +vmstate_init (init_vmstate_description_0); +static void esp_register_devices (void ) {sysbus_register_withprop (&esp_info);hw/fdc.c +16
-0@@ -1938,6 +1938,14 @@ static ISADeviceInfo isa_fdc_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_isa_fdc); +} + +vmstate_init (init_vmstate_description_0); +static const VMStateDescription vmstate_sysbus_fdc ={ .name ="fdc" , .version_id =2 ,@@ -1961,6 +1969,14 @@ static SysBusDeviceInfo sysbus_fdc_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_sysbus_fdc); +} + +vmstate_init (init_vmstate_description_1); +static SysBusDeviceInfo sun4m_fdc_info = { .init = sun4m_fdc_init1, .qdev.name ="SUNW,fdtwo" ,hw/fw_cfg.c +8
-0@@ -399,6 +399,14 @@ static SysBusDeviceInfo fw_cfg_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_fw_cfg); +} + +vmstate_init (init_vmstate_description_0); +static void fw_cfg_register_devices (void ) {sysbus_register_withprop (&fw_cfg_info);hw/gus.c +8
-0@@ -315,6 +315,14 @@ static ISADeviceInfo gus_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_gus); +} + +vmstate_init (init_vmstate_description_0); +static void gus_register (void ) {isa_qdev_register (&gus_info);hw/hda-audio.c +8
-0@@ -906,6 +906,14 @@ static HDACodecDeviceInfo hda_audio_info_output = { .stream = hda_audio_stream, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_hda_audio); +} + +vmstate_init (init_vmstate_description_0); +static HDACodecDeviceInfo hda_audio_info_duplex = { .qdev.name ="hda-duplex" , .qdev.desc ="HDA Audio Codec, duplex" ,hw/hpet.c +8
-0@@ -737,6 +737,14 @@ static SysBusDeviceInfo hpet_device_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_hpet); +} + +vmstate_init (init_vmstate_description_0); +static void hpet_register_device (void ) {sysbus_register_withprop (&hpet_device_info);hw/hw.h +3
-0@@ -914,4 +914,7 @@ int vmstate_register_with_alias_id(DeviceState *dev, int instance_id, int required_for_version);void vmstate_unregister (DeviceState *dev,const VMStateDescription *vmsd,void *opaque); + +void register_vmstate_description (const VMStateDescription *desc); +#endif hw/i2c.c +8
-0@@ -66,6 +66,14 @@ i2c_bus *i2c_init_bus(DeviceState *parent, const char *name)return bus; } +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description (void ) +{ +register_vmstate_description (&vmstate_i2c_bus); +} + +vmstate_init (init_vmstate_description); +void i2c_set_slave_address (i2c_slave *dev,uint8_t address) { dev->address = address;hw/i8254.c +8
-0@@ -539,6 +539,14 @@ static ISADeviceInfo pit_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pit); +} + +vmstate_init (init_vmstate_description_0); +static void pit_register (void ) {isa_qdev_register (&pit_info);hw/i8259.c +8
-0@@ -487,6 +487,14 @@ static void pic_init1(int io_addr, int elcr_addr, PicState *s)qemu_register_reset (pic_reset, s); } +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description (void ) +{ +register_vmstate_description (&vmstate_pic); +} + +vmstate_init (init_vmstate_description); +void pic_info (Monitor *mon) {int i;hw/intel-hda.c +8
-0@@ -1283,6 +1283,14 @@ static PCIDeviceInfo intel_hda_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_intel_hda); +} + +vmstate_init (init_vmstate_description_0); +static void intel_hda_register (void ) {pci_qdev_register (&intel_hda_info);hw/ioapic.c +8
-0@@ -350,6 +350,14 @@ static SysBusDeviceInfo ioapic_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ioapic); +} + +vmstate_init (init_vmstate_description_0); +static void ioapic_register_devices (void ) {sysbus_register_withprop (&ioapic_info);hw/ioh3420.c +8
-0@@ -229,6 +229,14 @@ static PCIDeviceInfo ioh3420_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ioh3420); +} + +vmstate_init (init_vmstate_description_0); +static void ioh3420_register (void ) {pci_qdev_register (&ioh3420_info);hw/kvmclock.c +8
-0@@ -99,6 +99,14 @@ static SysBusDeviceInfo kvmclock_info = { .init = kvmclock_init, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&kvmclock_vmsd); +} + +vmstate_init (init_vmstate_description_0); +/* Note: Must be called after VCPU initialization. */ void kvmclock_create (void ) {hw/lance.c +8
-0@@ -153,6 +153,14 @@ static SysBusDeviceInfo lance_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lance); +} + +vmstate_init (init_vmstate_description_0); +static void lance_register_devices (void ) {sysbus_register_withprop (&lance_info);hw/lm32_juart.c +8
-0@@ -142,6 +142,14 @@ static SysBusDeviceInfo lm32_juart_info = { .qdev.reset = juart_reset, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lm32_juart); +} + +vmstate_init (init_vmstate_description_0); +static void lm32_juart_register (void ) {sysbus_register_withprop (&lm32_juart_info);hw/lm32_pic.c +8
-0@@ -182,6 +182,14 @@ static SysBusDeviceInfo lm32_pic_info = { .qdev.reset = pic_reset, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lm32_pic); +} + +vmstate_init (init_vmstate_description_0); +static void lm32_pic_register (void ) {sysbus_register_withprop (&lm32_pic_info);hw/lm32_sys.c +8
-0@@ -153,6 +153,14 @@ static SysBusDeviceInfo lm32_sys_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lm32_sys); +} + +vmstate_init (init_vmstate_description_0); +static void lm32_sys_register (void ) {sysbus_register_withprop (&lm32_sys_info);hw/lm32_timer.c +8
-0@@ -214,6 +214,14 @@ static SysBusDeviceInfo lm32_timer_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lm32_timer); +} + +vmstate_init (init_vmstate_description_0); +static void lm32_timer_register (void ) {sysbus_register_withprop (&lm32_timer_info);hw/lm32_uart.c +8
-0@@ -280,6 +280,14 @@ static SysBusDeviceInfo lm32_uart_info = { .qdev.reset = uart_reset, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lm32_uart); +} + +vmstate_init (init_vmstate_description_0); +static void lm32_uart_register (void ) {sysbus_register_withprop (&lm32_uart_info);hw/lm832x.c +8
-0@@ -504,6 +504,14 @@ static I2CSlaveInfo lm8323_info = { .send = lm_i2c_tx }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lm_kbd); +} + +vmstate_init (init_vmstate_description_0); +static void lm832x_register_devices (void ) {i2c_register_slave (&lm8323_info);hw/lsi53c895a.c +8
-0@@ -2211,6 +2211,14 @@ static PCIDeviceInfo lsi_info = { .exit = lsi_scsi_uninit, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_lsi_scsi); +} + +vmstate_init (init_vmstate_description_0); +static void lsi53c895a_register_devices (void ) {pci_qdev_register (&lsi_info);hw/marvell_88w8618_audio.c +8
-0@@ -291,6 +291,14 @@ static SysBusDeviceInfo mv88w8618_audio_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&mv88w8618_audio_vmsd); +} + +vmstate_init (init_vmstate_description_0); +static void mv88w8618_register_devices (void ) {sysbus_register_withprop (&mv88w8618_audio_info);hw/max7310.c +8
-0@@ -196,6 +196,14 @@ static I2CSlaveInfo max7310_info = { .send = max7310_tx }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_max7310); +} + +vmstate_init (init_vmstate_description_0); +static void max7310_register_devices (void ) {i2c_register_slave (&max7310_info);hw/mc146818rtc.c +8
-0@@ -650,6 +650,14 @@ static ISADeviceInfo mc146818rtc_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_rtc); +} + +vmstate_init (init_vmstate_description_0); +static void mc146818rtc_register (void ) {isa_qdev_register (&mc146818rtc_info);hw/mst_fpga.c +8
-0@@ -248,6 +248,14 @@ static SysBusDeviceInfo mst_fpga_info = { .qdev.vmsd = &vmstate_mst_fpga_regs, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_mst_fpga_regs); +} + +vmstate_init (init_vmstate_description_0); +static void mst_fpga_register (void ) {sysbus_register_withprop (&mst_fpga_info);hw/musicpal.c +56
-0@@ -423,6 +423,14 @@ static SysBusDeviceInfo mv88w8618_eth_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&mv88w8618_eth_vmsd); +} + +vmstate_init (init_vmstate_description_0); +/* LCD register offsets */ #define MP_LCD_IRQCTRL 0x180#define MP_LCD_IRQSTAT 0x184@@ -637,6 +645,14 @@ static SysBusDeviceInfo musicpal_lcd_info = { .qdev.vmsd = &musicpal_lcd_vmsd, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&musicpal_lcd_vmsd); +} + +vmstate_init (init_vmstate_description_1); +/* PIC register offsets */ #define MP_PIC_STATUS 0x00#define MP_PIC_ENABLE_SET 0x08@@ -753,6 +769,14 @@ static SysBusDeviceInfo mv88w8618_pic_info = { .qdev.vmsd = &mv88w8618_pic_vmsd, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_2 (void ) +{ +register_vmstate_description (&mv88w8618_pic_vmsd); +} + +vmstate_init (init_vmstate_description_2); +/* PIT register offsets */ #define MP_PIT_TIMER1_LENGTH 0x00/* ... */ @@ -927,6 +951,14 @@ static SysBusDeviceInfo mv88w8618_pit_info = { .qdev.vmsd = &mv88w8618_pit_vmsd, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_3 (void ) +{ +register_vmstate_description (&mv88w8618_pit_vmsd); +} + +vmstate_init (init_vmstate_description_3); +/* Flash config register offsets */ #define MP_FLASHCFG_CFGR0 0x04@@ -1004,6 +1036,14 @@ static SysBusDeviceInfo mv88w8618_flashcfg_info = { .qdev.vmsd = &mv88w8618_flashcfg_vmsd, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_4 (void ) +{ +register_vmstate_description (&mv88w8618_flashcfg_vmsd); +} + +vmstate_init (init_vmstate_description_4); +/* Misc register offsets */ #define MP_MISC_BOARD_REVISION 0x18@@ -1335,6 +1375,14 @@ static SysBusDeviceInfo musicpal_gpio_info = { .qdev.vmsd = &musicpal_gpio_vmsd, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_5 (void ) +{ +register_vmstate_description (&musicpal_gpio_vmsd); +} + +vmstate_init (init_vmstate_description_5); +/* Keyboard codes & masks */ #define KEY_RELEASED 0x80#define KEY_CODE 0x7f@@ -1478,6 +1526,14 @@ static SysBusDeviceInfo musicpal_key_info = { .qdev.vmsd = &musicpal_key_vmsd, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_6 (void ) +{ +register_vmstate_description (&musicpal_key_vmsd); +} + +vmstate_init (init_vmstate_description_6); +static struct arm_boot_info musicpal_binfo = { .loader_start =0x0 , .board_id =0x20e ,hw/ne2000.c +8
-0@@ -773,6 +773,14 @@ static PCIDeviceInfo ne2000_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pci_ne2000); +} + +vmstate_init (init_vmstate_description_0); +static void ne2000_register_devices (void ) {pci_qdev_register (&ne2000_info);hw/pc.c +8
-0@@ -497,6 +497,14 @@ static ISADeviceInfo port92_info = { .init = port92_initfn, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_port92_isa); +} + +vmstate_init (init_vmstate_description_0); +static void port92_register (void ) {isa_qdev_register (&port92_info);hw/pci.c +8
-0@@ -269,6 +269,14 @@ void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,vmstate_register (NULL ,-1 , &vmstate_pcibus, bus); } +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description (void ) +{ +register_vmstate_description (&vmstate_pcibus); +} + +vmstate_init (init_vmstate_description); +PCIBus *pci_bus_new (DeviceState *parent,const char *name,int devfn_min) {PCIBus *bus;hw/pckbd.c +16
-0@@ -433,6 +433,14 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,qemu_register_reset (kbd_reset, s); } +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description (void ) +{ +register_vmstate_description (&vmstate_kbd); +} + +vmstate_init (init_vmstate_description); + typedef struct ISAKBDState { ISADevice dev; KBDState kbd;@@ -492,6 +500,14 @@ static ISADeviceInfo i8042_info = { .init = i8042_initfn, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_kbd_isa); +} + +vmstate_init (init_vmstate_description_0); +static void i8042_register (void ) {isa_qdev_register (&i8042_info);hw/pcnet-pci.c +8
-0@@ -338,6 +338,14 @@ static PCIDeviceInfo pcnet_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pci_pcnet); +} + +vmstate_init (init_vmstate_description_0); +static void pci_pcnet_register_devices (void ) {pci_qdev_register (&pcnet_info);hw/piix_pci.c +8
-0@@ -364,6 +364,14 @@ static PCIDeviceInfo i440fx_info[] = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_piix3); +} + +vmstate_init (init_vmstate_description_0); +static SysBusDeviceInfo i440fx_pcihost_info = { .init = i440fx_pcihost_initfn, .qdev.name ="i440FX-pcihost" ,hw/pl031.c +8
-0@@ -229,6 +229,14 @@ static SysBusDeviceInfo pl031_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pl031); +} + +vmstate_init (init_vmstate_description_0); +static void pl031_register_devices (void ) {sysbus_register_withprop (&pl031_info);hw/pl050.c +16
-0@@ -171,6 +171,14 @@ static SysBusDeviceInfo pl050_kbd_info = { .qdev.vmsd = &vmstate_pl050, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pl050); +} + +vmstate_init (init_vmstate_description_0); +static SysBusDeviceInfo pl050_mouse_info = { .init = pl050_init_mouse, .qdev.name ="pl050_mouse" ,@@ -178,6 +186,14 @@ static SysBusDeviceInfo pl050_mouse_info = { .qdev.vmsd = &vmstate_pl050, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_pl050); +} + +vmstate_init (init_vmstate_description_1); +static void pl050_register_devices (void ) {sysbus_register_withprop (&pl050_kbd_info);hw/pl080.c +16
-0@@ -388,6 +388,14 @@ static SysBusDeviceInfo pl080_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pl080); +} + +vmstate_init (init_vmstate_description_0); +static SysBusDeviceInfo pl081_info = { .init = pl081_init, .qdev.name ="pl081" ,@@ -396,6 +404,14 @@ static SysBusDeviceInfo pl081_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_pl080); +} + +vmstate_init (init_vmstate_description_1); +/* The PL080 and PL081 are the same except for the number of channels they implement (8 and 2 respectively). */ static void pl080_register_devices (void )hw/pl110.c +16
-0@@ -405,6 +405,14 @@ static SysBusDeviceInfo pl110_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pl110); +} + +vmstate_init (init_vmstate_description_0); +static SysBusDeviceInfo pl110_versatile_info = { .init = pl110_versatile_init, .qdev.name ="pl110_versatile" ,@@ -413,6 +421,14 @@ static SysBusDeviceInfo pl110_versatile_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_pl110); +} + +vmstate_init (init_vmstate_description_1); +static void pl110_register_devices (void ) {sysbus_register_withprop (&pl110_info);hw/pl190.c +8
-0@@ -270,6 +270,14 @@ static SysBusDeviceInfo pl190_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pl190); +} + +vmstate_init (init_vmstate_description_0); +static void pl190_register_devices (void ) {sysbus_register_withprop (&pl190_info);hw/ps2.c +16
-0@@ -615,6 +615,14 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg)return s; } +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ps2_keyboard); +} + +vmstate_init (init_vmstate_description_0); +void *ps2_mouse_init (void (*update_irq)(void *,int ),void *update_arg) {PS2MouseState *s = (PS2MouseState *)qemu_mallocz (sizeof (PS2MouseState));@@ -626,3 +634,11 @@ void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg)qemu_register_reset (ps2_mouse_reset, s);return s; } + +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_ps2_mouse); +} + +vmstate_init (init_vmstate_description_1);hw/pxa2xx.c +16
-0@@ -1293,6 +1293,14 @@ static SysBusDeviceInfo pxa2xx_rtc_sysbus_info = { .qdev.vmsd = &vmstate_pxa2xx_rtc_regs, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pxa2xx_rtc_regs); +} + +vmstate_init (init_vmstate_description_0); +/* I2C Interface */ typedef struct { i2c_slave i2c;@@ -1595,6 +1603,14 @@ static SysBusDeviceInfo pxa2xx_i2c_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_pxa2xx_i2c); +} + +vmstate_init (init_vmstate_description_1); +/* PXA Inter-IC Sound Controller */ static void pxa2xx_i2s_reset (PXA2xxI2SState *i2s) {hw/pxa2xx_dma.c +8
-0@@ -561,6 +561,14 @@ static SysBusDeviceInfo pxa2xx_dma_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pxa2xx_dma); +} + +vmstate_init (init_vmstate_description_0); +static void pxa2xx_dma_register (void ) {sysbus_register_withprop (&pxa2xx_dma_info);hw/pxa2xx_pic.c +8
-0@@ -309,6 +309,14 @@ static SysBusDeviceInfo pxa2xx_pic_info = { .qdev.vmsd = &vmstate_pxa2xx_pic_regs, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pxa2xx_pic_regs); +} + +vmstate_init (init_vmstate_description_0); +static void pxa2xx_pic_register (void ) {sysbus_register_withprop (&pxa2xx_pic_info);hw/pxa2xx_timer.c +16
-0@@ -496,6 +496,14 @@ static SysBusDeviceInfo pxa25x_timer_dev_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_pxa2xx_timer_regs); +} + +vmstate_init (init_vmstate_description_0); +static SysBusDeviceInfo pxa27x_timer_dev_info = { .init = pxa2xx_timer_init, .qdev.name ="pxa27x-timer" ,@@ -510,6 +518,14 @@ static SysBusDeviceInfo pxa27x_timer_dev_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_pxa2xx_timer_regs); +} + +vmstate_init (init_vmstate_description_1); +static void pxa2xx_timer_register (void ) {sysbus_register_withprop (&pxa25x_timer_dev_info);hw/qxl.c +16
-0@@ -1504,6 +1504,14 @@ static PCIDeviceInfo qxl_info_primary = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&qxl_vmstate); +} + +vmstate_init (init_vmstate_description_0); +static PCIDeviceInfo qxl_info_secondary = { .qdev.name ="qxl" , .qdev.desc ="Spice QXL GPU (secondary)" ,@@ -1522,6 +1530,14 @@ static PCIDeviceInfo qxl_info_secondary = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&qxl_vmstate); +} + +vmstate_init (init_vmstate_description_1); +static void qxl_register (void ) {pci_qdev_register (&qxl_info_primary);hw/rtl8139.c +16
-0@@ -3269,6 +3269,14 @@ static const VMStateDescription vmstate_rtl8139 = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_rtl8139_hotplug_ready); +} + +vmstate_init (init_vmstate_description_0); +/***********************************************************/ /* PCI RTL8139 definitions */ @@ -3422,6 +3430,14 @@ static PCIDeviceInfo rtl8139_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_rtl8139); +} + +vmstate_init (init_vmstate_description_1); +static void rtl8139_register_devices (void ) {pci_qdev_register (&rtl8139_info);hw/sb16.c +8
-0@@ -1413,6 +1413,14 @@ static ISADeviceInfo sb16_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_sb16); +} + +vmstate_init (init_vmstate_description_0); +static void sb16_register (void ) {isa_qdev_register (&sb16_info);hw/sbi.c +8
-0@@ -140,6 +140,14 @@ static SysBusDeviceInfo sbi_info = { .qdev.reset = sbi_reset, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_sbi); +} + +vmstate_init (init_vmstate_description_0); +static void sbi_register_devices (void ) {sysbus_register_withprop (&sbi_info);hw/serial.c +8
-2@@ -804,8 +804,6 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase, s->chr = chr;serial_init_core (s); -vmstate_register (NULL , base, &vmstate_serial, s); -register_ioport_write (base,8 ,1 , serial_ioport_write, s);register_ioport_read (base,8 ,1 , serial_ioport_read, s);return s;@@ -971,6 +969,14 @@ static ISADeviceInfo serial_isa_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_isa_serial); +} + +vmstate_init (init_vmstate_description_0); +static void serial_register_devices (void ) {isa_qdev_register (&serial_isa_info);hw/slavio_intctl.c +8
-0@@ -455,6 +455,14 @@ static SysBusDeviceInfo slavio_intctl_info = { .qdev.reset = slavio_intctl_reset, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_intctl); +} + +vmstate_init (init_vmstate_description_0); +static void slavio_intctl_register_devices (void ) {sysbus_register_withprop (&slavio_intctl_info);hw/slavio_misc.c +8
-0@@ -484,6 +484,14 @@ static SysBusDeviceInfo slavio_misc_info = { .qdev.reset = slavio_misc_reset, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_misc); +} + +vmstate_init (init_vmstate_description_0); +static SysBusDeviceInfo apc_info = { .init = apc_init1, .qdev.name ="apc" ,hw/slavio_timer.c +8
-0@@ -416,6 +416,14 @@ static SysBusDeviceInfo slavio_timer_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_slavio_timer); +} + +vmstate_init (init_vmstate_description_0); +static void slavio_timer_register_devices (void ) {sysbus_register_withprop (&slavio_timer_info);hw/smc91c111.c +8
-0@@ -774,6 +774,14 @@ static SysBusDeviceInfo smc91c111_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_smc91c111); +} + +vmstate_init (init_vmstate_description_0); +static void smc91c111_register_devices (void ) {sysbus_register_withprop (&smc91c111_info);hw/sparc32_dma.c +8
-0@@ -297,6 +297,14 @@ static SysBusDeviceInfo sparc32_dma_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_dma); +} + +vmstate_init (init_vmstate_description_0); +static void sparc32_dma_register_devices (void ) {sysbus_register_withprop (&sparc32_dma_info);hw/spitz.c +32
-0@@ -1043,6 +1043,14 @@ static SysBusDeviceInfo sl_nand_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_sl_nand_info); +} + +vmstate_init (init_vmstate_description_0); +static VMStateDescription vmstate_spitz_kbd = { .name ="spitz-keyboard" , .version_id =1 ,@@ -1067,6 +1075,14 @@ static SysBusDeviceInfo spitz_keyboard_info = { }, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_spitz_kbd); +} + +vmstate_init (init_vmstate_description_1); +static const VMStateDescription vmstate_corgi_ssp_regs = { .name ="corgi-ssp" , .version_id =1 ,@@ -1086,6 +1102,14 @@ static SSISlaveInfo corgi_ssp_info = { .transfer = corgi_ssp_transfer }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_2 (void ) +{ +register_vmstate_description (&vmstate_corgi_ssp_regs); +} + +vmstate_init (init_vmstate_description_2); +static const VMStateDescription vmstate_spitz_lcdtg_regs = { .name ="spitz-lcdtg" , .version_id =1 ,@@ -1106,6 +1130,14 @@ static SSISlaveInfo spitz_lcdtg_info = { .transfer = spitz_lcdtg_transfer }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_3 (void ) +{ +register_vmstate_description (&vmstate_spitz_lcdtg_regs); +} + +vmstate_init (init_vmstate_description_3); +static void spitz_register_devices (void ) {ssi_register_slave (&corgi_ssp_info);hw/ssd0303.c +8
-0@@ -304,6 +304,14 @@ static I2CSlaveInfo ssd0303_info = { .send = ssd0303_send }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ssd0303); +} + +vmstate_init (init_vmstate_description_0); +static void ssd0303_register_devices (void ) {i2c_register_slave (&ssd0303_info);hw/sun4c_intctl.c +8
-0@@ -216,6 +216,14 @@ static SysBusDeviceInfo sun4c_intctl_info = { .qdev.reset = sun4c_intctl_reset, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_sun4c_intctl); +} + +vmstate_init (init_vmstate_description_0); +static void sun4c_intctl_register_devices (void ) {sysbus_register_withprop (&sun4c_intctl_info);hw/sun4m_iommu.c +8
-0@@ -370,6 +370,14 @@ static SysBusDeviceInfo iommu_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_iommu); +} + +vmstate_init (init_vmstate_description_0); +static void iommu_register_devices (void ) {sysbus_register_withprop (&iommu_info);hw/tcx.c +8
-0@@ -643,6 +643,14 @@ static SysBusDeviceInfo tcx_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_tcx); +} + +vmstate_init (init_vmstate_description_0); +static void tcx_register_devices (void ) {sysbus_register_withprop (&tcx_info);hw/tmp105.c +8
-0@@ -236,6 +236,14 @@ static I2CSlaveInfo tmp105_info = { .send = tmp105_tx }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_tmp105); +} + +vmstate_init (init_vmstate_description_0); +static void tmp105_register_devices (void ) {i2c_register_slave (&tmp105_info);hw/twl92230.c +8
-0@@ -868,6 +868,14 @@ static I2CSlaveInfo twl92230_info = { .send = menelaus_tx }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_menelaus); +} + +vmstate_init (init_vmstate_description_0); +static void twl92230_register_devices (void ) {i2c_register_slave (&twl92230_info);hw/usb-hid.c +8
-0@@ -999,6 +999,14 @@ static struct USBDeviceInfo hid_info[] = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_usb_kbd); +} + +vmstate_init (init_vmstate_description_0); +static void usb_hid_register_devices (void ) {usb_qdev_register_many (hid_info);hw/usb-hub.c +8
-0@@ -583,6 +583,14 @@ static struct USBDeviceInfo hub_info = { .handle_destroy = usb_hub_handle_destroy, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_usb_hub); +} + +vmstate_init (init_vmstate_description_0); +static void usb_hub_register_devices (void ) {usb_qdev_register (&hub_info);hw/usb-uhci.c +8
-0@@ -1207,6 +1207,14 @@ static PCIDeviceInfo uhci_info[] = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_uhci); +} + +vmstate_init (init_vmstate_description_0); +static void uhci_register (void ) {pci_qdev_register_many (uhci_info);hw/versatilepb.c +8
-0@@ -354,6 +354,14 @@ static SysBusDeviceInfo vpb_sic_info = { .qdev.no_user = 1, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_vpb_sic); +} + +vmstate_init (init_vmstate_description_0); +static void versatilepb_register_devices (void ) {sysbus_register_withprop (&vpb_sic_info);hw/vga-isa.c +8
-0@@ -81,6 +81,14 @@ static ISADeviceInfo vga_info = { .init = vga_initfn, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_vga_common); +} + +vmstate_init (init_vmstate_description_0); +static void vga_register (void ) {isa_qdev_register (&vga_info);hw/vga-pci.c +8
-0@@ -116,6 +116,14 @@ static PCIDeviceInfo vga_info = { .romfile = "vgabios-stdvga.bin", }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_vga_pci); +} + +vmstate_init (init_vmstate_description_0); +static void vga_register (void ) {pci_qdev_register (&vga_info);hw/vmmouse.c +8
-0@@ -282,6 +282,14 @@ static ISADeviceInfo vmmouse_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_vmmouse); +} + +vmstate_init (init_vmstate_description_0); +static void vmmouse_dev_register (void ) {isa_qdev_register (&vmmouse_info);hw/vmware_vga.c +8
-0@@ -1318,6 +1318,14 @@ static PCIDeviceInfo vmsvga_info = { .romfile = "vgabios-vmware.bin", }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_vmware_vga); +} + +vmstate_init (init_vmstate_description_0); +static void vmsvga_register (void ) {pci_qdev_register (&vmsvga_info);hw/vt82c686.c +16
-0@@ -522,6 +522,14 @@ static PCIDeviceInfo via_pm_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_acpi); +} + +vmstate_init (init_vmstate_description_0); +static void vt82c686b_pm_register (void ) {pci_qdev_register (&via_pm_info);@@ -587,6 +595,14 @@ static PCIDeviceInfo via_info = { .config_write = vt82c686b_write_config, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_1 (void ) +{ +register_vmstate_description (&vmstate_via); +} + +vmstate_init (init_vmstate_description_1); +static void vt82c686b_register (void ) {pci_qdev_register (&via_info);hw/wdt_i6300esb.c +8
-0@@ -439,6 +439,14 @@ static PCIDeviceInfo i6300esb_info = { .init = i6300esb_init, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_i6300esb); +} + +vmstate_init (init_vmstate_description_0); +static void i6300esb_register_devices (void ) {watchdog_add_model (&model);hw/wdt_ib700.c +8
-0@@ -128,6 +128,14 @@ static ISADeviceInfo wdt_ib700_info = { .init = wdt_ib700_init, }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ib700); +} + +vmstate_init (init_vmstate_description_0); +static void wdt_ib700_register_devices (void ) {watchdog_add_model (&model);hw/wm8750.c +8
-0@@ -699,6 +699,14 @@ static I2CSlaveInfo wm8750_info = { .send = wm8750_tx }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_wm8750); +} + +vmstate_init (init_vmstate_description_0); +static void wm8750_register_devices (void ) {i2c_register_slave (&wm8750_info);hw/xio3130_downstream.c +8
-0@@ -194,6 +194,14 @@ static PCIDeviceInfo xio3130_downstream_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_xio3130_downstream); +} + +vmstate_init (init_vmstate_description_0); +static void xio3130_downstream_register (void ) {pci_qdev_register (&xio3130_downstream_info);hw/xio3130_upstream.c +8
-0@@ -168,6 +168,14 @@ static PCIDeviceInfo xio3130_upstream_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_xio3130_upstream); +} + +vmstate_init (init_vmstate_description_0); +static void xio3130_upstream_register (void ) {pci_qdev_register (&xio3130_upstream_info);hw/zaurus.c +8
-0@@ -236,6 +236,14 @@ static SysBusDeviceInfo scoop_sysbus_info = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_scoop_regs); +} + +vmstate_init (init_vmstate_description_0); +static void scoop_register (void ) {sysbus_register_withprop (&scoop_sysbus_info);module.h +2
-0@@ -24,12 +24,14 @@ typedef enum {MODULE_INIT_BLOCK ,MODULE_INIT_DEVICE ,MODULE_INIT_MACHINE , +MODULE_INIT_VMSTATE , MODULE_INIT_MAX } module_init_type;#define block_init (function) module_init(function, MODULE_INIT_BLOCK)#define device_init (function) module_init(function, MODULE_INIT_DEVICE)#define machine_init (function) module_init(function, MODULE_INIT_MACHINE) +#define vmstate_init (function) module_init(function, MODULE_INIT_MACHINE)void register_module_init (void (*fn)(void ),module_init_type type);savevm.c +4
-0@@ -1285,6 +1285,10 @@ void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd, } } +void register_vmstate_description (const VMStateDescription *desc) +{ +} +static void vmstate_subsection_save (QEMUFile *f,const VMStateDescription *vmsd,void *opaque); static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,target-i386/machine.c +8
-0@@ -504,6 +504,14 @@ static const VMStateDescription vmstate_cpu = { } }; +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description (void ) +{ +register_vmstate_description (&vmstate_cpu); +} + +vmstate_init (init_vmstate_description); +void cpu_save (QEMUFile *f,void *opaque) {vmstate_save_state (f, &vmstate_cpu, opaque);Signature · 1 line
1.7.0.4
Re: [Qemu-devel] [PATCH 02/11] vmstate: register all VMStateDescriptions
In reply to Anthony LiguoriQuoted 9 lines · Anthony Liguori
This is a purely mechanical change.
hw/acpi_piix4.c +7
-0+/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ + register_vmstate_description(&vmstate_ac97); +} + +vmstate_init (init_vmstate_description_0);
hw/acpi_piix4.c static PCIDeviceInfo piix4_pm_info = { · line 470
Quoted 10 lines
hw/acpi_piix4.c +9
-0+ +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ + register_vmstate_description(&vmstate_acpi); +} + +vmstate_init (init_vmstate_description_0); +
Do we really need five lines of boilerplate for every device?
(I'm wondering if there's some way you could avoid having all this for the common case where the vmstate is pointed to by the DeviceInfo struct, given that we already register all the devices. Failing that, some sort of macro...)
-- PMM
Re: [Qemu-devel] [PATCH 02/11] vmstate: register all VMStateDescriptions
Quoted 20 lines · Peter Maydell
Quoted 7 lines · Anthony Liguori
This is a purely mechanical change.
hw/ac97.c +6
-0+/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_ac97); +} +hw/ac97.c static PCIDeviceInfo ac97_info = {
Quoted 10 lines
hw/ac97.c +10
-0+vmstate_init (init_vmstate_description_0); + +/* Register the VMState Description to support VMState introspection */ +static void init_vmstate_description_0 (void ) +{ +register_vmstate_description (&vmstate_acpi); +} + +vmstate_init (init_vmstate_description_0); +Do we really need five lines of boilerplate for every device?
Quoted 4 lines
(I'm wondering if there's some way you could avoid having all this for the common case where the vmstate is pointed to by the DeviceInfo struct, given that we already register all the devices. Failing that, some sort of macro...)
Heh, well that just goes right and head and tremendously simplifies everything :-)
There are just a few cases where VMStateDescription is not reachable via DeviceInfo so DeviceInfo is definitely the way to go.
Regards,
Anthony Liguori
Quoted 2 lines
-- PMM
PATCH 3/11 vmstate: for vmstate types that reuse the same field, make sure name is unique
In reply to Anthony LiguoriFor a schema to work, we need to make sure that each field name is unique. We have a number of derivative types today that reuse the base name. This patch fixes this.
--- hw/hw.h | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)
hw/hw.h +13 -3
@@ -390,6 +390,16 @@ extern const VMStateInfo vmstate_info_unused_buffer; .offset = vmstate_offset_value(_state, _field, _type), \ } +#define VMSTATE_SINGLE_TEST_HACK (_field, _state, _test, _version, _info, _type) { \ + .name = (stringify(_field) "-hack"), \ + .version_id = (_version), \ + .field_exists = (_test), \ + .size = sizeof(_type), \ + .info = &(_info), \ + .flags = VMS_SINGLE, \ + .offset = vmstate_offset_value(_state, _field, _type), \ +} +#define VMSTATE_POINTER (_field, _state, _version, _info, _type) { \ .name = (stringify(_field)), \ .version_id = (_version), \
@@ -419,7 +429,7 @@ extern const VMStateInfo vmstate_info_unused_buffer; }#define VMSTATE_ARRAY_TEST (_field, _state, _num, _test, _info, _type) {\ - .name = (stringify(_field)), \ + .name = (stringify(_field) "-" stringify(_test)), \ .field_exists = (_test), \ .num = (_num), \ .info = &(_info), \
@@ -429,7 +439,7 @@ extern const VMStateInfo vmstate_info_unused_buffer; }#define VMSTATE_SUB_ARRAY (_field, _state, _start, _num, _version, _info, _type) { \ - .name = (stringify(_field)), \ + .name = (stringify(_field) "[" stringify(_start) "]"), \ .version_id = (_version), \ .num = (_num), \ .info = &(_info), \
@@ -621,7 +631,7 @@ extern const VMStateInfo vmstate_info_unused_buffer; }#define VMSTATE_UNUSED_BUFFER (_test, _version, _size) { \ - .name = "unused", \ + .name = "unused" stringify(__LINE__), \ .field_exists = (_test), \ .version_id = (_version), \ .size = (_size), \
Signature · 1 line
1.7.0.4
Re: [Qemu-devel] [PATCH 03/11] vmstate: for vmstate types that reuse the same field, make sure name is unique
Quoted 49 lines · Anthony Liguori
For a schema to work, we need to make sure that each field name is unique. We have a number of derivative types today that reuse the base name. This patch fixes this.
Signed-off-by Anthony Liguori<[email protected]>--- hw/hw.h | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)hw/hw.h +12
-2@@ -390,6 +390,16 @@ extern const VMStateInfo vmstate_info_unused_buffer; .offset = vmstate_offset_value(_state, _field, _type), \ } +#define VMSTATE_SINGLE_TEST_HACK (_field, _state, _test, _version, _info, _type) { \ + .name = (stringify(_field) "-hack"), \ + .version_id = (_version), \ + .field_exists = (_test), \ + .size = sizeof(_type), \ + .info =&(_info), \ + .flags = VMS_SINGLE, \ + .offset = vmstate_offset_value(_state, _field, _type), \ +} +#define VMSTATE_POINTER (_field, _state, _version, _info, _type) { \ .name = (stringify(_field)), \ .version_id = (_version), \@@ -419,7 +429,7 @@ extern const VMStateInfo vmstate_info_unused_buffer; }#define VMSTATE_ARRAY_TEST (_field, _state, _num, _test, _info, _type) {\ - .name = (stringify(_field)), \ + .name = (stringify(_field) "-" stringify(_test)), \ .field_exists = (_test), \ .num = (_num), \ .info =&(_info), \@@ -429,7 +439,7 @@ extern const VMStateInfo vmstate_info_unused_buffer; }#define VMSTATE_SUB_ARRAY (_field, _state, _start, _num, _version, _info, _type) { \ - .name = (stringify(_field)), \ + .name = (stringify(_field) "[" stringify(_start) "]"), \ .version_id = (_version), \ .num = (_num), \ .info =&(_info), \
hw/hw.h extern const VMStateInfo vmstate_info_unused_buffer; · line 634
Quoted 5 lines
hw/hw.h +1
-1@@ -621,7 +631,7 @@ extern const VMStateInfo vmstate_info_unused_buffer; }#define VMSTATE_UNUSED_BUFFER (_test, _version, _size) { \ - .name = "unused", \ + .name = "unused" stringify(__LINE__), \
Why this does generate a unique name, it does not generate a stable name. We need to add a name argument to this macro and all its derivatives. I'll update tomorrow.
If the test suite fails saying you added a new field labelled "unusedXXXX", this is why.
Regards,
Anthony Liguori
Quoted 3 lines
hw/hw.h +0
-0.field_exists = (_test), \ .version_id = (_version), \ .size = (_size), \
PATCH 4/11 sb16: fix migration quirk
In reply to Anthony LiguoriWe seem to migrate the same field twice. It's been this way since Fabrice committed the original file. Since semantically, we basically ignore the first value, make this an unused entry.
--- hw/sb16.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
hw/sb16.c +2 -1
@@ -77,6 +77,7 @@ typedef struct SB16State {int v2x6; +uint8_t csp_param_dummy;uint8_t csp_param;uint8_t csp_value;uint8_t csp_mode;
@@ -1313,7 +1314,7 @@ static const VMStateDescription vmstate_sb16 = {VMSTATE_INT32 (can_write, SB16State),VMSTATE_INT32 (v2x6, SB16State), -VMSTATE_UINT8 (csp_param, SB16State), +VMSTATE_UINT8 (csp_param_dummy, SB16State),VMSTATE_UINT8 (csp_value, SB16State),VMSTATE_UINT8 (csp_mode, SB16State), VMSTATE_UINT8(csp_param, SB16State),
Signature · 1 line
1.7.0.4
[Qemu-devel] Re: [PATCH 04/11] sb16: fix migration quirk
Quoted 22 lines · Anthony Liguori
We seem to migrate the same field twice. It's been this way since Fabrice committed the original file. Since semantically, we basically ignore the first value, make this an unused entry.
Signed-off-by Anthony Liguori <[email protected]>--- hw/sb16.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)hw/sb16.c +1
-0@@ -77,6 +77,7 @@ typedef struct SB16State {int v2x6; +uint8_t csp_param_dummy;uint8_t csp_param;uint8_t csp_value;uint8_t csp_mode;
hw/sb16.c static const VMStateDescription vmstate_sb16 = { · line 1320
Quoted 8 lines
hw/sb16.c +1
-1@@ -1313,7 +1314,7 @@ static const VMStateDescription vmstate_sb16 = {VMSTATE_INT32 (can_write, SB16State),VMSTATE_INT32 (v2x6, SB16State), -VMSTATE_UINT8 (csp_param, SB16State), +VMSTATE_UINT8 (csp_param_dummy, SB16State),VMSTATE_UINT8 (csp_value, SB16State),VMSTATE_UINT8 (csp_mode, SB16State), VMSTATE_UINT8(csp_param, SB16State),
VMSTATE_UNUSED(1) instead?
Later, Juan.
Re: [Qemu-devel] Re: [PATCH 04/11] sb16: fix migration quirk
Quoted 26 lines · Juan Quintela
Quoted 25 lines · Anthony Liguori
We seem to migrate the same field twice. It's been this way since Fabrice committed the original file. Since semantically, we basically ignore the first value, make this an unused entry.
Signed-off-by Anthony Liguori<[email protected]>--- hw/sb16.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)hw/sb16.c +1
-0@@ -77,6 +77,7 @@ typedef struct SB16State {int v2x6; +uint8_t csp_param_dummy;uint8_t csp_param;uint8_t csp_value;uint8_t csp_mode;@@ -1313,7 +1314,7 @@ static const VMStateDescription vmstate_sb16 = {VMSTATE_INT32 (can_write, SB16State), VMSTATE_INT32(v2x6, SB16State),
Quoted 6 lines
hw/sb16.c static const VMStateDescription vmstate_sb16 = { · line 1320
Quoted 5 lines
hw/sb16.c +1
-1-VMSTATE_UINT8 (csp_param, SB16State), +VMSTATE_UINT8 (csp_param_dummy, SB16State),VMSTATE_UINT8 (csp_value, SB16State),VMSTATE_UINT8 (csp_mode, SB16State), VMSTATE_UINT8(csp_param, SB16State),
VMSTATE_UNUSED(1)instead?
Ack. I forgot to update this patch to do that.
Regards,
Anthony Liguori
Quoted 2 lines
Later, Juan.
PATCH 5/11 vga-isa: fix migration by breaking it
In reply to Anthony LiguoriThis is pretty sad. We use the same section name for vga-isa as we do for vga-pci even though we use separate formats. This breaks the live migration protocol because we may misinterpret the vga-isa as a vga-pci device.
vga-isa should use it's own wrapper just like vga-pci does. That's what we do in this patch.
Signed-by-off: Anthony Liguori <[email protected]>
--- hw/vga-isa.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
hw/vga-isa.c +11 -2
@@ -72,10 +72,19 @@ static int vga_initfn(ISADevice *dev)return 0 ; } +static const VMStateDescription vmstate_vga_isa = { + .name ="isa-vga" , + .version_id =1 , + .fields = (VMStateField []) { +VMSTATE_STRUCT (state, ISAVGAState,0 , vmstate_vga_common, VGACommonState), +VMSTATE_END_OF_LIST (), + }, +}; +static ISADeviceInfo vga_info = { .qdev.name ="isa-vga" , .qdev.size =sizeof (ISAVGAState), - .qdev.vmsd = &vmstate_vga_common, + .qdev.vmsd = &vmstate_vga_isa, .qdev.reset = vga_reset_isa, .qdev.no_user =1 , .init = vga_initfn,
@@ -84,7 +93,7 @@ static ISADeviceInfo vga_info = {/* Register the VMState Description to support VMState introspection */ static void init_vmstate_description_0 (void ) { -register_vmstate_description (&vmstate_vga_common); +register_vmstate_description (&vmstate_vga_isa); }vmstate_init (init_vmstate_description_0);
Signature · 1 line
1.7.0.4
[Qemu-devel] Re: [PATCH 05/11] vga-isa: fix migration by breaking it
Quoted 38 lines · Anthony Liguori
This is pretty sad. We use the same section name for vga-isa as we do for vga-pci even though we use separate formats. This breaks the live migration protocol because we may misinterpret the vga-isa as a vga-pci device.
vga-isa should use it's own wrapper just like vga-pci does. That's what we do in this patch.
Signed-by-off: Anthony Liguori <[email protected]>
--- hw/vga-isa.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)hw/vga-isa.c +10
-1@@ -72,10 +72,19 @@ static int vga_initfn(ISADevice *dev)return 0 ; } +static const VMStateDescription vmstate_vga_isa = { + .name ="isa-vga" , + .version_id =1 , + .fields = (VMStateField []) { +VMSTATE_STRUCT (state, ISAVGAState,0 , vmstate_vga_common, VGACommonState), +VMSTATE_END_OF_LIST (), + }, +}; +static ISADeviceInfo vga_info = { .qdev.name ="isa-vga" , .qdev.size =sizeof (ISAVGAState), - .qdev.vmsd = &vmstate_vga_common, + .qdev.vmsd = &vmstate_vga_isa, .qdev.reset = vga_reset_isa, .qdev.no_user =1 , .init = vga_initfn,
hw/vga-isa.c static ISADeviceInfo vga_info = { · line 99
Quoted 8 lines
hw/vga-isa.c +1
-1@@ -84,7 +93,7 @@ static ISADeviceInfo vga_info = {/* Register the VMState Description to support VMState introspection */ static void init_vmstate_description_0 (void ) { -register_vmstate_description (&vmstate_vga_common); +register_vmstate_description (&vmstate_vga_isa); }vmstate_init (init_vmstate_description_0);
This was done that way when I ported this device.
This define is also always setup CONFIG_BOCHS_VBE, and at some point it didn't worked without it.
But this is a different problem that doing the tests.
Later, JUan.
PATCH 6/11 fdc: fix migration of non-ISA fdc devices
In reply to Anthony LiguoriAgain, we are not using a unique name for non-ISA fdc devices and as a result, we may misinterpret an ISA fdc device as a non-ISA fdc device.
In this case, both ISA fdc and non-ISA fdc are using too generic of a name. Since ISA fdc is more common, let it keep the old name.
--- hw/fdc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/fdc.c +1 -1
@@ -1947,7 +1947,7 @@ static void init_vmstate_description_0(void)vmstate_init (init_vmstate_description_0);static const VMStateDescription vmstate_sysbus_fdc ={ - .name ="fdc" , + .name ="sysbus-fdc" , .version_id =2 , .minimum_version_id =2 , .fields = (VMStateField []) {
Signature · 1 line
1.7.0.4
PATCH 7/11 eeprom93xx: Use the new hack macro to avoid duplicate field names
In reply to Anthony LiguoriI don't fully understand this hack business but we need field to be unique so..
--- hw/eeprom93xx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/eeprom93xx.c +1 -1
@@ -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_TEST_HACK(_f, _s, _t, 0, vmstate_hack_uint16_from_uint8, uint16_t)static bool is_old_eeprom_version (void *opaque,int version_id) {
Signature · 1 line
1.7.0.4
[Qemu-devel] Re: [PATCH 07/11] eeprom93xx: Use the new hack macro to avoid duplicate field names
Quoted 12 lines · Anthony Liguori
I don't fully understand this hack business but we need field to be unique so..
Signed-off-by Anthony Liguori <[email protected]>--- hw/eeprom93xx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)hw/eeprom93xx.c +0
-0
hw/eeprom93xx.c static const VMStateInfo vmstate_hack_uint16_from_uint8 = { · line 120
Quoted 8 lines
hw/eeprom93xx.c +1
-1@@ -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_TEST_HACK(_f, _s, _t, 0, vmstate_hack_uint16_from_uint8, uint16_t)static bool is_old_eeprom_version (void *opaque,int version_id) {
After the fact, we need to promote it as "full types".
Basically it is needed when we sent a field with a different size that we use it on the struct.
if we have
struct FOOState {
int32_t bar;....
}
and it is sent as
VMSTATE_INT8(bar, ....)
In this case, I went through the whole device, checed that int8_t was enough and did the change.
But if we have:
struct FOOState {
int8_t bar;....
}
and it is sent as
VMSTATE_INT32(bar, ....)
Then it is not trivial :-(
We change FOOState to int32 or we break migration format. Here is where the _HACK suffix appeared.
I thought it was not going to be needed a lot, but there are several devices that just sent everything over the wire as uint32, independently of its type.
Later, Juan.
Re: [Qemu-devel] Re: [PATCH 07/11] eeprom93xx: Use the new hack macro to avoid duplicate field names
Quoted 51 lines · Juan Quintela
Quoted 12 lines · Anthony Liguori
I don't fully understand this hack business but we need field to be unique so..
Signed-off-by Anthony Liguori<[email protected]>--- hw/eeprom93xx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)hw/eeprom93xx.c +0
-0hw/eeprom93xx.c static const VMStateInfo vmstate_hack_uint16_from_uint8 = { · line 120
Quoted 8 lines
hw/eeprom93xx.c +1
-1@@ -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_TEST_HACK(_f, _s, _t, 0, vmstate_hack_uint16_from_uint8, uint16_t)static bool is_old_eeprom_version (void *opaque,int version_id) {After the fact, we need to promote it as "full types".
Basically it is needed when we sent a field with a different size that we use it on the struct.
if we have
struct FOOState { int32_t bar;....
}and it is sent as
VMSTATE_INT8(bar, ....)In this case, I went through the whole device, checed that
int8_twas enough and did the change.But if we have:
struct FOOState { int8_t bar;....
}and it is sent as
VMSTATE_INT32(bar, ....)
Quoted 8 lines
Then it is not trivial :-(
We change FOOState to int32 or we break migration format. Here is where the
_HACKsuffix appeared.I thought it was not going to be needed a lot, but there are several devices that just sent everything over the wire as uint32, independently of its type.
Could we get away with just doing:
VMSTATE_UNUSED(3),VMSTATE_UINT8(bar, ...),
That's fully compatible on the wire and seems to be a clearer expression of exactly what the problem is.
Regards,
Anthony Liguori
Quoted 2 lines
Later, Juan.
[Qemu-devel] Re: [PATCH 07/11] eeprom93xx: Use the new hack macro to avoid duplicate field names
Quoted 20 lines · Anthony Liguori
Quoted 19 lines · Juan Quintela
Quoted 18 lines · Anthony Liguori
I don't fully understand this hack business but we need field to be unique so..
Signed-off-by Anthony Liguori<[email protected]>--- hw/eeprom93xx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)hw/eeprom93xx.c +1
-1@@ -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_TEST_HACK(_f, _s, _t, 0, vmstate_hack_uint16_from_uint8, uint16_t)
Quoted 7 lines
Quoted 2 lines
hw/eeprom93xx.c static const VMStateInfo vmstate_hack_uint16_from_uint8 = { · line 120
Quoted 2 lines
hw/eeprom93xx.c +0
-0static bool is_old_eeprom_version (void *opaque,int version_id) {Could we get away with just doing:
VMSTATE_UNUSED(3),VMSTATE_UINT8(bar, ...),
Remember that we are "supposed to be" big/little endian safe.
Quoted 2 lines
That's fully compatible on the wire and seems to be a clearer expression of exactly what the problem is.
if we are going to break big endian machines, I fully agree.
Later, Juan.
[Qemu-devel] Re: [PATCH 07/11] eeprom93xx: Use the new hack macro to avoid duplicate field names
Quoted 21 lines · Juan Quintela
Quoted 20 lines · Anthony Liguori
Quoted 19 lines · Juan Quintela
Quoted 18 lines · Anthony Liguori
I don't fully understand this hack business but we need field to be unique so..
Signed-off-by Anthony Liguori<[email protected]>--- hw/eeprom93xx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)hw/eeprom93xx.c +1
-1@@ -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_TEST_HACK(_f, _s, _t, 0, vmstate_hack_uint16_from_uint8, uint16_t)
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
hw/eeprom93xx.c static const VMStateInfo vmstate_hack_uint16_from_uint8 = { · line 120
Quoted 2 lines
hw/eeprom93xx.c +0
-0static bool is_old_eeprom_version (void *opaque,int version_id) {Could we get away with just doing:
VMSTATE_UNUSED(3),VMSTATE_UINT8(bar, ...),Remember that we are "supposed to be" big/little endian safe.
We always send in network byte order (big endian) so this is safe.
Quoted 3 lines
Quoted 2 lines
That's fully compatible on the wire and seems to be a clearer expression of exactly what the problem is.
if we are going to break big endian machines, I fully agree.
The migration protocol is always big endian, see:
void qemu_put_be32(QEMUFile *f, unsigned int v)
{
qemu_put_byte(f, v >> 24);
qemu_put_byte(f, v >> 16);
qemu_put_byte(f, v >> 8);
qemu_put_byte(f, v);
}So this is completely safe.
Regards,
ANthony Liguori
Quoted 1 line
Later, Juan.
PATCH 8/11 fw_cfg: make sure all VMState fields are unique.
In reply to Anthony Liguori--- hw/fw_cfg.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/fw_cfg.c +1 -1
@@ -194,7 +194,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_TEST_HACK(_f, _s, _t, 0, vmstate_hack_uint32_as_uint16, uint32_t)static bool is_version_1 (void *opaque,int version_id)
Signature · 1 line
1.7.0.4
PATCH 9/11 pckbd: make non-ISA pckbd use a unique name
In reply to Anthony LiguoriAnother problem with non-PC versions of devices reusing the PC section name.
--- hw/pckbd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/pckbd.c +1 -1
@@ -366,7 +366,7 @@ static void kbd_reset(void *opaque) }static const VMStateDescription vmstate_kbd = { - .name ="pckbd" , + .name ="mm-pckbd" , .version_id =3 , .minimum_version_id =3 , .minimum_version_id_old =3 ,
Signature · 1 line
1.7.0.4
PATCH 10/11 vl: add a new -vmstate-dump option to write a VMState JSON schema
In reply to Anthony LiguoriThis ends up being pretty slick as we can store the JSON schema in the tree and then use a test wrapper to validate whether fields change.
Current schema will come with the test wrapper.
--- hw/hw.h | 2 + qemu-options.hx | 10 ++++++++ savevm.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ vl.c | 10 ++++++++ 4 files changed, 84 insertions(+), 0 deletions(-)
hw/hw.h +2 -0
@@ -927,4 +927,6 @@ void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd,void register_vmstate_description (const VMStateDescription *desc); +void vmstate_dump_schema (void ); +#endif
qemu-options.hx +10 -0
@@ -2368,6 +2368,16 @@ Specify a trace file to log output traces to. ETEXI #endif +DEF("vmstate-dump", 0, QEMU_OPTION_vmstate_dump, + "-vmstate-dump output the current VMState schema and exit\n", + QEMU_ARCH_ALL) +STEXI +@item -vmstate-dump +@findex -vmstate-dump +This option is only used for an internal test suite. The output format may +change in the future. +ETEXI + HXCOMM This is the last statement. Insert new options before this line! STEXI @end table
savevm.c +62 -0
76 lines not on this page · raw message
vl.c +10 -0
@@ -2038,6 +2038,7 @@ int main(int argc, char **argv, char **envp)#endif int defconfig =1 ;const char *trace_file =NULL ; +bool vmstate_dump = false;atexit (qemu_run_exit_notifiers);error_set_progname (argv[0 ]);
@@ -2876,6 +2877,9 @@ int main(int argc, char **argv, char **envp)fclose (fp);break ; } +case QEMU_OPTION_vmstate_dump: + vmstate_dump = true; +break ;default :os_parse_cmd_args (popt->index, optarg); }
@@ -3124,6 +3128,12 @@ int main(int argc, char **argv, char **envp) }qemu_add_globals (); +if (vmstate_dump) { +module_call_init (MODULE_INIT_VMSTATE ); +vmstate_dump_schema (); +exit (0 ); + } + machine->init (ram_size, boot_devices, kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
Signature · 1 line
1.7.0.4
PATCH 11/11 test-vmstate: add test case to verify we don't change VMState
In reply to Anthony LiguoriWe've had lots of issues surrounding live migration breaking. This is because we haven't had a good way to validate that what we're migrating isn't changing underneath of us.
This test works by first converting the in-tree schema to C source as a string. This is built into the test case. The test case will then query QEMU for the current schema.
It converts both strings to QObjects via the JSON parser and then does a recursive diff. Unlike a simple diff command, this lets us say exactly what you did to break migration. For instance, you get error messages like:
You broke migration by changing the type of field 'par' in device 'cpu', version 1 from 'uint32' to 'uint64'.
It only covers devices that support VMState and it currently doesn't look at subsections yet.
The in-tree schema needs to be updated whenever migration changes but this ends up being a very nice way to ensure that we're reviewing migration protocol changes.
The test case is built in the default build, and can be run by `make check'.
I've also added a `make check-help' to encourage people to use more specific check commands.
Finally, there's a make test-report which generates a nice HTML version of the test output.
The current test case would catch the couple recent migration regressions.
--- Makefile | 34 ++- scripts/json2c.sh | 5 + test-vmstate.c | 142 +++++++ vmstate/schema.json | 1176 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1355 insertions(+), 2 deletions(-) create mode 100755 scripts/json2c.sh create mode 100644 test-vmstate.c create mode 100644 vmstate/schema.json
Makefile +32 -2
@@ -25,7 +25,8 @@ Makefile: ; configure: ; .PHONY: all clean cscope distclean dvi html info install install-doc \ - pdf recurse-all speed tar tarbin test build-all + pdf recurse-all speed tar tarbin test build-all check-vmstate check \ + check-help $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
@@ -71,7 +72,9 @@ defconfig: -include config-all-devices.mak -build-all: $(DOCS) $(TOOLS) recurse-all +TESTS=test-vmstate + +build-all: $(DOCS) $(TOOLS) $(TESTS) recurse-all config-host.h: config-host.h-timestamp config-host.h-timestamp: config-host.mak
@@ -146,6 +149,33 @@ trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS) simpletrace.o: simpletrace.c $(GENERATED_HEADERS) +vmstate-schema.c: $(SRC_PATH)/vmstate/schema.json + $(call quiet-command,$(SRC_PATH)/scripts/json2c.sh < $^ > $@," GEN $@") + +test-vmstate-obj-y = qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o qjson.o +test-vmstate-obj-y += json-streamer.o json-lexer.o json-parser.o +test-vmstate-obj-y += vmstate-schema.o qemu-malloc.o $(oslib-obj-y) + +test-vmstate: test-vmstate.o $(test-vmstate-obj-y) + +check-vmstate: test-vmstate + @./test-vmstate + +check: check-vmstate + +check-help: + @echo " make check run all check tests against build" + @echo " make check-vmstate run VMState checks" + @echo " make test-report.html make an HTML report of make check" + +test-report.log: $(TESTS) + @gtester -k -o $@ $^ + +test-report.html: test-report.log + @gtester-report $^ > $@ + +-include $(SUBDIR_DEVICES_MAK_DEP) + version.o: $(SRC_PATH)/version.rc config-host.mak $(call quiet-command,$(WINDRES) -I. -o $@ $<," RC $(TARGET_DIR)$@")
scripts/json2c.sh new file +5 -0
@@ -0,0 +1,5 @@ +#!/bin/sh + +echo 'const char *vmstate_schema_json = ' +sed -e "s:\":\':g;s:^\(.*\)$: \"\1\":g" +echo ' ;'
test-vmstate.c new file +142 -0
142 lines not on this page · raw message
vmstate/schema.json new file +1176 -0
1,176 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Re: [Qemu-devel] [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
Quoted 15 lines · Anthony Liguori
We've had lots of issues surrounding live migration breaking. This is because we haven't had a good way to validate that what we're migrating isn't changing underneath of us.
This test works by first converting the in-tree schema to C source as a string. This is built into the test case. The test case will then query QEMU for the current schema.
It converts both strings to QObjects via the JSON parser and then does a recursive diff. Unlike a simple diff command, this lets us say exactly what you did to break migration. For instance, you get error messages like:
You broke migration by changing the type of field 'par' in device 'cpu', version 1 from 'uint32' to 'uint64'.
Quoted 8 lines
It only covers devices that support VMState and it currently doesn't look at subsections yet.
The in-tree schema needs to be updated whenever migration changes but this ends up being a very nice way to ensure that we're reviewing migration protocol changes.
The test case is built in the default build, and can be run by `make check'.
This test takes a disturbingly long time to run considering what it's doing (~3 seconds). Turns out, the JSON parser is horribly slow because it allocates and frees memory faster than a hummingbird on steroids.
I have a local patch that removes this and afterwards the test runs in just 70ms. I'll send that fix out tomorrow.
Regards,
Anthony Liguori
Re: [Qemu-devel] [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
In reply to Anthony Liguoritest-vmstate.c line 104
Quoted 9 lines · Anthony Liguori
test-vmstate.c new file +9
-0+static QObject *read_current_schema (void ) +{ + char buffer[65536]; + int fd; + int ret; + size_t offset = 0; + ssize_t len; + + ret = system("i386-softmmu/qemu -vmstate-dump > /tmp/schema.json");
Please don't hardcode i386-softmmu, there should at least be a way to override it. For example, I tend to build x86_64-softmmu only.
Using a temporary file is not ideal because as soon as this program runs as part of an automated build system we could be clobbering the file if multiple runs are going in parallel. How about popen(3)?
Quoted 8 lines
vmstate/schema.json new file +2
-0@@ -0,0 +1,1176 @@ +{ + "cpu": {
vmstate/schema.json line 12
Quoted 10 lines
vmstate/schema.json new file +10
-0+ "mcg_cap": "uint64", + "a20_mask": "int32", + "tsc_offset": "uint64", + "idt": { + "flags": "uint32", + "limit": "uint32", + "selector": "uint32", + "base": "uint32", + "__version__": 1 + },
Is field ordering important and did we lose that information as soon as we started using dicts to represent vmstate dumps?
Stefan
Re: [Qemu-devel] [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
In reply to Anthony LiguoriQuoted 4 lines · Anthony Liguori
+ if (
old_version!=new_version) {
+ g_error("Version %d of device `%s' is available in QEMU, but schema still reports %d, please update schema.\n",
+ new_version, device,old_version);
+ }
Might be nice for these "please update" error messages to include a pointer to a docs file explaining in more detail how to do that?
(also >80 char line ;-))
vmstate/schema.json line 5
Quoted 11 lines
vmstate/schema.json new file +5
-0@@ -0,0 +1,1176 @@ +{ + "cpu": { + "mcg_cap": "uint64", + "a20_mask": "int32", + "tsc_offset": "uint64",
This schema file appears to be board-specific (or at least x86-specific) -- shouldn't the cpu/board/whatever name be in the filename, so we have scope to expand the test to checking migration issues for other platforms too?
(I don't care much about ARM migration breakages just at the moment but I suspect that it will be becoming more important by this time next year...)
Also since this looks like an autogenerated file that's going to be going into version control maybe it should have a comment header at the top of the "autogenerated, do not edit by hand!" type.
-- PMM
Re: [Qemu-devel] [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
Quoted 9 lines · Peter Maydell
test-vmstate.c line 34
Quoted 4 lines · Anthony Liguori
test-vmstate.c new file +4
-0+if (old_version != new_version) { +g_error ("Version %d of device `%s' is available in QEMU, but schema still reports %d, please update schema.\n" , + new_version, device, old_version); + }Might be nice for these "please update" error messages to include a pointer to a docs file explaining in more detail how to do that?
(also>80 char line ;-))
Ack.
Quoted 7 lines
Quoted 7 lines
vmstate/schema.json new file +1
-0@@ -0,0 +1,1176 @@ +{
Quoted 8 lines
vmstate/schema.json line 5
Quoted 4 lines
vmstate/schema.json new file +4
-0+ "cpu": { + "mcg_cap": "uint64", + "a20_mask": "int32", + "tsc_offset": "uint64",This schema file appears to be board-specific (or at least x86-specific) -- shouldn't the cpu/board/whatever name be in the filename, so we have scope to expand the test to checking migration issues for other platforms too?
It's not really. Every VMStateDescription that is builtin into the tree is in the file.
That said, the only target where the CPU is currently described by VMStateDescription is target-i386.
Right now the file is generated via i386-softmmu. There may be a few devices left out because they are either not compiled into i386-softmmu or are target specific.
We could complicate things further by trying to run against every target and then building a union of all target outputs but I'm not sure it's worth the effort at this stage.
Quoted 8 lines
(I don't care much about ARM migration breakages just at the moment but I suspect that it will be becoming more important by this time next year...)
Also since this looks like an autogenerated file that's going to be going into version control maybe it should have a comment header at the top of the "autogenerated, do not edit by hand!" type.
JSON doesn't support comments.. I can add comment parsing to our parser though.
Regards,
Anthony Liguori
Quoted 2 lines
-- PMM
[Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
Quoted 47 lines · Anthony Liguori
Quoted 9 lines · Peter Maydell
test-vmstate.c line 34
Quoted 4 lines · Anthony Liguori
test-vmstate.c new file +4
-0+if (old_version != new_version) { +g_error ("Version %d of device `%s' is available in QEMU, but schema still reports %d, please update schema.\n" , + new_version, device, old_version); + }Might be nice for these "please update" error messages to include a pointer to a docs file explaining in more detail how to do that?
(also>80 char line ;-))Ack.
Quoted 7 lines
Quoted 7 lines
vmstate/schema.json new file +1
-0@@ -0,0 +1,1176 @@ +{Quoted 8 lines
vmstate/schema.json line 5
Quoted 4 lines
vmstate/schema.json new file +4
-0+ "cpu": { + "mcg_cap": "uint64", + "a20_mask": "int32", + "tsc_offset": "uint64",This schema file appears to be board-specific (or at least x86-specific) -- shouldn't the cpu/board/whatever name be in the filename, so we have scope to expand the test to checking migration issues for other platforms too?
It's not really. Every VMStateDescription that is builtin into the tree is in the file.
That said, the only target where the CPU is currently described by VMStateDescription is target-i386.
Right now the file is generated via i386-softmmu. There may be a few devices left out because they are either not compiled into i386-softmmu or are target specific.
We could complicate things further by trying to run against every target and then building a union of all target outputs but I'm not sure it's worth the effort at this stage.
Quoted 4 lines
(I don't care much about ARM migration breakages just at the moment but I suspect that it will be becoming more important by this time next year...)
Quoted 7 lines
Quoted 4 lines
Also since this looks like an autogenerated file that's going to be going into version control maybe it should have a comment header at the top of the "autogenerated, do not edit by hand!" type.
JSON doesn't support comments.. I can add comment parsing to our parser though.
We need to fix the ordering problem.
Whatever schema we have should be good enough to allow:
- describe me this blob that contains the state for this device.
eepro100 at least is missing. Althought I would vote to just change the eepro100 "naming" to always use eepro100 or similar, and remove the current hack of having to change the vmstate->name for each different device.
Later, Juan.
Re: [Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
Quoted 46 lines · Juan Quintela
Quoted 45 lines · Anthony Liguori
Quoted 9 lines · Peter Maydell
test-vmstate.c line 34
Quoted 4 lines · Anthony Liguori
test-vmstate.c new file +4
-0+if (old_version != new_version) { +g_error ("Version %d of device `%s' is available in QEMU, but schema still reports %d, please update schema.\n" , + new_version, device, old_version); + }Might be nice for these "please update" error messages to include a pointer to a docs file explaining in more detail how to do that?
(also>80 char line ;-))Ack.
Quoted 7 lines
Quoted 7 lines
vmstate/schema.json new file +1
-0@@ -0,0 +1,1176 @@ +{Quoted 8 lines
vmstate/schema.json line 5
Quoted 4 lines
vmstate/schema.json new file +4
-0+ "cpu": { + "mcg_cap": "uint64", + "a20_mask": "int32", + "tsc_offset": "uint64",This schema file appears to be board-specific (or at least x86-specific) -- shouldn't the cpu/board/whatever name be in the filename, so we have scope to expand the test to checking migration issues for other platforms too?
It's not really. Every VMStateDescription that is builtin into the tree is in the file.
That said, the only target where the CPU is currently described by VMStateDescription is target-i386.
Right now the file is generated via i386-softmmu. There may be a few devices left out because they are either not compiled into i386-softmmu or are target specific.
We could complicate things further by trying to run against every target and then building a union of all target outputs but I'm not sure it's worth the effort at this stage.
Quoted 4 lines
(I don't care much about ARM migration breakages just at the moment but I suspect that it will be becoming more important by this time next year...)
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Also since this looks like an autogenerated file that's going to be going into version control maybe it should have a comment header at the top of the "autogenerated, do not edit by hand!" type.
JSON doesn't support comments.. I can add comment parsing to our parser though.
We need to fix the ordering problem.
Dunno what you mean by ordering.
Quoted 2 lines
Whatever schema we have should be good enough to allow:
- describe me this blob that contains the state for this device.
Schema for VMState is different than what's used for this test case here. I agree, it's a harder problem than just what's being spit out here :-)
Quoted 4 lines
eepro100 at least is missing. Althought I would vote to just change the eepro100 "naming" to always use eepro100 or similar, and remove the current hack of having to change the
vmstate->namefor each different device.
I just ran into eepro100 and my head nearly exploded.
I set the name to be eepro100-base and then just added that once. A better solution would be to separate out the fields such that we can have a bunch of VMStateDescriptions that all use the same fields.
I think we ought to merge VMStateDescription into DeviceInfo. For compatibility, we probably need a vmstate_alias name since the device names don't always map 1-1 with the qdev names. But this should eliminate the problem of reusing VMStateDescriptions for multiple devices.
Regards,
Anthony Liguori
Quoted 2 lines
Later, Juan.
Re: [Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
Quoted 4 lines · Anthony Liguori
I think we ought to merge VMStateDescription into DeviceInfo. For compatibility, we probably need a
vmstate_aliasname since the device names don't always map 1-1 with the qdev names. But this should eliminate the problem of reusing VMStateDescriptions for multiple devices.
That's a feature, not a bug. Consider eg hw/pl110.c -- there are two different DeviceInfo devices but since the underlying implementation is the same you definitely don't want to have two separate VMStateDescription structures to get out of sync.
-- PMM
Re: [Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
Quoted 10 lines · Peter Maydell
Quoted 4 lines · Anthony Liguori
I think we ought to merge VMStateDescription into DeviceInfo. For compatibility, we probably need a
vmstate_aliasname since the device names don't always map 1-1 with the qdev names. But this should eliminate the problem of reusing VMStateDescriptions for multiple devices.That's a feature, not a bug. Consider eg
hw/pl110.c-- there are two different DeviceInfo devices but since the underlying implementation is the same you definitely don't want to have two separate VMStateDescription structures to get out of sync.
Yep. i8254/apic/ioapic vs. (upcoming) i8254-kvm/apic-kvm/ioapic-kvm will provide further use cases.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Re: [Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
In reply to Peter MaydellQuoted 9 lines · Peter Maydell
Quoted 4 lines · Anthony Liguori
I think we ought to merge VMStateDescription into DeviceInfo. For compatibility, we probably need a
vmstate_aliasname since the device names don't always map 1-1 with the qdev names. But this should eliminate the problem of reusing VMStateDescriptions for multiple devices.That's a feature, not a bug. Consider eg
hw/pl110.c-- there are two different DeviceInfo devices but since the underlying implementation is the same you definitely don't want to have two separate VMStateDescription structures to get out of sync.
No, it's a bug.
Migration uses the VMStateDescription name as a section identifier. The section identifiers MUST be unique for a given device. Otherwise, if both devices are present, migration fails miserably. It also means that if the wrong devices are created on the destination, instead of predictable failure, you get unpredictable guest corruption.
The Right Way to support what you're describing above is to have a single VMStateField array and two VMStateDescriptions. IOW:
VMStateField pl110_fields[] = {
VMSTATE_INT32(versatile, pl110_state),
VMSTATE_UINT32_ARRAY(timing, pl110_state, 4),
VMSTATE_UINT32(cr, pl110_state),
VMSTATE_UINT32(upbase, pl110_state),
VMSTATE_UINT32(lpbase, pl110_state),
VMSTATE_UINT32(int_status, pl110_state),
....
};VMStateDescription vmstate_pl110 = {
.name = "pl110",
...
.fields = pl110_fields,
};VMStateDescription vmstate_pl110_versatile = {
.name = "pl110-versatile",
...
.fields = pl110_fields,
};Merging VMStateDescription with DeviceInfo will force this on people making it difficult to make this mistake again.
Regards,
Anthony Liguori
Quoted 2 lines
-- PMM
Re: [Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
Quoted 11 lines · Anthony Liguori
Quoted 9 lines · Peter Maydell
Quoted 4 lines · Anthony Liguori
I think we ought to merge VMStateDescription into DeviceInfo. For compatibility, we probably need a
vmstate_aliasname since the device names don't always map 1-1 with the qdev names. But this should eliminate the problem of reusing VMStateDescriptions for multiple devices.That's a feature, not a bug. Consider eg
hw/pl110.c-- there are two different DeviceInfo devices but since the underlying implementation is the same you definitely don't want to have two separate VMStateDescription structures to get out of sync.
Quoted 7 lines
No, it's a bug.
Migration uses the VMStateDescription name as a section identifier. The section identifiers MUST be unique for a given device. Otherwise, if both devices are present, migration fails miserably. It also means that if the wrong devices are created on the destination, instead of predictable failure, you get unpredictable guest corruption.
This is true for incompatible devices, but not for those that are perfectly exchangeable (like in-kernel vs. user-space irqchip).
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Re: [Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
Quoted 3 lines · Jan Kiszka
This is true for incompatible devices, but not for those that are perfectly exchangeable (like in-kernel vs. user-space irqchip).
I view this as the exception that proves the rule.
We should handle cases like this as very special cases. I've found almost close to a dozen cases where we've got devices with conflicting names that aren't compatible and so far, none that truly are.
Regards,
Anthony Liguori
Quoted 2 lines
Jan
Re: [Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
In reply to Anthony LiguoriQuoted 3 lines · Anthony Liguori
Migration uses the VMStateDescription name as a section identifier. The section identifiers MUST be unique for a given device. Otherwise, if both devices are present, migration fails miserably.
So how does it work if you have two devices of the same type in the system? I'd assumed that the unique identifier would be one based on the actually instantiated devices.
Quoted 6 lines
It also means that if the
wrong devices are created on the destination, instead of predictable failure, you get unpredictable guest corruption.The Right Way to support what you're describing above is to have a single VMStateField array and two VMStateDescriptions. IOW:
This doesn't make sense because it's decoupling the information about minimum version ID etc (in the VMStateDescription) from the information about which fields are in which version (which is in the VMStateField array when it's initialised via VMSTATE_*_V() macros). So although you get to avoid duplicating all the fields in the arrangement you suggest you still end up with version_id, minimum_version_id etc being duplicated and needing to stay in sync.
-- PMM
Re: [Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
Quoted 7 lines · Peter Maydell
Quoted 3 lines · Anthony Liguori
Migration uses the VMStateDescription name as a section identifier. The section identifiers MUST be unique for a given device. Otherwise, if both devices are present, migration fails miserably.
So how does it work if you have two devices of the same type in the system? I'd assumed that the unique identifier would be one based on the actually instantiated devices.
It's a combination of the section name + a device instance ID that has some magic behind making it unique and stable. But instance ID is not unique on it's own.
Quoted 6 lines
Quoted 6 lines
It also means that if the
wrong devices are created on the destination, instead of predictable failure, you get unpredictable guest corruption.The Right Way to support what you're describing above is to have a single VMStateField array and two VMStateDescriptions. IOW:
Quoted 8 lines
This doesn't make sense because it's decoupling the information about minimum version ID etc (in the VMStateDescription) from the information about which fields are in which version (which is in the VMStateField array when it's initialised via VMSTATE_*_V() macros). So although you get to avoid duplicating all the fields in the arrangement you suggest you still end up with
version_id,minimum_version_idetc being duplicated and needing to stay in sync.
So maybe we just need to remove name from VMStateDescription and force it to come from DeviceInfo.
Regards,
Anthony Liguori
Quoted 2 lines
-- PMM
[Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
In reply to Anthony LiguoriQuoted 5 lines · Anthony Liguori
Quoted 2 lines · Juan Quintela
Anthony Liguori<[email protected]> wrote:
We need to fix the ordering problem.Dunno what you mean by ordering.
vmstate:
static const VMStateDescription vmstate_cpu = {
.name = "cpu",
.version_id = CPU_SAVE_VERSION, .minimum_version_id = 3, .minimum_version_id_old = 3,
.pre_save = cpu_pre_save,
.post_load = cpu_post_load,
.fields = (VMStateField []) {
VMSTATE_UINTTL_ARRAY(regs, CPUState, CPU_NB_REGS), VMSTATE_UINTTL(eip, CPUState), VMSTATE_UINTTL(eflags, CPUState), VMSTATE_UINT32(hflags, CPUState),
/* FPU */
vs
dump
"cpu": {
"mcg_cap": "uint64",
"a20_mask": "int32",
"tsc_offset": "uint64",
"idt": {
"flags": "uint32",
"limit": "uint32",
"selector": "uint32",
"base": "uint32",
"__version__": 1
},
"intercept_cr_write": "uint16",
"nmi_injected": "uint8", You see that they are not in same order, then I can't use the schema to read an arbitrary savevm image. I think that ordering should be preserved, makes schema much, much more useful.
Once told that, I think that doing a big schema is just wrong, we should do an schema for device (or at least for architecture). And no hardcoded names (as they are today). It is just trivial to run it for x86_64-softmmu/i386-softmmu (the things that should work nowadays).
That way, downstreams can use it for its own "minimal machines".
Quoted 6 lines
Quoted 2 lines
Whatever schema we have should be good enough to allow:
- describe me this blob that contains the state for this device.Schema for VMState is different than what's used for this test case here. I agree, it's a harder problem than just what's being spit out here :-)
It should be the same IMHO, it will not complicate anything here, and just make it more useful.
Quoted 6 lines
Quoted 4 lines
eepro100 at least is missing. Althought I would vote to just change the eepro100 "naming" to always use eepro100 or similar, and remove the current hack of having to change the
vmstate->namefor each different device.I just ran into eepro100 and my head nearly exploded.
Being there, know the feeling.
Quoted 9 lines
I set the name to be eepro100-base and then just added that once. A better solution would be to separate out the fields such that we can have a bunch of VMStateDescriptions that all use the same fields.
I think we ought to merge VMStateDescription into DeviceInfo. For compatibility, we probably need a
vmstate_aliasname since the device names don't always map 1-1 with the qdev names. But this should eliminate the problem of reusing VMStateDescriptions for multiple devices.
Agreed with that.
Later, Juan.
[Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
Quoted 41 lines · Juan Quintela
Quoted 4 lines · Anthony Liguori
Quoted 2 lines · Juan Quintela
Anthony Liguori<[email protected]> wrote:
We need to fix the ordering problem.Dunno what you mean by ordering.
vmstate:
static const VMStateDescription
vmstate_cpu= {
.name = "cpu",
.version_id =CPU_SAVE_VERSION, .minimum_version_id = 3, .minimum_version_id_old = 3,
.pre_save =cpu_pre_save,
.post_load =cpu_post_load,
.fields = (VMStateField []) {
VMSTATE_UINTTL_ARRAY(regs, CPUState, CPU_NB_REGS),VMSTATE_UINTTL(eip, CPUState),VMSTATE_UINTTL(eflags, CPUState),VMSTATE_UINT32(hflags, CPUState),
/* FPU */vs
dump
"cpu": { "mcg_cap": "uint64", "a20_mask": "int32", "tsc_offset": "uint64", "idt": { "flags": "uint32", "limit": "uint32", "selector": "uint32", "base": "uint32", "__version__": 1 }, "intercept_cr_write": "uint16", "nmi_injected": "uint8",
Quoted 3 lines
You see that they are not in same order, then I can't use the schema to read an arbitrary savevm image. I think that ordering should be preserved, makes schema much, much more useful.
This is *only* for testing right now. We can enhance it down the road if we want to but this is an opaque thing that's only there to enable test cases to be written.
Quoted 7 lines
Once told that, I think that doing a big schema is just wrong, we should do an schema for device (or at least for architecture). And no hardcoded names (as they are today). It is just trivial to run it for x86_64-softmmu/i386-softmmu (the things that should work nowadays).
That way, downstreams can use it for its own "minimal machines".
I agree, we ought to try to make this schema more consumable. But some of that is that the schema needs to describe types in a more meaningful way as there's a lot of weird types right now.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Whatever schema we have should be good enough to allow:
- describe me this blob that contains the state for this device.Schema for VMState is different than what's used for this test case here. I agree, it's a harder problem than just what's being spit out here :-)
It should be the same IMHO, it will not complicate anything here, and just make it more useful.
Yeah, it will tremendously complicate things because QDict's don't preserve order. It's all fixable but why wait to have something that's incredibly useful in tree?
Quoted 11 lines
Quoted 5 lines
Quoted 4 lines
eepro100 at least is missing. Althought I would vote to just change the eepro100 "naming" to always use eepro100 or similar, and remove the current hack of having to change the
vmstate->namefor each different device.I just ran into eepro100 and my head nearly exploded.
Being there, know the feeling.
Quoted 4 lines
I set the name to be eepro100-base and then just added that once. A better solution would be to separate out the fields such that we can have a bunch of VMStateDescriptions that all use the same fields.
Quoted 6 lines
Quoted 5 lines
I think we ought to merge VMStateDescription into DeviceInfo. For compatibility, we probably need a
vmstate_aliasname since the device names don't always map 1-1 with the qdev names. But this should eliminate the problem of reusing VMStateDescriptions for multiple devices.Agreed with that.
Once we settle on the unit tests, I can look at writing some scripts to do this.
Regards,
Anthony Liguori
Quoted 1 line
Later, Juan.
[Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
Quoted 10 lines · Anthony Liguori
Quoted 9 lines · Juan Quintela
Quoted 2 lines · Anthony Liguori
Quoted 1 line · Juan Quintela
Anthony Liguori<[email protected]> wrote:
Once told that, I think that doing a big schema is just wrong, we should do an schema for device (or at least for architecture). And no hardcoded names (as they are today). It is just trivial to run it for x86_64-softmmu/i386-softmmu (the things that should work nowadays).
Quoted 5 lines
Quoted 1 line
That way, downstreams can use it for its own "minimal machines".
I agree, we ought to try to make this schema more consumable. But some of that is that the schema needs to describe types in a more meaningful way as there's a lot of weird types right now.
I have no clue about qdicts, but it is as easy as:
- add a new field that gives the "order", if this is not possible
- add a new qdict from order -> name
it is not rockets science. I am looking at your patch right now, but my experience with glib, q* and json is inexistant, so I go slowwwwww.
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Whatever schema we have should be good enough to allow:
- describe me this blob that contains the state for this device.Schema for VMState is different than what's used for this test case here. I agree, it's a harder problem than just what's being spit out here :-)
It should be the same IMHO, it will not complicate anything here, and just make it more useful.
Yeah, it will tremendously complicate things because QDict's don't preserve order. It's all fixable but why wait to have something that's incredibly useful in tree?
see above.
Quoted 16 lines
Quoted 16 lines
Quoted 5 lines
Quoted 4 lines
eepro100 at least is missing. Althought I would vote to just change the eepro100 "naming" to always use eepro100 or similar, and remove the current hack of having to change the
vmstate->namefor each different device.I just ran into eepro100 and my head nearly exploded.
Being there, know the feeling.
Quoted 9 lines
I set the name to be eepro100-base and then just added that once. A better solution would be to separate out the fields such that we can have a bunch of VMStateDescriptions that all use the same fields.
I think we ought to merge VMStateDescription into DeviceInfo. For compatibility, we probably need a
vmstate_aliasname since the device names don't always map 1-1 with the qdev names. But this should eliminate the problem of reusing VMStateDescriptions for multiple devices.
Quoted 4 lines
Quoted 1 line
Agreed with that.
Once we settle on the unit tests, I can look at writing some scripts to do this.
I think that we need to improve the code that you sent, but I agree that we can go by parts.
Later, Juan.
[Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
In reply to Peter MaydellQuoted 28 lines · Peter Maydell
Quoted 4 lines · Anthony Liguori
+ if (
old_version!=new_version) {
+ g_error("Version %d of device `%s' is available in QEMU, but schema still reports %d, please update schema.\n",
+ new_version, device,old_version);
+ }Might be nice for these "please update" error messages to include a pointer to a docs file explaining in more detail how to do that?
(also >80 char line ;-))vmstate/schema.json line 5
Quoted 11 lines
vmstate/schema.json new file +5
-0@@ -0,0 +1,1176 @@ +{ + "cpu": { + "mcg_cap": "uint64", + "a20_mask": "int32", + "tsc_offset": "uint64",This schema file appears to be board-specific (or at least x86-specific) -- shouldn't the cpu/board/whatever name be in the filename, so we have scope to expand the test to checking migration issues for other platforms too?
Quoted 8 lines
(I don't care much about ARM migration breakages just at the moment but I suspect that it will be becoming more important by this time next year...)
Also since this looks like an autogenerated file that's going to be going into version control maybe it should have a comment header at the top of the "autogenerated, do not edit by hand!" type.
I agree with you. Just passing another argument to all programs telling what we are talking about would be much better for this.
And we need (at least) x86_64 & i386 (this ones are supposed to work). ARM people are sending lots of vmstate changes, I guess/hope that somebody is trying to get it working.
/me looks at Peter O:-), hint, hint, ...
Any idea if there are images for testing ARM?
Later, Juan.
[Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
Quoted 5 lines · Juan Quintela
Peter Maydell <[email protected]> wrote:
ARM people are sending lots of vmstate changes, I guess/hope that somebody is trying to get it working./me looks at Peter O:-), hint, hint, ...
Well, the main thing I care about currently (or did back before Christmas which is when I sent a patchset to add save/restore to a pile of ARM devices) is simple save-and-restore for debugging use. The rest is just that patches don't get through code review unless they get the vmstate stuff right, and I care about not being rejected :-)
I think it's still the case that there are devices in some of the ARM devboards with no save/restore support at all. I would really prefer it if the default for a device was "I do not support this" with the things like USB where somebody has audited them as genuinely needing no save/restore code explicitly marked as "this is OK"; then we could easily determine what needed fixing and not offer a broken facility to users.
Quoted 1 line
Any idea if there are images for testing ARM?
There are prebuilt images on Aurelien's website for ARM and others, which is the simplest thing:
http://www.aurel32.net/info/debian_arm_qemu.php
-- PMM
[Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
Quoted 14 lines · Peter Maydell
Quoted 5 lines · Juan Quintela
Peter Maydell <[email protected]> wrote:
ARM people are sending lots of vmstate changes, I guess/hope that somebody is trying to get it working./me looks at Peter O:-), hint, hint, ...
Well, the main thing I care about currently (or did back before Christmas which is when I sent a patchset to add save/restore to a pile of ARM devices) is simple save-and-restore for debugging use. The rest is just that patches don't get through code review unless they get the vmstate stuff right, and I care about not being rejected :-)
Quoted 8 lines
I think it's still the case that there are devices in some of the ARM devboards with no save/restore support at all. I would really prefer it if the default for a device was "I do not support this" with the things like USB where somebody has audited them as genuinely needing no save/restore code explicitly marked as "this is OK"; then we could easily determine what needed fixing and not offer a broken facility to users.
I agree, but that means (again), review of all devices to change the defaults. It is on my ToDo list (but my ToDo list is huge :-(
Quoted 5 lines
Quoted 1 line
Any idea if there are images for testing ARM?
There are prebuilt images on Aurelien's website for ARM and others, which is the simplest thing:
http://www.aurel32.net/info/debian_arm_qemu.php
That images don't migrate for me at all. Guest got hung after migration, at least some state (probably irq's) are not passed correctly.
Later, Juan.
[Qemu-devel] Re: [PATCH 11/11] test-vmstate: add test case to verify we don't change VMState
Quoted 8 lines · Juan Quintela
Quoted 3 lines · Peter Maydell
There are prebuilt images on Aurelien's website for ARM and others, which is the simplest thing:
http://www.aurel32.net/info/debian_arm_qemu.phpThat images don't migrate for me at all. Guest got hung after migration, at least some state (probably irq's) are not passed correctly.
Yeah, I said they were probably buggy. The only thing I've ever tested is vmsave/restore for versatilepb, and that was a few months ago now.
-- PMM