From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SouSE-00006f-4u for qemu-devel@nongnu.org; Wed, 11 Jul 2012 06:47:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SouS7-0001jw-Ro for qemu-devel@nongnu.org; Wed, 11 Jul 2012 06:47:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SouS7-0001jh-Jv for qemu-devel@nongnu.org; Wed, 11 Jul 2012 06:47:27 -0400 Message-ID: <4FFD59BB.9020006@redhat.com> Date: Wed, 11 Jul 2012 12:47:23 +0200 From: Igor Mammedov MIME-Version: 1.0 References: <1337742502-28565-1-git-send-email-afaerber@suse.de> <1337742502-28565-6-git-send-email-afaerber@suse.de> In-Reply-To: <1337742502-28565-6-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 05/59] apic: Replace cpu_env pointer by X86CPU link List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Cc: Paolo Bonzini , Anthony Liguori , qemu-devel@nongnu.org On 05/23/2012 05:07 AM, Andreas F=C3=A4rber wrote: > Needed for converting cpu_is_bsp(). > > Signed-off-by: Andreas F=C3=A4rber > Cc: Paolo Bonzini > --- ... > @@ -899,7 +900,13 @@ static DeviceState *apic_init(void *env, uint8_t a= pic_id) > } > > qdev_prop_set_uint8(dev, "id", apic_id); > - qdev_prop_set_ptr(dev, "cpu_env", env); > + object_property_set_link(OBJECT(dev), OBJECT(ENV_GET_CPU(env)), "c= pu", > + &error); Setting back-link should be done before or inside of x86_cpu_realize(), i.e. no CPU internals outside of CPU object. But that depends on CPU becoming a child of something between object_new(= TYPE_X86_CPU) and x86_cpu_realize(), otherwise it would crash in object_property_set_li= nk (). Currently it could be done in target-i386/helper.c:cpu_x86_init()but not = in hw/pc.c:pc_new_cpu() because cpu_x86_init() returns realized CPU. Perhaps we should wait with this and previous patch till APIC is moved in= side of CPU. As a way to avoid back-link issue we could make CPU a child of /machine i= n cpu_x86_init() before callling x86_cpu_realize(). Yes, it won't be at boa= rd level but it won't hurt *-user target and might be acceptable sacrifice for i386-softmmu in = effort of QOMifing x86cpu and converting from qdev_prop_set_ptr() to object_property_set_lin= k(). --=20 ----- Igor