qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Bellows <greg.bellows@linaro.org>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org,
	christoffer.dall@linaro.org
Cc: Greg Bellows <greg.bellows@linaro.org>
Subject: [Qemu-devel] [PATCH 2/5] target-arm: Add feature parsing to virt
Date: Mon, 19 Jan 2015 16:30:18 -0600	[thread overview]
Message-ID: <1421706621-23731-3-git-send-email-greg.bellows@linaro.org> (raw)
In-Reply-To: <1421706621-23731-1-git-send-email-greg.bellows@linaro.org>

Added machvirt parsing of feature keywords added to the -cpu command line
option.  Parsing occurs during machine initialization.

Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
---
 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);
-- 
1.8.3.2

  parent reply	other threads:[~2015-01-19 22:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-19 22:30 [Qemu-devel] [PATCH 0/5] target-arm: ARM64: Adding EL1 AARCH32 guest support Greg Bellows
2015-01-19 22:30 ` [Qemu-devel] [PATCH 1/5] target-arm: Add ARM CPU feature parsing Greg Bellows
2015-01-20 14:19   ` Alex Bennée
2015-01-20 14:49     ` Greg Bellows
2015-01-21 10:57       ` Alex Bennée
2015-01-20 15:22   ` Igor Mammedov
2015-01-20 15:34     ` Peter Maydell
2015-01-20 15:59       ` Igor Mammedov
2015-01-20 16:08         ` Peter Maydell
2015-01-20 16:25           ` Igor Mammedov
2015-01-20 22:45             ` Greg Bellows
2015-01-21 11:33               ` Igor Mammedov
2015-01-20 15:34     ` Greg Bellows
2015-01-20 16:02       ` Eduardo Habkost
2015-01-20 16:05       ` Igor Mammedov
2015-01-19 22:30 ` Greg Bellows [this message]
2015-01-20 16:58   ` [Qemu-devel] [PATCH 2/5] target-arm: Add feature parsing to virt Alex Bennée
2015-01-19 22:30 ` [Qemu-devel] [PATCH 3/5] target-arm: Add 32/64-bit register sync Greg Bellows
2015-01-19 22:30 ` [Qemu-devel] [PATCH 4/5] target-arm: Add AArch32 guest support to KVM64 Greg Bellows
2015-01-20 16:57   ` Alex Bennée
2015-01-20 20:03     ` Greg Bellows
2015-01-21 10:54       ` Alex Bennée
2015-01-21 10:56         ` Peter Maydell
2015-01-19 22:30 ` [Qemu-devel] [PATCH 5/5] target-arm: Adjust kernel load address for Image Greg Bellows
2015-01-20 10:21 ` [Qemu-devel] [PATCH 0/5] target-arm: ARM64: Adding EL1 AARCH32 guest support Sergey Fedorov
2015-01-20 10:26   ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421706621-23731-3-git-send-email-greg.bellows@linaro.org \
    --to=greg.bellows@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).