From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1d98-000246-6G for qemu-devel@nongnu.org; Wed, 15 Aug 2012 08:56:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1d94-0008Tz-1h for qemu-devel@nongnu.org; Wed, 15 Aug 2012 08:56:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1d93-0008Tq-Q2 for qemu-devel@nongnu.org; Wed, 15 Aug 2012 08:56:21 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7FCuKmh028096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 15 Aug 2012 08:56:20 -0400 Message-ID: <502B9CB2.7050409@redhat.com> Date: Wed, 15 Aug 2012 14:57:22 +0200 From: Hans de Goede MIME-Version: 1.0 References: <1345032008-29365-1-git-send-email-kraxel@redhat.com> In-Reply-To: <1345032008-29365-1-git-send-email-kraxel@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] ehci: fix Interrupt Threshold Control implementation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org Hi, On 08/15/2012 02:00 PM, Gerd Hoffmann wrote: > 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. Looks good except for 2 things: 1) For some reason it does not fix my redirected usb mass storage device not seen until lsusb issue, I will investigate this further 2) Does not apply cleanly to master, there is no vmstate_ehci.pre_seave in master Regards, Hans > > Signed-off-by: Gerd Hoffmann > --- > hw/usb/hcd-ehci.c | 12 ++++++++++-- > 1 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c > index 2eeef29..b78bf44 100644 > --- a/hw/usb/hcd-ehci.c > +++ b/hw/usb/hcd-ehci.c > @@ -576,7 +576,12 @@ static inline void ehci_update_irq(EHCIState *s) > /* flag interrupt condition */ > static inline void ehci_raise_irq(EHCIState *s, int intr) > { > - s->usbsts_pending |= intr; > + if (intr & (USBSTS_PCD | USBSTS_FLR | USBSTS_HSE)) { > + s->usbsts |= intr; > + ehci_update_irq(s); > + } else { > + s->usbsts_pending |= intr; > + } > } > > /* > @@ -2480,7 +2485,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[]) { > @@ -2488,6 +2494,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), >