[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/54] ehci: Properly report completed but not yet p
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 09/54] ehci: Properly report completed but not yet processed packets to the guest |
Date: |
Thu, 6 Sep 2012 09:12:10 +0200 |
From: Hans de Goede <address@hidden>
Reported packets which have completed before being cancelled as such to the
host. Note that the new code path this patch adds is untested since it I've
been unable to actually trigger the race which needs this code path.
Signed-off-by: Hans de Goede <address@hidden>
---
hw/usb/hcd-ehci.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 4fe85c8..0a6c9ef 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -489,6 +489,9 @@ static const char *ehci_mmio_names[] = {
[CONFIGFLAG] = "CONFIGFLAG",
};
+static int ehci_state_executing(EHCIQueue *q);
+static int ehci_state_writeback(EHCIQueue *q);
+
static const char *nr2str(const char **n, size_t len, uint32_t nr)
{
if (nr < len && n[nr] != NULL) {
@@ -750,6 +753,16 @@ static void ehci_free_packet(EHCIPacket *p)
usb_packet_unmap(&p->packet, &p->sgl);
qemu_sglist_destroy(&p->sgl);
}
+ if (p->async == EHCI_ASYNC_FINISHED) {
+ int state = ehci_get_state(p->queue->ehci, p->queue->async);
+ /* This is a normal, but rare condition (cancel racing completion) */
+ fprintf(stderr, "EHCI: Warning packet completed but not processed\n");
+ ehci_state_executing(p->queue);
+ ehci_state_writeback(p->queue);
+ ehci_set_state(p->queue->ehci, p->queue->async, state);
+ /* state_writeback recurses into us with async == EHCI_ASYNC_NONE!! */
+ return;
+ }
QTAILQ_REMOVE(&p->queue->packets, p, next);
usb_packet_cleanup(&p->packet);
g_free(p);
--
1.7.1
- [Qemu-devel] [PATCH 52/54] xhci: support multiple interrupters, (continued)
- [Qemu-devel] [PATCH 52/54] xhci: support multiple interrupters, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 21/54] usb-redir: Get rid of unused async-struct dev member, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 27/54] usb-redir: Ensure our peer has the necessary caps when redirecting to XHCI, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 24/54] usb-redir: Convert to new libusbredirparser 0.5 API, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 15/54] ehci: Handle USB_RET_PROCERR in ehci_fill_queue, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 18/54] usb-redir: Don't delay handling of open events to a bottom half, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 23/54] usb-redir: Return babble when getting more bulk data then requested, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 20/54] usb-redir: Get rid of local shadow copy of packet headers, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 37/54] xhci: add trace_usb_xhci_ep_set_dequeue, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 33/54] xhci: move device lookup into xhci_setup_packet, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 09/54] ehci: Properly report completed but not yet processed packets to the guest,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 36/54] xhci: trace cc codes in cleartext, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 38/54] xhci: fix runtime write tracepoint, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 31/54] xhci: rip out background transfer code, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 42/54] usb3: superspeed endpoint companion, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 34/54] xhci: implement mfindex, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 35/54] xhci: iso xfer support, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 47/54] xhci: add msix support, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 45/54] xhci: fix & cleanup msi., Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 48/54] xhci: move register update into xhci_intr_raise, Gerd Hoffmann, 2012/09/06
- [Qemu-devel] [PATCH 46/54] xhci: rework interrupt handling, Gerd Hoffmann, 2012/09/06