From patchwork Tue Feb 10 10:50:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 44531 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1C6472151F for ; Tue, 10 Feb 2015 10:51:50 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id u10sf8873299lbd.3 for ; Tue, 10 Feb 2015 02:51:49 -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:in-reply-to:references: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=O5rHkCu2QMHxwlFY/U0dRBfWiritGaKToMejf2HPIiw=; b=DnfV3b2p+nrCxkUGXnA1W0aVynDyiYk/gtgb4Cfg1O8KyUF3drAI1gGbMIseR+d2FG GXtGwGNL7oia5V5wSlgCZCY7tLqKzuSp9qB49j1feCzrG1pbM05ZWsJwJldzI3hJr/+0 UERaT6DK6AJNaeV6xA63mX0p5Ba28ZuSNup8ejs609ifFell+On4FCEISdkRNa8Facyo I0t4985Ja3DeY6u4gcg72n2oIP6K8kAmjTHX3HPvl5L58W9ViQeHxBebKFUf7KyiCP31 f8ZnCakufTfq/KKHQZHQi7idVY1SDQHktmM/AOlKEpHcaIOk5CQRE9wMZ86t3pVJ0Hbg ZK8g== X-Gm-Message-State: ALoCoQl6C66h2ykh0vY5QqLYMlJn7QTgykjcf3oEeZlD9PmyhrdNXkAu2+HE6GWGjJ/JJrNPPMHc X-Received: by 10.152.219.136 with SMTP id po8mr2648696lac.4.1423565508733; Tue, 10 Feb 2015 02:51:48 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.137 with SMTP id lc9ls568500lab.28.gmail; Tue, 10 Feb 2015 02:51:48 -0800 (PST) X-Received: by 10.112.142.134 with SMTP id rw6mr21272539lbb.100.1423565508527; Tue, 10 Feb 2015 02:51:48 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id ka10si11610990lbc.125.2015.02.10.02.51.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Feb 2015 02:51:48 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id p9so1699075lbv.0 for ; Tue, 10 Feb 2015 02:51:48 -0800 (PST) X-Received: by 10.112.85.68 with SMTP id f4mr22275561lbz.106.1423565508411; Tue, 10 Feb 2015 02:51:48 -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 h5csp523213lbj; Tue, 10 Feb 2015 02:51:47 -0800 (PST) X-Received: by 10.224.135.200 with SMTP id o8mr38074158qat.1.1423565506765; Tue, 10 Feb 2015 02:51:46 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id c17si17949556qgd.17.2015.02.10.02.51.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 10 Feb 2015 02:51:46 -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]:39033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YL8Px-0005Fl-Pg for patch@linaro.org; Tue, 10 Feb 2015 05:51:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YL8P2-0004L6-Kl for qemu-devel@nongnu.org; Tue, 10 Feb 2015 05:50:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YL8Ox-00057V-QC for qemu-devel@nongnu.org; Tue, 10 Feb 2015 05:50:48 -0500 Received: from mail-pa0-f48.google.com ([209.85.220.48]:33392) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YL8Ox-00057K-IP for qemu-devel@nongnu.org; Tue, 10 Feb 2015 05:50:43 -0500 Received: by mail-pa0-f48.google.com with SMTP id eu11so18641618pac.7 for ; Tue, 10 Feb 2015 02:50:42 -0800 (PST) X-Received: by 10.68.134.37 with SMTP id ph5mr36536205pbb.4.1423565442807; Tue, 10 Feb 2015 02:50:42 -0800 (PST) Received: from localhost.localdomain ([210.177.145.249]) by mx.google.com with ESMTPSA id ht2sm7174678pdb.82.2015.02.10.02.50.40 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Feb 2015 02:50:42 -0800 (PST) From: Greg Bellows To: qemu-devel@nongnu.org, peter.maydell@linaro.org, christoffer.dall@linaro.org, alex.bennee@linaro.org, edgar.iglesias@gmail.com Date: Tue, 10 Feb 2015 18:50:13 +0800 Message-Id: <1423565415-5844-3-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1423565415-5844-1-git-send-email-greg.bellows@linaro.org> References: <1423565415-5844-1-git-send-email-greg.bellows@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.48 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH v4 2/4] target-arm: Add feature parsing to virt 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: greg.bellows@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.217.169 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 Added machvirt parsing of feature keywords added to the -cpu command line option. Parsing occurs during machine initialization. Signed-off-by: Greg Bellows Reviewed-by: Peter Maydell --- v3 -> v4 - Fix misspelling v1 -> v2 - Fix multiple property handling --- hw/arm/virt.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 34d9379..3c37a5e 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -602,15 +602,19 @@ static void machvirt_init(MachineState *machine) MemoryRegion *ram = g_new(MemoryRegion, 1); const char *cpu_model = machine->cpu_model; VirtBoardInfo *vbi; + char **cpustr; if (!cpu_model) { cpu_model = "cortex-a15"; } - vbi = find_machine_info(cpu_model); + /* Separate the actual CPU model name from any appended features */ + cpustr = g_strsplit(cpu_model, ",", 2); + + vbi = find_machine_info(cpustr[0]); if (!vbi) { - error_report("mach-virt: CPU %s not supported", cpu_model); + error_report("mach-virt: CPU %s not supported", cpustr[0]); exit(1); } @@ -624,8 +628,10 @@ static void machvirt_init(MachineState *machine) create_fdt(vbi); for (n = 0; n < smp_cpus; n++) { - ObjectClass *oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model); + ObjectClass *oc = cpu_class_by_name(TYPE_ARM_CPU, cpustr[0]); + CPUClass *cc = CPU_CLASS(oc); Object *cpuobj; + Error *err = NULL; if (!oc) { fprintf(stderr, "Unable to find CPU definition\n"); @@ -633,6 +639,13 @@ 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); + if (err) { + error_report("%s", error_get_pretty(err)); + exit(1); + } + if (!vms->secure) { object_property_set_bool(cpuobj, false, "has_el3", NULL); } @@ -652,6 +665,7 @@ static void machvirt_init(MachineState *machine) object_property_set_bool(cpuobj, true, "realized", NULL); } + g_strfreev(cpustr); fdt_add_timer_nodes(vbi); fdt_add_cpu_nodes(vbi); fdt_add_psci_node(vbi);