From patchwork Mon Jan 14 11:50:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 211770 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 3260D2C00A3 for ; Mon, 14 Jan 2013 22:51:09 +1100 (EST) Received: from localhost ([::1]:54590 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuiZE-0000Vg-Fq for incoming@patchwork.ozlabs.org; Mon, 14 Jan 2013 06:51:04 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuiYx-0000Gm-IC for qemu-devel@nongnu.org; Mon, 14 Jan 2013 06:50:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TuiYr-0004EK-LB for qemu-devel@nongnu.org; Mon, 14 Jan 2013 06:50:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuiYr-0004E3-C8 for qemu-devel@nongnu.org; Mon, 14 Jan 2013 06:50:41 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0EBoemj004791 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 14 Jan 2013 06:50:40 -0500 Received: from rincewind.home.kraxel.org (ovpn-116-52.ams2.redhat.com [10.36.116.52]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0EBoJ2S002808; Mon, 14 Jan 2013 06:50:28 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 73A6D41B19; Mon, 14 Jan 2013 12:50:19 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 14 Jan 2013 12:50:16 +0100 Message-Id: <1358164219-14070-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1358164219-14070-1-git-send-email-kraxel@redhat.com> References: <1358164219-14070-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 3/6] xhci: nuke transfe5rs on detach 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 Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-xhci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 5b2e7f8..5fb0c48 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -1197,6 +1197,7 @@ static int xhci_ep_nuke_xfers(XHCIState *xhci, unsigned int slotid, ep = epctx->transfers[xferi].packet.ep; } killed += xhci_ep_nuke_one_xfer(&epctx->transfers[xferi]); + epctx->transfers[xferi].packet.ep = NULL; xferi = (xferi + 1) % TD_QUEUE; } if (ep) { @@ -2201,7 +2202,7 @@ static unsigned int xhci_get_slot(XHCIState *xhci, XHCIEvent *event, XHCITRB *tr /* cleanup slot state on usb device detach */ static void xhci_detach_slot(XHCIState *xhci, USBPort *uport) { - int slot; + int slot, ep; for (slot = 0; slot < xhci->numslots; slot++) { if (xhci->slots[slot].uport == uport) { @@ -2212,6 +2213,11 @@ static void xhci_detach_slot(XHCIState *xhci, USBPort *uport) return; } + for (ep = 0; ep < 31; ep++) { + if (xhci->slots[slot].eps[ep]) { + xhci_ep_nuke_xfers(xhci, slot+1, ep+1); + } + } xhci->slots[slot].uport = NULL; }