diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2015-03-11 13:21:05 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2015-03-11 13:21:05 +0000 |
commit | 886bc7a0492ff5d3b6c42157afff827b68595c34 (patch) | |
tree | 2bf2dbc0c28cda21efb8f8a9caada30f074140e3 /hw | |
parent | 48412371415a260d00fc7fdcdb400da55f268828 (diff) | |
download | qemu-886bc7a0492ff5d3b6c42157afff827b68595c34.zip qemu-886bc7a0492ff5d3b6c42157afff827b68595c34.tar.gz qemu-886bc7a0492ff5d3b6c42157afff827b68595c34.tar.bz2 |
hw/arm/virt: fix cmdline parsing bug with CPU options and smp > 1
The recently introduced feature that allows 32 bit guests to be
executed under KVM on a 64-bit host incorrectly handles the case
where more than 1 cpu is specified using '-smp N'
For instance, this invocation of qemu
qemu-system-aarch64 -M virt -cpu cortex-a57,aarch64=off -smp 2
produces the following error
qemu-system-aarch64: Expected key=value format, found aarch64
which is caused by the destructive parsing performed by
cpu_common_parse_features(), resulting in subsequent attempts
to parse the CPU option string (for each additional CPU) to fail.
So duplicate the string before parsing it, and free it directly
afterwards.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Greg Bellows <greg.bellows@linaro.org>
Message-id: 1425402380-10488-1-git-send-email-ard.biesheuvel@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/arm/virt.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 93b7605..9072bc2 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -758,6 +758,7 @@ static void machvirt_init(MachineState *machine) CPUClass *cc = CPU_CLASS(oc); Object *cpuobj; Error *err = NULL; + char *cpuopts = g_strdup(cpustr[1]); if (!oc) { fprintf(stderr, "Unable to find CPU definition\n"); @@ -766,7 +767,8 @@ static void machvirt_init(MachineState *machine) cpuobj = object_new(object_class_get_name(oc)); /* Handle any CPU options specified by the user */ - cc->parse_features(CPU(cpuobj), cpustr[1], &err); + cc->parse_features(CPU(cpuobj), cpuopts, &err); + g_free(cpuopts); if (err) { error_report("%s", error_get_pretty(err)); exit(1); |