From: Gerd Hoffmann <kraxel@redhat.com> To: qemu-devel@nongnu.org Cc: "Peter Maydell" <peter.maydell@linaro.org>, "Thomas Huth" <thuth@redhat.com>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, "Wainer dos Santos Moschetta" <wainersm@redhat.com>, "Willian Rampazzo" <willianr@redhat.com>, "Gerd Hoffmann" <kraxel@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org> Subject: [PULL 7/7] docs: Fold usb2.txt passthrough information into usb.rst Date: Thu, 29 Jul 2021 14:50:44 +0200 [thread overview] Message-ID: <20210729125044.3531457-8-kraxel@redhat.com> (raw) In-Reply-To: <20210729125044.3531457-1-kraxel@redhat.com> From: Peter Maydell <peter.maydell@linaro.org> Fold the usb2.txt information on device passthrough into usb.rst; since this is the last part of the .txt file we can delete it now. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20210728141457.14825-5-peter.maydell@linaro.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- docs/usb2.txt | 58 ------------------------------------- MAINTAINERS | 1 - docs/system/devices/usb.rst | 49 +++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 59 deletions(-) delete mode 100644 docs/usb2.txt diff --git a/docs/usb2.txt b/docs/usb2.txt deleted file mode 100644 index 6a88d5314f9c..000000000000 --- a/docs/usb2.txt +++ /dev/null @@ -1,58 +0,0 @@ - -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 -via qdev properties, i,e. when using '-device'. - -USB pass through hints ----------------------- - -The usb-host driver has a bunch of properties to specify the device -which should be passed to the guest: - - hostbus=<nr> -- Specifies the bus number the device must be attached - to. - - hostaddr=<nr> -- Specifies the device address the device got - assigned by the guest os. - - hostport=<str> -- Specifies the physical port the device is attached - to. - - vendorid=<hexnr> -- Specifies the vendor ID of the device. - productid=<hexnr> -- Specifies the product ID of the device. - -In theory you can combine all these properties as you like. In -practice only a few combinations are useful: - - (1) vendorid+productid -- match for a specific device, pass it to - the guest when it shows up somewhere in the host. - - (2) hostbus+hostport -- match for a specific physical port in the - host, any device which is plugged in there gets passed to the - guest. - - (3) hostbus+hostaddr -- most useful for ad-hoc pass through as the - hostaddr isn't stable, the next time you plug in the device it - gets a new one ... - -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 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: - - qemu -M pc ${otheroptions} \ - -usb \ - -device usb-ehci,id=ehci \ - -device usb-host,bus=usb-bus.0,hostbus=3,hostport=1 \ - -device usb-host,bus=ehci.0,hostbus=1,hostport=1 - -enjoy, - Gerd - --- -Gerd Hoffmann <kraxel@redhat.com> diff --git a/MAINTAINERS b/MAINTAINERS index b1f8e82befc6..2089e71007d6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1837,7 +1837,6 @@ F: hw/usb/* F: stubs/usb-dev-stub.c F: tests/qtest/usb-*-test.c F: docs/system/devices/usb.rst -F: docs/usb-storage.txt F: include/hw/usb.h F: include/hw/usb/ diff --git a/docs/system/devices/usb.rst b/docs/system/devices/usb.rst index bab0cd3fdfd1..afb7d6c2268d 100644 --- a/docs/system/devices/usb.rst +++ b/docs/system/devices/usb.rst @@ -300,3 +300,52 @@ are not supported yet. When relaunching QEMU, you may have to unplug and plug again the USB device to make it work again (this is a bug). + +``usb-host`` properties for specifying the host device +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The example above uses the ``vendorid`` and ``productid`` to +specify which host device to pass through, but this is not +the only way to specify the host device. ``usb-host`` supports +the following properties: + +``hostbus=<nr>`` + Specifies the bus number the device must be attached to +``hostaddr=<nr>`` + Specifies the device address the device got assigned by the guest os +``hostport=<str>`` + Specifies the physical port the device is attached to +``vendorid=<hexnr>`` + Specifies the vendor ID of the device +``productid=<hexnr>`` + Specifies the product ID of the device. + +In theory you can combine all these properties as you like. In +practice only a few combinations are useful: + +- ``vendorid`` and ``productid`` -- match for a specific device, pass it to + the guest when it shows up somewhere in the host. + +- ``hostbus`` and ``hostport`` -- match for a specific physical port in the + host, any device which is plugged in there gets passed to the + guest. + +- ``hostbus`` and ``hostaddr`` -- most useful for ad-hoc pass through as the + hostaddr isn't stable. The next time you plug the device into the host it + will get a new hostaddr. + +Note that on the host USB 1.1 devices are handled by UHCI/OHCI and USB +2.0 by EHCI. That means different USB devices plugged into the very +same physical port on the host may show up on different host buses +depending on the speed. Supposing that devices plugged into a given +physical port appear as bus 1 + port 1 for 2.0 devices and bus 3 + port 1 +for 1.1 devices, you can pass through any device plugged into that port +and also assign it to the correct USB bus in QEMU like this: + +.. parsed-literal:: + + |qemu_system| -M pc [...] \\ + -usb \\ + -device usb-ehci,id=ehci \\ + -device usb-host,bus=usb-bus.0,hostbus=3,hostport=1 \\ + -device usb-host,bus=ehci.0,hostbus=1,hostport=1 -- 2.31.1
next prev parent reply other threads:[~2021-07-29 13:03 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-29 12:50 [PULL 0/7] Usb 20210729 patches Gerd Hoffmann 2021-07-29 12:50 ` [PULL 1/7] usb-host: wire up timer for windows Gerd Hoffmann 2021-07-29 12:50 ` [PULL 2/7] ci: add libusb for windows builds Gerd Hoffmann 2021-07-29 12:50 ` [PULL 3/7] usbredir: fix free call Gerd Hoffmann 2021-07-29 12:50 ` [PULL 4/7] docs: Incorporate information in usb-storage.txt into rST manual Gerd Hoffmann 2021-07-29 12:50 ` [PULL 5/7] docs: Fold usb2.txt USB controller information into usb.rst Gerd Hoffmann 2021-07-29 12:50 ` [PULL 6/7] docs: Fold usb2.txt physical port addressing info " Gerd Hoffmann 2021-07-29 12:50 ` Gerd Hoffmann [this message] 2021-07-30 8:14 ` [PULL 0/7] Usb 20210729 patches Peter Maydell
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210729125044.3531457-8-kraxel@redhat.com \ --to=kraxel@redhat.com \ --cc=alex.bennee@linaro.org \ --cc=f4bug@amsat.org \ --cc=peter.maydell@linaro.org \ --cc=qemu-devel@nongnu.org \ --cc=thuth@redhat.com \ --cc=wainersm@redhat.com \ --cc=willianr@redhat.com \ --subject='Re: [PULL 7/7] docs: Fold usb2.txt passthrough information into usb.rst' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.