XHCI controllers in QEMU do not work with USB redirection
When I try to set up USB redirection for a QEMU VM, using the recommended "qemu-xhci" controller does not work. On the host, I get a "Speed mismatch" warning. On the guest, the USB device is not detected, and I get -110 errors in dmesg.
This also happens with the "nec-usb-xhci" controller.
However, when I start the same VM with the same launch parameters on an Arch Linux install, I'm not encountering any issue.
Using the integrated controller on a q35 board ("-machine q35,usb=on") and removing the XHCI controller works, but then the performance is subpar. When trying to use both controllers, I'm getting the same errors.
My QEMU launch parameters:
qemu-system-x86_64 \
-smp sockets=1,cores=6,threads=1 \
-m 16G \
-cpu host,kvm=on \
-machine q35,accel=kvm,kernel_irqchip=on,vmport=off,sata=off,usb=off,graphics=off,firmware=/usr/share/ovmf/bios.bin \
-global ICH9-LPC.disable_s3=1 \
-global ICH9-LPC.disable_s4=1 \
-mem-prealloc \
-rtc base=utc,clock=host \
-device vfio-pci,host=01:00.0 \
-device virtio-blk-pci,id=blkos,discard=on,drive=osdisk \
-drive file=/dev/vg0/vmdisk,format=raw,if=none,discard=unmap,aio=native,cache=none,id=osdisk \
-netdev user,id=net4,ipv6=off \
-device virtio-net-pci,netdev=net4 \
-device qemu-xhci \
-device usb-host,vendorid=0x0bb4,productid=0x2210 \
-device usb-host,vendorid=0x0bb4,productid=0x2134 \
-device usb-host,vendorid=0x0bb4,productid=0x0306 \
-device usb-host,vendorid=0x0bb4,productid=0x2c87 \
-nographic \
-vga none \
-display none
Relevant guest dmesg output:
[ 30.769814] usb 5-4: New USB device found, idVendor=0409, idProduct=55aa, bcdDevice= 1.01
[ 30.769827] usb 5-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 30.769834] usb 5-4: Product: QEMU USB Hub
[ 30.769839] usb 5-4: Manufacturer: QEMU
[ 30.769843] usb 5-4: SerialNumber: 314159-0000:00:08.0-4
[ 30.771176] hub 5-4:1.0: USB hub found
[ 30.771397] hub 5-4:1.0: 8 ports detected
[ 30.998127] usb 5-3: new full-speed USB device number 3 using xhci_hcd
[ 31.190125] usb 5-4.1: new full-speed USB device number 4 using xhci_hcd
[ 36.402124] usb 5-3: unable to read config index 0 descriptor/all
[ 36.402136] usb 5-3: can't read configurations, error -110
[ 36.682119] usb 5-3: new full-speed USB device number 5 using xhci_hcd
[ 42.033696] usb 5-3: unable to read config index 0 descriptor/all
[ 42.033708] usb 5-3: can't read configurations, error -110
[ 42.034928] usb usb5-port3: attempt power cycle
[ 42.385206] usb 5-3: new full-speed USB device number 6 using xhci_hcd
[ 47.665443] usb 5-3: unable to read config index 0 descriptor/all
[ 47.665454] usb 5-3: can't read configurations, error -110
[ 47.952141] usb 5-3: new full-speed USB device number 7 using xhci_hcd
I'm using Alpine Edge with the LTS kernel, with everything updated to the latest version (linux 5.10.50-0-lts, QEMU 6.0.0).