From 7d7d4d19c5f070bb2a0612fe537d5f3dd6ec9554 Mon Sep 17 00:00:00 2001 Message-Id: <7d7d4d19c5f070bb2a0612fe537d5f3dd6ec9554.1346940159.git.minovotn@redhat.com> In-Reply-To: References: From: Gerd Hoffmann Date: Thu, 16 Aug 2012 11:39:10 +0200 Subject: [PATCH 08/18] ehci: fix Interrupt Threshold Control implementation RH-Author: Gerd Hoffmann Message-id: <1345117160-21046-9-git-send-email-kraxel@redhat.com> Patchwork-id: 40929 O-Subject: [RHEL-6.4 qemu-kvm PATCH 08/18] ehci: fix Interrupt Threshold Control implementation Bugzilla: 805172 RH-Acked-by: Paolo Bonzini RH-Acked-by: Hans de Goede RH-Acked-by: Laszlo Ersek First, not all interrupts are subject to Interrupt Threshold Control, some of them must be delivered without delay. Second, Interrupt Threshold Control state must be part of vmstate, otherwise we might loose IRQs on migration. Signed-off-by: Gerd Hoffmann (cherry picked from commit FIXME-once-merged) Conflicts: hw/usb-ehci.c --- hw/usb-ehci.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) Signed-off-by: Michal Novotny --- hw/usb-ehci.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c index aa0afbf..b4772c9 100644 --- a/hw/usb-ehci.c +++ b/hw/usb-ehci.c @@ -408,6 +408,7 @@ struct EHCIState { USBPort ports[NB_PORTS]; USBPort *companion_ports[NB_PORTS]; uint32_t usbsts_pending; + uint32_t usbsts_frindex; /* unused, for upstream migration compatibility */ EHCIQueueHead aqueues; EHCIQueueHead pqueues; @@ -566,7 +567,11 @@ static inline void ehci_set_interrupt(EHCIState *s, int intr) static inline void ehci_record_interrupt(EHCIState *s, int intr) { - s->usbsts_pending |= intr; + if (intr & (USBSTS_PCD | USBSTS_FLR | USBSTS_HSE)) { + ehci_set_interrupt(s, intr); + } else { + s->usbsts_pending |= intr; + } } static inline void ehci_commit_interrupt(EHCIState *s) @@ -2251,6 +2256,8 @@ static int usb_ehci_post_load(void *opaque, int version_id) static const VMStateDescription vmstate_ehci = { .name = "ehci", .version_id = 1, + .version_id = 2, + .minimum_version_id = 1, .pre_save = usb_ehci_pre_save, .post_load = usb_ehci_post_load, .fields = (VMStateField[]) { @@ -2258,6 +2265,8 @@ static const VMStateDescription vmstate_ehci = { /* mmio registers */ VMSTATE_UINT32(usbcmd, EHCIState), VMSTATE_UINT32(usbsts, EHCIState), + VMSTATE_UINT32_V(usbsts_pending, EHCIState, 2), + VMSTATE_UINT32_V(usbsts_frindex, EHCIState, 2), VMSTATE_UINT32(usbintr, EHCIState), VMSTATE_UINT32(frindex, EHCIState), VMSTATE_UINT32(ctrldssegment, EHCIState), -- 1.7.11.4