QEMU Upstream
How to build QEMU (upstream version) with Xen
Nowadays, xen-unstable will clone and build a qemu git tree from xenbits. (It is qemu-stable-1.0 today). But you can follow this guide to build the upstream unstable qemu git tree.
You can add this to your "xen-unstable.git/.config" file, so xen-unstable will clone and build the upstream tree.
QEMU_UPSTREAM_URL = git://git.qemu.org/qemu.git QEMU_UPSTREAM_REVISION = master
Then, add "device_model_version = 'qemu-xen'" in your vm config file to use this new qemu.
Or build qemu out of the xen-unstable dir:
Get the source
- Get Xen source (version 4.2 aka xen-unstable development version)
- Get QEMU upstream source from:
Build it!
- Build Xen
- make xen tools, if it fail see bellow.
- Build QEMU upstream with Xen
- For xen-unstable.hg versions between 23412:996c7726a376 and 23632:33717472f37e you will need to copy path_to_xen/tools/libxc/xc_e820.h to $path_to_xen_source/dist/install/usr/include" for configuration script to work. After 23632:33717472f37e xc_e820.h was squashed into xenctrl.h
- ./configure --enable-xen --target-list=i386-softmmu --extra-cflags="-I$path_to_xen_source/tools/include -I$path_to_xen_source/tools/libxc -I$path_to_xen_source/tools/xenstore" --extra-ldflags="-L$path_to_xen_source/tools/libxc -L$path_to_xen_source/tools/xenstore"
- make
Troubleshooting compilation errors: If you get an error from configure like "ERROR: User requested feature xen ERROR: configure was not able to find it" then see this: http://xen.1045712.n5.nabble.com/Upstream-Qemu-With-Xen-configuration-problem-td4561779.html , ie. you need to point the paths for "configure" to xen source directory, not to xen dist directory.
Run it!
Either:
- With the latest xen-unstable tree, use:
- device_model_version = 'qemu-xen'
- device_model_override = '/root/work/qemu/_build/i386-softmmu/qemu-system-i386'
Now xl will always try run qemu upstream with seabios, so build xen with seabios.
- For troubleshooting device_model on older Xen related errors (Xen specific options -domain-name, -vcpus, etc) see: http://xen.1045712.n5.nabble.com/Upstream-QEMU-not-working-with-Xen-unstable-lacks-option-definitions-td4372252.html
Use with SeaBIOS
SeaBIOS support is now fully integrated into the Xen build system (in xen-unstable and xen-4.2 onwards) and is always used when using device_model_version = "qemu-xen".
If you want to build a version of SeaBIOS other than the default then you can override SEABIOS_UPSTREAM_URL and/or SEABIOS_UPSTREAM_TAG via .config. For reference the upstream SeaBIOS repository is [[1]].
New features
Virtio
It's the PV drivers from KVM world. To use it for network, just use 'virtio-net' as a model:
vif = [ 'model=virtio-net' ]
You will need those kernel modules to use a virtio device
virtio_mmio virtio_pci virtio_net
SPICE / QXL
SPICE is an other remote-display protocol and QXL is a PV framebuffer which use the best of the SPICE capability. To activate SPICE you can add this in the VM config file (this works only with xl).
spice=1 spicehost='0.0.0.0' spiceport=6000 spicedisable_ticketing=1
If you which to use QXL as well you'll have to add:
device_model_args_hvm = [ '-vga', 'qxl' ] videoram = 64
But QXL does not work yet under Xen.
Difference with qemu-xen-traditional
Missing feature from the good old qemu-dm
Currently, there is few missing feature that not supported by QEMU upstream, but the work is ongoing.
- dirty log: This is needed to migrate a guest. Patches have been posted to both QEMU and libxl, but are not applied yet.
- VGA passthrough: Sometime (all the time?), simple PCI passthrough does not works for graphics card. The few things that are done in qemu-dm are not yet upstreamed.
New feature from QEMU upstream
There is some benefice of upstreaming the support of Xen to QEMU, we can now use:
- VirtIO, as an alternative to Xen PV drivers
- SPICE, for a remote-display instead of the old VNC.
- different kind of file format for a disc.
- ...