From 05c4b782ef8463145092ddf0e1f2227d6dad90f5 Mon Sep 17 00:00:00 2001
Message-Id: <05c4b782ef8463145092ddf0e1f2227d6dad90f5.1334837238.git.minovotn@redhat.com>
In-Reply-To: <79df69022f0dd9fd4f051adb900412b509731978.1334837238.git.minovotn@redhat.com>
References: <79df69022f0dd9fd4f051adb900412b509731978.1334837238.git.minovotn@redhat.com>
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Wed, 18 Apr 2012 07:59:11 +0200
Subject: [PATCH 3/3] ehci: remove hack

RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <1334735951-562-1-git-send-email-kraxel@redhat.com>
Patchwork-id: 39303
O-Subject: [RHEL-6.3 qemu-kvm PATCH] ehci: remove hack
Bugzilla: 812328
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>

To answer the question in the comment removed by this patch:  I think
this was needed because several places in the ehci emulation did not
check the T bit of link entries correctly and thus might have followed
invalid references.  See commit 2a5ff735dc1074171a0cbb1dc228d6d6e907f571

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

[ rhel6: 2a5ff735dc1074171a0cbb1dc228d6d6e907f571 backport is
         1db13e969ac48302e4b16abc1127cef4cd0d8698 ]

bugzilla: 812328 - qemu-kvm aborted when using multiple usb storage on
                   Win2003 guest
upstream: http://patchwork.ozlabs.org/patch/153168/
brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=4309935

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

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

diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index 3a69c8c..d71eb19 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -132,7 +132,6 @@
 #define NB_MAXINTRATE    8        // Max rate at which controller issues ints
 #define NB_PORTS         6        // Number of downstream ports
 #define BUFF_SIZE        5*4096   // Max bytes to transfer per transaction
-#define MAX_ITERATIONS   20       // Max number of QH before we break the loop
 #define MAX_QH           100      // Max allowable queue heads in a chain
 
 /*  Internal periodic / asynchronous schedule state machine states
@@ -1929,24 +1928,8 @@ static void ehci_advance_state(EHCIState *ehci,
 {
     EHCIQueue *q = NULL;
     int again;
-    int iter = 0;
 
     do {
-        if (ehci_get_state(ehci, async) == EST_FETCHQH) {
-            iter++;
-            /* if we are roaming a lot of QH without executing a qTD
-             * something is wrong with the linked list. TO-DO: why is
-             * this hack needed?
-             */
-            assert(iter < MAX_ITERATIONS);
-#if 0
-            if (iter > MAX_ITERATIONS) {
-                DPRINTF("\n*** advance_state: bailing on MAX ITERATIONS***\n");
-                ehci_set_state(ehci, async, EST_ACTIVE);
-                break;
-            }
-#endif
-        }
         switch(ehci_get_state(ehci, async)) {
         case EST_WAITLISTHEAD:
             again = ehci_state_waitlisthead(ehci, async);
@@ -1978,7 +1961,6 @@ static void ehci_advance_state(EHCIState *ehci,
             break;
 
         case EST_EXECUTE:
-            iter = 0;
             again = ehci_state_execute(q, async);
             break;
 
-- 
1.7.7.6

