mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
hw: add .min_cpus and .default_cpus fields to machine_class
max_cpus needs to be an upper bound on the number of vCPUs initialized; otherwise TCG region initialization breaks. Some boards initialize a hard-coded number of vCPUs, which is not captured by the global max_cpus and therefore breaks TCG initialization. Fix it by adding the .min_cpus field to machine_class. This commit also changes some user-facing behaviour: we now die if -smp is below this hard-coded vCPU minimum instead of silently ignoring the passed -smp value (sometimes announcing this by printing a warning). However, the introduction of .default_cpus lessens the likelihood that users will notice this: if -smp isn't set, we now assign the value in .default_cpus to both smp_cpus and max_cpus. IOW, if a user does not set -smp, they always get a correct number of vCPUs. This change fixes3468b59
("tcg: enable multiple TCG contexts in softmmu", 2017-10-24), which broke TCG initialization for some ARM boards. Fixes:3468b59e18
Reported-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> Signed-off-by: Emilio G. Cota <cota@braap.org> Message-id: 1510343626-25861-6-git-send-email-cota@braap.org Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
1342b0355e
commit
7264961934
5 changed files with 31 additions and 11 deletions
|
@ -27,7 +27,6 @@
|
|||
#include "qemu-common.h"
|
||||
#include "cpu.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "sysemu/qtest.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "net/net.h"
|
||||
#include "hw/arm/arm.h"
|
||||
|
@ -129,13 +128,6 @@ exynos4_boards_init_common(MachineState *machine,
|
|||
Exynos4BoardType board_type)
|
||||
{
|
||||
Exynos4BoardState *s = g_new(Exynos4BoardState, 1);
|
||||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||
|
||||
if (smp_cpus != EXYNOS4210_NCPUS && !qtest_enabled()) {
|
||||
error_report("%s board supports only %d CPU cores, ignoring smp_cpus"
|
||||
" value",
|
||||
mc->name, EXYNOS4210_NCPUS);
|
||||
}
|
||||
|
||||
exynos4_board_binfo.ram_size = exynos4_board_ram_size[board_type];
|
||||
exynos4_board_binfo.board_id = exynos4_board_id[board_type];
|
||||
|
@ -189,6 +181,8 @@ static void nuri_class_init(ObjectClass *oc, void *data)
|
|||
mc->desc = "Samsung NURI board (Exynos4210)";
|
||||
mc->init = nuri_init;
|
||||
mc->max_cpus = EXYNOS4210_NCPUS;
|
||||
mc->min_cpus = EXYNOS4210_NCPUS;
|
||||
mc->default_cpus = EXYNOS4210_NCPUS;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
}
|
||||
|
||||
|
@ -205,6 +199,8 @@ static void smdkc210_class_init(ObjectClass *oc, void *data)
|
|||
mc->desc = "Samsung SMDKC210 board (Exynos4210)";
|
||||
mc->init = smdkc210_init;
|
||||
mc->max_cpus = EXYNOS4210_NCPUS;
|
||||
mc->min_cpus = EXYNOS4210_NCPUS;
|
||||
mc->default_cpus = EXYNOS4210_NCPUS;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -167,6 +167,8 @@ static void raspi2_machine_init(MachineClass *mc)
|
|||
mc->no_floppy = 1;
|
||||
mc->no_cdrom = 1;
|
||||
mc->max_cpus = BCM2836_NCPUS;
|
||||
mc->min_cpus = BCM2836_NCPUS;
|
||||
mc->default_cpus = BCM2836_NCPUS;
|
||||
mc->default_ram_size = 1024 * 1024 * 1024;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
};
|
||||
|
|
|
@ -189,6 +189,7 @@ static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data)
|
|||
mc->units_per_default_bus = 1;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
mc->max_cpus = XLNX_ZYNQMP_NUM_APU_CPUS + XLNX_ZYNQMP_NUM_RPU_CPUS;
|
||||
mc->default_cpus = XLNX_ZYNQMP_NUM_APU_CPUS;
|
||||
}
|
||||
|
||||
static const TypeInfo xlnx_ep108_machine_init_typeinfo = {
|
||||
|
@ -246,6 +247,7 @@ static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data)
|
|||
mc->units_per_default_bus = 1;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
mc->max_cpus = XLNX_ZYNQMP_NUM_APU_CPUS + XLNX_ZYNQMP_NUM_RPU_CPUS;
|
||||
mc->default_cpus = XLNX_ZYNQMP_NUM_APU_CPUS;
|
||||
}
|
||||
|
||||
static const TypeInfo xlnx_zcu102_machine_init_typeinfo = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue