From patchwork Tue Jan 27 23:58:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 43869 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2956823FFF for ; Wed, 28 Jan 2015 00:01:21 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id n3sf4100482wiv.0 for ; Tue, 27 Jan 2015 16:01:20 -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=e4BXYD1pO+qkDx2fUzheTuormdm6CcHzYGojYdXpw2gp5IkGV2nX1oX6AkoVSF1pV9 mnf7ozSfg6WPimCokhC9vT4I+3fX/lmACDKGSLZbLWRFIyUAVRDBtL/OdYw+yXiK1P68 2GvVbA7TyRqwQLMPBvq825iGEzP0PSjrp/cdsydAuZmdU2igxRaFEFAt2LxwNUNmZO5E EP0LD6kX1Qzi3mv1WK2L0TuOfuWqs9BEtYxdLxjXKi5O1ceKg2nJOcadXYYfK+Pvw6Ms 1WIa/3xYYNa4FwiuRqTQo1LHTvOmUsYNfgWTyxgRvV5AX3/qBMr8Flj2pyhhv1bMPmz9 /kzA== X-Gm-Message-State: ALoCoQkfxmN5eRF5ij+iCPchieLGY0z9llKu1WkBdcORGSbmLe4hV8rJlWuql4iRHP+HPPtXCLcb X-Received: by 10.152.2.40 with SMTP id 8mr612361lar.7.1422403280360; Tue, 27 Jan 2015 16:01:20 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.228 with SMTP id uh4ls102547lac.108.gmail; Tue, 27 Jan 2015 16:01:20 -0800 (PST) X-Received: by 10.152.5.101 with SMTP id r5mr4716323lar.33.1422403280219; Tue, 27 Jan 2015 16:01:20 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id zp10si2674310lbb.104.2015.01.27.16.01.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Jan 2015 16:01:19 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id u10so15916545lbd.9 for ; Tue, 27 Jan 2015 16:01:19 -0800 (PST) X-Received: by 10.112.14.6 with SMTP id l6mr4729091lbc.91.1422403279803; Tue, 27 Jan 2015 16:01:19 -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 h5csp1261497lbj; Tue, 27 Jan 2015 16:01:19 -0800 (PST) X-Received: by 10.140.20.83 with SMTP id 77mr6946806qgi.40.1422403278190; Tue, 27 Jan 2015 16:01:18 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 66si3810941qgl.23.2015.01.27.16.01.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 27 Jan 2015 16:01:18 -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]:50592 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGG4L-0002BM-CH for patch@linaro.org; Tue, 27 Jan 2015 19:01:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGG24-0006r5-Qq for qemu-devel@nongnu.org; Tue, 27 Jan 2015 18:58:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGG1y-0005Tc-Tq for qemu-devel@nongnu.org; Tue, 27 Jan 2015 18:58:56 -0500 Received: from mail-pd0-f169.google.com ([209.85.192.169]:57691) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGG1y-0005TU-On for qemu-devel@nongnu.org; Tue, 27 Jan 2015 18:58:50 -0500 Received: by mail-pd0-f169.google.com with SMTP id g10so21872372pdj.0 for ; Tue, 27 Jan 2015 15:58:50 -0800 (PST) X-Received: by 10.70.134.142 with SMTP id pk14mr872869pdb.17.1422403130271; Tue, 27 Jan 2015 15:58:50 -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 nu5sm2679909pbb.79.2015.01.27.15.58.48 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Jan 2015 15:58:49 -0800 (PST) From: Greg Bellows To: qemu-devel@nongnu.org, peter.maydell@linaro.org, christoffer.dall@linaro.org, alex.bennee@linaro.org Date: Tue, 27 Jan 2015 17:58:35 -0600 Message-Id: <1422403117-16921-3-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1422403117-16921-1-git-send-email-greg.bellows@linaro.org> References: <1422403117-16921-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.192.169 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH v3 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.178 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 --- 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);