[SLOF] [PATCH v2 0/5] usb: Add support for USB3 devices behind a hub

Alexey Kardashevskiy aik at ozlabs.ru
Wed Aug 3 14:28:57 AEST 2016


On 02/08/16 19:19, Thomas Huth wrote:
> The current XHCI code in SLOF can not deal with USB devices that
> are attached to a hub, since it does not set up the so-called
> "route string" in the slot context data yet. For example, with the
> following command, SLOF fails to detect the keyboard and it is not
> possible to type in any key in the VGA console:
> 
> qemu-system-ppc64 -nodefaults -vga std \
>   -device nec-usb-xhci,id=controller1 \
>   `for ((i=0;i<32;i++)); do echo " -device usb-mouse" ; done ` \
>   -device usb-kbd -serial stdio


I applied and pushed it to github, however I got few questions.
The command line above does not add any hub, this does:

/home/aik/qemu-system-ppc64 -enable-kvm -m 4G \
-trace events=qemu_trace_events -vga std -nodefaults \
-device nec-usb-xhci,id=nec-usb-xhci0 \
-device usb-hub,id=usb-hub0,port=1 \
-device usb-kbd,id=usb-kbd0,port=1.2 \
-serial stdio -bios slof-xhci.bin -machine pseries -smp 16,threads=8

I am surprised there is no "usb-hub0.1"-ish bus in "info qtree" so I am not
sure my command line puts the keyboard to that hub but I think it does.


What I also noticed, quite often (60% of attempts actually), keyboard does
not work in VNC at all. It seems to be a QEMU/VNC issue as
minimizing/maximizing the VNC window helps in 80% cases - have you seen this?




> (since the for loop adds a lot of USB devices, QEMU automatically
> adds some USB hubs here inbetween, so that the final usb-kbd
> is added behind a USB hub, too).
> 
> This patch series now makes sure that we can use USB devices
> behind a hub on a XHCI controller too. For this, I had to
> increase the amount of available slot contexts, make sure
> that the code keeps track of the USB hub topology, and finally
> make sure that a correct route string is build from this
> topology information.
> 
> v2:
> - Added comment in the third patch as requested by Nikunj
> - Added a 5th patch that sets the slot context speed according
>   to the port status (as suggested by Nikunj)
> 
> Thomas Huth (5):
>   usb: Move XHCI port state arrays from header to .c file
>   usb: Increase amount of maximum slot IDs and add a sanity check
>   usb: Initialize USB3 devices on a hub and keep track of hub topology
>   usb: Build correct route string for USB3 devices behind a hub
>   usb: Set XHCI slot speed according to port status
> 
>  lib/libusb/usb-core.h |  1 +
>  lib/libusb/usb-hub.c  | 49 ++++++++++++++++++++++++++++++++++++++++++-------
>  lib/libusb/usb-xhci.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
>  lib/libusb/usb-xhci.h | 23 ++++-------------------
>  4 files changed, 88 insertions(+), 34 deletions(-)
> 


-- 
Alexey


More information about the SLOF mailing list