@@ -419,6 +419,8 @@ int kvm_dirty_pages_log_reset(kvm_context_t kvm)
}
+static int kvm_create_context(void);
+
int kvm_init(int smp_cpus)
{
int fd;
@@ -478,7 +480,7 @@ int kvm_init(int smp_cpus)
}
pthread_mutex_lock(&qemu_mutex);
- return 0;
+ return kvm_create_context();
out_close:
close(fd);
@@ -2249,7 +2251,7 @@ int kvm_arch_init_irq_routing(void)
}
#endif
-int kvm_qemu_create_context(void)
+static int kvm_create_context()
{
int r;
@@ -930,7 +930,6 @@ struct kvm_pit_state { };
int kvm_main_loop(void);
int kvm_qemu_init(void);
-int kvm_qemu_create_context(void);
int kvm_init_ap(void);
int kvm_vcpu_inited(CPUState *env);
void kvm_load_registers(CPUState *env);
@@ -5838,13 +5838,6 @@ int main(int argc, char **argv, char **envp)
if (ram_size == 0)
ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;
- if (kvm_enabled()) {
- if (kvm_qemu_create_context() < 0) {
- fprintf(stderr, "Could not create KVM context\n");
- exit(1);
- }
- }
-
#ifdef CONFIG_KQEMU
/* FIXME: This is a nasty hack because kqemu can't cope with dynamic
guest ram allocation. It needs to go away. */
There is no reason why kvm_create_context is placed outside kvm_init(). After we call kvm_init(), no extra initialization step should be necessary. This patch folds kvm_create_context into it, simplifying vl.c code. Signed-off-by: Glauber Costa <glommer@redhat.com> --- qemu-kvm.c | 6 ++++-- qemu-kvm.h | 1 - vl.c | 7 ------- 3 files changed, 4 insertions(+), 10 deletions(-)