> > diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> > index 0d35e95430fe..bf290262cbfe 100644
> > --- a/target/i386/cpu.c
> > +++ b/target/i386/cpu.c
> > @@ -9044,6 +9044,12 @@ static void x86_cpu_post_initfn(Object *obj)
> >               X86_CONFIDENTIAL_GUEST(current_machine->cgs), (CPU(obj)));
> >       }
> >   #endif
> > +
> > +    /*
> > +     * Re-apply the "feature[=foo]" from '-cpu' option since they might
> > +     * be overwritten by above
> > +     */
> > +    qdev_prop_set_globals(DEVICE(obj));
> >   }
> 
> This patch LGTM.

This solution will call qdev_prop_set_globals() twice. My concern is
that this masks the problem: previous x86 CPU assumptions about the
order of global property initialization break down...

Per the commit message of Paolo's commit:

"This is incorrect because the leaf class cannot observe property
values applied by the superclasses; for example, a compat property
will be set on a device *after* the class's post_init callback has
run."

X86 CPUs have the issue (e.g., "vendor" doesn't work) now because
they - as leaf class, don't care about the property values of
superclass - the DeviceState. If a property is just for initialization,
like "vendor", it should be placed in the instance_init() instead of
instance_post_init().

In addition, if other places handle it similarly, the device's
post_init seems pointless. :-(

Thanks,
Zhao


Reply via email to