Received: from eggs.gnu.org ([2001:4830:134:3::10]:56997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTDFl-000487-Lu for qemu-devel@nongnu.org; Tue, 09 Feb 2016 13:43:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTDFk-0001t7-7B for qemu-devel@nongnu.org; Tue, 09 Feb 2016 13:43:09 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:57274) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTDFk-0001sQ-0U for qemu-devel@nongnu.org; Tue, 09 Feb 2016 13:43:08 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.84) (envelope-from ) id 1aTDFi-0006Kn-Im for qemu-devel@nongnu.org; Tue, 09 Feb 2016 18:43:06 +0000 From: Peter Maydell Date: Tue, 9 Feb 2016 18:43:04 +0000 Message-Id: <1455043385-24250-15-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1455043385-24250-1-git-send-email-peter.maydell@linaro.org> References: <1455043385-24250-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PULL 14/15] hw/arm/virt: fix max-cpus check List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Andrew Jones mach-virt doesn't yet support hotplug, but command lines specifying -smp ,maxcpus= don't fail. Of course specifying bigger-num as something bigger than the machine supports, e.g. > 8 on a gicv2 machine, should fail though. This fix also makes mach- virt's max-cpus check truly consistent with the one in vl.c:main, as the one there was already correctly checking max-cpus instead of smp-cpus. Reported-by: Shannon Zhao Signed-off-by: Andrew Jones Reviewed-by: Shannon Zhao Message-id: 1454511578-24863-1-git-send-email-drjones@redhat.com Signed-off-by: Peter Maydell --- hw/arm/virt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 15658f4..44bbbea 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1013,7 +1013,7 @@ static void machvirt_init(MachineState *machine) MemoryRegion *sysmem = get_system_memory(); MemoryRegion *secure_sysmem = NULL; int gic_version = vms->gic_version; - int n, max_cpus; + int n, virt_max_cpus; MemoryRegion *ram = g_new(MemoryRegion, 1); const char *cpu_model = machine->cpu_model; VirtBoardInfo *vbi; @@ -1051,15 +1051,15 @@ static void machvirt_init(MachineState *machine) * many redistributors we can fit into the memory map. */ if (gic_version == 3) { - max_cpus = vbi->memmap[VIRT_GIC_REDIST].size / 0x20000; + virt_max_cpus = vbi->memmap[VIRT_GIC_REDIST].size / 0x20000; } else { - max_cpus = GIC_NCPU; + virt_max_cpus = GIC_NCPU; } - if (smp_cpus > max_cpus) { + if (max_cpus > virt_max_cpus) { error_report("Number of SMP CPUs requested (%d) exceeds max CPUs " "supported by machine 'mach-virt' (%d)", - smp_cpus, max_cpus); + max_cpus, virt_max_cpus); exit(1); } -- 1.9.1