Hi Cédric > Subject: Re: [PATCH v1 07/12] hw/arm/aspeed_ast10x0: Pass SoC name to > common init for AST10x0 family reuse > > On 11/6/25 09:49, Jamin Lin wrote: > > Refactor the AST10x0 common initialization to accept a socname > > parameter. > > > > The AST1030 model can be reused by AST1060 since they share most of > > the same controllers. This approach allows AST1060 to leverage the > > existing > > AST1030 initialization flow while keeping separate SoC-specific init > > functions for components that differ. > > > > This prepares the framework for AST1060 support, allowing it to reuse > > AST1030 device models and initialization flow without code duplication. > > > > No functional changes. > > > > Signed-off-by: Jamin Lin <[email protected]> > > --- > > hw/arm/aspeed_ast10x0.c | 14 +++++++------- > > 1 file changed, 7 insertions(+), 7 deletions(-) > > > > diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c index > > 5bbe16af24..c85c21b149 100644 > > --- a/hw/arm/aspeed_ast10x0.c > > +++ b/hw/arm/aspeed_ast10x0.c > > @@ -107,19 +107,14 @@ static qemu_irq > aspeed_soc_ast1030_get_irq(AspeedSoCState *s, int dev) > > return qdev_get_gpio_in(DEVICE(&a->armv7m), sc->irqmap[dev]); > > } > > > > -static void aspeed_soc_ast10x0_init(Object *obj) > > +static void aspeed_soc_ast10x0_init(Object *obj, const char *socname) > > { > > Aspeed10x0SoCState *a = ASPEED10X0_SOC(obj); > > AspeedSoCState *s = ASPEED_SOC(obj); > > AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s); > > - char socname[8]; > > char typename[64]; > > int i; > > > > - if (sscanf(object_get_typename(obj), "%7s", socname) != 1) { > > - g_assert_not_reached(); > > - } > > - > > object_initialize_child(obj, "armv7m", &a->armv7m, > TYPE_ARMV7M); > > > > s->sysclk = qdev_init_clock_in(DEVICE(s), "sysclk", NULL, NULL, > > 0); @@ -184,8 +179,13 @@ static void aspeed_soc_ast10x0_init(Object > *obj) > > static void aspeed_soc_ast1030_init(Object *obj) > > { > > AspeedSoCState *s = ASPEED_SOC(obj); > > + char socname[8]; > > + > > + if (sscanf(object_get_typename(obj), "%7s", socname) != 1) { > > + g_assert_not_reached(); > > + } > > > > - aspeed_soc_ast10x0_init(obj); > > + aspeed_soc_ast10x0_init(obj, socname); > > > As Philippe suggested, why not use directly : > > aspeed_soc_ast10x0_init(obj, "ast1030"); > Thanks for the review and suggestion. Will update it.
Thanks-Jamin > > Thanks, > > C. > > > > > object_initialize_child(obj, "lpc", &s->lpc, TYPE_ASPEED_LPC); > > object_initialize_child(obj, "peci", &s->peci, TYPE_ASPEED_PECI); > > }
