Message ID | 20240123224842.18485-5-philmd@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | hw/arm/aspeed: Check for CPU types in machine_run_board_init() | expand |
On 1/23/24 23:48, Philippe Mathieu-Daudé wrote: > In order to alter AspeedSoCClass::cpu_type in the next > commit, introduce the aspeed_soc_cpu_type() helper to > retrieve the per-SoC CPU type from AspeedSoCClass. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Cédric Le Goater <clg@kaod.org> Thanks, C. > --- > include/hw/arm/aspeed_soc.h | 1 + > hw/arm/aspeed_ast10x0.c | 2 +- > hw/arm/aspeed_ast2400.c | 3 ++- > hw/arm/aspeed_ast2600.c | 3 ++- > hw/arm/aspeed_soc_common.c | 5 +++++ > 5 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h > index cb832bc1ee..a060a59918 100644 > --- a/include/hw/arm/aspeed_soc.h > +++ b/include/hw/arm/aspeed_soc.h > @@ -143,6 +143,7 @@ struct AspeedSoCClass { > qemu_irq (*get_irq)(AspeedSoCState *s, int dev); > }; > > +const char *aspeed_soc_cpu_type(AspeedSoCClass *sc); > > enum { > ASPEED_DEV_SPI_BOOT, > diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c > index 8becb146a8..dca601a3f9 100644 > --- a/hw/arm/aspeed_ast10x0.c > +++ b/hw/arm/aspeed_ast10x0.c > @@ -211,7 +211,7 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) > /* AST1030 CPU Core */ > armv7m = DEVICE(&a->armv7m); > qdev_prop_set_uint32(armv7m, "num-irq", 256); > - qdev_prop_set_string(armv7m, "cpu-type", sc->cpu_type); > + qdev_prop_set_string(armv7m, "cpu-type", aspeed_soc_cpu_type(sc)); > qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk); > object_property_set_link(OBJECT(&a->armv7m), "memory", > OBJECT(s->memory), &error_abort); > diff --git a/hw/arm/aspeed_ast2400.c b/hw/arm/aspeed_ast2400.c > index ad76035528..3baf95916d 100644 > --- a/hw/arm/aspeed_ast2400.c > +++ b/hw/arm/aspeed_ast2400.c > @@ -156,7 +156,8 @@ static void aspeed_ast2400_soc_init(Object *obj) > } > > for (i = 0; i < sc->num_cpus; i++) { > - object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type); > + object_initialize_child(obj, "cpu[*]", &a->cpu[i], > + aspeed_soc_cpu_type(sc)); > } > > snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname); > diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c > index 386a88d4e0..b264433cf0 100644 > --- a/hw/arm/aspeed_ast2600.c > +++ b/hw/arm/aspeed_ast2600.c > @@ -158,7 +158,8 @@ static void aspeed_soc_ast2600_init(Object *obj) > } > > for (i = 0; i < sc->num_cpus; i++) { > - object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type); > + object_initialize_child(obj, "cpu[*]", &a->cpu[i], > + aspeed_soc_cpu_type(sc)); > } > > snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname); > diff --git a/hw/arm/aspeed_soc_common.c b/hw/arm/aspeed_soc_common.c > index 828f61093b..36ca189ce9 100644 > --- a/hw/arm/aspeed_soc_common.c > +++ b/hw/arm/aspeed_soc_common.c > @@ -18,6 +18,11 @@ > #include "hw/char/serial.h" > > > +const char *aspeed_soc_cpu_type(AspeedSoCClass *sc) > +{ > + return sc->cpu_type; > +} > + > qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev) > { > return ASPEED_SOC_GET_CLASS(s)->get_irq(s, dev);
On 1/24/24 08:48, Philippe Mathieu-Daudé wrote: > In order to alter AspeedSoCClass::cpu_type in the next > commit, introduce the aspeed_soc_cpu_type() helper to > retrieve the per-SoC CPU type from AspeedSoCClass. > > Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org> > --- > include/hw/arm/aspeed_soc.h | 1 + > hw/arm/aspeed_ast10x0.c | 2 +- > hw/arm/aspeed_ast2400.c | 3 ++- > hw/arm/aspeed_ast2600.c | 3 ++- > hw/arm/aspeed_soc_common.c | 5 +++++ > 5 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/inclu Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
On 1/24/24 08:48, Philippe Mathieu-Daudé wrote: > In order to alter AspeedSoCClass::cpu_type in the next > commit, introduce the aspeed_soc_cpu_type() helper to > retrieve the per-SoC CPU type from AspeedSoCClass. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > include/hw/arm/aspeed_soc.h | 1 + > hw/arm/aspeed_ast10x0.c | 2 +- > hw/arm/aspeed_ast2400.c | 3 ++- > hw/arm/aspeed_ast2600.c | 3 ++- > hw/arm/aspeed_soc_common.c | 5 +++++ > 5 files changed, 11 insertions(+), 3 deletions(-) > Reviewed-by: Gavin Shan <gshan@redhat.com>
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index cb832bc1ee..a060a59918 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -143,6 +143,7 @@ struct AspeedSoCClass { qemu_irq (*get_irq)(AspeedSoCState *s, int dev); }; +const char *aspeed_soc_cpu_type(AspeedSoCClass *sc); enum { ASPEED_DEV_SPI_BOOT, diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c index 8becb146a8..dca601a3f9 100644 --- a/hw/arm/aspeed_ast10x0.c +++ b/hw/arm/aspeed_ast10x0.c @@ -211,7 +211,7 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) /* AST1030 CPU Core */ armv7m = DEVICE(&a->armv7m); qdev_prop_set_uint32(armv7m, "num-irq", 256); - qdev_prop_set_string(armv7m, "cpu-type", sc->cpu_type); + qdev_prop_set_string(armv7m, "cpu-type", aspeed_soc_cpu_type(sc)); qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk); object_property_set_link(OBJECT(&a->armv7m), "memory", OBJECT(s->memory), &error_abort); diff --git a/hw/arm/aspeed_ast2400.c b/hw/arm/aspeed_ast2400.c index ad76035528..3baf95916d 100644 --- a/hw/arm/aspeed_ast2400.c +++ b/hw/arm/aspeed_ast2400.c @@ -156,7 +156,8 @@ static void aspeed_ast2400_soc_init(Object *obj) } for (i = 0; i < sc->num_cpus; i++) { - object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type); + object_initialize_child(obj, "cpu[*]", &a->cpu[i], + aspeed_soc_cpu_type(sc)); } snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname); diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index 386a88d4e0..b264433cf0 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -158,7 +158,8 @@ static void aspeed_soc_ast2600_init(Object *obj) } for (i = 0; i < sc->num_cpus; i++) { - object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type); + object_initialize_child(obj, "cpu[*]", &a->cpu[i], + aspeed_soc_cpu_type(sc)); } snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname); diff --git a/hw/arm/aspeed_soc_common.c b/hw/arm/aspeed_soc_common.c index 828f61093b..36ca189ce9 100644 --- a/hw/arm/aspeed_soc_common.c +++ b/hw/arm/aspeed_soc_common.c @@ -18,6 +18,11 @@ #include "hw/char/serial.h" +const char *aspeed_soc_cpu_type(AspeedSoCClass *sc) +{ + return sc->cpu_type; +} + qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev) { return ASPEED_SOC_GET_CLASS(s)->get_irq(s, dev);
In order to alter AspeedSoCClass::cpu_type in the next commit, introduce the aspeed_soc_cpu_type() helper to retrieve the per-SoC CPU type from AspeedSoCClass. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/hw/arm/aspeed_soc.h | 1 + hw/arm/aspeed_ast10x0.c | 2 +- hw/arm/aspeed_ast2400.c | 3 ++- hw/arm/aspeed_ast2600.c | 3 ++- hw/arm/aspeed_soc_common.c | 5 +++++ 5 files changed, 11 insertions(+), 3 deletions(-)