From 76f6cb5f5a0578c4e78d672f3f095136fd9d5cf6 Mon Sep 17 00:00:00 2001 Message-Id: <76f6cb5f5a0578c4e78d672f3f095136fd9d5cf6.1343750985.git.minovotn@redhat.com> In-Reply-To: <3ef4055cdb5048ae1b1c3aa11bf1cae31c337b90.1343750985.git.minovotn@redhat.com> References: <3ef4055cdb5048ae1b1c3aa11bf1cae31c337b90.1343750985.git.minovotn@redhat.com> From: Gerd Hoffmann Date: Mon, 9 Jul 2012 12:56:38 +0200 Subject: [PATCH 2/5] usb-uhci: fix commit 8e65b7c04965c8355e4ce43211582b6b83054e3d for vmstate RH-Author: Gerd Hoffmann Message-id: <1341838601-27682-3-git-send-email-kraxel@redhat.com> Patchwork-id: 40236 O-Subject: [RHEL-6.4 qemu-kvm PATCH 2/5] usb-uhci: fix commit 8e65b7c04965c8355e4ce43211582b6b83054e3d for vmstate Bugzilla: 808653 831549 RH-Acked-by: Paolo Bonzini RH-Acked-by: Hans de Goede RH-Acked-by: Laszlo Ersek From: TeLeMan The commit 8e65b7c04965c8355e4ce43211582b6b83054e3d introduced expire_time of UHCIState. But expire_time is not in vmstate, the second uhci_frame_timer will not be fired immediately after loadvm. [ rhel6: Instead of adding expire_time to vmstate initialize it to the current time in post_load. We might loose a few usb frames then, resulting in iso xfer stream delays. But we don't break migration to older versions. ] Signed-off-by: TeLeMan Signed-off-by: Aurelien Jarno (cherry picked from commit 6881dd5f199e283b88c69fe1a3f58331031a3752) Signed-off-by: Gerd Hoffmann --- hw/usb-uhci.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) Signed-off-by: Michal Novotny --- hw/usb-uhci.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c index 017c771..3b32e86 100644 --- a/hw/usb-uhci.c +++ b/hw/usb-uhci.c @@ -353,6 +353,15 @@ static void uhci_pre_save(void *opaque) uhci_async_cancel_all(s); } +static int uhci_post_load(void *opaque, int version_id) +{ + UHCIState *s = opaque; + + s->expire_time = qemu_get_clock(vm_clock) + + (get_ticks_per_sec() / FRAME_TIMER_FREQ); + return 0; +} + static const VMStateDescription vmstate_uhci_port = { .name = "uhci port", .version_id = 1, @@ -370,6 +379,7 @@ static const VMStateDescription vmstate_uhci = { .minimum_version_id = 1, .minimum_version_id_old = 1, .pre_save = uhci_pre_save, + .post_load = uhci_post_load, .fields = (VMStateField []) { VMSTATE_PCI_DEVICE(dev, UHCIState), VMSTATE_UINT8_EQUAL(num_ports_vmstate, UHCIState), -- 1.7.10.4