34b321
From ad3f6b5b188c572bd07cc5929e844138c2d95915 Mon Sep 17 00:00:00 2001
34b321
From: Gerd Hoffmann <kraxel@redhat.com>
34b321
Date: Fri, 13 Nov 2015 13:32:34 +0100
34b321
Subject: [PATCH 1/6] ehci: clear suspend bit on detach
34b321
34b321
Message-id: <1447421554-28366-2-git-send-email-kraxel@redhat.com>
34b321
Patchwork-id: 68349
34b321
O-Subject: [RHEL-7.3 qemu-kvm PATCH 1/1] ehci: clear suspend bit on detach
34b321
Bugzilla: 1268879
34b321
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
34b321
RH-Acked-by: John Snow <jsnow@redhat.com>
34b321
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
34b321
34b321
When a device is detached, clear the suspend bit (PORTSC_SUSPEND)
34b321
in the port status register.
34b321
34b321
The specs are not *that* clear what is supposed to happen in case
34b321
a suspended device is unplugged.  But the enable bit (PORTSC_PED)
34b321
is cleared, and the specs mention setting suspend with enable being
34b321
unset is undefined behavior.  So clearing them both looks reasonable,
34b321
and it actually fixes the reported bug.
34b321
34b321
Cc: Hans de Goede <hdegoede@redhat.com>
34b321
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
34b321
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
34b321
Message-id: 1445413462-18004-1-git-send-email-kraxel@redhat.com
34b321
(cherry picked from commit cbf82fa01e6fd4ecb234b235b10ffce548154a95)
34b321
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
34b321
---
34b321
 hw/usb/hcd-ehci.c | 2 +-
34b321
 1 file changed, 1 insertion(+), 1 deletion(-)
34b321
34b321
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
34b321
index 02d2ab7..3429c77 100644
34b321
--- a/hw/usb/hcd-ehci.c
34b321
+++ b/hw/usb/hcd-ehci.c
34b321
@@ -802,7 +802,7 @@ static void ehci_detach(USBPort *port)
34b321
     ehci_queues_rip_device(s, port->dev, 0);
34b321
     ehci_queues_rip_device(s, port->dev, 1);
34b321
 
34b321
-    *portsc &= ~(PORTSC_CONNECT|PORTSC_PED);
34b321
+    *portsc &= ~(PORTSC_CONNECT|PORTSC_PED|PORTSC_SUSPEND);
34b321
     *portsc |= PORTSC_CSC;
34b321
 
34b321
     ehci_raise_irq(s, USBSTS_PCD);
34b321
-- 
34b321
1.8.3.1
34b321