From patchwork Mon Sep 16 15:04:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 275231 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7E25F2C00F7 for ; Tue, 17 Sep 2013 01:05:13 +1000 (EST) Received: from localhost ([::1]:35301 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLaMR-000544-Jb for incoming@patchwork.ozlabs.org; Mon, 16 Sep 2013 11:05:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLaLv-0004iy-6a for qemu-devel@nongnu.org; Mon, 16 Sep 2013 11:04:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLaLo-0002Pl-Hr for qemu-devel@nongnu.org; Mon, 16 Sep 2013 11:04:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33650) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLaLo-0002PI-AV for qemu-devel@nongnu.org; Mon, 16 Sep 2013 11:04:32 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8GF4UgD017490 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 16 Sep 2013 11:04:31 -0400 Received: from shalem.localdomain.com (vpn1-5-203.ams2.redhat.com [10.36.5.203]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8GF4ThM004293; Mon, 16 Sep 2013 11:04:29 -0400 From: Hans de Goede To: Gerd Hoffmann Date: Mon, 16 Sep 2013 17:04:27 +0200 Message-Id: <1379343867-4285-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Hans de Goede , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] xhci: Fix number of streams allocated when using streams 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 According to the xhci spec the total number of streams is 2 ^ (MaxPStreams + 1), and this is also how the Linux xhci driver uses this field. Signed-off-by: Hans de Goede --- hw/usb/hcd-xhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index f02231d..69d9144 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -1138,7 +1138,7 @@ static void xhci_reset_streams(XHCIEPContext *epctx) static void xhci_alloc_streams(XHCIEPContext *epctx, dma_addr_t base) { assert(epctx->pstreams == NULL); - epctx->nr_pstreams = 2 << epctx->max_pstreams; + epctx->nr_pstreams = 2 << (epctx->max_pstreams + 1); epctx->pstreams = xhci_alloc_stream_contexts(epctx->nr_pstreams, base); }