From 2bd4e52234861597aaf4283d468f6363ae4b84e8 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Wed, 29 Feb 2012 13:04:30 +0100
Subject: [PATCH 3/3] usb-ehci: fix reset

RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <1330520670-8230-1-git-send-email-kraxel@redhat.com>
Patchwork-id: 37778
O-Subject: [RHEL-6.3 qemu-kvm PATCH] usb-ehci: fix reset
Bugzilla: 752049
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>

Two reset fixes:
  * pick up s->usbcmd value after ehci_reset call to make sure it
    keeps the reset value and doesn't get rubbish filled in when
    val is written back to the mmio register array later on.
  * make sure the frame timer is zapped on reset.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Git commit: 81d37739

bugzilla: 752049 - windows guest hangs when booting with usb stick
                   passthrough
upstream: http://patchwork.ozlabs.org/patch/142611/

---
 hw/usb-ehci.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 hw/usb-ehci.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index 256f939..a95c76a 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -875,6 +875,7 @@ static void ehci_reset(void *opaque)
         }
     }
     ehci_queues_rip_all(s);
+    qemu_del_timer(s->frame_timer);
 }
 
 static uint32_t ehci_mem_readb(void *ptr, target_phys_addr_t addr)
@@ -1033,7 +1034,7 @@ static void ehci_mem_writel(void *ptr, target_phys_addr_t addr, uint32_t val)
 
         if (val & USBCMD_HCRESET) {
             ehci_reset(s);
-            val &= ~USBCMD_HCRESET;
+            val = s->usbcmd;
         }
 
         /* not supporting dynamic frame list size at the moment */
-- 
1.7.7.6

