From patchwork Tue Mar 3 17:06:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 45376 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f197.google.com (mail-we0-f197.google.com [74.125.82.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BF55621416 for ; Tue, 3 Mar 2015 17:07:10 +0000 (UTC) Received: by wesq59 with SMTP id q59sf30022478wes.2 for ; Tue, 03 Mar 2015 09:07:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=GxI0L9pkQoH9LmLMYDeeMhJz43kOeODQv48CBXjVuUI=; b=ijMEYcdlZo27rJiH2Avza1fqFSor1xO2H21wB3sXgAozg8GduvbhKN84ZozodwYBPR uUkvNRGL93xSiqpuGCT5t/kxWyCh1T2YJV8xFmJVSkpKQqOIgfnLMC1R30BZtlKdDB6r GwfLYpRKRNw6f5XEwl7250BEBCMnVoPNI1jRTtELy+CmOaCT5V0RUjHoluo2JOOpxfLA 3H0C5laSmedvAka+My9Fx/pdv0gESXeva66vper7tTPWPHdsVhvGfXUgfIB74+pPzgRW u6HkqJ5RkG/GJK/784lAKuofxHqtA6XWMMdW2gZJMYINyK+HBrmTxbhAaeLSzm517Og7 ndqw== X-Gm-Message-State: ALoCoQnUeikcxRVKgdBEXM3HNOdY3EnO8iXb2IJQgLRZnQb5FhLtOnODjcuRNxr9FHJDU90YZz7x X-Received: by 10.180.39.164 with SMTP id q4mr436488wik.5.1425402430077; Tue, 03 Mar 2015 09:07:10 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.68 with SMTP id y4ls78155lay.12.gmail; Tue, 03 Mar 2015 09:07:09 -0800 (PST) X-Received: by 10.152.170.233 with SMTP id ap9mr28996099lac.47.1425402429730; Tue, 03 Mar 2015 09:07:09 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id cq6si887804lad.79.2015.03.03.09.07.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2015 09:07:09 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lams18 with SMTP id s18so38799169lam.11 for ; Tue, 03 Mar 2015 09:07:09 -0800 (PST) X-Received: by 10.112.147.104 with SMTP id tj8mr15319543lbb.106.1425402429605; Tue, 03 Mar 2015 09:07:09 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp696374lbj; Tue, 3 Mar 2015 09:07:08 -0800 (PST) X-Received: by 10.140.41.169 with SMTP id z38mr57603033qgz.56.1425402427748; Tue, 03 Mar 2015 09:07:07 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l10si1060130qab.80.2015.03.03.09.07.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Mar 2015 09:07:07 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:39915 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSqHi-0008CR-RV for patch@linaro.org; Tue, 03 Mar 2015 12:07:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSqHF-0007MR-Qv for qemu-devel@nongnu.org; Tue, 03 Mar 2015 12:06:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YSqHC-0006sV-AT for qemu-devel@nongnu.org; Tue, 03 Mar 2015 12:06:37 -0500 Received: from mail-we0-f179.google.com ([74.125.82.179]:39619) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSqHC-0006s9-5T for qemu-devel@nongnu.org; Tue, 03 Mar 2015 12:06:34 -0500 Received: by wesx3 with SMTP id x3so41176540wes.6 for ; Tue, 03 Mar 2015 09:06:32 -0800 (PST) X-Received: by 10.194.61.65 with SMTP id n1mr72165916wjr.53.1425402392710; Tue, 03 Mar 2015 09:06:32 -0800 (PST) Received: from ards-macbook-pro.local ([213.143.61.132]) by mx.google.com with ESMTPSA id e18sm2112128wjz.27.2015.03.03.09.06.29 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Mar 2015 09:06:31 -0800 (PST) From: Ard Biesheuvel To: peter.maydell@linaro.org, qemu-devel@nongnu.org, alex.bennee@linaro.org, greg.bellows@linaro.org Date: Tue, 3 Mar 2015 18:06:20 +0100 Message-Id: <1425402380-10488-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.179 Cc: Ard Biesheuvel Subject: [Qemu-devel] [PATCH] hw/arm/virt: fix cmdline parsing bug with CPU options and smp > 1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 Reviewed-by: Greg Bellows --- 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 69f51ac0da58..f8a6c46323dc 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);