From: Glauber Costa Subject: [PATCH] remove kvm_init_ap from qemu code. Date: Tue, 23 Sep 2008 17:25:15 -0300 Message-ID: <1222201515-8881-1-git-send-email-glommer@redhat.com> Cc: avi@redhat.com, aliguori@us.ibm.com To: kvm@vger.kernel.org Return-path: Received: from mx2.redhat.com ([66.187.237.31]:60972 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752425AbYIWU3f (ORCPT ); Tue, 23 Sep 2008 16:29:35 -0400 Sender: kvm-owner@vger.kernel.org List-ID: Call it as a special case for cpu 0 creation. This removes a piece of kvm code from raw qemu. Signed-off-by: Glauber Costa --- qemu/qemu-kvm.c | 21 ++++++++++++--------- qemu/qemu-kvm.h | 1 - qemu/vl.c | 3 --- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c index cfdf90f..62d797d 100644 --- a/qemu/qemu-kvm.c +++ b/qemu/qemu-kvm.c @@ -436,15 +436,7 @@ static void *ap_main_loop(void *_env) return NULL; } -void kvm_init_new_ap(int cpu, CPUState *env) -{ - pthread_create(&vcpu_info[cpu].thread, NULL, ap_main_loop, env); - - while (vcpu_info[cpu].created == 0) - qemu_cond_wait(&qemu_vcpu_cond); -} - -int kvm_init_ap(void) +static int kvm_init_ap(void) { #ifdef TARGET_I386 kvm_tpr_opt_setup(); @@ -455,6 +447,17 @@ int kvm_init_ap(void) return 0; } +void kvm_init_new_ap(int cpu, CPUState *env) +{ + if (!cpu) + kvm_init_ap(); + + pthread_create(&vcpu_info[cpu].thread, NULL, ap_main_loop, env); + + while (vcpu_info[cpu].created == 0) + qemu_cond_wait(&qemu_vcpu_cond); +} + void qemu_kvm_notify_work(void) { uint64_t value = 1; diff --git a/qemu/qemu-kvm.h b/qemu/qemu-kvm.h index fd9d5d1..f8791b8 100644 --- a/qemu/qemu-kvm.h +++ b/qemu/qemu-kvm.h @@ -16,7 +16,6 @@ int kvm_main_loop(void); int kvm_qemu_init(void); int kvm_qemu_create_context(void); void kvm_init_new_ap(int cpu, CPUState *env); -int kvm_init_ap(void); void kvm_qemu_destroy(void); void kvm_load_registers(CPUState *env); void kvm_save_registers(CPUState *env); diff --git a/qemu/vl.c b/qemu/vl.c index ad4d24b..9ec3c61 100644 --- a/qemu/vl.c +++ b/qemu/vl.c @@ -10080,9 +10080,6 @@ int main(int argc, char **argv) } } - if (kvm_enabled()) - kvm_init_ap(); - machine->init(ram_size, vga_ram_size, boot_devices, ds, kernel_filename, kernel_cmdline, initrd_filename, cpu_model); -- 1.5.5.1