Xen USB Passthrough

From Xen
Revision as of 20:03, 25 January 2012 by ToddDeshane (talk | contribs) (fix category tag)

Xen USB Passthrough

Xen supports passthru of USB devices from dom0 to guests using two different methods.

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!

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 do the USB 1.1 passthru to a running HVM guest from the qemu-dm console (hit ctrl-alt-2 to access the qemu console) by using a command like this:

usb_add host:xxxx:yyyy

Xen 3.4.3 and Xen 4.0.0 (and newer versions) add support for the HVM guest USB 1.1 add/del also by using "xm" commands:

  • xm usb-add
  • xm usb-del

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.