Skip to content

Commit

Permalink
hw/isa/piix4: Migrate Reset Control Register
Browse files Browse the repository at this point in the history
When adding the Reset register in commit 5790b75 we
forgot to migrate it.

While it is possible a VM using the PIIX4 is migrated just
after requesting a system shutdown, it is very unlikely.
However when restoring a migrated VM, we might have the
RCR bit #4 set on the stack and when the VM resume it
directly shutdowns.

Add a post_load() migration handler and set the default
RCR value to 0 for earlier versions, assuming the VM was
not going to shutdown before migration.

Fixes: 5790b75 ("piix4: Add the Reset Control Register")
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
philmd committed Apr 13, 2021
1 parent 50fab4c commit 6227120
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion hw/isa/piix4.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,25 @@ static void piix4_isa_reset(DeviceState *dev)
pci_conf[0xae] = 0x00;
}

static int piix4_ide_post_load(void *opaque, int version_id)
{
PIIX4State *s = opaque;

if (version_id == 2) {
s->rcr = 0;
}

return 0;
}

static const VMStateDescription vmstate_piix4 = {
.name = "PIIX4",
.version_id = 2,
.version_id = 3,
.minimum_version_id = 2,
.post_load = piix4_ide_post_load,
.fields = (VMStateField[]) {
VMSTATE_PCI_DEVICE(dev, PIIX4State),
VMSTATE_UINT8_V(rcr, PIIX4State, 3),
VMSTATE_END_OF_LIST()
}
};
Expand Down

0 comments on commit 6227120

Please sign in to comment.