Clean up KVM/QEMU interaction
commit73209711cedd60256cb1deac5563a14cc066bef2
authorAnthony Liguori <aliguori@us.ibm.com>
Tue, 29 Jan 2008 22:46:55 +0000 (29 16:46 -0600)
committerAvi Kivity <avi@qumranet.com>
Wed, 30 Jan 2008 14:47:01 +0000 (30 16:47 +0200)
treed95f76a88c1c345f6bca9be5d42a160af053974b
parent2764ef2258798557d8bcd2ad16dc61e6d3bade75
Clean up KVM/QEMU interaction

This patch attempts to clean up the interactions between KVM and QEMU.  Sorry
for such a big patch, but I don't think there's a better way to approach this
such that it's still bisect friendly.  I think this is most of what's needed to
get basic KVM support into QEMU though.

Right now, there's a mix of #ifdef USE_KVM, if (kvm_allowed), and various
extern declarations.  It's all pretty fugly and there's a lot of mistakes due
to it.

The following patch eliminates almost all uses of #ifdef USE_KVM by introducing
a kvm_enabled() macro.  If USE_KVM is set, this macro evaluates to kvm_allowed.
If USE_KVM isn't set, the macro evaluates to 0.

Since GCC eliminates if (0) blocks, this is just as good as using #ifdef.  By
making sure that we never call into libkvm directly from QEMU, we can also just
not link qemu-kvm when USE_KVM isn't set instead of having the entire file
wrapped in a USE_KVM.

We also change the --enable-kvm configure option to --disable-kvm since KVM is
enabled by default.

I've tested this patch on x86 with 32-bit and 64-bit Linux guests and a 32-bit
Windows guest.  I've also tested with USE_KVM not set.  Jerone has also
verified that it doesn't PPC.  My apologies if it breaks ia64 but I have no
way of testing that.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
30 files changed:
Makefile.target
block-raw-posix.c
configure
cpu-exec.c
exec.c
gdbstub.c
hw/apic.c
hw/cirrus_vga.c
hw/i8259.c
hw/ipf.c
hw/pc.c
hw/ppc440_bamboo.c
hw/vga.c
hw/vga_int.h
hw/vmport.c
kvm/configure
migration.c
monitor.c
osdep.c
qemu-kvm-ia64.c
qemu-kvm-powerpc.c
qemu-kvm-x86.c
qemu-kvm.c
qemu-kvm.h
target-i386/cpu.h
target-i386/helper2.c
target-ia64/cpu.h
target-ia64/op_helper.c
target-ppc/cpu.h
vl.c