From patchwork Fri Jan 13 13:37:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 135839 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2A4A9B6F65 for ; Sat, 14 Jan 2012 00:37:00 +1100 (EST) Received: from localhost ([::1]:56442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlhJS-00075O-BE for incoming@patchwork.ozlabs.org; Fri, 13 Jan 2012 08:36:58 -0500 Received: from eggs.gnu.org ([140.186.70.92]:59020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlhJG-00074Y-OO for qemu-devel@nongnu.org; Fri, 13 Jan 2012 08:36:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlhJA-0002l0-Fz for qemu-devel@nongnu.org; Fri, 13 Jan 2012 08:36:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58585) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlhJA-0002kr-8H for qemu-devel@nongnu.org; Fri, 13 Jan 2012 08:36:40 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0DDadrE009035 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 Jan 2012 08:36:39 -0500 Received: from shalem.localdomain (vpn1-6-225.ams2.redhat.com [10.36.6.225]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q0DDaa8s002993 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 13 Jan 2012 08:36:38 -0500 Message-ID: <4F1033AD.8070701@redhat.com> Date: Fri, 13 Jan 2012 14:37:49 +0100 From: Hans de Goede User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Erik Rull References: <0Na7hH-1Rhr3U3YN4-001hiO@icpu819.kundenserver.de> <4F0483E4.1020103@rdsoftware.de> In-Reply-To: <4F0483E4.1020103@rdsoftware.de> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org Subject: Re: [Qemu-devel] Mixed USB 1.1 and USB 2.0 on the same port 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 On 01/04/2012 05:52 PM, Erik Rull wrote: > erik.rull@rdsoftware.de wrote: >>> On 12/31/11 13:11, Erik Rull wrote: >>>> Hi all, >>>> >>>> how can I use a USB 1.1 device on the USB 2.0 bus? Currently the EHCI >>>> implementation complains that the device is mismatches the USB version. >>> >>> -readconfig docs/ich9-ehci-uhci.cfg >>> >>> cheers, >>> Gerd >> >> Thanks for the hint. >> >> It looks better now. But some things are still a bit strange.Hi, >> >> Sequence: >> device_add usb-host,bus=ehci.0,hostbus=2,hostport=1.4 >> Plug in a USB 2.0 printer >> (gets detected by the guest, printing is possible, no bluescreen, it just >> works) >> Remove the USB 2.0 printer >> Plug in a USB 1.1 dongle >> Gets detected, etc., fine >> Remove the USB 1.1 dongle >> Plug in the USB 2.0 printer again >> Guest complains now, that a USB 2.0 device was plugged into a USB 1.1 port >> => printer is now 1.1 and does not work as if EHCI is missing now >> => reboot guest, everything is fine again?? >> >> Any idea what could have happened here? >> Same behavior when using a 2.0 USB key and the USB 1.1 dongle - also on >> other ports - the transfer rate is horrible after having removed the USB >> 1.1 device and reconnected the 2.0 device. >> Exchanging the two USB 2.0 devices on the same port without having the 1.1 >> device plugged in is fine! >> >> Any hint what is wrong here would be great. >> >> Best regards, >> >> Erik >> > > Additional Information: > This behavior is present on a Linux guest as well! After having removed the 1.1 Dongle and plugged in the printer, the Linux guest detects the hardware via the UHCI kernel drivers and tells me to use a faster hub for max. performance. > It looks as if the speed downgrade by the 1.1 device cannot be reversed at runtime. I've managed to reproduce this and written a fix for it. I've just send a patch for this to the list. I've also attached this patch here for your convenience. Regards, Hans From 0b5059a8c0ae45c66caf5947f66b5c5cae81f622 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 13 Jan 2012 14:26:26 +0100 Subject: [PATCH] usb-ehci: Clear the portstatus powner bit on device disconnect According to the EHCI spec port ownerhsip should revert to the EHCI controller on device disconnect. This fixes the problem of a port getting stuck on USB 1 when using redirection and plugging in a USB 2 device after a USB 1 device has been redirected. Signed-off-by: Hans de Goede --- hw/usb-ehci.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c index a946e1d..69bcc4b 100644 --- a/hw/usb-ehci.c +++ b/hw/usb-ehci.c @@ -764,6 +764,11 @@ static void ehci_detach(USBPort *port) USBPort *companion = s->companion_ports[port->index]; companion->ops->detach(companion); companion->dev = NULL; + /* + * EHCI spec 4.2.2: "When a disconnect occurs... On the event, + * the port ownership is returned immediately to the EHCI controller." + */ + *portsc &= ~PORTSC_POWNER; return; } -- 1.7.7.4