9ae3a8
From a558699e5f028623c2d5f9bb60d28b8f56b7766a Mon Sep 17 00:00:00 2001
9ae3a8
From: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Date: Fri, 11 Jul 2014 14:20:36 +0200
9ae3a8
Subject: [PATCH 03/43] uhci: egsm fix
9ae3a8
9ae3a8
Message-id: <1405088470-24115-4-git-send-email-kraxel@redhat.com>
9ae3a8
Patchwork-id: 59820
9ae3a8
O-Subject: [RHEL-7.1 qemu-kvm PATCH 03/37] uhci: egsm fix
9ae3a8
Bugzilla: 1046873
9ae3a8
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
9ae3a8
When the guest goes suspend the uhci controller while there are
9ae3a8
pending resume requests on the ports go signal global resume
9ae3a8
instantly.
9ae3a8
9ae3a8
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
(cherry picked from commit 9f0f1a0c096f29a856f2e6903beda45b44ce9cdd)
9ae3a8
---
9ae3a8
 hw/usb/hcd-uhci.c | 7 +++++++
9ae3a8
 1 file changed, 7 insertions(+)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/usb/hcd-uhci.c | 7 +++++++
9ae3a8
 1 file changed, 7 insertions(+)
9ae3a8
9ae3a8
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
9ae3a8
index 3380107..989c37a 100644
9ae3a8
--- a/hw/usb/hcd-uhci.c
9ae3a8
+++ b/hw/usb/hcd-uhci.c
9ae3a8
@@ -191,6 +191,7 @@ bool ich9_uhci123_irqpin_override;
9ae3a8
 
9ae3a8
 static void uhci_async_cancel(UHCIAsync *async);
9ae3a8
 static void uhci_queue_fill(UHCIQueue *q, UHCI_TD *td);
9ae3a8
+static void uhci_resume(void *opaque);
9ae3a8
 
9ae3a8
 static inline int32_t uhci_queue_token(UHCI_TD *td)
9ae3a8
 {
9ae3a8
@@ -500,6 +501,12 @@ static void uhci_port_write(void *opaque, hwaddr addr,
9ae3a8
             return;
9ae3a8
         }
9ae3a8
         s->cmd = val;
9ae3a8
+        if (val & UHCI_CMD_EGSM) {
9ae3a8
+            if ((s->ports[0].ctrl & UHCI_PORT_RD) ||
9ae3a8
+                (s->ports[1].ctrl & UHCI_PORT_RD)) {
9ae3a8
+                uhci_resume(s);
9ae3a8
+            }
9ae3a8
+        }
9ae3a8
         break;
9ae3a8
     case 0x02:
9ae3a8
         s->status &= ~val;
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8