[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/21] usb-ehci: Handle ISO packets failing with an
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 14/21] usb-ehci: Handle ISO packets failing with an error other then NAK |
Date: |
Tue, 28 Feb 2012 11:20:23 +0100 |
From: Hans de Goede <address@hidden>
Before this patch the ehci code was not checking for any other errors other
then USB_RET_NAK. This causes 2 problems:
1) Other errors are not reported to the guest.
2) When transactions with the ITD_XACT_IOC bit set completing with another
error would not result in USBSTS_INT getting set.
I hit this problem when unplugging devices while iso data was streaming from
the device to the guest. When this happens it takes a while for the guest to
process the unplugging and remove ISO transactions from the ehci schedule, in
the mean time these transactions would complete with a result of USB_RET_NODEV,
which was not handled. This lead to the Linux guest's usb subsystem "hanging",
that is it would no longer see new usb devices getting plugged in and running
for example lsusb would lead to a stuck (D state) lsusb process. This patch
fixes this.
Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb-ehci.c | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index 048eb76..b95773f 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -1510,11 +1510,27 @@ static int ehci_process_itd(EHCIState *ehci,
/* IN */
set_field(&itd->transact[i], ret, ITD_XACT_LENGTH);
}
-
- if (itd->transact[i] & ITD_XACT_IOC) {
- ehci_record_interrupt(ehci, USBSTS_INT);
+ } else {
+ switch (ret) {
+ default:
+ fprintf(stderr, "Unexpected iso usb result: %d\n", ret);
+ /* Fall through */
+ case USB_RET_NODEV:
+ /* 3.3.2: XACTERR is only allowed on IN transactions */
+ if (dir) {
+ itd->transact[i] |= ITD_XACT_XACTERR;
+ ehci_record_interrupt(ehci, USBSTS_ERRINT);
+ }
+ break;
+ case USB_RET_BABBLE:
+ itd->transact[i] |= ITD_XACT_BABBLE;
+ ehci_record_interrupt(ehci, USBSTS_ERRINT);
+ break;
}
}
+ if (itd->transact[i] & ITD_XACT_IOC) {
+ ehci_record_interrupt(ehci, USBSTS_INT);
+ }
itd->transact[i] &= ~ITD_XACT_ACTIVE;
}
}
--
1.7.1
- [Qemu-devel] [PATCH 07/21] usb-xhci: enable packet queuing, (continued)
- [Qemu-devel] [PATCH 07/21] usb-xhci: enable packet queuing, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 18/21] usb-redir: Let the usb-host know about our device filtering, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 05/21] usb-uhci: process uhci_handle_td return code via switch., Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 03/21] usb-uhci: cleanup UHCIAsync allocation & initialization., Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 13/21] libcacard: fix reported ATR length, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 16/21] usb-redir: Fix printing of device version, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 09/21] usb-ehci: sanity-check iso xfers, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 19/21] usb-redir: Limit return values returned by iso packets, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 11/21] libcacard: link with glib for g_strndup, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 10/21] usb-desc: fix user trigerrable segfaults (!config), Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 14/21] usb-ehci: Handle ISO packets failing with an error other then NAK,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 20/21] usb-redir: Return USB_RET_NAK when we've no data for an interrupt endpoint, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 21/21] usb: Resolve warnings about unassigned bus on usb device creation, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 12/21] usb-ccid: advertise SELF_POWERED, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 17/21] usb-redir: Always clear device state on filter reject, Gerd Hoffmann, 2012/02/28
- [Qemu-devel] [PATCH 15/21] ehci: drop old stuff, Gerd Hoffmann, 2012/02/28
- Re: [Qemu-devel] [PULL] usb patch queue, Anthony Liguori, 2012/02/29