thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
0a122b
From 1d59e428d7754c0fc331092d265254a0b3473546 Mon Sep 17 00:00:00 2001
0a122b
From: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Date: Wed, 11 Dec 2013 10:04:22 +0100
0a122b
Subject: [PATCH 1/5] xhci: add support for suspend/resume
0a122b
0a122b
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Message-id: <1386756262-29763-2-git-send-email-kraxel@redhat.com>
0a122b
Patchwork-id: 56161
0a122b
O-Subject: [RHEL-7 qemu-kvm PATCH 1/1] xhci: add support for suspend/resume
0a122b
Bugzilla: 1012365
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
0a122b
The OS can ask the xhci controller to save and restore its
0a122b
internal state, which is used by the OS when the system is
0a122b
suspended and resumed.
0a122b
0a122b
This patch handles writes to the save + restore bits in the
0a122b
command register.  Only thing it does is updating the
0a122b
restore error bit in the status register to signal an error
0a122b
on restore.  The guest OS should do a full reinitialization
0a122b
after resume then.
0a122b
0a122b
This is the minimal patch which gets S3 going with xhci.
0a122b
Implementing full save/restore support is TBD.
0a122b
0a122b
https://bugzilla.redhat.com/show_bug.cgi?id=1012365
0a122b
0a122b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
0a122b
(cherry picked from commit f1f8bc218a422081f36f0b325b3de5e6a5078b74)
0a122b
---
0a122b
 hw/usb/hcd-xhci.c | 8 ++++++++
0a122b
 1 file changed, 8 insertions(+)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/usb/hcd-xhci.c |    8 ++++++++
0a122b
 1 files changed, 8 insertions(+), 0 deletions(-)
0a122b
0a122b
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
0a122b
index 9d7315f..87ba7af 100644
0a122b
--- a/hw/usb/hcd-xhci.c
0a122b
+++ b/hw/usb/hcd-xhci.c
0a122b
@@ -2976,6 +2976,14 @@ static void xhci_oper_write(void *ptr, hwaddr reg,
0a122b
         } else if (!(val & USBCMD_RS) && (xhci->usbcmd & USBCMD_RS)) {
0a122b
             xhci_stop(xhci);
0a122b
         }
0a122b
+        if (val & USBCMD_CSS) {
0a122b
+            /* save state */
0a122b
+            xhci->usbsts &= ~USBSTS_SRE;
0a122b
+        }
0a122b
+        if (val & USBCMD_CRS) {
0a122b
+            /* restore state */
0a122b
+            xhci->usbsts |= USBSTS_SRE;
0a122b
+        }
0a122b
         xhci->usbcmd = val & 0xc0f;
0a122b
         xhci_mfwrap_update(xhci);
0a122b
         if (val & USBCMD_HCRST) {
0a122b
-- 
0a122b
1.7.1
0a122b