qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v16 01/23] cpu: Introduce TCGCpuOperations struct


From: Eduardo Habkost
Subject: Re: [PATCH v16 01/23] cpu: Introduce TCGCpuOperations struct
Date: Wed, 10 Feb 2021 07:32:55 -0500

On Wed, Feb 10, 2021 at 03:21:51PM +0300, Roman Bolshakov wrote:
> On Thu, Feb 04, 2021 at 05:39:09PM +0100, Claudio Fontana wrote:
> > From: Eduardo Habkost <ehabkost@redhat.com>
> > 
> > The TCG-specific CPU methods will be moved to a separate struct,
> > to make it easier to move accel-specific code outside generic CPU
> > code in the future.  Start by moving tcg_initialize().
> > 
> > The new CPUClass.tcg_opts field may eventually become a pointer,
> > but keep it an embedded struct for now, to make code conversion
> > easier.
> > 
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > 
> > [claudio: move TCGCpuOperations inside include/hw/core/cpu.h]
> > 
> > Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> > ---
[...]
> > diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
> > index b3fd6643e8..d66f0351a9 100644
> > --- a/target/alpha/cpu.c
> > +++ b/target/alpha/cpu.c
> > @@ -231,7 +231,7 @@ static void alpha_cpu_class_init(ObjectClass *oc, void 
> > *data)
> >      dc->vmsd = &vmstate_alpha_cpu;
> >  #endif
> >      cc->disas_set_info = alpha_cpu_disas_set_info;
> > -    cc->tcg_initialize = alpha_translate_init;
> > +    cc->tcg_ops.initialize = alpha_translate_init;
> 
> Hi,
> 
> Would it be cleaner if the file had:
> 
> static
> TcgCpuOperations alpha_tcg_ops = {
>     .initialize = alpha_translate_init,
> };
> 
> CPUClass definition would be:
> struct CPUClass {
>   ...
>   TCGCpuOperations *tcg_ops;
>   ...
> }
> 
> And class init would be:
> 
> cc->tcg_ops = &alpha_tcg_ops;

That's exactly what's done by:

  Subject: [PATCH v16 15/23] cpu: tcg_ops: move to tcg-cpu-ops.h, keep a 
pointer in CPUClass
  20210204163931.7358-16-cfontana@suse.de/">https://lore.kernel.org/qemu-devel/20210204163931.7358-16-cfontana@suse.de/

> 
> And you would grow arch_tcg_ops as you convert them?
> I'm sorry if I missed similar comment and it was already discussed.
> 
> Regards,
> Roman
> 

-- 
Eduardo




reply via email to

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