From f06d21b8bcccf7923c9594ce0dd0a67cc7f5e109 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Gerd Hoffmann Date: Thu, 16 Aug 2012 11:39:04 +0200 Subject: [PATCH 02/18] ehci: move async schedule to bottom half RH-Author: Gerd Hoffmann Message-id: <1345117160-21046-3-git-send-email-kraxel@redhat.com> Patchwork-id: 40921 O-Subject: [RHEL-6.4 qemu-kvm PATCH 02/18] ehci: move async schedule to bottom half Bugzilla: 805172 RH-Acked-by: Paolo Bonzini RH-Acked-by: Hans de Goede RH-Acked-by: Laszlo Ersek This way we can kick the async schedule independant from the periodic frame timer. Signed-off-by: Gerd Hoffmann (cherry picked from commit 0fb3e299bdc0f21e0a0ff7d19276a87e0825d651) Conflicts: hw/usb-ehci.c --- hw/usb-ehci.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) Signed-off-by: Michal Novotny --- hw/usb-ehci.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c index d71eb19..5dbee41 100644 --- a/hw/usb-ehci.c +++ b/hw/usb-ehci.c @@ -401,6 +401,7 @@ struct EHCIState { */ uint32_t sofv; QEMUTimer *frame_timer; + QEMUBH *async_bh; int attach_poll_counter; int astate; // Current state in asynchronous schedule int pstate; // Current state in periodic schedule @@ -890,6 +891,7 @@ static void ehci_reset(void *opaque) ehci_queues_rip_all(s, 0); ehci_queues_rip_all(s, 1); qemu_del_timer(s->frame_timer); + qemu_bh_cancel(s->async_bh); } static uint32_t ehci_mem_readb(void *ptr, target_phys_addr_t addr) @@ -1042,6 +1044,7 @@ static void ehci_mem_writel(void *ptr, target_phys_addr_t addr, uint32_t val) if (!(val & USBCMD_RUNSTOP) && (s->usbcmd & USBCMD_RUNSTOP)) { qemu_del_timer(s->frame_timer); + qemu_bh_cancel(s->async_bh); ehci_queues_rip_all(s, 0); ehci_queues_rip_all(s, 1); ehci_set_usbsts(s, USBSTS_HALT); @@ -2159,11 +2162,17 @@ static void ehci_frame_timer(void *opaque) /* Async is not inside loop since it executes everything it can once * called */ - ehci_advance_async_state(ehci); + qemu_bh_schedule(ehci->async_bh); qemu_mod_timer(ehci->frame_timer, expire_time); } +static void ehci_async_bh(void *opaque) +{ + EHCIState *ehci = opaque; + ehci_advance_async_state(ehci); +} + static CPUReadMemoryFunc *ehci_readfn[3]={ ehci_mem_readb, ehci_mem_readw, @@ -2294,6 +2303,7 @@ static int usb_ehci_initfn(PCIDevice *dev) } s->frame_timer = qemu_new_timer(vm_clock, ehci_frame_timer, s); + s->async_bh = qemu_bh_new(ehci_async_bh, s); QTAILQ_INIT(&s->aqueues); QTAILQ_INIT(&s->pqueues); -- 1.7.11.4