From 1b10b10445ab438c3fa1107f9962add3ae0716c6 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 31 Mar 2017 07:40:45 +0200 Subject: [PATCH] xhci: set kick_active for retried xfers too Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-xhci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index f0af852..8958f95 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -2083,6 +2083,7 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid) return; } + epctx->kick_active++; if (epctx->retry) { XHCITransfer *xfer = epctx->retry; @@ -2093,6 +2094,7 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid) mfindex = xhci_mfindex_get(xhci); xhci_check_intr_iso_kick(xhci, xfer, epctx, mfindex); if (xfer->running_retry) { + epctx->kick_active--; return; } xfer->timed_xfer = 0; @@ -2101,6 +2103,7 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid) if (xfer->iso_xfer) { /* retry iso transfer */ if (xhci_setup_packet(xfer) < 0) { + epctx->kick_active--; return; } usb_handle_packet(xfer->packet.ep->dev, &xfer->packet); @@ -2109,10 +2112,12 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid) } else { /* retry nak'ed transfer */ if (xhci_setup_packet(xfer) < 0) { + epctx->kick_active--; return; } usb_handle_packet(xfer->packet.ep->dev, &xfer->packet); if (xfer->packet.status == USB_RET_NAK) { + epctx->kick_active--; return; } xhci_try_complete_packet(xfer); @@ -2126,6 +2131,7 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid) if (epctx->state == EP_HALTED) { DPRINTF("xhci: ep halted, not running schedule\n"); + epctx->kick_active--; return; } @@ -2134,6 +2140,7 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid) uint32_t err; stctx = xhci_find_stream(epctx, streamid, &err); if (stctx == NULL) { + epctx->kick_active--; return; } ring = &stctx->ring; @@ -2145,7 +2152,6 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid) } assert(ring->dequeue != 0); - epctx->kick_active++; while (1) { length = xhci_ring_chain_length(xhci, ring); if (length <= 0) { -- 1.8.3.1