From patchwork Thu Jun 7 09:30:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 163624 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 10DECB6EE6 for ; Thu, 7 Jun 2012 21:44:23 +1000 (EST) Received: from localhost ([::1]:56303 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ScZ5H-0001tj-CB for incoming@patchwork.ozlabs.org; Thu, 07 Jun 2012 05:32:51 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ScZ46-0000QZ-H6 for qemu-devel@nongnu.org; Thu, 07 Jun 2012 05:31:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ScZ3y-0004DV-36 for qemu-devel@nongnu.org; Thu, 07 Jun 2012 05:31:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ScZ3x-0004Cj-Q8 for qemu-devel@nongnu.org; Thu, 07 Jun 2012 05:31:29 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q579VSUg021034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 7 Jun 2012 05:31:28 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-45.ams2.redhat.com [10.36.116.45]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q579VRE7023677; Thu, 7 Jun 2012 05:31:27 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id CBA8341ADD; Thu, 7 Jun 2012 11:31:26 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 7 Jun 2012 11:30:52 +0200 Message-Id: <1339061486-28513-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1339061486-28513-1-git-send-email-kraxel@redhat.com> References: <1339061486-28513-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 03/37] uhci: make bandwidth tunable 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 Add a property for the uhci bandwidth. Can be used to make uhci emulation run faster than real hardware. Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-uhci.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 91bcc7e..2e7c8f9 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -133,6 +133,7 @@ struct UHCIState { QEMUTimer *frame_timer; QEMUBH *bh; uint32_t frame_bytes; + uint32_t frame_bandwidth; UHCIPort ports[NB_PORTS]; /* Interrupts that should be raised at the end of the current frame. */ @@ -908,7 +909,7 @@ static void uhci_async_complete(USBPort *port, USBPacket *packet) uhci_async_free(async); } else { async->done = 1; - if (s->frame_bytes < 1280) { + if (s->frame_bytes < s->frame_bandwidth) { qemu_bh_schedule(s->bh); } } @@ -1007,7 +1008,7 @@ static void uhci_process_frame(UHCIState *s) qhdb_reset(&qhdb); for (cnt = FRAME_MAX_LOOPS; is_valid(link) && cnt; cnt--) { - if (s->frame_bytes >= 1280) { + if (s->frame_bytes >= s->frame_bandwidth) { /* We've reached the usb 1.1 bandwidth, which is 1280 bytes/frame, stop processing */ trace_usb_uhci_frame_stop_bandwidth(); @@ -1258,6 +1259,7 @@ static int usb_uhci_exit(PCIDevice *dev) static Property uhci_properties[] = { DEFINE_PROP_STRING("masterbus", UHCIState, masterbus), DEFINE_PROP_UINT32("firstport", UHCIState, firstport, 0), + DEFINE_PROP_UINT32("bandwidth", UHCIState, frame_bandwidth, 1280), DEFINE_PROP_END_OF_LIST(), };