Stand-alone Native Linux KVM Tool repo
C C++ Makefile Other
Switch branches/tags
Nothing to show
Clone or download
jpbrucker and wildea01 virtio/pci: Register a single eventfd for vhost
Vhost supports a single eventfd as the kick mechanism. Registering a
second one will override the first. To ensure vhost works with our
virtio-pci, only register the kick eventfd that is used by the guest.

Fixes: a508ea9 ("virtio/pci: Use port I/O for configuration registers by default")
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Latest commit 0e1882a Apr 4, 2018
Permalink
Failed to load latest commit information.
Documentation Documentation: remove documentation stubs and common-cmds.h generation Mar 2, 2016
arm ioeventfd: Don't register on the PIO bus if the arch doesn't support it Apr 6, 2018
config Makefile: avoid using linker for embedding guest_init binaries Aug 30, 2017
disk use <poll.h> instead of <sys/poll.h> Jul 20, 2015
guest kvmtool/x86: implement guest_pre_init Oct 27, 2015
hw extend GSI IRQ routing to take a device ID Jun 9, 2017
include ioeventfd: Don't register on the PIO bus if the arch doesn't support it Apr 6, 2018
mips ioeventfd: Don't register on the PIO bus if the arch doesn't support it Apr 6, 2018
net/uip kvm tools: net: don't propagate error codes from tx/rx operations Jun 1, 2015
powerpc ioeventfd: Don't register on the PIO bus if the arch doesn't support it Apr 6, 2018
tests kvmtool/tests: fix iso build on debian Mar 16, 2016
ui kvmtool: fix VM exit race attempting to pthread_kill an exited thread Nov 5, 2015
util kvmtool: add script for updating kernel headers May 17, 2016
virtio virtio/pci: Register a single eventfd for vhost Apr 6, 2018
x86 ioeventfd: Don't register on the PIO bus if the arch doesn't support it Apr 6, 2018
.gitignore gitignore: fix cscope ignoring Jun 9, 2016
COPYING kvmtool: Add a GPL license text file Jun 1, 2015
CREDITS-Git kvm tools: Provide the basic Gitish framework Jun 1, 2015
INSTALL kvmtool: Update documentation to mark version as stand-alone Jun 1, 2015
Makefile Add GICv2m support Nov 3, 2017
README README: suggest a format.subjectprefix Dec 20, 2016
builtin-balloon.c kvm tools: specify the amount to balloon is in MB Jun 1, 2015
builtin-debug.c kvm tools: support injecting arbitrary sysrqs Jun 1, 2015
builtin-help.c kvm tools: change the binary name from kvm to lkvm in print message Jun 1, 2015
builtin-list.c kvm tools: Return error status in lkvm list Jun 1, 2015
builtin-pause.c kvm tools: Check the state before pause/resume Jun 1, 2015
builtin-resume.c kvm tools: Check the state before pause/resume Jun 1, 2015
builtin-run.c builtin-run: Fix console= parameter concatenation Nov 3, 2017
builtin-sandbox.c kvm tools: Add 'kvm sandbox' Jun 1, 2015
builtin-setup.c Makefile: avoid using linker for embedding guest_init binaries Aug 30, 2017
builtin-stat.c kvm tools: Fix print format warnings Jun 1, 2015
builtin-stop.c kvm tools: carefully send and handle stop ipc Jun 1, 2015
builtin-version.c kvm tools: Improve 'kvm version' output Jun 1, 2015
code16gcc.h kvm: BIOS E820 memory map emulation Jun 1, 2015
devices.c kvmtool: devices.c: Update parent when inserting into rbtree Jun 15, 2016
framebuffer.c kvm tools: use init/exit where possible Jun 1, 2015
guest_compat.c kvm tools: Improve compat message format Jun 1, 2015
ioeventfd.c ioeventfd: Don't register on the PIO bus if the arch doesn't support it Apr 6, 2018
ioport.c kvm__emulate_io: Don't fall through from IO in to IO out if no handler Aug 7, 2015
irq.c Add GICv2m support Nov 3, 2017
kvm-cmd.c kvm tools: Add BUG_ON() helper to make a run-time critical tests Jun 1, 2015
kvm-cpu.c kvmtool: delegate exit/reboot responsibility to vcpu0 Apr 14, 2016
kvm-ipc.c kvmtool: Change readdir_r to readdir Apr 18, 2016
kvm.c Prevent segfault when kvm_pause is called too early Nov 3, 2017
main.c kvm tools: Use kvm__get_dir() helper function Jun 1, 2015
mmio.c kvm tools: Fix print format warnings Jun 1, 2015
pci.c kvm tools: Handle virtio/pci I/O space as little endian Jun 1, 2015
symbol.c kvm tools: use init/exit where possible Jun 1, 2015
term.c kvmtool: Switch serial input to raw mode Apr 24, 2017

