[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 10/12] hw/arm/raspi: List models creatable by the generic 'ras
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 10/12] hw/arm/raspi: List models creatable by the generic 'raspi' machine |
Date: |
Tue, 4 Feb 2025 01:22:38 +0100 |
All the following models can be created (with different RAM size):
$ qemu-system-aarch64 -M raspi
qemu-system-aarch64: Missing model, try -M raspi,model=help
$ qemu-system-aarch64 -M raspi,model=help
Available models (processor):
- A (BCM2835)
- B (BCM2835)
- A+ (BCM2835)
- B+ (BCM2835)
- 2B (BCM2836)
- CM1 (BCM2835)
- 3B (BCM2837)
- Zero (BCM2835)
- CM3 (BCM2837)
- ZeroW (BCM2835)
- 3B+ (BCM2837)
- 3A+ (BCM2837)
- CM3+ (BCM2837)
- 4B (BCM2838)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/arm/raspi.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index b184ac3c446..8cae1ff6f93 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -445,7 +445,7 @@ static void raspi_generic_machine_init(MachineState *ms)
uint64_t max_ramsize;
if (!board_rev) {
- error_report("Missing model");
+ error_report("Missing model, try -M raspi,model=help");
exit(1);
}
@@ -500,8 +500,33 @@ static void raspi_update_board_rev(RaspiBaseMachineState
*s)
ms->smp.max_cpus = soc_property[proc].cores_count;
}
+static void raspi_list_machine_models(void)
+{
+ printf("Available models (processor):\n");
+
+ for (unsigned i = 0; i < ARRAY_SIZE(types); i++) {
+ const char *soc_type;
+
+ if (!types[i].model) {
+ continue;
+ }
+
+ soc_type = soc_property[types[i].proc_id].type;
+ if (!soc_type) {
+ continue;
+ }
+ printf("- %-10s (BCM%s)\n",
+ types[i].model,
+ soc_property[types[i].proc_id].type + 3);
+ }
+}
+
static void raspi_set_machine_model(Object *obj, const char *value, Error
**errp)
{
+ if (!strcmp(value, "help")) {
+ raspi_list_machine_models();
+ exit(0);
+ }
for (unsigned i = 0; i < ARRAY_SIZE(types); i++) {
if (types[i].model && !strcmp(value, types[i].model)) {
RaspiBaseMachineState *s = RASPI_BASE_MACHINE(obj);
@@ -512,6 +537,7 @@ static void raspi_set_machine_model(Object *obj, const char
*value, Error **errp
}
}
error_setg(errp, "Invalid model");
+ error_append_hint(errp, "Use model=help to list models.\n");
}
static char *raspi_get_machine_model(Object *obj, Error **errp)
--
2.47.1
- Re: [PATCH v2 03/12] hw/arm/raspi: Unify RASPI_MACHINE types, (continued)
- [PATCH v2 04/12] hw/arm/raspi: Pass board_rev as argument to raspi_base_machine_init(), Philippe Mathieu-Daudé, 2025/02/03
- [PATCH v2 05/12] hw/arm/raspi: Consider processor id in types[] array, Philippe Mathieu-Daudé, 2025/02/03
- [PATCH v2 06/12] hw/arm/raspi: Consider network interface for B models, Philippe Mathieu-Daudé, 2025/02/03
- [PATCH v2 07/12] hw/arm/raspi: Check ramsize is within chipset aperture, Philippe Mathieu-Daudé, 2025/02/03
- [PATCH v2 08/12] hw/arm/raspi: Introduce generic Raspberry Pi machine, Philippe Mathieu-Daudé, 2025/02/03
- [PATCH v2 09/12] hw/arm/raspi: Have the generic machine take a 'revision' property, Philippe Mathieu-Daudé, 2025/02/03
- [PATCH v2 10/12] hw/arm/raspi: List models creatable by the generic 'raspi' machine,
Philippe Mathieu-Daudé <=
- [PATCH v2 12/12] hw/arm/raspi: Support more models, Philippe Mathieu-Daudé, 2025/02/03
- [PATCH v2 11/12] hw/arm/raspi: Deprecate old raspiX machine names, Philippe Mathieu-Daudé, 2025/02/03