]> git.proxmox.com Git - mirror_qemu.git/commitdiff
gt64xxx_pci: Add VMStateDescription
authorSanjay Lal <sanjayl@kymasys.com>
Fri, 20 Jun 2014 13:59:58 +0000 (14:59 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Fri, 20 Jun 2014 21:40:16 +0000 (23:40 +0200)
Add VMStateDescription for GT64120 PCI emulation used by the Malta
platform, to allow it to work with savevm/loadvm and live migration.

The entire register array is saved/restored using VMSTATE_UINT32_ARRAY
(fixed length GT_REGS = 1024).

Signed-off-by: Sanjay Lal <sanjayl@kymasys.com>
[james.hogan@imgtec.com: Convert to VMState]
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Andreas Färber <afaerber@suse.de>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
hw/mips/gt64xxx_pci.c

index 6398514c99d2b15cd047149c8457717e352e9347..22f63ce0c8af1a4a5cbb1f128986d7a4bf65e2c9 100644 (file)
@@ -312,6 +312,27 @@ static void gt64120_pci_mapping(GT64120State *s)
     }
 }
 
+static int gt64120_post_load(void *opaque, int version_id)
+{
+    GT64120State *s = opaque;
+
+    gt64120_isd_mapping(s);
+    gt64120_pci_mapping(s);
+
+    return 0;
+}
+
+static const VMStateDescription vmstate_gt64120 = {
+    .name = "gt64120",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .post_load = gt64120_post_load,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT32_ARRAY(regs, GT64120State, GT_REGS),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static void gt64120_writel (void *opaque, hwaddr addr,
                             uint64_t val, unsigned size)
 {
@@ -1174,9 +1195,11 @@ static const TypeInfo gt64120_pci_info = {
 
 static void gt64120_class_init(ObjectClass *klass, void *data)
 {
+    DeviceClass *dc = DEVICE_CLASS(klass);
     SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
 
     sdc->init = gt64120_init;
+    dc->vmsd = &vmstate_gt64120;
 }
 
 static const TypeInfo gt64120_info = {