mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-02-07 16:50:44 -07:00
usb: bug fix collection, doc update.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJbH6QBAAoJEEy22O7T6HE4ZwMP/RHEknxR+tGKYfUxtVP24+ta tKMVuewqnDuIjUQsYj/tMvtGEvPd827Cy1X+ocqNq1Gk9aJez+DWWoDlrSXlLyiG r4EBMmOasFdmp1D9iQEDUF0pbnbXQv7kqhnM7XbyO+rjNe1rX7HElmRXtcjBcY2I QCIpekUBVGzFO97pVzB66gwYpJvmQu2YS2783NaujeS9VEEUFy6RFCFhfNwxhA4W C264zFVk68oK1fL+71Y3Kq0WKmetBwfW2ozcBAnqLB5z0hGd9bHJocaLwqgaaQWC uaGUJS70Q7iWZ8NwOYvrpK/2ZetjPAeU6ERXeR7tK6yfkjV9UmpPXQ0aqu1OSgEr VjuMPEDK0tL8pgcuhhxkJOD6S/HNyCe8y7WLeHKpd21Mv+R2yB1zs2xsWrdMqreZ 2YXUpgvIaZJBycO8vzmzWwiSNInOGO/3Vu1kpUP4T/rdmFZ1q5f8tGgwMlq/JsU4 Ce/p0BCcCXvcG+2x5uouffIuTur4DUPn93BCUmjy/TuyggtXVNoQHEVGrMDjiyO/ 9RFVUgJl32mTbIqfVaWkweTch/yXm4XVrlbcTW3VhCCVWyA9O0m+MwyjIoNeXn8L yPLF+3ndYgMoTJBFZ20HWEGhZ2+I54fhn/iRW6Nq7qtZ2rOP//K2CqyEp/CuQWis vxb796sHEPPUeTCoCiVY =sxQ0 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/usb-20180612-pull-request' into staging usb: bug fix collection, doc update. # gpg: Signature made Tue 12 Jun 2018 11:44:17 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/usb-20180612-pull-request: usb-mtp: Return error on suspicious TYPE_DATA packet from initiator usb-hcd-xhci-test: add a test for ccid hotplug usb-ccid: fix bus leak object: fix OBJ_PROP_LINK_UNREF_ON_RELEASE ambivalence bus: do not unref the added child bus on realize usb/dev-mtp: Fix use of uninitialized values usb: correctly handle Zero Length Packets usb: update docs Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
2ab09bf2f9
23 changed files with 109 additions and 71 deletions
|
|
@ -1,16 +1,42 @@
|
|||
|
||||
USB 2.0 Quick Start
|
||||
===================
|
||||
USB Quick Start
|
||||
===============
|
||||
|
||||
The QEMU EHCI Adapter can be used with and without companion
|
||||
controllers. See below for the companion controller mode.
|
||||
XHCI controller support
|
||||
-----------------------
|
||||
|
||||
When not running in companion controller mode there are two completely
|
||||
separate USB busses: One USB 1.1 bus driven by the UHCI controller and
|
||||
one USB 2.0 bus driven by the EHCI controller. Devices must be
|
||||
attached to the correct controller manually.
|
||||
QEMU has XHCI host adapter support. The XHCI hardware design is much
|
||||
more virtualization-friendly when compared to EHCI and UHCI, thus XHCI
|
||||
emulation uses less resources (especially cpu). So if your guest
|
||||
supports XHCI (which should be the case for any operating system
|
||||
released around 2010 or later) we recommend using it:
|
||||
|
||||
The '-usb' switch will make qemu create the UHCI controller as part of
|
||||
qemu -device qemu-xhci
|
||||
|
||||
XHCI supports USB 1.1, USB 2.0 and USB 3.0 devices, so this is the
|
||||
only controller you need. With only a single USB controller (and
|
||||
therefore only a single USB bus) present in the system there is no
|
||||
need to use the bus= parameter when adding USB devices.
|
||||
|
||||
|
||||
EHCI controller support
|
||||
-----------------------
|
||||
|
||||
The QEMU EHCI Adapter supports USB 2.0 devices. It can be used either
|
||||
standalone or with companion controllers (UHCI, OHCI) for USB 1.1
|
||||
devices. The companion controller setup is more convenient to use
|
||||
because it provides a single USB bus supporting both USB 2.0 and USB
|
||||
1.1 devices. See next section for details.
|
||||
|
||||
When running EHCI in standalone mode you can add UHCI or OHCI
|
||||
controllers for USB 1.1 devices too. Each controller creates its own
|
||||
bus though, so there are two completely separate USB buses: One USB
|
||||
1.1 bus driven by the UHCI controller and one USB 2.0 bus driven by
|
||||
the EHCI controller. Devices must be attached to the correct
|
||||
controller manually.
|
||||
|
||||
The easiest way to add a UHCI controller to a 'pc' machine is the
|
||||
'-usb' switch. QEMU will create the UHCI controller as function of
|
||||
the PIIX3 chipset. The USB 1.1 bus will carry the name "usb-bus.0".
|
||||
|
||||
You can use the standard -device switch to add a EHCI controller to
|
||||
|
|
@ -19,9 +45,8 @@ the controller so the USB 2.0 bus gets a individual name, for example
|
|||
'-device usb-ehci,id=ehci". This will give you a USB 2.0 bus named
|
||||
"ehci.0".
|
||||
|
||||
I strongly recommend to also use -device to attach usb devices because
|
||||
you can specify the bus they should be attached to this way. Here is
|
||||
a complete example:
|
||||
When adding USB devices using the -device switch you can specify the
|
||||
bus they should be attached to. Here is a complete example:
|
||||
|
||||
qemu -M pc ${otheroptions} \
|
||||
-drive if=none,id=usbstick,file=/path/to/image \
|
||||
|
|
@ -30,58 +55,44 @@ a complete example:
|
|||
-device usb-tablet,bus=usb-bus.0 \
|
||||
-device usb-storage,bus=ehci.0,drive=usbstick
|
||||
|
||||
This attaches a usb tablet to the UHCI adapter and a usb mass storage
|
||||
This attaches a USB tablet to the UHCI adapter and a USB mass storage
|
||||
device to the EHCI adapter.
|
||||
|
||||
|
||||
Companion controller support
|
||||
----------------------------
|
||||
|
||||
Companion controller support has been added recently. The operational
|
||||
model described above with two completely separate busses still works
|
||||
fine. Additionally the UHCI and OHCI controllers got the ability to
|
||||
attach to a usb bus created by EHCI as companion controllers. This is
|
||||
done by specifying the masterbus and firstport properties. masterbus
|
||||
specifies the bus name the controller should attach to. firstport
|
||||
specifies the first port the controller should attach to, which is
|
||||
needed as usually one ehci controller with six ports has three uhci
|
||||
companion controllers with two ports each.
|
||||
The UHCI and OHCI controllers can attach to a USB bus created by EHCI
|
||||
as companion controllers. This is done by specifying the masterbus
|
||||
and firstport properties. masterbus specifies the bus name the
|
||||
controller should attach to. firstport specifies the first port the
|
||||
controller should attach to, which is needed as usually one EHCI
|
||||
controller with six ports has three UHCI companion controllers with
|
||||
two ports each.
|
||||
|
||||
There is a config file in docs which will do all this for you, just
|
||||
try ...
|
||||
There is a config file in docs which will do all this for
|
||||
you, just try ...
|
||||
|
||||
qemu -readconfig docs/config/ich9-ehci-uhci.cfg
|
||||
|
||||
... then use "bus=ehci.0" to assign your usb devices to that bus.
|
||||
... then use "bus=ehci.0" to assign your USB devices to that bus.
|
||||
|
||||
|
||||
xhci controller support
|
||||
-----------------------
|
||||
|
||||
There is also xhci host controller support available. It got a lot
|
||||
less testing than ehci and there are a bunch of known limitations, so
|
||||
ehci may work better for you. On the other hand the xhci hardware
|
||||
design is much more virtualization-friendly, thus xhci emulation uses
|
||||
less resources (especially cpu). If you want to give xhci a try
|
||||
use this to add the host controller ...
|
||||
|
||||
qemu -device nec-usb-xhci,id=xhci
|
||||
|
||||
... then use "bus=xhci.0" when assigning usb devices.
|
||||
Using the '-usb' switch for 'q35' machines will create a similar
|
||||
USB controller configuration.
|
||||
|
||||
|
||||
More USB tips & tricks
|
||||
======================
|
||||
|
||||
Recently the usb pass through driver (also known as usb-host) and the
|
||||
qemu usb subsystem gained a few capabilities which are available only
|
||||
Recently the USB pass through driver (also known as usb-host) and the
|
||||
QEMU USB subsystem gained a few capabilities which are available only
|
||||
via qdev properties, i,e. when using '-device'.
|
||||
|
||||
|
||||
physical port addressing
|
||||
------------------------
|
||||
|
||||
First you can (for all usb devices) specify the physical port where
|
||||
First you can (for all USB devices) specify the physical port where
|
||||
the device will show up in the guest. This can be done using the
|
||||
"port" property. UHCI has two root ports (1,2). EHCI has four root
|
||||
ports (1-4), the emulated (1.1) USB hub has eight ports.
|
||||
|
|
@ -94,7 +105,7 @@ Plugging a hub into UHCI port 2 works like this:
|
|||
|
||||
-device usb-hub,bus=usb-bus.0,port=2
|
||||
|
||||
Plugging a virtual usb stick into port 4 of the hub just plugged works
|
||||
Plugging a virtual USB stick into port 4 of the hub just plugged works
|
||||
this way:
|
||||
|
||||
-device usb-storage,bus=usb-bus.0,port=2.4,drive=...
|
||||
|
|
@ -143,7 +154,7 @@ practice only a few combinations are useful:
|
|||
|
||||
Note that USB 1.1 devices are handled by UHCI/OHCI and USB 2.0 by
|
||||
EHCI. That means a device plugged into the very same physical port
|
||||
may show up on different busses depending on the speed. The port I'm
|
||||
may show up on different buses depending on the speed. The port I'm
|
||||
using for testing is bus 1 + port 1 for 2.0 devices and bus 3 + port 1
|
||||
for 1.1 devices. Passing through any device plugged into that port
|
||||
and also assign them to the correct bus can be done this way:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue