Revision as of 07:38, March 4, 2014 by Daniel Robbins (Talk)


KVM is a hardware-accelerated full-machine hypervisor and virtualization solution included as part of kernel 2.6.20 and later. It allows you to create and start hardware-accelerated virtual machines under Linux using the QEMU tools.

Kernel Setup

To enable KVM, the following kernel config parameters should be enabled (this is based on a 3.x kernel):

Under Processor type and features, enable Linux guest support, and enable the following options:

Under Processor type and features-->Linux guest support:

--- Linux guest support
[*]   Enable paravirtualization code
[ ]     paravirt-ops debugging (NEW)
[*]     Paravirtualization layer for spinlocks
[ ]     Xen guest support (NEW)
[*]   KVM Guest support (including kvmclock) (NEW)
[ ]     Enable debug information for KVM Guests in debugfs (NEW)
[ ]   Paravirtual steal time accounting (NEW)

Under the Virtualization category from the main kernel config menu, enable Kernel-based Virtual Machine (KVM) support, and enable at least one type of KVM, either for Intel or AMD processors. It is also recommended to enable Host kernel acceleration for virtio net.

Under Virtualization:

--- Virtualization
<M>   Kernel-based Virtual Machine (KVM) support
<M>     KVM for Intel processors support
<M>     KVM for AMD processors support
[*]     KVM legacy PCI device assignment support
<M>   Host kernel accelerator for virtio net

You can use modules or build these parts directly into the kernel. Build your new kernel and modules, and reboot.

User-space tools

If you are using QEMU on your desktop, add the following USE flag to /etc/portage/make.conf:

USE="$USE usbredir"

This will enable good mouse support for QEMU on your desktop.

Now, emerge qemu:

#  emerge qemu

Initial Setup

Prior to using KVM, modprobe the appropriate accelerated driver for Intel or AMD:

# modprobe kvm_intel