qemu-arm
[Top][All Lists]
Advanced

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

[PATCH 6/6] hw/arm/raspi: Get the CPU core count from the revision code


From: Philippe Mathieu-Daudé
Subject: [PATCH 6/6] hw/arm/raspi: Get the CPU core count from the revision code
Date: Mon, 3 Feb 2020 09:26:19 +0100

The number of cores is tied to the SoC, and we already know how
to extract the Chip ID from the revision code. Use it to determine
the number of cores.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
 hw/arm/raspi.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 12dc4d1486..aff5d57261 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -39,9 +39,10 @@ enum BoardIdChip {
 
 static const struct {
     const char *soc_name;
+    int cores_count;
 } soc_config[] = {
-    [C_BCM2836] = {TYPE_BCM2836},
-    [C_BCM2837] = {TYPE_BCM2837},
+    [C_BCM2836] = {TYPE_BCM2836, BCM283X_NCPUS},
+    [C_BCM2837] = {TYPE_BCM2837, BCM283X_NCPUS},
 };
 
 typedef struct RaspiMachineState {
@@ -113,6 +114,11 @@ static const char *board_soc_name(const RaspiBoardInfo 
*config)
     return soc_config[board_chip_id(config)].soc_name;
 }
 
+static int cpu_cores_count(const RaspiBoardInfo *config)
+{
+    return soc_config[board_chip_id(config)].cores_count;
+}
+
 static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info)
 {
     static const uint32_t smpboot[] = {
@@ -312,9 +318,7 @@ static void raspi_machine_class_init(ObjectClass *oc, void 
*data)
     mc->no_parallel = 1;
     mc->no_floppy = 1;
     mc->no_cdrom = 1;
-    mc->max_cpus = BCM283X_NCPUS;
-    mc->min_cpus = BCM283X_NCPUS;
-    mc->default_cpus = BCM283X_NCPUS;
+    mc->default_cpus = mc->min_cpus = mc->max_cpus = cpu_cores_count(config);
     mc->default_ram_size = board_ram_size(config);
     mc->ignore_memory_transaction_failures = true;
 }
-- 
2.21.1




reply via email to

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