So that the vcpu state is initialized, from vcpu thread context, after machine initialization is settled. This allows to revert apic_init's apic_reset call. apic_reset now happens through system_reset, similarly to qemu upstream. Signed-off-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx> diff --git a/hw/apic.c b/hw/apic.c index ae805dc..627ff98 100644 --- a/hw/apic.c +++ b/hw/apic.c @@ -1131,11 +1131,6 @@ int apic_init(CPUState *env) vmstate_register(s->idx, &vmstate_apic, s); qemu_register_reset(apic_reset, s); - /* apic_reset must be called before the vcpu threads are initialized and load - * registers, in qemu-kvm. - */ - apic_reset(s); - local_apics[s->idx] = s; return 0; } diff --git a/qemu-kvm.c b/qemu-kvm.c index 44e8b75..ef8c288 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1918,11 +1918,6 @@ static void *ap_main_loop(void *_env) setup_kernel_sigmask(env); pthread_mutex_lock(&qemu_mutex); - cpu_single_env = env; - - kvm_arch_init_vcpu(env); - - kvm_arch_load_regs(env); /* signal VCPU creation */ current_env->created = 1; @@ -1934,6 +1929,8 @@ static void *ap_main_loop(void *_env) /* re-initialize cpu_single_env after re-acquiring qemu_mutex */ cpu_single_env = env; + kvm_arch_init_vcpu(env); + kvm_arch_load_regs(env); kvm_main_loop_cpu(env); return NULL; -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html