Patchwork Fix ioapic vmstate

login
register
mail settings
Submitter Pavel Dovgaluk
Date June 17, 2011, 7:30 a.m.
Message ID <001f01cc2cc0$6b7933f0$426b9bd0$@Dovgaluk@ispras.ru>
Download mbox | patch
Permalink /patch/100767/
State New
Headers show

Comments

Pavel Dovgaluk - June 17, 2011, 7:30 a.m.
This patch fixes save/restore vmstate of IOAPIC.
  When irr member of IOAPICState is not saved and loaded,
restoring becomes non-deterministic, because irr is kept from
state of VM that was before loading.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@gmail.com>
---
 hw/ioapic.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Andreas Färber - June 17, 2011, 7:20 p.m.
Am 17.06.2011 um 09:30 schrieb Pavel Dovgaluk:

>  This patch fixes save/restore vmstate of IOAPIC.
>  When irr member of IOAPICState is not saved and loaded,
> restoring becomes non-deterministic, because irr is kept from
> state of VM that was before loading.
>
> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@gmail.com>
> ---
> hw/ioapic.c |    1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/hw/ioapic.c b/hw/ioapic.c
> index 2109568..e583284 100644
> --- a/hw/ioapic.c
> +++ b/hw/ioapic.c
> @@ -207,6 +207,7 @@ static const VMStateDescription vmstate_ioapic = {
>     .fields      = (VMStateField []) {
>         VMSTATE_UINT8(id, IOAPICState),
>         VMSTATE_UINT8(ioregsel, IOAPICState),
> +        VMSTATE_UINT32(irr, IOAPICState),
>         VMSTATE_UINT64_ARRAY(ioredtbl, IOAPICState, IOAPIC_NUM_PINS),
>         VMSTATE_END_OF_LIST()
>     }

You can't just add a field to VMState. Either the version_id must be  
incremented, or a subsection must be used.

Andreas

Patch

diff --git a/hw/ioapic.c b/hw/ioapic.c
index 2109568..e583284 100644
--- a/hw/ioapic.c
+++ b/hw/ioapic.c
@@ -207,6 +207,7 @@  static const VMStateDescription vmstate_ioapic = {
     .fields      = (VMStateField []) {
         VMSTATE_UINT8(id, IOAPICState),
         VMSTATE_UINT8(ioregsel, IOAPICState),
+        VMSTATE_UINT32(irr, IOAPICState),
         VMSTATE_UINT64_ARRAY(ioredtbl, IOAPICState, IOAPIC_NUM_PINS),
         VMSTATE_END_OF_LIST()
     }