From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLk0H-0005DE-1J for qemu-devel@nongnu.org; Wed, 11 Feb 2015 21:59:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLk0D-0007g2-1o for qemu-devel@nongnu.org; Wed, 11 Feb 2015 21:59:44 -0500 Received: from mail-pd0-f180.google.com ([209.85.192.180]:35692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLk0C-0007fr-Rs for qemu-devel@nongnu.org; Wed, 11 Feb 2015 21:59:40 -0500 Received: by pdbfl12 with SMTP id fl12so8752432pdb.2 for ; Wed, 11 Feb 2015 18:59:40 -0800 (PST) From: Greg Bellows Date: Thu, 12 Feb 2015 10:59:06 +0800 Message-Id: <1423709948-7662-3-git-send-email-greg.bellows@linaro.org> In-Reply-To: <1423709948-7662-1-git-send-email-greg.bellows@linaro.org> References: <1423709948-7662-1-git-send-email-greg.bellows@linaro.org> Subject: [Qemu-devel] [PATCH v5 2/4] target-arm: Add feature parsing to virt List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, peter.maydell@linaro.org, christoffer.dall@linaro.org, alex.bennee@linaro.org Cc: edgar.iglesias@gmail.com, Greg Bellows , a.spyridakis@virtualopensystems.com 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); -- 1.8.3.2