README

Native Linux KVM tool
=====================

kvmtool is a lightweight tool for hosting KVM guests. As a pure virtualization
tool it only supports guests using the same architecture, though it supports
running 32-bit guests on those 64-bit architectures that allow this.

From the original announcement email:
-------------------------------------------------------
The goal of this tool is to provide a clean, from-scratch, lightweight
KVM host tool implementation that can boot Linux guest images (just a
hobby, won't be big and professional like QEMU) with no BIOS
dependencies and with only the minimal amount of legacy device
emulation.

It's great as a learning tool if you want to get your feet wet in
virtualization land: it's only 5 KLOC of clean C code that can already
boot a guest Linux image.

Right now it can boot a Linux image and provide you output via a serial
console, over the host terminal, i.e. you can use it to boot a guest
Linux image in a terminal or over ssh and log into the guest without
much guest or host side setup work needed.
--------------------------

This is the stand-alone version which does not live inside a Linux
kernel tree.
1. To check it out, clone the main git repository:

  git clone git://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git

2. Compile the tool (for more elaborate instructions see INSTALL):

  cd kvmtool && make

3. Download a raw userspace image:

  wget http://wiki.qemu.org/download/linux-0.2.img.bz2 && bunzip2
linux-0.2.img.bz2

4. The guest kernel has to be built with the following configuration:

 - For the default console output:
	CONFIG_SERIAL_8250=y
	CONFIG_SERIAL_8250_CONSOLE=y

 - For running 32bit images on 64bit hosts:
	CONFIG_IA32_EMULATION=y

 - Proper FS options according to image FS (e.g. CONFIG_EXT2_FS, CONFIG_EXT4_FS).

 - For all virtio devices listed below:
	CONFIG_VIRTIO=y
	CONFIG_VIRTIO_RING=y
	CONFIG_VIRTIO_PCI=y

 - For virtio-blk devices (--disk, -d):
	CONFIG_VIRTIO_BLK=y

 - For virtio-net devices ([--network, -n] virtio):
	CONFIG_VIRTIO_NET=y

 - For virtio-9p devices (--virtio-9p):
	CONFIG_NET_9P=y
	CONFIG_NET_9P_VIRTIO=y
	CONFIG_9P_FS=y

 - For virtio-balloon device (--balloon):
	CONFIG_VIRTIO_BALLOON=y

 - For virtio-console device (--console virtio):
	CONFIG_VIRTIO_CONSOLE=y

 - For virtio-rng device (--rng):
	CONFIG_HW_RANDOM_VIRTIO=y

 - For vesa device (--sdl or --vnc):
	CONFIG_FB_VESA=y


5. And finally, launch the hypervisor:

  ./lkvm run --disk linux-0.2.img \
	    --kernel ../../arch/x86/boot/bzImage \
or

  sudo ./lkvm run --disk linux-0.2.img \
		 --kernel ../../arch/x86/boot/bzImage \
		 --network virtio

The tool has been written by Pekka Enberg, Cyrill Gorcunov, Asias He,
Sasha Levin and Prasad Joshi. Special thanks to Avi Kivity for his help
on KVM internals and Ingo Molnar for all-around support and encouragement!

See the following thread for original discussion for motivation of this
project:

http://thread.gmane.org/gmane.linux.kernel/962051/focus=962620

Another detailed example can be found in the lwn.net article:

http://lwn.net/Articles/658511/

Contributing
------------

Please send patches for kvmtool to kvm@vger.kernel.org, in the usual git
patch format, including "kvmtool" in the mail subject. "kvmtool" can be
added automatically by issuing the command

 git config format.subjectprefix "PATCH kvmtool"

in the git repository.