qemu/hw/usb
Hans de Goede 0132b4b659 usb: Halt ep queue en cancel pending packets on a packet error
For controllers which queue up more then 1 packet at a time, we must halt the
ep queue, and inside the controller code cancel all pending packets on an
error.

There are multiple reasons for this:
1) Guests expect the controllers to halt ep queues on error, so that they
get the opportunity to cancel transfers which the scheduled after the failing
one, before processing continues

2) Not cancelling queued up packets after a failed transfer also messes up
the controller state machine, in the case of EHCI causing the following
assert to trigger: "assert(p->qtdaddr == q->qtdaddr)" at hcd-ehci.c:2075

3) For bulk endpoints with pipelining enabled (redirection to a real USB
device), we must cancel all the transfers after this a failed one so that:
a) If they've completed already, they are not processed further causing more
   stalls to be reported, originating from the same failed transfer
b) If still in flight, they are cancelled before the guest does
   a clear stall, otherwise the guest and device can loose sync!

Note this patch only touches the ehci and uhci controller changes, since AFAIK
no other controllers actually queue up multiple transfer. If I'm wrong on this
other controllers need to be updated too!

Also note that this patch was heavily tested with the ehci code, where I had
a reproducer for a device causing a transfer to fail. The uhci code is not
tested with actually failing transfers and could do with a thorough review!

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-08-31 11:55:17 +02:00
..
bus.c usb: restore USBDevice->attached on vmload 2012-06-20 14:46:02 +02:00
core.c usb: Halt ep queue en cancel pending packets on a packet error 2012-08-31 11:55:17 +02:00
desc.c qdev: Use wrapper for qdev_get_path 2012-06-18 15:14:38 +02:00
desc.h usb: add serial number generator 2012-04-26 12:21:17 +02:00
dev-audio.c usb: add serial number generator 2012-04-26 12:21:17 +02:00
dev-bluetooth.c Allow machines to configure the QEMU_VERSION that's exposed via hardware 2012-06-19 13:36:56 -05:00
dev-hid.c Allow machines to configure the QEMU_VERSION that's exposed via hardware 2012-06-19 13:36:56 -05:00
dev-hub.c Allow machines to configure the QEMU_VERSION that's exposed via hardware 2012-06-19 13:36:56 -05:00
dev-network.c net: Rename qemu_del_vlan_client() to qemu_del_net_client() 2012-08-01 13:32:10 +01:00
dev-serial.c Allow machines to configure the QEMU_VERSION that's exposed via hardware 2012-06-19 13:36:56 -05:00
dev-smartcard-reader.c Allow machines to configure the QEMU_VERSION that's exposed via hardware 2012-06-19 13:36:56 -05:00
dev-storage.c usb-storage: fix SYNCHRONIZE_CACHE 2012-08-07 10:49:06 +02:00
dev-uas.c usb: update uas product id 2012-08-16 08:39:49 +02:00
dev-wacom.c Allow machines to configure the QEMU_VERSION that's exposed via hardware 2012-06-19 13:36:56 -05:00
hcd-ehci.c usb: Halt ep queue en cancel pending packets on a packet error 2012-08-31 11:55:17 +02:00
hcd-musb.c usb: the big rename 2012-03-13 10:15:32 +01:00
hcd-ohci.c usb-ohci: Use universal DMA helper functions 2012-06-27 16:33:25 -05:00
hcd-uhci.c usb: Halt ep queue en cancel pending packets on a packet error 2012-08-31 11:55:17 +02:00
hcd-xhci.c xhci: trace: slots 2012-06-07 10:02:22 +02:00
host-bsd.c usb: the big rename 2012-03-13 10:15:32 +01:00
host-linux.c usb: async control xfer fixup 2012-08-16 08:39:49 +02:00
host-stub.c usb: the big rename 2012-03-13 10:15:32 +01:00
libhw.c usb: Convert usb_packet_{map, unmap} to universal DMA helpers 2012-06-27 16:33:25 -05:00
Makefile.objs usb: add usb attached scsi emulation 2012-07-12 15:00:39 +02:00
redirect.c usb-redir: Correctly handle the usb_redir_babble usbredir status 2012-07-09 11:59:54 +02:00