Patchwork [0.14?,v2,2/4] ioapic: Save/restore irr

login
register
mail settings
Submitter Jan Kiszka
Date Feb. 3, 2011, 6:25 p.m.
Message ID <450f6655159ac0682be35b8eb47cd4a92d26737e.1296757518.git.jan.kiszka@siemens.com>
Download mbox | patch
Permalink /patch/81700/
State New
Headers show

Comments

Jan Kiszka - Feb. 3, 2011, 6:25 p.m.
This is a guest modifiable state that must be saved/restored properly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/ioapic.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

Patch

diff --git a/hw/ioapic.c b/hw/ioapic.c
index 443c579..edf99cc 100644
--- a/hw/ioapic.c
+++ b/hw/ioapic.c
@@ -231,14 +231,27 @@  static void ioapic_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t va
     }
 }
 
+static int ioapic_post_load(void *opaque, int version_id)
+{
+    IOAPICState *s = opaque;
+
+    if (version_id == 1) {
+        /* set sane values */
+        s->irr = 0;
+    }
+    return 0;
+}
+
 static const VMStateDescription vmstate_ioapic = {
     .name = "ioapic",
-    .version_id = 1,
+    .version_id = 2,
+    .post_load = ioapic_post_load,
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
     .fields      = (VMStateField []) {
         VMSTATE_UINT8(id, IOAPICState),
         VMSTATE_UINT8(ioregsel, IOAPICState),
+        VMSTATE_UINT32_V(irr, IOAPICState, 2),
         VMSTATE_UINT64_ARRAY(ioredtbl, IOAPICState, IOAPIC_NUM_PINS),
         VMSTATE_END_OF_LIST()
     }