usb/hcd-ehci: Fix error handling on missing device for iTD
commitccee80c68db14b3e965582a19393992b5c2b97f4
authorAnthony PERARD <anthony.perard@citrix.com>
Wed, 14 Oct 2020 10:41:06 +0000 (14 11:41 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 19 Oct 2020 07:17:08 +0000 (19 09:17 +0200)
tree82ca177172e6ec0e37d57652b22971190969417f
parent69958d8a3d9535f43a457044b2b277c3c6a5ef3d
usb/hcd-ehci: Fix error handling on missing device for iTD

The EHCI Host Controller emulation attempt to locate the device
associated with a periodic isochronous transfer description (iTD) and
when this fail the host controller is reset.

But according the EHCI spec 1.0 section 5.15.2.4 Host System
Error, the host controller is supposed to reset itself only when it
failed to communicate with the Host (Operating System), like when
there's an error on the PCI bus. If a transaction fails, there's
nothing in the spec that say to reset the host controller.

This patch rework the error path so that the host controller can keep
working when the OS setup a bogus transaction, it also revert to the
behavior of the EHCI emulation to before commits:
e94682f1fe ("ehci: check device is not NULL before calling usb_ep_get()")
7011baece2 ("usb: remove unnecessary NULL device check from usb_ep_get()")

The issue has been found while trying to passthrough a USB device to a
Windows Server 2012 Xen guest via "usb-ehci", which prevent the USB
device from working in Windows. ("usb-ehci" alone works, windows only
setup this weird periodic iTD to device 127 endpoint 15 when the USB
device is passthrough.)

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Message-id: 20201014104106.2962640-1-anthony.perard@citrix.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-ehci.c