From patchwork Mon Jan 19 22:30:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 43336 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 826322034D for ; Mon, 19 Jan 2015 22:32:00 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id u14sf18080625lbd.3 for ; Mon, 19 Jan 2015 14:31:59 -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=EQfo0RwyKnc0CizZGCxe19bX6cvr+BI8PmB921bAqeI=; b=WE8yFZ6xqBZgX68N6gZr7dINXyl6rHrznbmv9u+R0gIVk/p2K2uAe+CTg6qqBQZQDC 0Mj822wVQ+UzQC9yXo+1rHt/sT++rUS8ZAjOqUeZYjs48AxfMtlRM5CsSLjHQTogFRPa Igw++GjYJTHlAooYtE5PHKXwMO1G9+/3VacFnlfmZkRCm09lNtdiy9y5AoEroSGxU69F NMUTfoZiBf8nuBXLx/bIyFW2i1KhZl/EYGK5nQf33w3i9S64ktGflYyGZl7zlxd/nQuL 3rLbx0cpZZwSa+4fT2rm1i5Gh4Z5fYsRYShRr3hVgxRfy9FzsrHX+96O6BSwdILvEmTD ZS+A== X-Gm-Message-State: ALoCoQk4PfOP6nG+rhruUHNN60z0B6WSSECmHyfIQ72NXd+VskkN1DwhzwUEkKQ0rZ1LYX/ZyqqX X-Received: by 10.194.78.42 with SMTP id y10mr75wjw.4.1421706719153; Mon, 19 Jan 2015 14:31:59 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.133 with SMTP id c5ls623212lac.102.gmail; Mon, 19 Jan 2015 14:31:58 -0800 (PST) X-Received: by 10.112.148.73 with SMTP id tq9mr34611770lbb.37.1421706718893; Mon, 19 Jan 2015 14:31:58 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id w8si14869278lal.81.2015.01.19.14.31.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Jan 2015 14:31:58 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id q1so15991435lam.2 for ; Mon, 19 Jan 2015 14:31:58 -0800 (PST) X-Received: by 10.152.18.135 with SMTP id w7mr33674116lad.47.1421706718814; Mon, 19 Jan 2015 14:31:58 -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 c8csp1229053lbb; Mon, 19 Jan 2015 14:31:58 -0800 (PST) X-Received: by 10.140.21.80 with SMTP id 74mr49560655qgk.87.1421706717600; Mon, 19 Jan 2015 14:31:57 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j4si19460371qaz.130.2015.01.19.14.31.57 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 19 Jan 2015 14:31:57 -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]:40068 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDKrU-0004DY-Mv for patch@linaro.org; Mon, 19 Jan 2015 17:31:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDKqX-0003AQ-BT for qemu-devel@nongnu.org; Mon, 19 Jan 2015 17:30:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDKqS-0003Qu-7b for qemu-devel@nongnu.org; Mon, 19 Jan 2015 17:30:57 -0500 Received: from mail-pd0-f171.google.com ([209.85.192.171]:56327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDKqS-0003Qf-25 for qemu-devel@nongnu.org; Mon, 19 Jan 2015 17:30:52 -0500 Received: by mail-pd0-f171.google.com with SMTP id fp1so17532336pdb.2 for ; Mon, 19 Jan 2015 14:30:51 -0800 (PST) X-Received: by 10.68.217.97 with SMTP id ox1mr47944228pbc.53.1421706651307; Mon, 19 Jan 2015 14:30:51 -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 rl10sm985994pbb.67.2015.01.19.14.30.49 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Jan 2015 14:30:50 -0800 (PST) From: Greg Bellows To: qemu-devel@nongnu.org, peter.maydell@linaro.org, christoffer.dall@linaro.org Date: Mon, 19 Jan 2015 16:30:18 -0600 Message-Id: <1421706621-23731-3-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1421706621-23731-1-git-send-email-greg.bellows@linaro.org> References: <1421706621-23731-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.171 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH 2/5] 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.43 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 --- hw/arm/virt.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 2353440..cd192ae 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -573,12 +573,19 @@ static void machvirt_init(MachineState *machine) MemoryRegion *ram = g_new(MemoryRegion, 1); const char *cpu_model = machine->cpu_model; VirtBoardInfo *vbi; + char *cpuname, *features; if (!cpu_model) { cpu_model = "cortex-a15"; } - vbi = find_machine_info(cpu_model); + /* Separate the actual CPU model name from any appended features */ + cpuname = g_strdup(cpu_model); + cpuname = strtok(cpuname, ","); + /* Keep track of the features for later parsing */ + features = strtok(NULL, ","); + + vbi = find_machine_info(cpuname); if (!vbi) { error_report("mach-virt: CPU %s not supported", cpu_model); @@ -595,8 +602,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, cpuname); + CPUClass *cc = CPU_CLASS(oc); Object *cpuobj; + Error *err = NULL; if (!oc) { fprintf(stderr, "Unable to find CPU definition\n"); @@ -604,6 +613,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), features, &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 +639,7 @@ static void machvirt_init(MachineState *machine) object_property_set_bool(cpuobj, true, "realized", NULL); } + g_free(cpuname); fdt_add_timer_nodes(vbi); fdt_add_cpu_nodes(vbi); fdt_add_psci_node(vbi);