[CentOS] kvm/qemu: USB passthrough

Fri Oct 1 18:18:08 UTC 2021
hw <hw at gc-24.de>

Hi,

I'm trying to pass an USB port (or hub) to a kvm/qemu guest, to
no avail.

To find out which physical port I can use, I plugged a device
into the port, and dmesg on the host says:

usb 3-3: new high-speed USB device number 10 using xhci_hcd

Which device on the host is that?

lspci | grep -i usb
00:14.0 USB controller: Intel Corporation C610/X99 series chipset USB xHCI Host Controller (rev 05)
00:1a.0 USB controller: Intel Corporation C610/X99 series chipset USB Enhanced Host Controller #2 (rev 05)
00:1d.0 USB controller: Intel Corporation C610/X99 series chipset USB Enhanced Host Controller #1 (rev 05)

lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/15p, 480M
    |__ Port 6: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 13: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 14: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 12M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M

I tried to add the USB port to the domain by editing it and adding:

   <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x1d6b'/>
        <product id='0x0003'/>
      </source>
    </hostdev>

The domain (a windows 10) starts with that, but no USB port shows
up.  The documentation about this totally sucks, and I couldn't
find any answer that would work with a search engine, either.
When I try to use the bus and port attributes, I'm getting domain
verification errors from virsh edit.

Is it even possible to pass an usb port or hub through?  I just
need one USB port in the guest.