Xen USB Passthrough

From Xen

Jump to: navigation, search


Xen USB Passthrough

Xen supports passthru of USB devices from dom0 to guests using two different methods: HVM USB and PV USB. They use separate command sets which unfortunately look very similar:

  • HVM USB uses the following commands: usb-add, usb-del
  • PV USB' uses the following commands: usb-hc-create, usb-hc-destroy, usb-attach, usb-destroy

For Xen HVM (fully virtualized) guests:

  • Xen qemu-dm USB passthru using USB 1.1 emulation, by specifying "usb = 1" and "usbdevice = host:xxxx:yyyy" in /etc/xen/<guest> cfgfile. This method is low performance and doesn't support all USB devices, but it's available in all Xen 3.x and newer versions and doesn't require any special drivers in dom0 kernel or in the HVM guest.
  • Xen PVUSB support in Xen 4.0 and newer versions, when PVUSB drivers are available for both dom0 and the VM kernel.
  • Linux kernel USBIP support. For details refer to USB IP sourceforge webpage

For Xen PV (paravirtualized) guests:

  • Xen PVUSB support in Xen 4.0 and newer versions. Note that PVUSB requires special pvusb drivers in the kernel, in both the dom0 kernel and domU kernel.
  • Linux kernel USBIP support. For details refer to USB IP sourceforge webpage

Xen HVM guest qemu-dm USB 1.1 emulation/passthru

Qemu-dm used for Xen HVM (fully virtualized) guests supports USB passthru of devices from dom0 to the guest. Qemu-dm emulates USB 1.1 UHCI 2-port controller, which is pretty slow and limited in features and device support. Qemu-dm USB 1.1 passthru support is in all Xen 3.x (and newer) versions.

Qemu-dm USB 1.1 passthru doesn't require any additional backend drivers in dom0 or any additional frontend drivers in the guest!

As of Xen 4.2, HVM passthru is not available via xl, only xm. Support is slated for the 4.3 release.

Usage example in /etc/xen/<guest> cfgfile:

usb = 1
usbdevice = "host:xxxx:yyyy"

You can find out the "xxxx:yyyy" part by using "lsusb" command in dom0.

You can also plug a device into a running VM using usb-add and usb-del:

  • xm usb-add domain host:xxxx:yyyy
  • xm usb-del domain host:xxxx:yyyy

PVUSB support in Xen 4.0 and newer versions

PVUSB is a new high performance method of doing USB passthru from dom0 to the guests, supporting both USB 2.0 and USB 1.1 devices. PVUSB does not use Qemu-dm. PVUSB can be used with both HVM and PV domUs, but it requires special pvusb drivers in dom0 kernel (xen-usbback) and the frontend driver (xen-usbfront) in the VM.

Presentation slides about PVUSB from XenSummits (contains usage examples and syntax):

Links related to PVUSB:

Xen Linux kernels that have PVUSB support included:

More information about different kernel versions and drivers in them:

Windows Xen PVUSB drivers (frontends):

USB passthrough of the whole controller

You can also use Xen PCI passthrough ( XenPCIpassthrough ) to passthru the whole USB controller PCI device, with all USB devices connected to that USB controller.

Personal tools