QEMU Accelerator User Documentation


Table of Contents


QEMU Accelerator User Documentation

1. Introduction

QEMU Accelerator (KQEMU) is a driver allowing the QEMU PC emulator to run much faster when emulating a PC on an x86 host.

KQEMU is supported on x86 or x86_64 Linux 2.4 or 2.6 hosts. Experimental versions are available for FreeBSD and Windows NT/2000/2003/XP.

2. Installation

2.1 QEMU Compilation

First you must decompress the QEMU sources:

cd /tmp
tar zxvf qemu-x.y.z.tar.gz
cd qemu-x.y.z

Download and install the QEMU Accelerator Module in qemu-x.y.z/:

tar zxvf /tmp/kqemu-x.y.z.tar.gz

Then you configure QEMU and build it (usually no options are needed):

./configure
make

Then type as root user:

make install

to install QEMU in `/usr/local'.

2.2 QEMU Accelerator Installation for Linux

If you use x86 Linux, the compilation of the QEMU Accelerator Kernel Module (KQEMU) is automatically activated provided you have the necessary kernel headers. If nonetheless the compilation fails, you can disable its compilation with the `--disable-kqemu' configure option.

Note that KQEMU cannot currently work if the Xen virtualizer is running on your host.

If you are using a 2.6 host kernel, then all the necessary kernel headers should be already installed. If you are using a 2.4 kernel, then you should verify that properly configured kernel sources are installed and compiled. On a Redhat 9 distribution for example, the following must be done:

1) Install the kernel-source-xxx package
2) cd /usr/src/linux-xxx
3) make distclean
4) Copy /boot/config-vvv in .config (use uname -r to know your configuration name 'vvv')
5) Edit the Makefile to change the EXTRAVERSION line to match your
   current configuration name:
   EXTRAVERSION = -custom
to 
   EXTRAVERSION = -8 # This is an example, it can be -8smp too
5) make menuconfig # Just save the configuration
6) make dep bzImage

The installation of KQEMU is not fully automatic because it is highly distribution dependent. When launching

make install

KQEMU is installed in /lib/modules/kernel_version/misc. The device `/dev/kqemu' is created with read/write access rights for everyone. If you fear security issues, you can restrict the access rights of `/dev/kqemu'.

If you want that KQEMU is installed automatically at boot time, you can add

# Load the KQEMU kernel module
/sbin/modprobe kqemu

in `/etc/rc.d/rc.local'.

If the major number 250 is already used by another driver, you can use the option major=N to set an alternate major number.

If your distribution uses udev (like Fedora), use the kqemu module option major=0 to have the device `/dev/kqemu' automatically created:

# Load the KQEMU kernel module
/sbin/modprobe kqemu major=0

It is usually necessary to change the device access rights set by udev. Edit `/etc/udev/permissions.d/50-udev.permissions' and add:

# kqemu
kqemu:root:root:0666

2.3 QEMU Accelerator Installation for Windows

Right click on `kqemu.inf' in Explorer and choose Install.

In order to start kqemu, you must do:

net start kqemu

3. Usage

When QEMU is compiled with KQEMU support, the following option is added to QEMU:

`-no-kqemu'
Disable the usage of the QEMU Accelerator module (KQEMU). QEMU will work as usual but will be slower. This option can be useful to determine if emulation problems are coming from KQEMU.

When using KQEMU on a Linux or FreeBSD host, QEMU will create a big hidden file containing the RAM of the virtual machine. For best performance, it is important that this file is kept in RAM and not on the hard disk. QEMU uses the `/dev/shm' directory to create this file because tmpfs is usually mounted on it (check with the shell command df). Otherwise `/tmp' is used as fallback. You can use the QEMU_TMPDIR shell variable to set a new directory for the QEMU RAM file.

KQEMU has only been tested with Linux 2.4, Linux 2.6 and Windows 2000 as guest OSes. If your guest OS do not work with KQEMU, you can dynamically disable KQEMU with the `-no-kqemu' option.

If you use kqemu on an x86_64 host, you must use `qemu-system-x86_64' instead of `qemu'.

To see if kqemu is enabled and working correctly, use the QEMU monitor command:

info kqemu


This document was generated on 4 September 2005 using texi2html 1.56k.