From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ScuQd-0004IA-Rh for qemu-devel@nongnu.org; Fri, 08 Jun 2012 04:20:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ScuQX-0004F1-HM for qemu-devel@nongnu.org; Fri, 08 Jun 2012 04:20:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64909) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ScuQX-0004En-9I for qemu-devel@nongnu.org; Fri, 08 Jun 2012 04:20:13 -0400 Date: Fri, 8 Jun 2012 10:20:06 +0200 From: Igor Mammedov Message-ID: <20120608082006.GA22512@thinkpad.mammed.net> References: <1337742502-28565-1-git-send-email-afaerber@suse.de> <1337742502-28565-5-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1337742502-28565-5-git-send-email-afaerber@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH qom-next 04/59] pc: Add CPU as /machine/cpu[n] List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Anthony Liguori , qemu-devel@nongnu.org, Igor Mammedov On Wed, May 23, 2012 at 05:07:27AM +0200, Andreas F=E4rber wrote: > Using the cpu_index, give the X86CPU a canonical path. > This must be done before initializing the APIC. >=20 > Signed-off-by: Igor Mammedov > Signed-off-by: Andreas F=E4rber > --- > hw/pc.c | 12 ++++++++++++ > 1 files changed, 12 insertions(+), 0 deletions(-) >=20 > diff --git a/hw/pc.c b/hw/pc.c > index 4167782..e9d7e05 100644 > --- a/hw/pc.c > +++ b/hw/pc.c > @@ -945,6 +945,8 @@ static X86CPU *pc_new_cpu(const char *cpu_model) > { > X86CPU *cpu; > CPUX86State *env; > + char *name; > + Error *error =3D NULL; > =20 > cpu =3D cpu_x86_init(cpu_model); > if (cpu =3D=3D NULL) { > @@ -952,6 +954,16 @@ static X86CPU *pc_new_cpu(const char *cpu_model) > exit(1); > } > env =3D &cpu->env; > + > + name =3D g_strdup_printf("cpu[%d]", env->cpu_index); > + object_property_add_child(OBJECT(qdev_get_machine()), name, > + OBJECT(cpu), &error); This call might be too late. Imagine if before this call a property/child= of this CPU would set link on on it. Then it would assert in object_property_set_link= -> object_get_canonical_path since CPU would not have parent a that time. Wouldn't it better to make it child in CPU's initfn? This way CPU object could be used as a value for link anywhere once it's been created.=20 > + g_free(name); > + if (error_is_set(&error)) { > + qerror_report_err(error); > + exit(1); > + } > + > if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) { > env->apic_state =3D apic_init(env, env->cpuid_apic_id); > } > --=20 > 1.7.7 >=20 >=20