[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 31/31] hw/riscv/shakti_c: Check CPU type in machine_run_board_
From: |
Gavin Shan |
Subject: |
[PATCH v5 31/31] hw/riscv/shakti_c: Check CPU type in machine_run_board_init() |
Date: |
Wed, 15 Nov 2023 09:56:28 +1000 |
Set mc->valid_cpu_types so that the user specified CPU type can
be validated in machine_run_board_init(). We needn't to do it
by ourselves.
Signed-off-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/riscv/shakti_c.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/hw/riscv/shakti_c.c b/hw/riscv/shakti_c.c
index 12ea74b032..fc83ed4db4 100644
--- a/hw/riscv/shakti_c.c
+++ b/hw/riscv/shakti_c.c
@@ -28,6 +28,10 @@
#include "exec/address-spaces.h"
#include "hw/riscv/boot.h"
+static const char * const valid_cpu_types[] = {
+ RISCV_CPU_TYPE_NAME("shakti-c"),
+ NULL
+};
static const struct MemmapEntry {
hwaddr base;
@@ -47,12 +51,6 @@ static void shakti_c_machine_state_init(MachineState *mstate)
ShaktiCMachineState *sms = RISCV_SHAKTI_MACHINE(mstate);
MemoryRegion *system_memory = get_system_memory();
- /* Allow only Shakti C CPU for this platform */
- if (strcmp(mstate->cpu_type, TYPE_RISCV_CPU_SHAKTI_C) != 0) {
- error_report("This board can only be used with Shakti C CPU");
- exit(1);
- }
-
/* Initialize SoC */
object_initialize_child(OBJECT(mstate), "soc", &sms->soc,
TYPE_RISCV_SHAKTI_SOC);
@@ -85,6 +83,7 @@ static void shakti_c_machine_class_init(ObjectClass *klass,
void *data)
mc->desc = "RISC-V Board compatible with Shakti SDK";
mc->init = shakti_c_machine_state_init;
mc->default_cpu_type = TYPE_RISCV_CPU_SHAKTI_C;
+ mc->valid_cpu_types = valid_cpu_types;
mc->default_ram_id = "riscv.shakti.c.ram";
}
--
2.41.0
- Re: [PATCH v5 23/31] machine: Constify MachineClass::valid_cpu_types[i], (continued)
- [PATCH v5 24/31] machine: Use error handling when CPU type is checked, Gavin Shan, 2023/11/14
- [PATCH v5 25/31] machine: Introduce helper is_cpu_type_supported(), Gavin Shan, 2023/11/14
- [PATCH v5 27/31] hw/arm/virt: Hide host CPU model for tcg, Gavin Shan, 2023/11/14
- [PATCH v5 26/31] machine: Print CPU model name instead of CPU type name, Gavin Shan, 2023/11/14
- [PATCH v5 28/31] hw/arm/virt: Check CPU type in machine_run_board_init(), Gavin Shan, 2023/11/14
- [PATCH v5 29/31] hw/arm/sbsa-ref: Check CPU type in machine_run_board_init(), Gavin Shan, 2023/11/14
- [PATCH v5 30/31] hw/arm: Check CPU type in machine_run_board_init(), Gavin Shan, 2023/11/14
- [PATCH v5 31/31] hw/riscv/shakti_c: Check CPU type in machine_run_board_init(),
Gavin Shan <=
- Re: [PATCH v5 00/31] Unified CPU type check, Philippe Mathieu-Daudé, 2023/11/16
- Re: [PATCH v5 00/31] Unified CPU type check, Philippe Mathieu-Daudé, 2023/11/16