On 1/23/24 10:27, Cédric Le Goater wrote:
On 1/23/24 07:38, Philippe Mathieu-Daudé wrote:
Restrict MachineClass::valid_cpu_types[] to the single
valid CPU type.
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
hw/arm/aspeed.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index df627096d2..393c97d55e 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -1157,6 +1157,11 @@ static const char * const ast2500_a1_valid_cpu_types[] =
{
NULL
};
+static const char * const ast2600_a3_valid_cpu_types[] = {
+ ARM_CPU_TYPE_NAME("cortex-a9"),
This should be "cortex-a7"
Looking closer, the CPU information is under AspeedSoCClass. Why not build the
valid_cpu_types array with something like :
struct AspeedMachineClass {
...
const char *valid_cpu_types[2];
};
static void aspeed_machine_set_valid_cpu_types(MachineClass *mc)
{
AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(mc);
AspeedSoCClass *sc =
ASPEED_SOC_CLASS(object_class_by_name(amc->soc_name));
amc->valid_cpu_types[0] = sc->cpu_type;
amc->valid_cpu_types[1] = NULL;
mc->valid_cpu_types = amc->valid_cpu_types;
};
or better, change AspeedSoCClass::cpu_type to an array.
mc->valid_cpu_types =
ASPEED_SOC_CLASS(object_class_by_name(amc->soc_name))->cpu_types;
C.