summaryrefslogtreecommitdiffstats
path: root/target-ia64
diff options
context:
space:
mode:
authorAnthony Liguori <[email protected]>2008-01-29 16:46:55 -0600
committerAvi Kivity <[email protected]>2008-01-30 16:47:01 +0200
commit73209711cedd60256cb1deac5563a14cc066bef2 (patch)
treed95f76a88c1c345f6bca9be5d42a160af053974b /target-ia64
parent2764ef2258798557d8bcd2ad16dc61e6d3bade75 (diff)
downloadqemu-kvm-73209711cedd60256cb1deac5563a14cc066bef2.tar.gz
qemu-kvm-73209711cedd60256cb1deac5563a14cc066bef2.tar.bz2
qemu-kvm-73209711cedd60256cb1deac5563a14cc066bef2.zip
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 <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
Diffstat (limited to 'target-ia64')
-rw-r--r--target-ia64/cpu.h4
-rw-r--r--target-ia64/op_helper.c16
2 files changed, 6 insertions, 14 deletions
diff --git a/target-ia64/cpu.h b/target-ia64/cpu.h
index 2d91cb9bc..97358eec9 100644
--- a/target-ia64/cpu.h
+++ b/target-ia64/cpu.h
@@ -51,9 +51,7 @@ typedef struct CPUIA64State {
int user_mode_only;
uint32_t hflags;
-#ifdef USE_KVM
- uint8_t ready_for_interrupt_injection;
-#endif
+ uint8_t ready_for_interrupt_injection;
} CPUIA64State;
diff --git a/target-ia64/op_helper.c b/target-ia64/op_helper.c
index 5138af502..8660b17db 100644
--- a/target-ia64/op_helper.c
+++ b/target-ia64/op_helper.c
@@ -24,7 +24,7 @@
#include "cpu.h"
#include "exec-all.h"
-extern int kvm_allowed;
+#include "qemu-kvm.h"
CPUState *cpu_ia64_init(char *cpu_model){
CPUState *env;
@@ -33,14 +33,10 @@ CPUState *cpu_ia64_init(char *cpu_model){
return NULL;
cpu_exec_init(env);
cpu_reset(env);
-#ifdef USE_KVM
- {
- if (kvm_allowed) {
- kvm_qemu_init_env(env);
- env->ready_for_interrupt_injection = 1;
- }
+ if (kvm_enabled()) {
+ kvm_qemu_init_env(env);
+ env->ready_for_interrupt_injection = 1;
}
-#endif
return env;
}
@@ -74,12 +70,10 @@ void switch_mode(CPUState *env, int mode)
/* Handle a CPU exception. */
void do_interrupt(CPUIA64State *env)
{
-#ifdef USE_KVM
- if (kvm_allowed) {
+ if (kvm_enabled()) {
printf("%s: unexpect\n", __FUNCTION__);
exit(-1);
}
-#endif
}