kvm tools: Add arch-specific KVM_RUN exit handling via kvm_cpu__handle_exit()

This patch creates a new function in x86/kvm-cpu.c, kvm_cpu__handle_exit(), in
which arch-specific exit reasons can be handled outside of the common runloop.

Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Matt Evans
2011-12-09 17:53:56 +11:00
committed by Will Deacon
parent f57a7b2218
commit 341ee0d495
3 changed files with 15 additions and 2 deletions
+2
View File
@@ -2,6 +2,7 @@
#define KVM__KVM_CPU_H
#include "kvm/kvm-cpu-arch.h"
#include <stdbool.h>
struct kvm_cpu *kvm_cpu__init(struct kvm *kvm, unsigned long cpu_id);
void kvm_cpu__delete(struct kvm_cpu *vcpu);
@@ -11,6 +12,7 @@ void kvm_cpu__enable_singlestep(struct kvm_cpu *vcpu);
void kvm_cpu__run(struct kvm_cpu *vcpu);
void kvm_cpu__reboot(void);
int kvm_cpu__start(struct kvm_cpu *cpu);
bool kvm_cpu__handle_exit(struct kvm_cpu *vcpu);
int kvm_cpu__get_debug_fd(void);
void kvm_cpu__set_debug_fd(int fd);
+8 -2
View File
@@ -137,8 +137,14 @@ int kvm_cpu__start(struct kvm_cpu *cpu)
goto exit_kvm;
case KVM_EXIT_SHUTDOWN:
goto exit_kvm;
default:
goto panic_kvm;
default: {
bool ret;
ret = kvm_cpu__handle_exit(cpu);
if (!ret)
goto panic_kvm;
break;
}
}
kvm_cpu__handle_coalesced_mmio(cpu);
}
+5
View File
@@ -212,6 +212,11 @@ void kvm_cpu__reset_vcpu(struct kvm_cpu *vcpu)
kvm_cpu__setup_msrs(vcpu);
}
bool kvm_cpu__handle_exit(struct kvm_cpu *vcpu)
{
return false;
}
static void print_dtable(const char *name, struct kvm_dtable *dtable)
{
dprintf(debug_fd, " %s %016llx %08hx\n",