Re: [PATCH 4/5] Userspace changes for qemu-kvm HPET support(v8)

Gleb Natapov
2009-07-07T11:57:28Z

On Tue, Jun 30, 2009 at 11:59:18PM -0400, Beth Kon wrote:
> @@ -89,8 +95,12 @@ static int kvm_pit_load(QEMUFile *f, void *opaque, int version_id)
> c->count_load_time = sc->count_load_time;
> }
>
> - kvm_set_pit(kvm_context, &pit);
> -
> + if(qemu_kvm_has_pit_state2()) {
> + kvm_set_pit2(kvm_context, &pit2);
> + return 0;
Return is not needed here.

> + } else {
> + kvm_set_pit(kvm_context, (struct kvm_pit_state *)&pit2);
> + }
> return 0;
> }
>
[skip]
> @@ -390,6 +397,7 @@ void pit_save(QEMUFile *f, void *opaque)
> PITChannelState *s;
> int i;
>
> + qemu_put_be32(f, pit->flags);
> for(i = 0; i < 3; i++) {
> s = &pit->channels[i];
> qemu_put_be32(f, s->count);
> @@ -421,6 +429,7 @@ int pit_load(QEMUFile *f, void *opaque, int version_id)
> if (version_id != 1)
> return -EINVAL;
>
> + pit->flags = qemu_get_be32(f);
> for(i = 0; i < 3; i++) {
> s = &pit->channels[i];
> s->count=qemu_get_be32(f);
If migration data format changes you need to advance savevm version_id.

--
Gleb.