All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm <kvm@vger.kernel.org>,
	qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>
Subject: Re: [PATCH] acpi_piix4: fix migration of gpe fields
Date: Wed, 31 Oct 2012 09:30:19 +0100	[thread overview]
Message-ID: <5090E19B.1070806@redhat.com> (raw)
In-Reply-To: <20121030231419.GA19828@amt.cnet>

Il 31/10/2012 00:14, Marcelo Tosatti ha scritto:
> 
> 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.
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> 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 = {
>      }
>  };
>  
> +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);
> +    }
> +
> +    qemu_get_be16s(f, (uint16_t *)s->ar.gpe.en);
> +    for (i = 0; i < 3; i++) {
> +        qemu_get_be16s(f, &temp);
> +    }
> +
> +    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),
> 

ACK

Paolo

WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel@nongnu.org, kvm <kvm@vger.kernel.org>,
	Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] acpi_piix4: fix migration of gpe fields
Date: Wed, 31 Oct 2012 09:30:19 +0100	[thread overview]
Message-ID: <5090E19B.1070806@redhat.com> (raw)
In-Reply-To: <20121030231419.GA19828@amt.cnet>

Il 31/10/2012 00:14, Marcelo Tosatti ha scritto:
> 
> 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.
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> 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 = {
>      }
>  };
>  
> +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);
> +    }
> +
> +    qemu_get_be16s(f, (uint16_t *)s->ar.gpe.en);
> +    for (i = 0; i < 3; i++) {
> +        qemu_get_be16s(f, &temp);
> +    }
> +
> +    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),
> 

ACK

Paolo

  reply	other threads:[~2012-10-31  8:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-30 23:14 [PATCH] acpi_piix4: fix migration of gpe fields Marcelo Tosatti
2012-10-30 23:14 ` [Qemu-devel] " Marcelo Tosatti
2012-10-31  8:30 ` Paolo Bonzini [this message]
2012-10-31  8:30   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5090E19B.1070806@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.