From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VmJ65-0002T9-Eo for qemu-devel@nongnu.org; Fri, 29 Nov 2013 03:06:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VmJ5z-0002Af-F9 for qemu-devel@nongnu.org; Fri, 29 Nov 2013 03:06:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:25401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VmJ5z-0002AR-7D for qemu-devel@nongnu.org; Fri, 29 Nov 2013 03:06:39 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAT86c85031621 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 29 Nov 2013 03:06:38 -0500 From: Gerd Hoffmann Date: Fri, 29 Nov 2013 09:06:06 +0100 Message-Id: <1385712381-30918-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1385712381-30918-1-git-send-email-kraxel@redhat.com> References: <1385712381-30918-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 02/17] xhci: add support for suspend/resume List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann The OS can ask the xhci controller to save and restore its internal state, which is used by the OS when the system is suspended and resumed. This patch handles writes to the save + restore bits in the command register. Only thing it does is updating the restore error bit in the status register to signal an error on restore. The guest OS should do a full reinitialization after resume then. This is the minimal patch which gets S3 going with xhci. Implementing full save/restore support is TBD. https://bugzilla.redhat.com/show_bug.cgi?id=1012365 Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-xhci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index c3377ee..220e99d 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -3025,6 +3025,14 @@ static void xhci_oper_write(void *ptr, hwaddr reg, } else if (!(val & USBCMD_RS) && (xhci->usbcmd & USBCMD_RS)) { xhci_stop(xhci); } + if (val & USBCMD_CSS) { + /* save state */ + xhci->usbsts &= ~USBSTS_SRE; + } + if (val & USBCMD_CRS) { + /* restore state */ + xhci->usbsts |= USBSTS_SRE; + } xhci->usbcmd = val & 0xc0f; xhci_mfwrap_update(xhci); if (val & USBCMD_HCRST) { -- 1.8.3.1