From: Glauber Costa <[email protected]> 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 <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]> diff --git a/qemu-kvm.c b/qemu-kvm.c index edd400e..4d85993 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -400,6 +400,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; @@ -459,7 +461,7 @@ int kvm_init(int smp_cpus) } pthread_mutex_lock(&qemu_mutex); - return 0; + return kvm_create_context(); out_close: close(fd); @@ -2163,7 +2165,7 @@ int kvm_arch_init_irq_routing(void) } #endif -int kvm_qemu_create_context(void) +static int kvm_create_context() { int r; diff --git a/qemu-kvm.h b/qemu-kvm.h index 6a9be12..b186c9d 100644 --- a/qemu-kvm.h +++ b/qemu-kvm.h @@ -943,7 +943,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); diff --git a/vl.c b/vl.c index 939da1f..c09d801 100644 --- a/vl.c +++ b/vl.c @@ -5830,13 +5830,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. */ -- To unsubscribe from this list: send the line "unsubscribe kvm-commits" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
