From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRMvE-0006w6-55 for qemu-devel@nongnu.org; Thu, 25 Oct 2012 08:52:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TRMv4-0003ER-5I for qemu-devel@nongnu.org; Thu, 25 Oct 2012 08:52:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36001) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRMv3-0003EI-T8 for qemu-devel@nongnu.org; Thu, 25 Oct 2012 08:52:18 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9PCqHXt011100 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 25 Oct 2012 08:52:17 -0400 From: Gerd Hoffmann Date: Thu, 25 Oct 2012 14:51:40 +0200 Message-Id: <1351169529-10799-8-git-send-email-kraxel@redhat.com> In-Reply-To: <1351169529-10799-1-git-send-email-kraxel@redhat.com> References: <1351169529-10799-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 07/36] ehci: Detect going in circles when filling the queue List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Hans de Goede , Gerd Hoffmann From: Hans de Goede For ctrl endpoints Windows (atleast Win7) creates circular td lists, so far these were not a problem because we would stop filling the queue if altnext was set. Since further patches in this patchset remove the altnext check this does become a problem and we need detection for going in circles. Signed-off-by: Hans de Goede Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-ehci.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index d600f08..8bd87c7 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -2073,7 +2073,7 @@ static int ehci_fill_queue(EHCIPacket *p) { EHCIQueue *q = p->queue; EHCIqtd qtd = p->qtd; - uint32_t qtdaddr; + uint32_t qtdaddr, start_addr = p->qtdaddr; for (;;) { if (NLPTR_TBIT(qtd.altnext) == 0) { @@ -2083,6 +2083,13 @@ static int ehci_fill_queue(EHCIPacket *p) break; } qtdaddr = qtd.next; + /* + * Detect circular td lists, Windows creates these, counting on the + * active bit going low after execution to make the queue stop. + */ + if (qtdaddr == start_addr) { + break; + } get_dwords(q->ehci, NLPTR_GET(qtdaddr), (uint32_t *) &qtd, sizeof(EHCIqtd) >> 2); ehci_trace_qtd(q, NLPTR_GET(qtdaddr), &qtd); -- 1.7.1