All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 01/10] hw/arm/virt: fix cmdline parsing bug with CPU options and smp > 1
Date: Wed, 11 Mar 2015 14:18:41 +0000	[thread overview]
Message-ID: <1426083530-7591-2-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1426083530-7591-1-git-send-email-peter.maydell@linaro.org>

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

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>
---
 hw/arm/virt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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);
-- 
1.9.1

  reply	other threads:[~2015-03-11 14:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-11 14:18 [Qemu-devel] [PULL 00/10] target-arm queue Peter Maydell
2015-03-11 14:18 ` Peter Maydell [this message]
2015-03-11 14:18 ` [Qemu-devel] [PULL 02/10] stm32f2xx_timer: Add the stm32f2xx Timer Peter Maydell
2015-03-11 14:18 ` [Qemu-devel] [PULL 03/10] stm32f2xx_USART: Add the stm32f2xx USART Controller Peter Maydell
2015-03-11 14:18 ` [Qemu-devel] [PULL 04/10] stm32f2xx_SYSCFG: Add the stm32f2xx SYSCFG Peter Maydell
2015-03-11 14:18 ` [Qemu-devel] [PULL 05/10] stm32f205: Add the stm32f205 SoC Peter Maydell
2015-03-11 14:18 ` [Qemu-devel] [PULL 06/10] netduino2: Add the Netduino 2 Machine Peter Maydell
2015-03-11 14:18 ` [Qemu-devel] [PULL 07/10] target-arm: Add missing compatible property to A57 Peter Maydell
2015-03-11 14:18 ` [Qemu-devel] [PULL 08/10] integrator/cp: Model CP control registers as sysbus device Peter Maydell
2015-03-11 14:18 ` [Qemu-devel] [PULL 09/10] integrator/cp: Implement CARDIN and WPROT signals Peter Maydell
2015-03-11 14:18 ` [Qemu-devel] [PULL 10/10] bitops.h: sextract64() return type should be int64_t, not uint64_t Peter Maydell
2015-03-11 18:21 ` [Qemu-devel] [PULL 00/10] target-arm queue Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426083530-7591-2-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.