Received: from eggs.gnu.org ([2001:4830:134:3::10]:56435) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcA6C-0004ZB-M9 for qemu-devel@nongnu.org; Tue, 23 Aug 2016 07:42:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bcA66-00042T-RK for qemu-devel@nongnu.org; Tue, 23 Aug 2016 07:42:31 -0400 Received: from heidi.turbocat.net ([88.198.202.214]:51166 helo=mail.turbocat.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcA66-000428-Kp for qemu-devel@nongnu.org; Tue, 23 Aug 2016 07:42:26 -0400 From: Hans Petter Selasky Message-ID: Date: Tue, 23 Aug 2016 13:46:55 +0200 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------50773A30FB461E08837B32FF" Subject: [Qemu-devel] [PATCH] Fix remainder field for TR_SETUP completion event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Gerd Hoffmann This is a multi-part message in MIME format. --------------50773A30FB461E08837B32FF Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Patch is also attached. --HPS > Fix remainder field for TR_SETUP completion event. Previously > the code would incorrectly report the remainder as 8 bytes. A remainder of 0 > bytes should be reported when the SETUP packet is successfully transferred. > Found using FreeBSD's XHCI driver. > > Signed-off-by: Hans Petter Selasky > --- > hw/usb/hcd-xhci.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c > index 188f954..d996d7e 100644 > --- a/hw/usb/hcd-xhci.c > +++ b/hw/usb/hcd-xhci.c > @@ -1753,6 +1753,11 @@ static void xhci_xfer_report(XHCITransfer *xfer) > unsigned int chunk = 0; > > switch (TRB_TYPE(*trb)) { > + case TR_SETUP: > + chunk = trb->status & 0x1ffff; > + if (chunk > 8) > + chunk = 8; > + break; > case TR_DATA: > case TR_NORMAL: > case TR_ISOCH: > -- > 2.8.1 > --------------50773A30FB461E08837B32FF Content-Type: text/x-patch; name="0001-Fix-remainder-field-for-TR_SETUP-completion-event.-P.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Fix-remainder-field-for-TR_SETUP-completion-event.-P.pa"; filename*1="tch" >From 4771b0788a6f055a8830cb3b6f7bf922574bfe0d Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Tue, 23 Aug 2016 13:39:49 +0200 Subject: [PATCH] Fix remainder field for TR_SETUP completion event. Previously the code would incorrectly report the remainder as 8 bytes. A remainder of 0 bytes should be reported when the SETUP packet is successfully transferred. Found using FreeBSD's XHCI driver. Signed-off-by: Hans Petter Selasky --- hw/usb/hcd-xhci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 188f954..d996d7e 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -1753,6 +1753,11 @@ static void xhci_xfer_report(XHCITransfer *xfer) unsigned int chunk = 0; switch (TRB_TYPE(*trb)) { + case TR_SETUP: + chunk = trb->status & 0x1ffff; + if (chunk > 8) + chunk = 8; + break; case TR_DATA: case TR_NORMAL: case TR_ISOCH: -- 2.8.1 --------------50773A30FB461E08837B32FF--