From 7e0edd094c3bf0f6fb83bd9ee213d12459ec1c3f Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 17 Sep 2012 09:52:27 -0300
Subject: [RHEL6 qemu-kvm PATCH 01/23] ehci: RHEL-6 only: call
 ehci_advance_async_state(ehci)
 directly from timer

RH-Author: Hans de Goede <hdegoede@redhat.com>
Message-id: <1347875547-4680-1-git-send-email-hdegoede@redhat.com>
Patchwork-id: 41966
O-Subject: [RHEL-6.4 qemu-kvm PATCH] ehci: RHEL-6 only: call ehci_advance_async_state(ehci) directly from timer
Bugzilla:
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
RH-Acked-by: Uri Lublin <uril@redhat.com>
Bugzilla-related: 805172

Call ehci_advance_async_state(ehci) directly from the frame timer so as to not
delay interrupts by 1 frame. Before this patch the frame timer schedule a bh
to run ehci_advance_async_state, and then calls commit_interrupts, but since
the bh won't run till the timer function is done, this means any interrupts
generated by processing the async schedule will not get reported to the
guest until the next frame timer run. This fixes this.

The same change is made upstream in commit
afb7a0b85be3a21eccd5ede0a41815b15c300b6b, but as part of a larger
change which does not apply to RHEL-6.

The calling of ehci_advance_async_state() from a bh instead of directly was
done as part of the changes for EHCI live migration, so this is:

Related: rhbz#805172

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 hw/usb-ehci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/usb-ehci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index 86b187f..2e82833 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -2178,7 +2178,7 @@ static void ehci_frame_timer(void *opaque)
     /*  Async is not inside loop since it executes everything it can once
      *  called
      */
-    qemu_bh_schedule(ehci->async_bh);
+    ehci_advance_async_state(ehci);
 
     qemu_mod_timer(ehci->frame_timer, expire_time);
     ehci_commit_interrupt(ehci);
-- 
1.7.11.4

