qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 06/12] target-arm: Add feature parsing to virt
Date: Fri, 13 Feb 2015 05:54:39 +0000	[thread overview]
Message-ID: <1423806885-9548-7-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1423806885-9548-1-git-send-email-peter.maydell@linaro.org>

From: Greg Bellows <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>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1423736974-14254-3-git-send-email-greg.bellows@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 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 ee77093..69f51ac 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -728,15 +728,19 @@ static void machvirt_init(MachineState *machine)
     const char *cpu_model = machine->cpu_model;
     VirtBoardInfo *vbi;
     uint32_t gic_phandle;
+    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);
     }
 
@@ -750,8 +754,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");
@@ -759,6 +765,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);
         }
@@ -778,6 +791,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.9.1

  parent reply	other threads:[~2015-02-13  5:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-13  5:54 [Qemu-devel] [PULL 00/12] target-arm queue Peter Maydell
2015-02-13  5:54 ` [Qemu-devel] [PULL 01/12] pci: Allocate PCIe host bridge PCI ID Peter Maydell
2015-02-13  5:54 ` [Qemu-devel] [PULL 02/12] pci: Add generic PCIe host bridge Peter Maydell
2015-02-13  5:54 ` [Qemu-devel] [PULL 03/12] arm: Add PCIe host bridge in virt machine Peter Maydell
2015-02-13  5:54 ` [Qemu-devel] [PULL 04/12] pci: Move PCI VGA to pci.mak Peter Maydell
2015-02-13  5:54 ` [Qemu-devel] [PULL 05/12] target-arm: Add CPU property to disable AArch64 Peter Maydell
2015-02-13  5:54 ` Peter Maydell [this message]
2015-02-13  5:54 ` [Qemu-devel] [PULL 07/12] target-arm: Add 32/64-bit register sync Peter Maydell
2015-02-13  5:54 ` [Qemu-devel] [PULL 08/12] target-arm: Add AArch32 guest support to KVM64 Peter Maydell
2015-02-13  5:54 ` [Qemu-devel] [PULL 09/12] target-arm: A64: Fix shifts into sign bit Peter Maydell
2015-02-13  5:54 ` [Qemu-devel] [PULL 10/12] target-arm: A64: Fix handling of rotate in logic_imm_decode_wmask Peter Maydell
2015-02-13  5:54 ` [Qemu-devel] [PULL 11/12] target-arm: A64: Avoid left shifting negative integers in disas_pc_rel_addr Peter Maydell
2015-02-13  5:54 ` [Qemu-devel] [PULL 12/12] target-arm: A64: Avoid signed shifts in disas_ldst_pair() Peter Maydell
2015-02-13 11:04 ` [Qemu-devel] [PULL 00/12] target-arm queue Peter Maydell
2015-02-13 11:44 ` 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=1423806885-9548-7-git-send-email-peter.maydell@linaro.org \
    --to=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).