QEMU Upstream: Difference between revisions

From Xen
Jump to navigationJump to search
No edit summary
Line 1: Line 1:
= How to build QEMU with Xen =
= How QEMU builds in Xen =


When running ''make'' when building xen in the [http://xenbits.xen.org/gitweb/?p=xen.git xen git tree] the enabled qemu targets will be built and by default two targets are built:
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.


* CONFIG_QEMU_TRAD: checks out the git tree defined by CONFIG_QEMU
You can add this to your "xen-unstable.git/.config" file, so xen-unstable will clone and build the upstream tree.
git://xenbits.xen.org/qemu-xen-unstable.git
* CONFIG_QEMU_XEN: checks out the git tree defined by QEMU_UPSTREAM_URL
git://xenbits.xen.org/qemu-upstream-unstable.git

Add here documentation explaining the difference between these two. I suspect we only prefer to use the upstream version now?

= Overriding QEMU URL and revision =

If you'd like to modify the URL so that the another upstream version of qemu is used, and override the branch used you can edit your "xen/.Config.mk" file, for example:


QEMU_UPSTREAM_URL = git://git.qemu.org/qemu.git
QEMU_UPSTREAM_URL = git://git.qemu.org/qemu.git
QEMU_UPSTREAM_REVISION = master
QEMU_UPSTREAM_REVISION = master


As of 2014-01-22 the revision used by xen is 'qemu-xen-4.4.0-rc1', using the 'git://xenbits.xen.org/qemu-upstream-unstable.git' tree.


= Device model for qemu =
Then, add "device_model_version = 'qemu-xen'" in your vm config file to use this new qemu.


Which qemu is used by your vm is controlled by the ''device_model_version'' field in your vm configuration. These days you can use the distribution provided version of xemu directly. To use x86-64 version of qemu you would use:
Or build qemu out of the xen-unstable dir:


<code>
== Get the source ==
device_model_version = "/usr/bin/qemu-system-x86_64"
* Get Xen source (version 4.2 aka xen-unstable development version)
</code>
* Get QEMU upstream source from:
** git://git.qemu.org/qemu.git


If you are building qemu as per the xen default configuration and you'd like to use it you could specify:

<code>
device_model_version = "qemu-xen"
</code>

(can someone confirm the above?)

= Installing your own qemu =

* Get Xen source from the [http://xenbits.xen.org/gitweb/?p=xen.git xen git tree]
* Get QEMU upstream source from:
** git://git.qemu.org/qemu.git

== Build your own qemu ==


== Build it! ==
* Build Xen
* Build Xen
<code>
** make xen tools, if it fail see bellow.
make xen tools
If it fail see bellow.
* Build QEMU upstream with Xen
* Build QEMU upstream with Xen
<code>
** ./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"
./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
make
</code>


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.
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.
Line 36: Line 63:
* 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
* 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 ==
= Use with SeaBIOS =

SeaBIOS support is now fully integrated into the Xen build system and is always used when using ''device_model_version = "qemu-xen"''. You can also specify your bios preference explicitly by using in your vm config:


<code>
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"''.
bios = "seabios"
</code>


If you want to build a version of SeaBIOS other than the [http://xenbits.xen.org/gitweb/?p=seabios.git;a=shortlog;h=refs/heads/xen-unstable default] then you can override ''SEABIOS_UPSTREAM_URL'' and/or ''SEABIOS_UPSTREAM_TAG'' via ''.config''. For reference the upstream SeaBIOS repository is [[git://git.seabios.org/seabios.git]].
If you want to build a version of SeaBIOS other than the [http://xenbits.xen.org/gitweb/?p=seabios.git;a=shortlog;h=refs/heads/xen-unstable default] then you can override ''SEABIOS_UPSTREAM_URL'' and/or ''SEABIOS_UPSTREAM_TAG'' via ''.config''. For reference the upstream SeaBIOS repository is [[git://git.seabios.org/seabios.git]].

Revision as of 00:32, 23 January 2014

How QEMU builds in Xen

When running make when building xen in the xen git tree the enabled qemu targets will be built and by default two targets are built:

 * CONFIG_QEMU_TRAD: checks out the git tree defined by CONFIG_QEMU
   git://xenbits.xen.org/qemu-xen-unstable.git
 * CONFIG_QEMU_XEN:  checks out the git tree defined by QEMU_UPSTREAM_URL
   git://xenbits.xen.org/qemu-upstream-unstable.git

Add here documentation explaining the difference between these two. I suspect we only prefer to use the upstream version now?

Overriding QEMU URL and revision

If you'd like to modify the URL so that the another upstream version of qemu is used, and override the branch used you can edit your "xen/.Config.mk" file, for example:

 QEMU_UPSTREAM_URL = git://git.qemu.org/qemu.git
 QEMU_UPSTREAM_REVISION = master

As of 2014-01-22 the revision used by xen is 'qemu-xen-4.4.0-rc1', using the 'git://xenbits.xen.org/qemu-upstream-unstable.git' tree.

Device model for qemu

Which qemu is used by your vm is controlled by the device_model_version field in your vm configuration. These days you can use the distribution provided version of xemu directly. To use x86-64 version of qemu you would use:

device_model_version = "/usr/bin/qemu-system-x86_64"

If you are building qemu as per the xen default configuration and you'd like to use it you could specify:

device_model_version = "qemu-xen"

(can someone confirm the above?)

Installing your own qemu

 * Get Xen source from the xen git tree
 * Get QEMU upstream source from:
   ** git://git.qemu.org/qemu.git

Build your own qemu

  • Build Xen

make xen tools If it fail see bellow.

  • Build QEMU upstream with Xen

./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.

Use with SeaBIOS

SeaBIOS support is now fully integrated into the Xen build system and is always used when using device_model_version = "qemu-xen". You can also specify your bios preference explicitly by using in your vm config:

bios = "seabios"

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 another remote-display protocol and QXL is a PV framebuffer which uses the best of the SPICE capabilities. 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 wish to use QXL as well you have to add:

 device_model_args_hvm = [ '-vga', 'qxl' ]
 videoram = 128

QXL does not currently work under Xen due to some limitation. (check [this email] for more information.)

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 are some benefits from upstreaming the support of Xen to QEMU. We can now use:

  • VirtIO as an alternative to Xen PV drivers
  • SPICE, as a remote-display protocol instead of the old VNC.
  • different kind of file format for a disc.
  • the ability to connect several times to the VNC server.
  • ...