On Wed, 10 Oct 2012 12:01:29 +0200 Andreas Färber <afaer...@suse.de> wrote:
> Am 09.10.2012 19:17, schrieb Igor Mammedov: > > (L)APIC is a part of cpu [1] so move APIC initialization inside of > > x86_cpu object. Since cpu_model and override flags currently specify > > whether APIC should be created or not, APIC creation&initialization is > > moved into x86_cpu_apic_init() which is called from x86_cpu_realize(). > > > > [1] - all x86 cpus have integrated APIC if we overlook existence of i486, > > and it's more convenient to model after majority of them. > > > > Signed-off-by: Igor Mammedov <imamm...@redhat.com> > > I am happy with this latest round of fixes to ad-hoc feedback from my > CPU remodeling perspective (as an interim solution), and I depend on > this for my APIC changes (code is being moved around here). > > > + if (env->apic_state == NULL) { > > + error_set(errp, QERR_DEVICE_INIT_FAILED, apic_type); > > + return; > > + } > [...] > > + if (qdev_init(env->apic_state)) { > > + error_set(errp, QERR_DEVICE_INIT_FAILED, > > + object_get_typename(OBJECT(env->apic_state))); > > + return; > > + } > > Luiz, could you please take a look whether I can apply this to my > qom-cpu tree now or whether error_set() should be replaced by > error_setg() or something? Contents-wise these are error-checking > creation and initialization of a child (APIC) device/object. I only saw this after I replied to the last email I was copied in this thread. Is there anything else I should clarify? Basically, we should not use QERR_* macros in new code. The only exception are the ErrorClass errors, defined in qapi-schema.json (except GenericError). If you call qdev_init() or whatever function several times and use the same error message in all calls, then you should change qdev_init() to take an Error argument.