[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] acpi_piix4: fix migration of gpe fields
From: |
Philipp Hahn |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] acpi_piix4: fix migration of gpe fields |
Date: |
Mon, 20 Mar 2017 13:02:10 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 |
Hello Marcelo, cc:qemu,
Sorry for re-using this old thread, but I have a problem loading some
saved state from qemu-kvm-1.1.2, which fails for piix4_pm.
You following patch was committed as
<http://git.qemu-project.org/?p=qemu.git;a=commitdiff;h=b0b873a07872f7ab7f66f259c73fb9dd42aa66a9>:
Am 15.11.2012 um 01:11 schrieb Marcelo Tosatti:
> Migrate 16 bytes for en/sts fields (which is the correct size),
> increase version to 3, and document how to support incoming
> migration from qemu-kvm 1.2.
I my case qemu-kvm-1.1.2/hw/acpi_piix4.c:284
| VMSTATE_STRUCT(ar.gpe, PIIX4PMState, 2, vmstate_gpe, ACPIGPE),
only saves 4 bytes, not 16 bytes.
> Acked-by: Paolo Bonzini <address@hidden>
> Signed-off-by: Marcelo Tosatti <address@hidden>
> ---
> hw/acpi_piix4.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++----
> 1 files changed, 46 insertions(+), 4 deletions(-)
>
> diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
> index 15275cf..519269a 100644
> --- a/hw/acpi_piix4.c
> +++ b/hw/acpi_piix4.c
> @@ -235,10 +235,9 @@ static int vmstate_acpi_post_load(void *opaque, int
> version_id)
> { \
> .name = (stringify(_field)), \
> .version_id = 0, \
> - .num = GPE_LEN, \
> .info = &vmstate_info_uint16, \
> .size = sizeof(uint16_t), \
> - .flags = VMS_ARRAY | VMS_POINTER, \
> + .flags = VMS_SINGLE | VMS_POINTER, \
> .offset = vmstate_offset_pointer(_state, _field, uint8_t), \
> }
>
> @@ -267,11 +266,54 @@ static const VMStateDescription vmstate_pci_status = {
> }
> };
On load qemu-2.8 uses this function
> +static int acpi_load_old(QEMUFile *f, void *opaque, int version_id)
> +{
> + PIIX4PMState *s = opaque;
> + int ret, i;
> + uint16_t temp;
> +
> + ret = pci_device_load(&s->dev, f);
> + if (ret < 0) {
> + return ret;
> + }
> + qemu_get_be16s(f, &s->ar.pm1.evt.sts);
> + qemu_get_be16s(f, &s->ar.pm1.evt.en);
> + qemu_get_be16s(f, &s->ar.pm1.cnt.cnt);
> +
> + ret = vmstate_load_state(f, &vmstate_apm, opaque, 1);
> + if (ret) {
> + return ret;
> + }
> +
> + qemu_get_timer(f, s->ar.tmr.timer);
> + qemu_get_sbe64s(f, &s->ar.tmr.overflow_time);
> +
> + qemu_get_be16s(f, (uint16_t *)s->ar.gpe.sts);
> + for (i = 0; i < 3; i++) {
> + qemu_get_be16s(f, &temp);
> + }
and the loop loads 6 extra bytes here
> +
> + qemu_get_be16s(f, (uint16_t *)s->ar.gpe.en);
> + for (i = 0; i < 3; i++) {
> + qemu_get_be16s(f, &temp);
> + }
and 6 here.
So in total 12 bytes are read too much and qemu_loadvm_state() ends
somewhere in the middle of the next device state section. (patch 0001
helped me to identify that offset)
If I apply the attached 0002 patch, I can load the old VM state.
> +
> + ret = vmstate_load_state(f, &vmstate_pci_status, opaque, 1);
> + return ret;
> +}
> +
> +/* qemu-kvm 1.2 uses version 3 but advertised as 2
> + * To support incoming qemu-kvm 1.2 migration, change version_id
> + * and minimum_version_id to 2 below (which breaks migration from
> + * qemu 1.2).
> + *
> + */
> static const VMStateDescription vmstate_acpi = {
> .name = "piix4_pm",
> - .version_id = 2,
> - .minimum_version_id = 1,
> + .version_id = 3,
> + .minimum_version_id = 3,
> .minimum_version_id_old = 1,
> + .load_state_old = acpi_load_old,
> .post_load = vmstate_acpi_post_load,
> .fields = (VMStateField []) {
> VMSTATE_PCI_DEVICE(dev, PIIX4PMState),
>
Do you remember why 16 bytes were saved in your case?
Thank you in advance.
Philipp
0002-0007-Bug-38877-fix-qemu-kvm-1.1-piix4_pm-incompatibi.patch
Description: Text Data
0001-0006-Bug-38877-debug-loadvm-offset.patch
Description: Text Data
- Re: [Qemu-devel] [PATCH 1/2] acpi_piix4: fix migration of gpe fields,
Philipp Hahn <=