Xen USB Passthrough
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!
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
- 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):
- February 2009 PVUSB: http://www.xen.org/files/xensummit_oracle09/PVUSB.pdf
- November 2009 PVUSB update: http://www.xen.org/files/xensummit_intel09/PVUSBStatusUpdate.pdf
Links related to PVUSB:
- A script to use PVUSB in an easier way with Xen: http://www.neobiker.de/wiki/index.php?title=XEN-PVUSB
- Submission of PVUSB drivers to Xen, usage help etc: http://lists.xensource.com/archives/html/xen-devel/2009-03/msg01084.html
- PVUSB updates from 10/2009: http://lists.xensource.com/archives/html/xen-devel/2009-10/msg00257.html
- PVUSB xm/xend support: http://lists.xensource.com/archives/html/xen-devel/2009-12/msg00478.html and http://xenbits.xen.org/xen-unstable.hg?rev/2e5032921b07
- Mailinglist discussions about PVUSB: http://article.gmane.org/gmane.comp.emulators.xen.devel/70980, http://old.nabble.com/anyone-using-pvusb--td25273516.html
Xen Linux kernels that have PVUSB support included:
- linux-2.6.18-xen has both the PVUSB backend and frontend drivers included. http://xenbits.xen.org/linux-2.6.18-xen.hg
- PVUSB drivers are currently being ported to the pvops kernel (2.6.32). RFC patch available from: http://lists.xensource.com/archives/html/xen-devel/2011-01/msg00354.html (http://members.iinet.net.au/~nathanael/pvusb.diff).
- Novell SLES11 SP1 kernel-xen (2.6.32) has PVUSB backend and frontend drivers.
- Linux 3.x pvops PVUSB patches: http://lists.xen.org/archives/html/xen-devel/2012-02/msg00576.html and http://lists.xen.org/archives/html/xen-devel/2012-02/msg00571.html .
More information about different kernel versions and drivers in them:
- List of various Xen dom0 capable kernel trees for Linux: XenDom0Kernels:
- List of Xen features in different Linux kernel trees: XenKernelFeatures:
Windows Xen PVUSB drivers (frontends):
- Xen Windows GPLPV drivers by James Harper have an early version of PVUSB frontend driver included.
- Discussion about initial GPLPV usbfront implementation: http://lists.xensource.com/archives/html/xen-devel/2009-09/msg00491.html
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.