#1122188 xen-hypervisor-4.20-amd64: USB Passthrough to qemu HVM not pussible

#1122188#5
Date:
2025-12-08 13:40:40 UTC
From:
To:

#1122188#10
Date:
2025-12-15 18:12:55 UTC
From:
To:
This looks like you are trying to pass through a usb1 device, but there is
only a virtual usb2 controller in your vm.

If you adjust your vm configuration to create a virtual usb1 controller this
error will probably go away. You can do this by specifying

usb = 1

or alternatively for an usb1 and usb2 controller

usbctrl = [ "version=1, ports=2", "version=2, ports=6" ]

in your vms configuration.

However you likely will run into a different error:

$ xl usbdev-attach testvm hostbus=1 hostaddr=4
libxl: error: libxl_qmp.c:1837:qmp_ev_parse_error_messages: Domain 6:Parameter 'hostaddr' expects uint64
libxl: error: libxl_device.c:1500:device_addrm_aocomplete: unable to add device
libxl_device_usbdev_add failed.

This is a bug in xen and I'm currently in contact with xen upstream about
that. A possible fix is here:
https://lore.kernel.org/xen-devel/20251215135124.11410-1-anthony@xenproject.org/

#1122188#15
Date:
2025-12-22 14:45:18 UTC
From:
To:
Hi,


thx for reply

so this must have changed since version Xen-4.17 and before

Using xen 4.17 and older i can even define a USB Hostcontroller Version
3 and attach a(ny) USB Device

that is the same with a physical System, doesn't matter where i put the
USB Stick in ?


so for me as a user (since XEN 2x or so) it seems that i loose
functionality in every version

- in XEN 4.1 i could pass through a USB Device to a PVM , since XEN 4.11
or so only to a HVM

- Passthrough for PCI(e) Devices is gone

now i have to know which USB Device (Version) i want to attach and have
to do it in the correct order ?


now with the Patch


[root@debian01:~]# xl usb-list usbvm02
Devid  Type         BE  state usb-ver ports
0      devicemodel  0   0     2       6
   Port 1:
   Port 2:
   Port 3:
   Port 4:
   Port 5:
   Port 6:
Devid  Type         BE  state usb-ver ports
1      devicemodel  0   0     1       2
   Port 1: Bus 001 Device 008
   Port 2:
[root@debian01:~]# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 4c4a:4155 Jieli Technology USB Composite Device
Bus 001 Device 003: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 001 Device 004: ID 046a:c110 CHERRY KC 4500 Ergo Keyboard
Bus 001 Device 005: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
Bus 001 Device 006: ID 0557:7000 ATEN International Co., Ltd Hub
Bus 001 Device 007: ID 0557:2419 ATEN International Co., Ltd Virtual
mouse/keyboard device
Bus 001 Device 008: ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 002: ID 05e3:0626 Genesys Logic, Inc. Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 004 Device 002: ID 0bda:9210 Realtek Semiconductor Corp. RTL9210 M.2
NVME Adapter
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 009 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 010 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 011 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 012 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
[root@debian01:~]# xl usbdev-attach usbvm02 hostbus=1 hostaddr=5
libxl: error: libxl_qmp.c:1837:qmp_ev_parse_error_messages: Domain
14:failed to open host usb device 1:5
libxl: error: libxl_device.c:1500:device_addrm_aocomplete: unable to add
device
libxl_device_usbdev_add failed.
[root@debian01:~]# xl usbdev-attach usbvm02 hostbus=1 hostaddr=5
controller=1
[root@debian01:~]# xl usb-list usbvm02
Devid  Type         BE  state usb-ver ports
0      devicemodel  0   0     2       6
   Port 1:
   Port 2:
   Port 3:
   Port 4:
   Port 5:
   Port 6:
Devid  Type         BE  state usb-ver ports
1      devicemodel  0   0     1       2
   Port 1: Bus 001 Device 008
   Port 2: Bus 001 Device 005
[root@debian01:~]#

with XEN 4.17 (and earlier) i only do

xl create /etc/xen/usbvm02.cfg
xl usbctrl-attach usbvm02 version=3 ports=6

xl usbdev-attach usbvm02 hostbus=1 hostaddr=5


regards

Volker


Am 15.12.25 um 19:12 schrieb Maximilian Engelhardt:

#1122188#20
Date:
2026-02-19 19:24:33 UTC
From:
To:
Hi Volker

On Monday, 22 December 2025 15:45:18 CET Volker Gruenewald wrote:
[...]

With the patch I can do:

xl create test2-hvm.cfg

xl usbctrl-attach test2 version=3 ports=6
xl usbdev-attach test2 hostbus=1 hostaddr=2

just fine. So maybe not much changed after all.

Indeed the qemu documentation recommends using the xhcd (usb 3) controller as
it supports usb1, usb2 and usb3 so no multiple controllers are needed:
https://www.qemu.org/docs/master/system/devices/usb.html

I asked xen upstream if the usb patch can land in their stable-4.20 branch,
that would be the easiest way to get it into Debian.

$ head -v -n-1 test2-hvm.cfg
==> test2-hvm.cfg <==
name = "test2"
type = "hvm"
xen_platform_pci = 1
memory = "768"
disk = [
  "phy:/dev/vg0/test-grub,xvda,w",
  "phy:/dev/vg0/test2-root,xvdb,w",
  "phy:/dev/vg0/test2-var,xvdc,w",
  "phy:/dev/vg0/test2-tmp,xvdd,w",
]
vif = [ "type=vif, bridge=br0" ]