[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
- [PATCH v16 02/23] target/riscv: remove CONFIG_TCG, as it is always TCG, (continued)
- [PATCH v16 02/23] target/riscv: remove CONFIG_TCG, as it is always TCG, Claudio Fontana, 2021/02/04
- [PATCH v16 03/23] accel/tcg: split TCG-only code from cpu_exec_realizefn, Claudio Fontana, 2021/02/04
- [PATCH v16 05/23] cpu: Move cpu_exec_* to tcg_ops, Claudio Fontana, 2021/02/04
- [PATCH v16 06/23] cpu: Move tlb_fill to tcg_ops, Claudio Fontana, 2021/02/04
- [PATCH v16 04/23] cpu: Move synchronize_from_tb() to tcg_ops, Claudio Fontana, 2021/02/04
- [PATCH v16 01/23] cpu: Introduce TCGCpuOperations struct, Claudio Fontana, 2021/02/04
- [PATCH v16 07/23] cpu: Move debug_excp_handler to tcg_ops, Claudio Fontana, 2021/02/04
- [PATCH v16 08/23] target/arm: do not use cc->do_interrupt for KVM directly, Claudio Fontana, 2021/02/04
- [PATCH v16 09/23] cpu: move cc->do_interrupt to tcg_ops, Claudio Fontana, 2021/02/04
- [PATCH v16 10/23] cpu: move cc->transaction_failed to tcg_ops, Claudio Fontana, 2021/02/04
- [PATCH v16 13/23] cpu: move adjust_watchpoint_address to tcg_ops, Claudio Fontana, 2021/02/04
- [PATCH v16 11/23] cpu: move do_unaligned_access to tcg_ops, Claudio Fontana, 2021/02/04
- [PATCH v16 12/23] physmem: make watchpoint checking code TCG-only, Claudio Fontana, 2021/02/04
- [PATCH v16 16/23] accel: extend AccelState and AccelClass to user-mode, Claudio Fontana, 2021/02/04
- [PATCH v16 20/23] cpu: call AccelCPUClass::cpu_realizefn in cpu_exec_realizefn, Claudio Fontana, 2021/02/04