qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Krasnyansky <maxk@kernel.org>
To: anthony@codemonkey.ws, qemu-devel@nongnu.org
Cc: kvm@vger.kernel.org, Max Krasnyansky <maxk@kernel.org>
Subject: [Qemu-devel] [PATCH 8/8] uhci: fixes for save/load-vm
Date: Fri, 15 Aug 2008 00:51:50 +0000	[thread overview]
Message-ID: <74caf981d21c6dfb775112edba598a19b904bd28.1218760447.git.maxk@kernel.org> (raw)
In-Reply-To: <cover.1218760447.git.maxk@kernel.org>
In-Reply-To: <cover.1218760447.git.maxk@kernel.org>

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 <maxk@kernel.org>
---
 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

  parent reply	other threads:[~2008-08-15  0:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-15  0:51 [Qemu-devel] [PATCH 0/8] Various USB fixes and improvements (update 2) Max Krasnyansky
2008-08-15  0:51 ` [Qemu-devel] [PATCH 1/8] husb: support for USB host device auto disconnect Max Krasnyansky
2008-08-15  0:51 ` [Qemu-devel] [PATCH 2/8] husb: support for USB host device auto connect Max Krasnyansky
2008-08-15  0:51 ` [Qemu-devel] [PATCH 3/8] usb: generic packet handler cleanup and documentation Max Krasnyansky
2008-08-15  0:51 ` [Qemu-devel] [PATCH 4/8] uhci: rewrite UHCI emulator, fully async operation with multiple outstanding transactions Max Krasnyansky
2008-08-15  0:51 ` [Qemu-devel] [PATCH 5/8] husb: rewrite Linux host USB layer, fully async operation Max Krasnyansky
2008-08-15  0:51 ` [Qemu-devel] [PATCH 6/8] husb: remove disconnect detection timer Max Krasnyansky
2008-08-15  0:51 ` [Qemu-devel] [PATCH 7/8] husb: Fixup printfs and stuff based on the review comments Max Krasnyansky
2008-08-15  0:51 ` Max Krasnyansky [this message]
2008-08-18 14:02 ` [Qemu-devel] Re: [PATCH 0/8] Various USB fixes and improvements (update 2) Anthony Liguori
2008-08-18 14:14   ` Ian Jackson
2008-08-18 18:57   ` Max Krasnyansky
2008-08-21 18:44     ` Anthony Liguori
2008-08-21 19:36 ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74caf981d21c6dfb775112edba598a19b904bd28.1218760447.git.maxk@kernel.org \
    --to=maxk@kernel.org \
    --cc=anthony@codemonkey.ws \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).