[PATCH v2 6/6] hw/arm/zynq: Check for CPU types in machine_run_board_init()

Philippe Mathieu-Daudé posted 6 patches 10 months, 1 week ago
Maintainers: Igor Mitsyanko <i.mitsyanko@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, Rob Herring <robh@kernel.org>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Alistair Francis <alistair@alistair23.me>
There is a newer version of this series
[PATCH v2 6/6] hw/arm/zynq: Check for CPU types in machine_run_board_init()
Posted by Philippe Mathieu-Daudé 10 months, 1 week ago
Restrict MachineClass::valid_cpu_types[] to the single
valid CPU type.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/arm/xilinx_zynq.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index 66d0de139f..6ec65d4780 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -355,6 +355,10 @@ static void zynq_init(MachineState *machine)
 
 static void zynq_machine_class_init(ObjectClass *oc, void *data)
 {
+    static const char * const valid_cpu_types[] = {
+        ARM_CPU_TYPE_NAME("cortex-a9"),
+        NULL
+    };
     MachineClass *mc = MACHINE_CLASS(oc);
     mc->desc = "Xilinx Zynq Platform Baseboard for Cortex-A9";
     mc->init = zynq_init;
@@ -362,6 +366,7 @@ static void zynq_machine_class_init(ObjectClass *oc, void *data)
     mc->no_sdcard = 1;
     mc->ignore_memory_transaction_failures = true;
     mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9");
+    mc->valid_cpu_types = valid_cpu_types;
     mc->default_ram_id = "zynq.ext_ram";
 }
 
-- 
2.41.0


Re: [PATCH v2 6/6] hw/arm/zynq: Check for CPU types in machine_run_board_init()
Posted by Gavin Shan 10 months ago
On 1/24/24 08:25, 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/xilinx_zynq.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


Re: [PATCH v2 6/6] hw/arm/zynq: Check for CPU types in machine_run_board_init()
Posted by Richard Henderson 10 months ago
On 1/24/24 08:25, 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/xilinx_zynq.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
> index 66d0de139f..6ec65d4780 100644
> --- a/hw/arm/xilinx_zynq.c
> +++ b/hw/arm/xilinx_zynq.c
> @@ -355,6 +355,10 @@ static void zynq_init(MachineState *machine)
>   
>   static void zynq_machine_class_init(ObjectClass *oc, void *data)
>   {
> +    static const char * const valid_cpu_types[] = {
> +        ARM_CPU_TYPE_NAME("cortex-a9"),
> +        NULL
> +    };
>       MachineClass *mc = MACHINE_CLASS(oc);
>       mc->desc = "Xilinx Zynq Platform Baseboard for Cortex-A9";
>       mc->init = zynq_init;
> @@ -362,6 +366,7 @@ static void zynq_machine_class_init(ObjectClass *oc, void *data)
>       mc->no_sdcard = 1;
>       mc->ignore_memory_transaction_failures = true;
>       mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9");
> +    mc->valid_cpu_types = valid_cpu_types;

Same comment re default_cpu_type.  Otherwise,

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~