From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KV5KT-0000Ai-1j for qemu-devel@nongnu.org; Mon, 18 Aug 2008 10:03:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KV5KR-00009u-EL for qemu-devel@nongnu.org; Mon, 18 Aug 2008 10:03:28 -0400 Received: from [199.232.76.173] (port=54324 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KV5KR-00009p-Bz for qemu-devel@nongnu.org; Mon, 18 Aug 2008 10:03:27 -0400 Received: from mail-gx0-f19.google.com ([209.85.217.19]:36266) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KV5KQ-0007cW-Og for qemu-devel@nongnu.org; Mon, 18 Aug 2008 10:03:26 -0400 Received: by gxk12 with SMTP id 12so3491506gxk.10 for ; Mon, 18 Aug 2008 07:03:26 -0700 (PDT) Message-ID: <48A98102.10904@codemonkey.ws> Date: Mon, 18 Aug 2008 09:02:42 -0500 From: Anthony Liguori MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 0/8] Various USB fixes and improvements (update 2) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Krasnyansky Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Paul Brook Any objections to applying this series? It seems like the consensus is that OHCI support is better long term but this series seems pretty sane and self-contained. Regards, Anthony Liguori Max Krasnyansky wrote: > This is an updated version of the USB patches I sent out yesterday. > It includes changes and fixes suggested by Anthony. > > This time I also did more testing with XP running on top of QEMU/KQEMU > (used to be QEMU/KVM). > > Max Krasnyansky (8): > husb: support for USB host device auto disconnect. > husb: support for USB host device auto connect. > usb: generic packet handler cleanup and documentation > uhci: rewrite UHCI emulator, fully async operation with multiple > outstanding transactions > husb: rewrite Linux host USB layer, fully async operation > husb: remove disconnect detection timer > husb: fixup printfs and stuff based on the review comments > uhci: fixes for save/load-vm > > hw/usb-uhci.c | 905 ++++++++++++++++++++++++++++++++++----------------------- > hw/usb.c | 265 +++++++++-------- > hw/usb.h | 37 +++- > usb-linux.c | 645 +++++++++++++++++++++++----------------- > vl.c | 83 +++--- > 5 files changed, 1138 insertions(+), 797 deletions(-) > > ---- > Here is the original description. > > This patch series started when I tried to share USB ports between > four instances of Windows XP running on the same Linux box (under KVM). > I quickly realized that current USB support is not very flexible. We do > not handle devices disconnects, there is not way to assign certain USB > ports to VM instance, etc. > > Once I fixed that I discovered that USB devices that I absolutely need > in the VMs (Xilinx and Altera USB dongles) do not really work with > QEMU. VMs were getting stuck, applications unhappy, etc. > So I endded up rewriting UHCI and Linux host USB layers to make them > fully async and to support multiple outstanding transactions. > > The result is quite nice. We can now assign USB buses to VM instances > and devices are automatically connected to the VMs. Just do > usb_add host:N.* > in the console or -usbdevice command line option (N is the bus number). > Also when device is disconnected from the host it's automatically removed > from the guest. > > Host USB devices operate in fully async mode (except the control transfers). > All the stalls and jerkiness due to long synchronous transactions is gone. > I can easily hook up four different USB devices (mouse, CF card reader, > phone, Xilinx dongle) and everything is working perfectly. Mouse movements > are silky smooth :). > > I did some profiling with OProfile and we seems to be doing ok while XP is > pumping ~10 MBytes over USB (reported by one of the apps I'm using). UHCI > stuff is well below VNC for example. > > There is more work to be done (async control transfers for example). But I > think this is way better than what we have now and is ready for more testing > by wider audience. > > Most of the testing so far was done with KVM flavor of QEMU. I did test > generic i386-softmmu target a bit, it's too slow for any serious testing > with XP. I did full compile (all targets) too and it went fine. >