From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49092) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Swue8-0001pk-Mx for qemu-devel@nongnu.org; Thu, 02 Aug 2012 08:36:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Swue7-0004MU-66 for qemu-devel@nongnu.org; Thu, 02 Aug 2012 08:36:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46811) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Swue6-0004MJ-T2 for qemu-devel@nongnu.org; Thu, 02 Aug 2012 08:36:55 -0400 Message-ID: <501A7462.3030606@redhat.com> Date: Thu, 02 Aug 2012 14:36:50 +0200 From: Igor Mammedov MIME-Version: 1.0 References: <1343855634-8779-1-git-send-email-afaerber@suse.de> In-Reply-To: <1343855634-8779-1-git-send-email-afaerber@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH for-1.2] cpus: Register reset callback centrally List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Cc: qemu-devel@nongnu.org, Anthony Liguori I'm ok with this patch. It's reduces ugly ifdefs in wonderful realize function. :) Hence, Reviewed-By: Igor Mammedov On 08/01/2012 11:13 PM, Andreas F=C3=A4rber wrote: > Despite repeated protest commit 65dee38052597b6285eb208125369f01b29ba6c= 1 > (target-i386: move cpu_reset and reset callback to cpu.c) moved > registration of a reset callback from hw/pc.c to target-i386/cpu.c > while all other CPU reset handlers were still registered from machines. > > Instead, improve the situation by registering the callback in > qemu_init_vcpu(). Now new machines or CPUs no longer need to register > their own callbacks, and we can revert the code in target-i386/cpu.c. > > Signed-off-by: Andreas F=C3=A4rber > Cc: Anthony Liguori > Cc: Igor Mammedov > --- > cpus.c | 8 ++++++++ > target-i386/cpu.c | 11 ----------- > 2 files changed, 8 insertions(+), 11 deletions(-) > > diff --git a/cpus.c b/cpus.c > index 756e624..f717a61 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -1020,6 +1020,13 @@ static void qemu_dummy_start_vcpu(CPUArchState *= env) > } > } > > +static void cpu_machine_reset(void *opaque) > +{ > + CPUState *cpu =3D opaque; > + > + cpu_reset(cpu); > +} > + > void qemu_init_vcpu(void *_env) > { > CPUArchState *env =3D _env; > @@ -1027,6 +1034,7 @@ void qemu_init_vcpu(void *_env) > env->nr_cores =3D smp_cores; > env->nr_threads =3D smp_threads; > env->stopped =3D 1; > + qemu_register_reset(cpu_machine_reset, ENV_GET_CPU(env)); > if (kvm_enabled()) { > qemu_kvm_start_vcpu(env); > } else if (tcg_enabled()) { > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 857b94e..a511de9 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -1704,13 +1704,6 @@ bool cpu_is_bsp(X86CPU *cpu) > { > return cpu_get_apic_base(cpu->env.apic_state) & MSR_IA32_APICBASE= _BSP; > } > - > -/* TODO: remove me, when reset over QOM tree is implemented */ > -static void x86_cpu_machine_reset_cb(void *opaque) > -{ > - X86CPU *cpu =3D opaque; > - cpu_reset(CPU(cpu)); > -} > #endif > > static void mce_init(X86CPU *cpu) > @@ -1733,10 +1726,6 @@ void x86_cpu_realize(Object *obj, Error **errp) > { > X86CPU *cpu =3D X86_CPU(obj); > > -#ifndef CONFIG_USER_ONLY > - qemu_register_reset(x86_cpu_machine_reset_cb, cpu); > -#endif > - > mce_init(cpu); > qemu_init_vcpu(&cpu->env); > cpu_reset(CPU(cpu)); >