958e1b
From 2160ddf46b85b84d271e450383151ff288958622 Mon Sep 17 00:00:00 2001
958e1b
From: Gerd Hoffmann <kraxel@redhat.com>
958e1b
Date: Fri, 11 Jul 2014 14:20:41 +0200
958e1b
Subject: [PATCH 08/43] usb: parallelize usb3 streams
958e1b
958e1b
Message-id: <1405088470-24115-9-git-send-email-kraxel@redhat.com>
958e1b
Patchwork-id: 59844
958e1b
O-Subject: [RHEL-7.1 qemu-kvm PATCH 08/37] usb: parallelize usb3 streams
958e1b
Bugzilla: 1075846
958e1b
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
958e1b
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
958e1b
958e1b
usb3 bulk endpoints with streams are implicitly pipelined now,
958e1b
so the requests will actually be processed in parallel.  Also
958e1b
allow them to complete out-of-order.
958e1b
958e1b
Fixes stalls in the uas driver.
958e1b
958e1b
Cc: qemu-stable@nongnu.org
958e1b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
958e1b
(cherry picked from commit c96c41ed0d38d68a6c8b6f84751afebafeae31be)
958e1b
---
958e1b
 hw/usb/core.c | 7 ++++---
958e1b
 1 file changed, 4 insertions(+), 3 deletions(-)
958e1b
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
---
958e1b
 hw/usb/core.c | 7 ++++---
958e1b
 1 file changed, 4 insertions(+), 3 deletions(-)
958e1b
958e1b
diff --git a/hw/usb/core.c b/hw/usb/core.c
958e1b
index 05948ca..31960c2 100644
958e1b
--- a/hw/usb/core.c
958e1b
+++ b/hw/usb/core.c
958e1b
@@ -403,7 +403,7 @@ void usb_handle_packet(USBDevice *dev, USBPacket *p)
958e1b
         p->ep->halted = false;
958e1b
     }
958e1b
 
958e1b
-    if (QTAILQ_EMPTY(&p->ep->queue) || p->ep->pipeline) {
958e1b
+    if (QTAILQ_EMPTY(&p->ep->queue) || p->ep->pipeline || p->stream) {
958e1b
         usb_process_one(p);
958e1b
         if (p->status == USB_RET_ASYNC) {
958e1b
             /* hcd drivers cannot handle async for isoc */
958e1b
@@ -420,7 +420,8 @@ void usb_handle_packet(USBDevice *dev, USBPacket *p)
958e1b
              * When pipelining is enabled usb-devices must always return async,
958e1b
              * otherwise packets can complete out of order!
958e1b
              */
958e1b
-            assert(!p->ep->pipeline || QTAILQ_EMPTY(&p->ep->queue));
958e1b
+            assert(p->stream || !p->ep->pipeline ||
958e1b
+                   QTAILQ_EMPTY(&p->ep->queue));
958e1b
             if (p->status != USB_RET_NAK) {
958e1b
                 usb_packet_set_state(p, USB_PACKET_COMPLETE);
958e1b
             }
958e1b
@@ -434,7 +435,7 @@ void usb_packet_complete_one(USBDevice *dev, USBPacket *p)
958e1b
 {
958e1b
     USBEndpoint *ep = p->ep;
958e1b
 
958e1b
-    assert(QTAILQ_FIRST(&ep->queue) == p);
958e1b
+    assert(p->stream || QTAILQ_FIRST(&ep->queue) == p);
958e1b
     assert(p->status != USB_RET_ASYNC && p->status != USB_RET_NAK);
958e1b
 
958e1b
     if (p->status != USB_RET_SUCCESS ||
958e1b
-- 
958e1b
1.8.3.1
958e1b