[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH for-1.2 05/11] ehci: Schedule async-bh when IAAD bit
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH for-1.2 05/11] ehci: Schedule async-bh when IAAD bit gets set |
Date: |
Fri, 31 Aug 2012 16:19:16 +0200 |
From: Hans de Goede <address@hidden>
After the "ehci: Print a warning when a queue unexpectedly contains packets
on cancel" commit. Under certain reproducable conditions I was getting the
following message: "EHCI: Warning queue not empty on queue reset".
After aprox. 8 hours of debugging I've finally found the cause. The Linux EHCI
driver has an IAAD watchdog, to work around certain EHCI hardware sometimes
not acknowledging the doorbell at all. This watchdog has a timeout of 10 ms,
which is less then the time between 2 runs through the async schedule when
async_stepdown is at its highest value.
Thus the watchdog can trigger, after which Linux clears the IAAD bit and
re-uses the QH. IOW we were not properly detecting the unlink of the qh, due
to us missing (ignoring for more then 10 ms) the IAAD command, which triggered
the warning.
Signed-off-by: Hans de Goede <address@hidden>
---
hw/usb/hcd-ehci.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index a3aea6d..3e10977 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -1194,6 +1194,15 @@ static void ehci_mem_writel(void *ptr,
target_phys_addr_t addr, uint32_t val)
val &= ~USBCMD_FLS;
}
+ if (val & USBCMD_IAAD) {
+ /*
+ * Process IAAD immediately, otherwise the Linux IAAD watchdog may
+ * trigger and re-use a qh without us seeing the unlink.
+ */
+ s->async_stepdown = 0;
+ qemu_bh_schedule(s->async_bh);
+ }
+
if (((USBCMD_RUNSTOP | USBCMD_PSE | USBCMD_ASE) & val) !=
((USBCMD_RUNSTOP | USBCMD_PSE | USBCMD_ASE) & s->usbcmd)) {
if (s->pstate == EST_INACTIVE) {
--
1.7.1
- [Qemu-devel] [PULL for-1.2 00/11] usb patch queue, Gerd Hoffmann, 2012/08/31
- [Qemu-devel] [PATCH for-1.2 10/11] ehci: Fix interrupt endpoints no longer working, Gerd Hoffmann, 2012/08/31
- [Qemu-devel] [PATCH for-1.2 03/11] usb: unique packet ids, Gerd Hoffmann, 2012/08/31
- [Qemu-devel] [PATCH for-1.2 07/11] ehci: simplify ehci_state_executing, Gerd Hoffmann, 2012/08/31
- [Qemu-devel] [PATCH for-1.2 04/11] ehci: Fix NULL ptr deref when unplugging an USB dev with an iso stream active, Gerd Hoffmann, 2012/08/31
- [Qemu-devel] [PATCH for-1.2 05/11] ehci: Schedule async-bh when IAAD bit gets set,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH for-1.2 09/11] ehci: handle TD deactivation of inflight packets, Gerd Hoffmann, 2012/08/31
- [Qemu-devel] [PATCH for-1.2 11/11] uas: move transfer kickoff, Gerd Hoffmann, 2012/08/31
- [Qemu-devel] [PATCH for-1.2 06/11] ehci: Remove unnecessary ehci_flush_qh call, Gerd Hoffmann, 2012/08/31
- [Qemu-devel] [PATCH for-1.2 08/11] ehci: add ehci_cancel_queue(), Gerd Hoffmann, 2012/08/31
- [Qemu-devel] [PATCH for-1.2 02/11] usb: Halt ep queue en cancel pending packets on a packet error, Gerd Hoffmann, 2012/08/31
- [Qemu-devel] [PATCH for-1.2 01/11] fix info qtree indention, Gerd Hoffmann, 2012/08/31