[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 11/16] hw/arm/raspi: Use -smp cores=<N> option to restrict ena
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 11/16] hw/arm/raspi: Use -smp cores=<N> option to restrict enabled cores |
Date: |
Sun, 20 Oct 2019 01:47:10 +0200 |
The abstract TYPE_BCM283X device provides a 'enabled-cpus' property
to restrict the number of cores powered on reset. This because on
real hardware the GPU is responsible of starting the cores and keep
them spinning until the Linux kernel is ready to use them.
When using the -kernel paramenter, QEMU does this by installing the
'raspi_smpboot' code when arm_boot_info::write_board_setup() is
called. This is a special feature to help the Linux kernel, and can
only be used with a Linux kernel.
Even if loaded with the -kernel option, U-boot is not Linux, thus
is not recognized as it and the raspi_smpboot code is not installed.
Upon introduction of this machine in commit 1df7d1f9303, the -smp <N>
option allowd to limit the number of cores powered on reset.
Unfortunately later commit 72649619341 added a check which made this
feature unusable:
$ qemu-system-aarch64 -M raspi3 -smp 1
qemu-system-aarch64: Invalid SMP CPUs 1. The min CPUs supported by machine
'raspi3' is 4
Fortunately, the -smp option allow various kind of CPU topology:
-smp
[cpus=]n[,maxcpus=cpus][,cores=cores][,threads=threads][,dies=dies][,sockets=sockets]
set the number of CPUs to 'n' [default=1]
maxcpus= maximum number of total cpus, including
offline CPUs for hotplug, etc
cores= number of CPU cores on one socket (for PC, it's on one die)
threads= number of threads on one CPU core
dies= number of CPU dies on one socket (for PC only)
sockets= number of discrete sockets in the system
Let's use the 'cores' argument to specify the number of cores powered
at reset to restore this feature, and allow to boot U-boot.
We can now run U-boot using:
$ qemu-system-aarch64 -M raspi3 -smp 4,cores=1 ...
Reported-by: Laurent Bonnans <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/arm/raspi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 569d85c11a..45d3f91f95 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -190,8 +190,8 @@ static void raspi_init(MachineState *machine, int version)
/* Setup the SOC */
object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram),
&error_abort);
- object_property_set_int(OBJECT(&s->soc), machine->smp.cpus, "enabled-cpus",
- &error_abort);
+ object_property_set_int(OBJECT(&s->soc), machine->smp.cores,
+ "enabled-cpus", &error_abort);
int board_rev = version == 3 ? 0xa02082 : 0xa21041;
object_property_set_int(OBJECT(&s->soc), board_rev, "board-rev",
&error_abort);
--
2.21.0
- Re: [PATCH v3 05/16] hw/arm/bcm2836: Make the SoC code modular, (continued)
- [PATCH v3 06/16] hw/arm/bcm2836: Rename cpus[] as cpu[].core, Philippe Mathieu-Daudé, 2019/10/19
- [PATCH v3 08/16] hw/arm/bcm2835_peripherals: Add const link property in realize(), Philippe Mathieu-Daudé, 2019/10/19
- [PATCH v3 07/16] hw/arm/bcm2836: Use per CPU address spaces, Philippe Mathieu-Daudé, 2019/10/19
- [PATCH v3 09/16] hw/arm/bcm2836: Create VideoCore address space in the SoC, Philippe Mathieu-Daudé, 2019/10/19
- [PATCH v3 10/16] hw/arm/raspi: Use AddressSpace when using arm_boot::write_secondary_boot, Philippe Mathieu-Daudé, 2019/10/19
- [PATCH v3 11/16] hw/arm/raspi: Use -smp cores=<N> option to restrict enabled cores,
Philippe Mathieu-Daudé <=
- [PATCH v3 12/16] hw/arm/bcm2836: Rename enabled_cpus -> enabled_cores, Philippe Mathieu-Daudé, 2019/10/19
- [PATCH v3 13/16] hw/arm/raspi: Make the board code modular, Philippe Mathieu-Daudé, 2019/10/19
- [PATCH v3 14/16] hw/arm/highbank: Use AddressSpace when using write_secondary_boot(), Philippe Mathieu-Daudé, 2019/10/19
- [PATCH v3 15/16] python/qemu/machine: Allow to use other serial consoles than default, Philippe Mathieu-Daudé, 2019/10/19
- [PATCH NOTFORMERGE v3 16/16] tests/acceptance: Test U-boot on the Raspberry Pi 3, Philippe Mathieu-Daudé, 2019/10/19
- Re: [PATCH v3 00/16] hw/arm/raspi: Add thermal/timer, improve address space, run U-boot, Peter Maydell, 2019/10/24