Patchwork [11/15] pseries: savevm support for VIO devices

login
register
mail settings
Submitter David Gibson
Date Oct. 15, 2012, 12:24 a.m.
Message ID <1350260682-21428-12-git-send-email-david@gibson.dropbear.id.au>
Download mbox | patch
Permalink /patch/191450/
State New
Headers show

Comments

David Gibson - Oct. 15, 2012, 12:24 a.m.
This patch adds helpers to allow PAPR VIO devices to save state common
to all VIO devices during savevm.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/spapr_vio.c |   20 ++++++++++++++++++++
 hw/spapr_vio.h |    5 +++++
 2 files changed, 25 insertions(+)

Patch

diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c
index 848806d..acb2ba9 100644
--- a/hw/spapr_vio.c
+++ b/hw/spapr_vio.c
@@ -543,6 +543,26 @@  static TypeInfo spapr_vio_bridge_info = {
     .class_init    = spapr_vio_bridge_class_init,
 };
 
+const VMStateDescription vmstate_spapr_vio = {
+    .name = "spapr_vio",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField []) {
+        /* Sanity check */
+        VMSTATE_UINT32_EQUAL(reg, VIOsPAPRDevice),
+        VMSTATE_UINT32_EQUAL(irq, VIOsPAPRDevice),
+
+        /* General VIO device state */
+        VMSTATE_UINTTL(signal_state, VIOsPAPRDevice),
+        VMSTATE_UINT64(crq.qladdr, VIOsPAPRDevice),
+        VMSTATE_UINT32(crq.qsize, VIOsPAPRDevice),
+        VMSTATE_UINT32(crq.qnext, VIOsPAPRDevice),
+
+        VMSTATE_END_OF_LIST()
+    },
+};
+
 static void vio_spapr_device_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *k = DEVICE_CLASS(klass);
diff --git a/hw/spapr_vio.h b/hw/spapr_vio.h
index cc85d26..ad8d271 100644
--- a/hw/spapr_vio.h
+++ b/hw/spapr_vio.h
@@ -133,4 +133,9 @@  VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus);
 
 void spapr_vio_quiesce(void);
 
+extern const VMStateDescription vmstate_spapr_vio;
+
+#define VMSTATE_SPAPR_VIO(_f, _s) \
+    VMSTATE_STRUCT(_f, _s, 0, vmstate_spapr_vio, VIOsPAPRDevice)
+
 #endif /* _HW_SPAPR_VIO_H */