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 currently only supported for an x86 Linux 2.4 or 2.6 host system, but more host OSes (Windows, *BSD) and processors (x86_64) will be supported in the future.

Installation
************

KQEMU is currently only supported on Linux/x86.

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.

QEMU Accelerator Installation
=============================

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.

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 your distribution uses udev (like Fedora), the /dev/kqemu is not created automatically (yet) at every reboot. You can add the following in /etc/rc.d/rc.local:

     # Create the KQEMU device
     mknod /dev/kqemu c 250 0
     chmod 666 /dev/kqemu

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