SPICE support in Xen

From Xen

SPICE is a protocol for virtual desktops which allows a much richer connection than display-only protocols like VNC.

Xen 4.4

Xen Project 4.4 adds support for additional SPICE functionality, including vdagent, clipboard sharing, and USB redirection.

The following notes were added to the wiki on request of Fabio Fantoni, who added SPICE support to Xen


The SPICE protocol is currently only supported on HVM guests.

QEMU Upstream

To use SPICE you will need an upstream version of qemu built with SPICE support enabled.

The upstream qemu packages may already be in your Linux distribution. Recent Debian, Ubuntu, etc. will work: these have SPICE support already built-in. In addition to the xl configuration changes below, you only need to install spice-vdagent in the domU to fully enable SPICE.

Alternatively, you can compile upstream qemu from the xen source tree. However, you will need to apply a small patch to enable SPICE and USB Redirection to the build parameters. See:

 @@ -201,6 +201,8 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
  		--datadir=$(SHAREDIR)/qemu-xen \
  		--localstatedir=/var \
  		--disable-kvm \
 +		--enable-spice \
 +		--enable-usb-redir \
  		--disable-docs \
  		--disable-guest-agent \
  		--python=$(PYTHON) \

With xen 4.5 can be added with configure:

 ./configure --with-extra-qemuu-configure-args="--enable-spice --enable-usb-redir"

XL Configuration

You can use XL configuration parameters to enable SPICE support and control its advanced functions. Please check man xl.cfg or check out xl.cfg(5).

The following example is for a domU xl cfg for xen 4.4 with spice full features (except qxl):

# The fixed mac address is a workaround for know xl problem (network not working after restore)
# empty cdrom is for use cdrom hotswap from xl 
# raw disk with qdisk as backend produces better performance than blktap2
# spicedisable_ticketing enabled is for no spice password, instead use spicepasswd
# this will automatically redirect up to 4 usb devices from spice client to domUs
# This adds intel hd audio emulated card used for spice audio

Known Problems

  • Linux domUs with recent kernel need pci=nomsi set for kernel boot parameters to ensure that vdagent is working. This is a know problem with virtio devices on Xen which has not yet been solved. All other cases and things works out of box based on my tests. We are not entirely sure which kernel versions are affected, except that kernel >= 3.2 exhibits the problem, while kernel <= 2.6.32 does not. Feel free to update this section if you have more accurate information.

Ongoing work

Work on the following patches to improve SPICE support and integration in Xen is ongoing:

  • qxl vga support (libxl patch complete and seems good. qxl is working on windows domUs but is not working on linux domUs because other changes are needed on xen, xorg/qxl driver and/or qemu) patch v16
  • Basic SPICE support on PV guests (patch is working but needs serious improvements)
  • Add SPICE parameters to xenstore and handle those acquired with qmp (only the qmp part is currently working)
  • Automatic SPICE port selection similar to the support available in VNC (blocked, awaiting reply from qemu community)

The latest work in progress and discussions can be found on xen-devel and any patches (including partial and drafts) can be found on Fabio Fantoni's github repository.