Subject: qemu accelerator module, anyone?
To: None <tech-kern@NetBSD.org>
From: Hubert Feyrer <feyrer@cs.stevens.edu>
List: tech-kern
Date: 12/19/2005 09:33:11
(For those that don't know what qemu is: basically Open Source VMware ;)


I've looked a bit at the qemu accelerator module tonight. It provides a 
kernel-side interface (via an LKM) to qemu to run with higher emulation 
speed of 1-2 times instead of 5-6 times. The source is available at [1], 
apparently it works on Linux and FreeBSD.

The module loads as LKM, and provides a character device which is then 
used by the userland code of qemu to speed things up. The LKM consists of 
some C code that mostly does the LKM init and providing of the character 
device to allocate and free some kernel memory, plus some helper routines.

The second part of the LKM is a proprietary .o file that is closed source 
and which calls some of the helper routines - the whole architecture 
pretty much reminds me of the ath(4) driver.

Now... I'm not a kernel guru at all, and I failed pretty miserably at even 
trying to understand what's needed beyond the basics (FreeBSD's VM system 
is different from UVM for starters), and I'm quite clueless.

Maybe if someone wants to give this a try, here's how to get started:
  * cd pkgsrc/emulators/qemu
  * make patch
  * cd work*/qemu*
  * ftp http://www.qemu.org/kqemu-0.7.2.tar.gz
  * tar plzvxf http://www.qemu.org/kqemu-0.7.2.tar.gz
  * cd kqemu
  * make -f Makefile.freebsd

... then go from there. :)
When the module works and can be loaded, qemu's configure script needs 
some prodding to build with support for the module, but that's not so hard 
(I have a patch for the configure script).

Any takers?


  - Hubert

[1] http://www.qemu.org/kqemu-0.7.2.tar.gz