76daa3
From 94b8b48edfdcfdd24553028efaae2f817a70cc96 Mon Sep 17 00:00:00 2001
76daa3
From: Ladi Prosek <lprosek@redhat.com>
76daa3
Date: Wed, 17 May 2017 12:36:15 +0200
76daa3
Subject: [PATCH 16/27] usb-hub: clear PORT_STAT_SUSPEND on wakeup
76daa3
76daa3
RH-Author: Ladi Prosek <lprosek@redhat.com>
76daa3
Message-id: <20170517123615.9871-2-lprosek@redhat.com>
76daa3
Patchwork-id: 75259
76daa3
O-Subject: [RHV-7.4 qemu-kvm-rhev PATCH 1/1] usb-hub: clear PORT_STAT_SUSPEND on wakeup
76daa3
Bugzilla: 1447581
76daa3
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
76daa3
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
76daa3
RH-Acked-by: Thomas Huth <thuth@redhat.com>
76daa3
76daa3
The spec says:
76daa3
76daa3
  Suspend: (PORT_SUSPEND) This field indicates whether or not the device
76daa3
  on this port is suspended. Setting this field causes the device to
76daa3
  suspend by not propagating bus traffic downstream. This field may be
76daa3
  reset by a request or by resume signaling from the device attached to
76daa3
  the port.
76daa3
76daa3
I can't find any specific statement like "the PORT_SUSPEND field is reset
76daa3
automatically on remote wakeup", but without this patch, the only way to
76daa3
reset it is via the ClearPortFeature request so the ".. or by resume
76daa3
signaling from the device" clause is clearly not implemented on the remote
76daa3
wakeup path.
76daa3
76daa3
The default xhci Windows driver does not issue the ClearPortFeature request
76daa3
and suspended devices attached to a hub don't properly get out of the
76daa3
suspended state. Interestingly, the default uhci Windows driver *does*
76daa3
issue the ClearPortFeature request and does not exhibit this problem.
76daa3
76daa3
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
76daa3
Message-id: 20170511125314.24549-3-lprosek@redhat.com
76daa3
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
76daa3
(cherry-picked from commit 66849dcfbed4be2ba012fd55631558c623c43f89)
76daa3
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
76daa3
76daa3
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
76daa3
---
76daa3
 hw/usb/dev-hub.c | 1 +
76daa3
 1 file changed, 1 insertion(+)
76daa3
76daa3
diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
76daa3
index 9fe7333..47b7519 100644
76daa3
--- a/hw/usb/dev-hub.c
76daa3
+++ b/hw/usb/dev-hub.c
76daa3
@@ -208,6 +208,7 @@ static void usb_hub_wakeup(USBPort *port1)
76daa3
     USBHubPort *port = &s->ports[port1->index];
76daa3
 
76daa3
     if (port->wPortStatus & PORT_STAT_SUSPEND) {
76daa3
+        port->wPortStatus &= ~PORT_STAT_SUSPEND;
76daa3
         port->wPortChange |= PORT_STAT_C_SUSPEND;
76daa3
         usb_wakeup(s->intr, 0);
76daa3
     }
76daa3
-- 
76daa3
1.8.3.1
76daa3