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