On Wed, Feb 07, 2018 at 11:45:28AM +0100, Paolo Bonzini wrote:
> On 06/02/2018 21:30, Roman Kagan wrote:
> > +static SynICState *get_synic(X86CPU *cpu)
> > +{
> > + SynICState *synic =
> > + SYNIC(object_resolve_path_component(OBJECT(cpu), "synic"));
> > + assert(synic);
> > + return synic;
> > +}
> > +
>
> This is somewhat slow, maybe add the pointer to X86CPU?
It is, but it's only used on slow paths. I was reluctant to clutter
X86CPU with this stuff.
> > +void hyperv_synic_add(X86CPU *cpu)
> > +{
> > + Object *obj;
> > +
> > + obj = object_new(TYPE_SYNIC);
> > + object_property_add_child(OBJECT(cpu), "synic", obj, &error_abort);
> > + object_unref(obj);
> > + object_property_set_bool(obj, true, "realized", &error_abort);
> > +}
> > +
> > +void hyperv_synic_reset(X86CPU *cpu)
> > +{
> > + device_reset(DEVICE(get_synic(cpu)));
> > +}
> > +
> > +void hyperv_synic_update(X86CPU *cpu)
> > +{
> > + synic_update(get_synic(cpu));
> > +}
> > +
>
> Maybe rename to x86_cpu_hyperv_{add,get,reset,update}_synic?
I don't mind, can do.
Thanks,
Roman.