From 7264961934130df50d151def5eb415efa2e28ec5 Mon Sep 17 00:00:00 2001 From: "Emilio G. Cota" Date: Mon, 13 Nov 2017 13:55:27 +0000 Subject: 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 fixes 3468b59 ("tcg: enable multiple TCG contexts in softmmu", 2017-10-24), which broke TCG initialization for some ARM boards. Fixes: 3468b59e18b179bc63c7ce934de912dfa9596122 Reported-by: Thomas Huth Reviewed-by: Eduardo Habkost Reviewed-by: Alistair Francis Signed-off-by: Emilio G. Cota Message-id: 1510343626-25861-6-git-send-email-cota@braap.org Suggested-by: Peter Maydell Signed-off-by: Emilio G. Cota Signed-off-by: Peter Maydell --- hw/arm/xlnx-zcu102.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'hw/arm/xlnx-zcu102.c') diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c index 190eb69..9631a53 100644 --- a/hw/arm/xlnx-zcu102.c +++ b/hw/arm/xlnx-zcu102.c @@ -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 = { -- cgit v1.1