qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 6/8] hw/arm/aspeed/2600: Check for CPU types in machine_run_b


From: Cédric Le Goater
Subject: Re: [PATCH 6/8] hw/arm/aspeed/2600: Check for CPU types in machine_run_board_init()
Date: Tue, 23 Jan 2024 10:35:31 +0100
User-agent: Mozilla Thunderbird

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é <philmd@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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]