qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Zhang, Yang Z" <yang.z.zhang@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	"aliguori@us.ibm.com" <aliguori@us.ibm.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [Qemu-devel] [PATCH v4 7/7] RTC:Allow to migrate from old version
Date: Mon, 19 Mar 2012 12:56:58 +0200	[thread overview]
Message-ID: <4F6710FA.8060405@redhat.com> (raw)
In-Reply-To: <A9667DDFB95DB7438FA9D7D576C3D87E09E789@SHSMSX101.ccr.corp.intel.com>

On 03/19/2012 08:14 AM, Zhang, Yang Z wrote:
> The new logic is compatible with old. So it should not block migrate from old version. But new version cannot migrate to old.
>
> +static int rtc_load_old(QEMUFile *f, void *opaque, int version_id)
> +{
> +    RTCState *s = opaque;
> +
> +    if (version_id > 2) {
> +        return -EINVAL;
> +    }
> +
> +    qemu_get_buffer(f, s->cmos_data, sizeof(s->cmos_data));
> +    /* dummy load for compatibility */
> +    qemu_get_byte(f); /* cmos_index */
> +    qemu_get_be32(f); /* tm_sec */
> +    qemu_get_be32(f); /* tm_min */
> +    qemu_get_be32(f); /* tm_hour */
> +    qemu_get_be32(f); /* tm_wday */
> +    qemu_get_be32(f); /* tm_mday */
> +    qemu_get_be32(f); /* tm_mon */
> +    qemu_get_be32(f); /* tm_year */
> +    qemu_get_be64(f); /* periodic_timer */
> +    qemu_get_be64(f); /* next_periodic_time */
> +    qemu_get_be64(f); /* next_second_time */
> +    qemu_get_be64(f); /* second_timer */
> +    qemu_get_be64(f); /* second_timer2 */
> +    qemu_get_be32(f); /* irq_coalesced */
> +    qemu_get_be32(f); /* period */
> +

Why don't you just convert the data to the new in-memory format?  Then
you don't need a version update.

> +
> +    rtc_set_date_from_host(&s->dev);

If the guest is intentionally running with an incorrect date, this breaks.


-- 
error compiling committee.c: too many arguments to function

      reply	other threads:[~2012-03-19 10:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19  6:14 [Qemu-devel] [PATCH v4 7/7] RTC:Allow to migrate from old version Zhang, Yang Z
2012-03-19 10:56 ` Avi Kivity [this message]

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=4F6710FA.8060405@redhat.com \
    --to=avi@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yang.z.zhang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).