From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KWSVh-0005o3-BM for qemu-devel@nongnu.org; Fri, 22 Aug 2008 05:00:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KWSVg-0005nj-PD for qemu-devel@nongnu.org; Fri, 22 Aug 2008 05:00:45 -0400 Received: from [199.232.76.173] (port=51628 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KWSVg-0005nY-Is for qemu-devel@nongnu.org; Fri, 22 Aug 2008 05:00:44 -0400 Received: from hall.aurel32.net ([91.121.138.14]:43895) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KWSVg-000236-7Y for qemu-devel@nongnu.org; Fri, 22 Aug 2008 05:00:44 -0400 Date: Fri, 22 Aug 2008 11:00:41 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] uhci: Fixed length handling for SETUP and OUT tokens Message-ID: <20080822090041.GC21526@volta.aurel32.net> References: <1219384471-6335-1-git-send-email-maxk@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1219384471-6335-1-git-send-email-maxk@kernel.org> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, Max Krasnyansky On Fri, Aug 22, 2008 at 05:54:31AM +0000, Max Krasnyansky wrote: > Fixes regression reported agains Linux 2.6.18. > Looks like XP and newer Linux kernels are less sensitive > to length returned for control transfers. > > Signed-off-by: Max Krasnyansky Applied, thanks. > --- > hw/usb-uhci.c | 19 ++++++++++--------- > 1 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c > index 0714520..86b4696 100644 > --- a/hw/usb-uhci.c > +++ b/hw/usb-uhci.c > @@ -651,7 +651,7 @@ static int uhci_broadcast_packet(UHCIState *s, USBPacket *p) > > dprintf("uhci: packet enter. pid %s addr 0x%02x ep %d len %d\n", > pid2str(p->pid), p->devaddr, p->devep, p->len); > - if (p->pid == USB_TOKEN_OUT) > + if (p->pid == USB_TOKEN_OUT || p->pid == USB_TOKEN_SETUP) > dump_data(p->data, p->len); > > ret = USB_RET_NODEV; > @@ -771,7 +771,7 @@ out: > static int uhci_handle_td(UHCIState *s, uint32_t addr, UHCI_TD *td, uint32_t *int_mask) > { > UHCIAsync *async; > - int len = 0, max_len, ret = 0; > + int len = 0, max_len; > uint8_t pid; > > /* Is active ? */ > @@ -814,12 +814,13 @@ static int uhci_handle_td(UHCIState *s, uint32_t addr, UHCI_TD *td, uint32_t *in > case USB_TOKEN_OUT: > case USB_TOKEN_SETUP: > cpu_physical_memory_read(td->buffer, async->buffer, max_len); > - ret = uhci_broadcast_packet(s, &async->packet); > - len = max_len; > + len = uhci_broadcast_packet(s, &async->packet); > + if (len >= 0) > + len = max_len; > break; > > case USB_TOKEN_IN: > - ret = uhci_broadcast_packet(s, &async->packet); > + len = uhci_broadcast_packet(s, &async->packet); > break; > > default: > @@ -830,17 +831,17 @@ static int uhci_handle_td(UHCIState *s, uint32_t addr, UHCI_TD *td, uint32_t *in > return -1; > } > > - if (ret == USB_RET_ASYNC) { > + if (len == USB_RET_ASYNC) { > uhci_async_link(s, async); > return 2; > } > > - async->packet.len = ret; > + async->packet.len = len; > > done: > - ret = uhci_complete_td(s, td, async, int_mask); > + len = uhci_complete_td(s, td, async, int_mask); > uhci_async_free(s, async); > - return ret; > + return len; > } > > static void uhci_async_complete(USBPacket *packet, void *opaque) > -- > 1.5.5.1 > > > > -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net