From patchwork Mon Sep 10 10:44:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 182842 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D87D82C0085 for ; Mon, 10 Sep 2012 20:43:14 +1000 (EST) Received: from localhost ([::1]:57492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TB1SS-0005Sx-02 for incoming@patchwork.ozlabs.org; Mon, 10 Sep 2012 06:43:12 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TB1SL-0005Sh-OC for qemu-devel@nongnu.org; Mon, 10 Sep 2012 06:43:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TB1SH-00089R-DI for qemu-devel@nongnu.org; Mon, 10 Sep 2012 06:43:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23338) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TB1SH-00089A-5T for qemu-devel@nongnu.org; Mon, 10 Sep 2012 06:43:01 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8AAh0jp032374 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 10 Sep 2012 06:43:00 -0400 Received: from shalem.localdomain.com (vpn1-5-81.ams2.redhat.com [10.36.5.81]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8AAgvI6013634; Mon, 10 Sep 2012 06:42:59 -0400 From: Hans de Goede To: Gerd Hoffmann Date: Mon, 10 Sep 2012 12:44:10 +0200 Message-Id: <1347273851-8412-2-git-send-email-hdegoede@redhat.com> In-Reply-To: <1347273851-8412-1-git-send-email-hdegoede@redhat.com> References: <1347273851-8412-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Hans de Goede , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 1/2] ehci: Fix interrupts stopping when Interrupt Threshold Control is 8 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org If Interrupt Threshold Control is 8 or a multiple of 8, then s->usbsts_frindex can become exactly 0x4000, at which point (s->usbsts_frindex > s->frindex) will never become true, as s->usbsts_frindex will not be lowered / reset in this case. This patch fixes this. Signed-off-by: Hans de Goede --- hw/usb/hcd-ehci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 30d2b56..e6d2062 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -2426,7 +2426,7 @@ static void ehci_update_frindex(EHCIState *ehci, int frames) if (ehci->frindex == 0x00004000) { ehci_raise_irq(ehci, USBSTS_FLR); ehci->frindex = 0; - if (ehci->usbsts_frindex > 0x00004000) { + if (ehci->usbsts_frindex >= 0x00004000) { ehci->usbsts_frindex -= 0x00004000; } else { ehci->usbsts_frindex = 0;