From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KTnYA-0006VO-Rd for qemu-devel@nongnu.org; Thu, 14 Aug 2008 20:52:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KTnY5-0006St-Sb for qemu-devel@nongnu.org; Thu, 14 Aug 2008 20:52:16 -0400 Received: from [199.232.76.173] (port=40180 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTnY5-0006Si-Nv for qemu-devel@nongnu.org; Thu, 14 Aug 2008 20:52:13 -0400 Received: from hera.kernel.org ([140.211.167.34]:55256) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KTnY5-0001ey-77 for qemu-devel@nongnu.org; Thu, 14 Aug 2008 20:52:13 -0400 From: Max Krasnyansky Date: Fri, 15 Aug 2008 00:51:50 +0000 Message-Id: <74caf981d21c6dfb775112edba598a19b904bd28.1218760447.git.maxk@kernel.org> In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 8/8] uhci: fixes for save/load-vm Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws, qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, Max Krasnyansky For some reason we were not registering save/load-vm handler for piix3 flavor of UHCI and hence save/load was broken. Async transactions need to be canceled when we save the VM because there is no way we can save/restore all that state. Since we do not mess the original TD/QH the driver will simply resubmit the transfers. Tested with Windows XP-SP2 running under QEMU/KQEMU. Signed-off-by: Max Krasnyansky --- hw/usb-uhci.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c index c6e7751..1b15074 100644 --- a/hw/usb-uhci.c +++ b/hw/usb-uhci.c @@ -310,6 +310,8 @@ static void uhci_reset(UHCIState *s) int i; UHCIPort *port; + dprintf("uhci: full reset\n"); + pci_conf = s->dev.config; pci_conf[0x6a] = 0x01; /* usb clock */ @@ -331,13 +333,14 @@ static void uhci_reset(UHCIState *s) uhci_async_cancel_all(s); } -#if 1 static void uhci_save(QEMUFile *f, void *opaque) { UHCIState *s = opaque; uint8_t num_ports = NB_PORTS; int i; + uhci_async_cancel_all(s); + pci_device_save(&s->dev, f); qemu_put_8s(f, &num_ports); @@ -383,7 +386,6 @@ static int uhci_load(QEMUFile *f, void *opaque, int version_id) return 0; } -#endif static void uhci_ioport_writeb(void *opaque, uint32_t addr, uint32_t val) { @@ -1009,6 +1011,8 @@ static void uhci_frame_timer(void *opaque) qemu_del_timer(s->frame_timer); /* set hchalted bit in status - UHCI11D 2.1.2 */ s->status |= UHCI_STS_HCHALTED; + + dprintf("uhci: halted\n"); return; } @@ -1082,6 +1086,8 @@ void usb_uhci_piix3_init(PCIBus *bus, int devfn) to rely on this. */ pci_register_io_region(&s->dev, 4, 0x20, PCI_ADDRESS_SPACE_IO, uhci_map); + + register_savevm("uhci", 0, 1, uhci_save, uhci_load, s); } void usb_uhci_piix4_init(PCIBus *bus, int devfn) -- 1.5.5.1