From patchwork Wed Jan 21 18:49:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 43477 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 17816240D5 for ; Wed, 21 Jan 2015 18:51:31 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id d49sf8476761eek.2 for ; Wed, 21 Jan 2015 10:51:30 -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=HxZW/NxeCRbvgFFZXTPlJKQwAWoJsAmTxdMA2G8fEc8=; b=jfQeuxaNtx742Z2TA7li/71mWLqg667gsF0jP8jUmvHcOe1rpDk3MJfSpxKjVqtt0M 2BRCxiL+IKxDjk0QnsGoMU2XVibPaE5aq75nL0P72c1qpqs52QPGgeVjUyQMZW3qjv5F tar6Yw6go5mszMYlElLC01iXVEFbB1XZNj2TLa9qZfSIX9QgWbzbmnF7Iru5mrgcWOXt 2chVveHITsYaaMs1lHWZsWBlpEbLT4Gp85Ph1XO2EHtJV73e/ra6FABXowy/4oH/Fc3/ cd2Dq4e6FC0IYYtgNFcZVTNInbbw8S/SRi+2+E2kqpLy+h49ctPGdVEuTPaPPmmpDf60 q1RA== X-Gm-Message-State: ALoCoQnBadfR+XEohqJo1GCFgwytTy/YLQIkfRHr396xKZlOLDubijHGHXSHbtA3F5CHC3micuqr X-Received: by 10.180.228.38 with SMTP id sf6mr3789611wic.5.1421866290273; Wed, 21 Jan 2015 10:51:30 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.97 with SMTP id j1ls65742laj.28.gmail; Wed, 21 Jan 2015 10:51:30 -0800 (PST) X-Received: by 10.152.42.164 with SMTP id p4mr39451403lal.45.1421866290116; Wed, 21 Jan 2015 10:51:30 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id rb6si18749974lbb.8.2015.01.21.10.51.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Jan 2015 10:51:30 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id hv19so2524852lab.13 for ; Wed, 21 Jan 2015 10:51:30 -0800 (PST) X-Received: by 10.112.98.99 with SMTP id eh3mr45235963lbb.32.1421866289934; Wed, 21 Jan 2015 10:51:29 -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.9.200 with SMTP id c8csp8291lbb; Wed, 21 Jan 2015 10:51:29 -0800 (PST) X-Received: by 10.140.46.37 with SMTP id j34mr66701107qga.12.1421866288406; Wed, 21 Jan 2015 10:51:28 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n74si1210830qgd.96.2015.01.21.10.51.26 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 21 Jan 2015 10:51:28 -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]:49749 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YE0NC-0007Ks-7M for patch@linaro.org; Wed, 21 Jan 2015 13:51:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YE0Lz-0006BU-B5 for qemu-devel@nongnu.org; Wed, 21 Jan 2015 13:50:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YE0Lv-0001JI-JV for qemu-devel@nongnu.org; Wed, 21 Jan 2015 13:50:11 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:60257) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YE0Lv-0001IT-EO for qemu-devel@nongnu.org; Wed, 21 Jan 2015 13:50:07 -0500 Received: by mail-pa0-f53.google.com with SMTP id kx10so10276104pab.12 for ; Wed, 21 Jan 2015 10:50:06 -0800 (PST) X-Received: by 10.68.189.105 with SMTP id gh9mr63986229pbc.142.1421866206898; Wed, 21 Jan 2015 10:50:06 -0800 (PST) Received: from gbellows-linaro.qualcomm.com (rrcs-67-52-129-61.west.biz.rr.com. [67.52.129.61]) by mx.google.com with ESMTPSA id zk9sm7047429pac.1.2015.01.21.10.50.05 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Jan 2015 10:50:06 -0800 (PST) From: Greg Bellows To: qemu-devel@nongnu.org, peter.maydell@linaro.org, christoffer.dall@linaro.org Date: Wed, 21 Jan 2015 12:49:51 -0600 Message-Id: <1421866193-24941-3-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1421866193-24941-1-git-send-email-greg.bellows@linaro.org> References: <1421866193-24941-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.53 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH v2 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.215.54 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 --- 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 2353440..9b34e94 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -573,15 +573,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); } @@ -595,8 +599,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"); @@ -604,6 +610,13 @@ static void machvirt_init(MachineState *machine) } cpuobj = object_new(object_class_get_name(oc)); + /* Handle any CPU options specfied 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); } @@ -623,6 +636,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);