From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Smo2S-0000GY-CU for qemu-devel@nongnu.org; Thu, 05 Jul 2012 11:32:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Smo2G-0007aW-EX for qemu-devel@nongnu.org; Thu, 05 Jul 2012 11:32:15 -0400 Received: from cantor2.suse.de ([195.135.220.15]:47401 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Smo2G-0007a4-8K for qemu-devel@nongnu.org; Thu, 05 Jul 2012 11:32:04 -0400 Message-ID: <4FF5B36F.2000604@suse.de> Date: Thu, 05 Jul 2012 17:31:59 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1341110730-444-1-git-send-email-proljc@gmail.com> <1341110730-444-2-git-send-email-proljc@gmail.com> <4FF5951F.9060502@suse.de> <4FF59717.2030901@redhat.com> In-Reply-To: <4FF59717.2030901@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v8 01/16] target-or32: Add target stubs and QOM cpu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Jia Liu , qemu-devel@nongnu.org Am 05.07.2012 15:31, schrieb Paolo Bonzini: > Il 05/07/2012 15:22, Andreas F=C3=A4rber ha scritto: >>>> +static void openrisc_any_initfn(Object *obj) >>>> +{ >>>> + OpenRISCCPU *cpu =3D OPENRISC_CPU(obj); >>>> + >>>> + set_feature(cpu, OPENRISC_FEATURE_OB32S); >>>> + set_feature(cpu, OPENRISC_FEATURE_OF32S); >>>> + >>>> + cpu_reset(CPU(cpu)); >>>> +} >> Paolo, could class_base_init or something help with this pattern of >> needing to do something in every derived initfn? >=20 > I guess what you're looking for is some instance_post_init that is > called at init time after instance_init? Sort of. The pattern I was seeing is parent initializes something, child modifies it, some action is performed on it. Here we can get away by deferring the common action to realize stage, just like we did for arm. My reasoning was that it's better to reset in realizefn for reproducible behavior over system_reset. Not sure if we can always escape to such a late stage, but we can worry about that when we have a concrete use case. :) Andreas >> On the other hand I think we should move cpu_reset() into the realizef= n >> instead, that would avoid this issue here. >=20 > Yep. >=20 > Paolo --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg