qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suspicious QOM types without instance/class size


From: Eduardo Habkost
Subject: Re: Suspicious QOM types without instance/class size
Date: Mon, 24 Aug 2020 13:26:47 -0400

On Mon, Aug 24, 2020 at 08:06:42PM +0300, Roman Bolshakov wrote:
> On Mon, Aug 24, 2020 at 12:45:52PM -0400, Eduardo Habkost wrote:
> > On Mon, Aug 24, 2020 at 07:41:34PM +0300, Roman Bolshakov wrote:
> > > On Fri, Aug 21, 2020 at 01:48:02PM -0400, Eduardo Habkost wrote:
> > > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > > > ---
> > > > diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
> > > > index d81f569aed..81d1662d06 100644
> > > > --- a/target/i386/hvf/hvf.c
> > > > +++ b/target/i386/hvf/hvf.c
> > > > @@ -878,13 +878,11 @@ static int hvf_accel_init(MachineState *ms)
> > > >  {
> > > >      int x;
> > > >      hv_return_t ret;
> > > > -    HVFState *s;
> > > > +    HVFState *s = HVF_STATE(ms->accelerator);
> > > 
> > > The file also needs definition of MachineState:
> > > #include "hw/boards.h"
> > > 
> > > >  
> > > >      ret = hv_vm_create(HV_VM_DEFAULT);
> > > >      assert_hvf_ok(ret);
> > > >  
> > > > -    s = g_new0(HVFState, 1);
> > > > - 
> > > >      s->num_slots = 32;
> > > >      for (x = 0; x < s->num_slots; ++x) {
> > > >          s->slots[x].size = 0;
> > > > @@ -908,6 +906,7 @@ static void hvf_accel_class_init(ObjectClass *oc, 
> > > > void *data)
> > > >  static const TypeInfo hvf_accel_type = {
> > > >      .name = TYPE_HVF_ACCEL,
> > > >      .parent = TYPE_ACCEL,
> > > > +    .instance_size = sizeof(HVFState),
> > > >      .class_init = hvf_accel_class_init,
> > > >  };
> > > >  
> > > >  
> > 
> > However, the hvf patch above shouldn't require it.  You should be
> > able to apply and test it on top of qemu.git master.
> > 
> 
> Yeah, that's correct, thanks.
> 
> With the include fix for hw/boards.h, the patch works:
> Reviewed-By: Roman Bolshakov <r.bolshakov@yadro.com>
> Tested-By: Roman Bolshakov <r.bolshakov@yadro.com>
> 
> BTW, am I expected to see the accel in "info qtree" (or qom-tree)? It's
> not there for a reason.

I don't know if you are expect to see it.  I don't think there's
explicit code to attach the accel object to the user-visible QOM
tree.

-- 
Eduardo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]