qemu-patch-raspberry4/hw/usb
Gerd Hoffmann 7da76e12cc xhci: fix event queue IRQ handling
The qemu xhci emulation doesn't handle the ERDP_EHB flag correctly.

When the host adapter queues a new event the ERDP_EHB flag is set.  The
flag is cleared (via w1c) by the guest when it updates the ERDP (event
ring dequeue pointer) register to notify the host adapter which events
it has fetched.

An IRQ must be raised in case the ERDP_EHB flag flips from clear to set.
If the flag is set already (which implies there are events queued up
which are not yet processed by the guest) xhci must *not* raise a IRQ.

Qemu got that wrong and raised an IRQ on every event, thereby generating
spurious interrupts in case we've queued events faster than the guest
processed them.  This patch fixes that.

With that change in place we also have to check ERDP updates, to see
whenever the guest has fetched all queued events.  In case there are
still pending events set ERDP_EHB and raise an IRQ again, to make sure
the events don't linger unseen forever.

The linux kernel driver and the microsoft windows driver (shipped with
win8+) can deal with the spurious interrupts without problems.  The
renesas windows driver (v2.1.39) which can be used on older windows
versions is quite upset though.  It does spurious ERDP updates now and
then (not every time, seems we must hit a race window for this to
happen), which in turn makes the qemu xhci emulation think the event
ring is full.  Things go south from here ...

tl;dr: This is the "fix xhci on win7" patch.

Cc: M.Cerveny@computer.org
Cc: 1373228@bugs.launchpad.net
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1486104705-13761-1-git-send-email-kraxel@redhat.com
2017-02-06 12:12:26 +01:00
..
bus.c migration: Allow "device add" options to only add migratable devices 2017-01-24 17:54:47 +00:00
ccid-card-emulated.c event_notifier: cleanups around event_notifier_set_handler 2017-01-16 17:52:35 +01:00
ccid-card-passthru.c char: rename CharDriverState Chardev 2017-01-27 18:07:59 +01:00
ccid.h usb: Change *_exitfn return type from int to void 2016-10-28 18:17:23 +03:00
combined-packet.c usb: Clean up includes 2016-01-29 15:07:23 +00:00
core.c usb: check RNDIS message length 2016-02-23 10:38:00 +01:00
desc-msos.c usb: Clean up includes 2016-01-29 15:07:23 +00:00
desc.c usb: accept usb3 control requests 2017-02-06 10:23:17 +01:00
desc.h all: Clean up includes 2016-02-23 12:43:05 +00:00
dev-audio.c usb: Clean up includes 2016-01-29 15:07:23 +00:00
dev-bluetooth.c usb: Clean up includes 2016-01-29 15:07:23 +00:00
dev-hid.c hw/usb/dev-hid: Improve guest compatibility of usb-tablet 2017-02-06 10:23:17 +01:00
dev-hub.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
dev-mtp.c usb: Set category and description of the MTP device 2017-01-24 23:26:54 +03:00
dev-network.c net: Use correct type for bool flag 2016-07-19 20:18:27 +02:00
dev-serial.c char: rename CharDriverState Chardev 2017-01-27 18:07:59 +01:00
dev-smartcard-reader.c usb: ccid: check ccid apdu length 2017-02-06 10:23:18 +01:00
dev-storage.c block/qdev: Allow configuring WCE with qdev properties 2016-07-13 13:32:27 +02:00
dev-uas.c usb/uas: more verbose error message 2017-02-06 10:23:17 +01:00
dev-wacom.c usb: Clean up includes 2016-01-29 15:07:23 +00:00
hcd-ehci-pci.c usb: Clean up includes 2016-01-29 15:07:23 +00:00
hcd-ehci-sysbus.c usb: Clean up includes 2016-01-29 15:07:23 +00:00
hcd-ehci.c usb: ehci: fix memory leak in ehci_init_transfer 2016-11-10 15:29:58 +00:00
hcd-ehci.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
hcd-musb.c Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND 2016-03-22 22:20:17 +01:00
hcd-ohci.c usb: Fix incorrect default DMA offset. 2016-10-12 14:37:15 +02:00
hcd-uhci.c usb/uhci: move pid check 2016-04-25 12:05:05 +01:00
hcd-xhci.c xhci: fix event queue IRQ handling 2017-02-06 12:12:26 +01:00
host-legacy.c usb: Clean up includes 2016-01-29 15:07:23 +00:00
host-libusb.c hw/ppc/spapr: Fix boot path of usb-host storage devices 2017-01-31 10:10:13 +11:00
host-stub.c hw/ppc/spapr: Fix boot path of usb-host storage devices 2017-01-31 10:10:13 +11:00
host.h usb-host: move legacy cmd line bits 2013-02-19 12:30:05 +01:00
libhw.c usb: Clean up includes 2016-01-29 15:07:23 +00:00
Makefile.objs xen: add pvUSB backend 2016-05-23 13:30:03 +02:00
quirks-ftdi-ids.h usbredir: Add support for buffered bulk input (v2) 2013-01-08 10:56:58 +01:00
quirks-pl2303-ids.h usbredir: Add support for buffered bulk input (v2) 2013-01-08 10:56:58 +01:00
quirks.c usb: Clean up includes 2016-01-29 15:07:23 +00:00
quirks.h usbredir: Add support for buffered bulk input (v2) 2013-01-08 10:56:58 +01:00
redirect.c char: rename CharDriverState Chardev 2017-01-27 18:07:59 +01:00
trace-events trace: clean up trace-events files 2017-01-31 17:12:15 +00:00
tusb6010.c Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND 2016-03-22 22:20:17 +01:00
xen-usb.c xen: attach pvusb usb bus to backend qdev 2016-11-22 10:29:41 -08:00