From mboxrd@z Thu Jan 1 00:00:00 1970 From: Igor Mammedov Subject: Re: [PATCH qom-next 06/59] pc: Pass X86CPU to cpu_is_bsp() Date: Wed, 11 Jul 2012 12:25:15 +0200 Message-ID: <4FFD548B.1020803@redhat.com> References: <1337742502-28565-1-git-send-email-afaerber@suse.de> <1337742502-28565-7-git-send-email-afaerber@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Cc: "Anthony Liguori \(supporter:PC\)" , "Marcelo Tosatti \(supporter:X86\)" , qemu-devel@nongnu.org, X86 , "Avi Kivity \(supporter:X86\)" To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Return-path: In-Reply-To: <1337742502-28565-7-git-send-email-afaerber@suse.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org On 05/23/2012 05:07 AM, Andreas F=C3=A4rber wrote: > Also change return type to bool. > > Signed-off-by: Andreas F=C3=A4rber > --- > hw/apic.h | 2 +- > hw/apic_common.c | 2 +- > hw/pc.c | 6 +++--- > target-i386/helper.c | 2 +- > target-i386/kvm.c | 4 +++- > 5 files changed, 9 insertions(+), 7 deletions(-) > > diff --git a/hw/apic.h b/hw/apic.h > index 62179ce..1030097 100644 > --- a/hw/apic.h > +++ b/hw/apic.h > @@ -22,7 +22,7 @@ void apic_handle_tpr_access_report(DeviceState *d, ta= rget_ulong ip, > TPRAccess access); > > /* pc.c */ > -int cpu_is_bsp(CPUX86State *env); > +bool cpu_is_bsp(X86CPU *cpu); > DeviceState *cpu_get_current_apic(void); > > #endif > diff --git a/hw/apic_common.c b/hw/apic_common.c > index 46a9ff7..bea885b 100644 > --- a/hw/apic_common.c > +++ b/hw/apic_common.c > @@ -207,7 +207,7 @@ static void apic_reset_common(DeviceState *d) > APICCommonClass *info =3D APIC_COMMON_GET_CLASS(s); > bool bsp; > > - bsp =3D cpu_is_bsp(&s->cpu->env); > + bsp =3D cpu_is_bsp(s->cpu); > s->apicbase =3D 0xfee00000 | > (bsp ? MSR_IA32_APICBASE_BSP : 0) | MSR_IA32_APICBASE_ENABLE; > > diff --git a/hw/pc.c b/hw/pc.c > index 6bb3d2a..f0cbfef 100644 > --- a/hw/pc.c > +++ b/hw/pc.c > @@ -870,10 +870,10 @@ void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd) > nb_ne2k++; > } > > -int cpu_is_bsp(CPUX86State *env) > +bool cpu_is_bsp(X86CPU *cpu) > { > /* We hard-wire the BSP to the first CPU. */ > - return env->cpu_index =3D=3D 0; > + return cpu->env.cpu_index =3D=3D 0; > } > > DeviceState *cpu_get_current_apic(void) > @@ -945,7 +945,7 @@ static void pc_cpu_reset(void *opaque) > CPUX86State *env =3D &cpu->env; > > cpu_reset(CPU(cpu)); > - env->halted =3D !cpu_is_bsp(env); > + env->halted =3D !cpu_is_bsp(cpu); > } > > static X86CPU *pc_new_cpu(const char *cpu_model) > diff --git a/target-i386/helper.c b/target-i386/helper.c > index 2cc8097..018a98f 100644 > --- a/target-i386/helper.c > +++ b/target-i386/helper.c > @@ -1191,7 +1191,7 @@ void do_cpu_init(X86CPU *cpu) > env->interrupt_request =3D sipi; > env->pat =3D pat; > apic_init_reset(env->apic_state); > - env->halted =3D !cpu_is_bsp(env); > + env->halted =3D !cpu_is_bsp(cpu); > } > > void do_cpu_sipi(X86CPU *cpu) > diff --git a/target-i386/kvm.c b/target-i386/kvm.c > index 0d0d8f6..97a2cb1 100644 > --- a/target-i386/kvm.c > +++ b/target-i386/kvm.c > @@ -579,11 +579,13 @@ int kvm_arch_init_vcpu(CPUX86State *env) > > void kvm_arch_reset_vcpu(CPUX86State *env) > { > + X86CPU *cpu =3D x86_env_get_cpu(env); > + > env->exception_injected =3D -1; > env->interrupt_injected =3D -1; > env->xcr0 =3D 1; > if (kvm_irqchip_in_kernel()) { > - env->mp_state =3D cpu_is_bsp(env) ? KVM_MP_STATE_RUNNABLE : > + env->mp_state =3D cpu_is_bsp(cpu) ? KVM_MP_STATE_RUNNABLE : > KVM_MP_STATE_UNINITIALIZED; > } else { > env->mp_state =3D KVM_MP_STATE_RUNNABLE; > This patch won't be necessary with http://comments.gmane.org/gmane.comp.emulators.qemu/159553 where cpu_is_bsp() is abolished. --=20 ----- Igor From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sou6m-0001K3-1t for qemu-devel@nongnu.org; Wed, 11 Jul 2012 06:25:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sou6j-0003YX-AU for qemu-devel@nongnu.org; Wed, 11 Jul 2012 06:25:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41159) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sou6j-0003Y9-2B for qemu-devel@nongnu.org; Wed, 11 Jul 2012 06:25:21 -0400 Message-ID: <4FFD548B.1020803@redhat.com> Date: Wed, 11 Jul 2012 12:25:15 +0200 From: Igor Mammedov MIME-Version: 1.0 References: <1337742502-28565-1-git-send-email-afaerber@suse.de> <1337742502-28565-7-git-send-email-afaerber@suse.de> In-Reply-To: <1337742502-28565-7-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 qom-next 06/59] pc: Pass X86CPU to cpu_is_bsp() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Cc: "Anthony Liguori (supporter:PC)" , "Marcelo Tosatti (supporter:X86)" , qemu-devel@nongnu.org, X86 , "Avi Kivity (supporter:X86)" On 05/23/2012 05:07 AM, Andreas F=C3=A4rber wrote: > Also change return type to bool. > > Signed-off-by: Andreas F=C3=A4rber > --- > hw/apic.h | 2 +- > hw/apic_common.c | 2 +- > hw/pc.c | 6 +++--- > target-i386/helper.c | 2 +- > target-i386/kvm.c | 4 +++- > 5 files changed, 9 insertions(+), 7 deletions(-) > > diff --git a/hw/apic.h b/hw/apic.h > index 62179ce..1030097 100644 > --- a/hw/apic.h > +++ b/hw/apic.h > @@ -22,7 +22,7 @@ void apic_handle_tpr_access_report(DeviceState *d, ta= rget_ulong ip, > TPRAccess access); > > /* pc.c */ > -int cpu_is_bsp(CPUX86State *env); > +bool cpu_is_bsp(X86CPU *cpu); > DeviceState *cpu_get_current_apic(void); > > #endif > diff --git a/hw/apic_common.c b/hw/apic_common.c > index 46a9ff7..bea885b 100644 > --- a/hw/apic_common.c > +++ b/hw/apic_common.c > @@ -207,7 +207,7 @@ static void apic_reset_common(DeviceState *d) > APICCommonClass *info =3D APIC_COMMON_GET_CLASS(s); > bool bsp; > > - bsp =3D cpu_is_bsp(&s->cpu->env); > + bsp =3D cpu_is_bsp(s->cpu); > s->apicbase =3D 0xfee00000 | > (bsp ? MSR_IA32_APICBASE_BSP : 0) | MSR_IA32_APICBASE_ENABLE; > > diff --git a/hw/pc.c b/hw/pc.c > index 6bb3d2a..f0cbfef 100644 > --- a/hw/pc.c > +++ b/hw/pc.c > @@ -870,10 +870,10 @@ void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd) > nb_ne2k++; > } > > -int cpu_is_bsp(CPUX86State *env) > +bool cpu_is_bsp(X86CPU *cpu) > { > /* We hard-wire the BSP to the first CPU. */ > - return env->cpu_index =3D=3D 0; > + return cpu->env.cpu_index =3D=3D 0; > } > > DeviceState *cpu_get_current_apic(void) > @@ -945,7 +945,7 @@ static void pc_cpu_reset(void *opaque) > CPUX86State *env =3D &cpu->env; > > cpu_reset(CPU(cpu)); > - env->halted =3D !cpu_is_bsp(env); > + env->halted =3D !cpu_is_bsp(cpu); > } > > static X86CPU *pc_new_cpu(const char *cpu_model) > diff --git a/target-i386/helper.c b/target-i386/helper.c > index 2cc8097..018a98f 100644 > --- a/target-i386/helper.c > +++ b/target-i386/helper.c > @@ -1191,7 +1191,7 @@ void do_cpu_init(X86CPU *cpu) > env->interrupt_request =3D sipi; > env->pat =3D pat; > apic_init_reset(env->apic_state); > - env->halted =3D !cpu_is_bsp(env); > + env->halted =3D !cpu_is_bsp(cpu); > } > > void do_cpu_sipi(X86CPU *cpu) > diff --git a/target-i386/kvm.c b/target-i386/kvm.c > index 0d0d8f6..97a2cb1 100644 > --- a/target-i386/kvm.c > +++ b/target-i386/kvm.c > @@ -579,11 +579,13 @@ int kvm_arch_init_vcpu(CPUX86State *env) > > void kvm_arch_reset_vcpu(CPUX86State *env) > { > + X86CPU *cpu =3D x86_env_get_cpu(env); > + > env->exception_injected =3D -1; > env->interrupt_injected =3D -1; > env->xcr0 =3D 1; > if (kvm_irqchip_in_kernel()) { > - env->mp_state =3D cpu_is_bsp(env) ? KVM_MP_STATE_RUNNABLE : > + env->mp_state =3D cpu_is_bsp(cpu) ? KVM_MP_STATE_RUNNABLE : > KVM_MP_STATE_UNINITIALIZED; > } else { > env->mp_state =3D KVM_MP_STATE_RUNNABLE; > This patch won't be necessary with http://comments.gmane.org/gmane.comp.emulators.qemu/159553 where cpu_is_bsp() is abolished. --=20 ----- Igor