From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH 26/74] target-i386: Pass X86CPU to do_cpu_{init,sipi}() Date: Tue, 5 Jun 2012 03:21:58 +0200 Message-ID: <1338859366-20689-27-git-send-email-afaerber@suse.de> References: <1338859366-20689-1-git-send-email-afaerber@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Avi Kivity (supporter:X86), Marcelo Tosatti (supporter:X86), kvm@vger.kernel.org (open list:X86) To: qemu-devel@nongnu.org Return-path: Received: from cantor2.suse.de ([195.135.220.15]:52712 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757358Ab2FEBX6 (ORCPT ); Mon, 4 Jun 2012 21:23:58 -0400 In-Reply-To: <1338859366-20689-1-git-send-email-afaerber@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: Allows to use cpu_reset() in place of cpu_state_reset(). Signed-off-by: Andreas F=C3=A4rber Reviewed-by: Igor Mammedov --- cpu-exec.c | 4 ++-- target-i386/cpu.h | 4 ++-- target-i386/helper.c | 13 ++++++++----- target-i386/kvm.c | 6 ++++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 0344cd5..fbb39cb 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -287,11 +287,11 @@ int cpu_exec(CPUArchState *env) #if defined(TARGET_I386) if (interrupt_request & CPU_INTERRUPT_INIT) { svm_check_intercept(env, SVM_EXIT_INIT); - do_cpu_init(env); + do_cpu_init(x86_env_get_cpu(env)); env->exception_index =3D EXCP_HALTED; cpu_loop_exit(env); } else if (interrupt_request & CPU_INTERRUPT_SIPI)= { - do_cpu_sipi(env); + do_cpu_sipi(x86_env_get_cpu(env)); } else if (env->hflags2 & HF2_GIF_MASK) { if ((interrupt_request & CPU_INTERRUPT_SMI) && !(env->hflags & HF_SMM_MASK)) { diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 2460f63..aeff20b 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -1053,8 +1053,8 @@ static inline void cpu_get_tb_cpu_state(CPUX86Sta= te *env, target_ulong *pc, (env->eflags & (IOPL_MASK | TF_MASK | RF_MASK | VM_MASK)); } =20 -void do_cpu_init(CPUX86State *env); -void do_cpu_sipi(CPUX86State *env); +void do_cpu_init(X86CPU *cpu); +void do_cpu_sipi(X86CPU *cpu); =20 #define MCE_INJECT_BROADCAST 1 #define MCE_INJECT_UNCOND_AO 2 diff --git a/target-i386/helper.c b/target-i386/helper.c index 3421be2..e182025 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1187,27 +1187,30 @@ CPUX86State *cpu_x86_init(const char *cpu_model= ) } =20 #if !defined(CONFIG_USER_ONLY) -void do_cpu_init(CPUX86State *env) +void do_cpu_init(X86CPU *cpu) { + CPUX86State *env =3D &cpu->env; int sipi =3D env->interrupt_request & CPU_INTERRUPT_SIPI; uint64_t pat =3D env->pat; =20 - cpu_state_reset(env); + cpu_reset(CPU(cpu)); env->interrupt_request =3D sipi; env->pat =3D pat; apic_init_reset(env->apic_state); env->halted =3D !cpu_is_bsp(env); } =20 -void do_cpu_sipi(CPUX86State *env) +void do_cpu_sipi(X86CPU *cpu) { + CPUX86State *env =3D &cpu->env; + apic_sipi(env->apic_state); } #else -void do_cpu_init(CPUX86State *env) +void do_cpu_init(X86CPU *cpu) { } -void do_cpu_sipi(CPUX86State *env) +void do_cpu_sipi(X86CPU *cpu) { } #endif diff --git a/target-i386/kvm.c b/target-i386/kvm.c index e74a9e4..0d0d8f6 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -1698,6 +1698,8 @@ void kvm_arch_post_run(CPUX86State *env, struct k= vm_run *run) =20 int kvm_arch_process_async_events(CPUX86State *env) { + X86CPU *cpu =3D x86_env_get_cpu(env); + if (env->interrupt_request & CPU_INTERRUPT_MCE) { /* We must not raise CPU_INTERRUPT_MCE if it's not supported. = */ assert(env->mcg_cap); @@ -1732,11 +1734,11 @@ int kvm_arch_process_async_events(CPUX86State *= env) } if (env->interrupt_request & CPU_INTERRUPT_INIT) { kvm_cpu_synchronize_state(env); - do_cpu_init(env); + do_cpu_init(cpu); } if (env->interrupt_request & CPU_INTERRUPT_SIPI) { kvm_cpu_synchronize_state(env); - do_cpu_sipi(env); + do_cpu_sipi(cpu); } if (env->interrupt_request & CPU_INTERRUPT_TPR) { env->interrupt_request &=3D ~CPU_INTERRUPT_TPR; --=20 1.7.7