Hi, Philippe, On Fri, Aug 18, 2023 at 4:52 PM Philippe Mathieu-Daudé <phi...@linaro.org> wrote: > > Hi Jiajie, Song, > > (+Huacai) > > On 17/8/23 11:31, Song Gao wrote: > > From: Jiajie Chen <c...@jia.je> > > > > Add object class for future loongarch32 cpus. It is derived from the > > loongarch64 object class. > > Is it how the architecture design happened? IIUC per [*] it seems > the arch was designed as a whole then adapted per segment (32/R,64). > So from a QOM PoV better would be to have a abstract 'common' parent > objs/classes, then derive 32/64 from it. > IMHO this matters for the maintainability of target/loongarch/, but > if this isn't important then I won't object much to this series. >From my point of view, it is more natural to have loongarch32-cpu together with loongarch64-cpu, not loongarch32-cpu and loongarch-cpu (only for 64bit).
Huacai > > Regards, > > Phil. > > [*] > https://lore.kernel.org/linux-arch/20210706041820.1536502-1-chenhua...@loongson.cn/ > > > Signed-off-by: Jiajie Chen <c...@jia.je> > > Reviewed-by: Richard Henderson <richard.hender...@linaro.org> > > Signed-off-by: Song Gao <gaos...@loongson.cn> > > --- > > target/loongarch/cpu.c | 19 +++++++++++++++++++ > > target/loongarch/cpu.h | 1 + > > 2 files changed, 20 insertions(+) > > > > @@ -750,6 +760,15 @@ static const TypeInfo loongarch_cpu_type_infos[] = { > > .class_size = sizeof(LoongArchCPUClass), > > .class_init = loongarch_cpu_class_init, > > }, > > + { > > + .name = TYPE_LOONGARCH32_CPU, > > + .parent = TYPE_LOONGARCH_CPU, > > + .instance_size = sizeof(LoongArchCPU), > > + > > + .abstract = true, > > + .class_size = sizeof(LoongArchCPUClass), > > + .class_init = loongarch32_cpu_class_init, > > + }, > > DEFINE_LOONGARCH_CPU_TYPE("la464", loongarch_la464_initfn), > > }; > > > > diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h > > index 5a71d64a04..2af4c414b0 100644 > > --- a/target/loongarch/cpu.h > > +++ b/target/loongarch/cpu.h > > @@ -382,6 +382,7 @@ struct ArchCPU { > > }; > > > > #define TYPE_LOONGARCH_CPU "loongarch-cpu" > > +#define TYPE_LOONGARCH32_CPU "loongarch32-cpu" > > > > OBJECT_DECLARE_CPU_TYPE(LoongArchCPU, LoongArchCPUClass, > > LOONGARCH_CPU) > > -- Huacai Chen