qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Bellows <greg.bellows@linaro.org>
To: qemu-devel@nongnu.org, serge.fdrv@gmail.com,
	edgar.iglesias@gmail.com, aggelerf@ethz.ch,
	peter.maydell@linaro.org
Cc: Greg Bellows <greg.bellows@linaro.org>
Subject: [Qemu-devel] [PATCH v2 13/15] target-arm: Breakout integratorcp and versatilepb cpu init
Date: Thu, 11 Dec 2014 17:29:27 -0600	[thread overview]
Message-ID: <1418340569-30519-14-git-send-email-greg.bellows@linaro.org> (raw)
In-Reply-To: <1418340569-30519-1-git-send-email-greg.bellows@linaro.org>

This commit changes the integratorcp and versatilepb CPU initialization from
using the generic ARM cpu_arm_init function to doing it inline.  This is
necessary in order to allow CPU configuration changes to occur between CPU
instance initialization and realization.  Specifically, this change is in
preparation for disabling CPU EL3 support.

Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
---
 hw/arm/integratorcp.c | 19 +++++++++++++++++--
 hw/arm/versatilepb.c  | 20 ++++++++++++++++++--
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
index 266ec18..f196189 100644
--- a/hw/arm/integratorcp.c
+++ b/hw/arm/integratorcp.c
@@ -15,6 +15,7 @@
 #include "net/net.h"
 #include "exec/address-spaces.h"
 #include "sysemu/sysemu.h"
+#include "qemu/error-report.h"
 
 #define TYPE_INTEGRATOR_CM "integrator_core"
 #define INTEGRATOR_CM(obj) \
@@ -469,6 +470,8 @@ static void integratorcp_init(MachineState *machine)
     const char *kernel_filename = machine->kernel_filename;
     const char *kernel_cmdline = machine->kernel_cmdline;
     const char *initrd_filename = machine->initrd_filename;
+    ObjectClass *cpu_oc;
+    Object *cpuobj;
     ARMCPU *cpu;
     MemoryRegion *address_space_mem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
@@ -476,16 +479,28 @@ static void integratorcp_init(MachineState *machine)
     qemu_irq pic[32];
     DeviceState *dev;
     int i;
+    Error *err = NULL;
 
     if (!cpu_model) {
         cpu_model = "arm926";
     }
-    cpu = cpu_arm_init(cpu_model);
-    if (!cpu) {
+
+    cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model);
+    if (!cpu_oc) {
         fprintf(stderr, "Unable to find CPU definition\n");
         exit(1);
     }
 
+    cpuobj = object_new(object_class_get_name(cpu_oc));
+
+    object_property_set_bool(cpuobj, true, "realized", &err);
+    if (err) {
+        error_report("%s", error_get_pretty(err));
+        exit(1);
+    }
+
+    cpu = ARM_CPU(cpuobj);
+
     memory_region_init_ram(ram, NULL, "integrator.ram", ram_size, &error_abort);
     vmstate_register_ram_global(ram);
     /* ??? On a real system the first 1Mb is mapped as SSRAM or boot flash.  */
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index e6ef0a2..b74dc15 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -18,6 +18,7 @@
 #include "sysemu/block-backend.h"
 #include "exec/address-spaces.h"
 #include "hw/block/flash.h"
+#include "qemu/error-report.h"
 
 #define VERSATILE_FLASH_ADDR 0x34000000
 #define VERSATILE_FLASH_SIZE (64 * 1024 * 1024)
@@ -175,6 +176,8 @@ static struct arm_boot_info versatile_binfo;
 
 static void versatile_init(MachineState *machine, int board_id)
 {
+    ObjectClass *cpu_oc;
+    Object *cpuobj;
     ARMCPU *cpu;
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
@@ -189,15 +192,28 @@ static void versatile_init(MachineState *machine, int board_id)
     int n;
     int done_smc = 0;
     DriveInfo *dinfo;
+    Error *err = NULL;
 
     if (!machine->cpu_model) {
         machine->cpu_model = "arm926";
     }
-    cpu = cpu_arm_init(machine->cpu_model);
-    if (!cpu) {
+
+    cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, machine->cpu_model);
+    if (!cpu_oc) {
         fprintf(stderr, "Unable to find CPU definition\n");
         exit(1);
     }
+
+    cpuobj = object_new(object_class_get_name(cpu_oc));
+
+    object_property_set_bool(cpuobj, true, "realized", &err);
+    if (err) {
+        error_report("%s", error_get_pretty(err));
+        exit(1);
+    }
+
+    cpu = ARM_CPU(cpuobj);
+
     memory_region_init_ram(ram, NULL, "versatile.ram", machine->ram_size,
                            &error_abort);
     vmstate_register_ram_global(ram);
-- 
1.8.3.2

  parent reply	other threads:[~2014-12-11 23:30 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-11 23:29 [Qemu-devel] [PATCH v2 00/15] target-arm: Add CPU security extension enablement Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 01/15] target-arm: Add vexpress class and machine types Greg Bellows
2014-12-15 16:54   ` Peter Maydell
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 02/15] target-arm: Add vexpress a9 & a15 machine objects Greg Bellows
2014-12-15 16:54   ` Peter Maydell
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 03/15] target-arm: Switch to common vexpress machine init Greg Bellows
2014-12-15 16:55   ` Peter Maydell
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 04/15] target-arm: Add vexpress machine secure property Greg Bellows
2014-12-15 17:11   ` Peter Maydell
2014-12-15 17:46     ` Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 05/15] target-arm: Change vexpress daughterboard init arg Greg Bellows
2014-12-15 16:55   ` Peter Maydell
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 06/15] target-arm: Add virt class and machine types Greg Bellows
2014-12-15 16:56   ` Peter Maydell
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 07/15] target-arm: Add virt machine secure property Greg Bellows
2014-12-15 17:12   ` Peter Maydell
2014-12-15 17:51     ` Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 08/15] target-arm: Add feature unset function Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 09/15] target-arm: Add ARMCPU secure property Greg Bellows
2014-12-15 17:01   ` Peter Maydell
2014-12-15 17:18     ` Greg Bellows
2014-12-15 17:21       ` Peter Maydell
2014-12-15 17:34         ` Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 10/15] target-arm: Add arm_boot_info secure_boot control Greg Bellows
2014-12-15 17:04   ` Peter Maydell
2014-12-15 17:23     ` Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 11/15] target-arm: Enable CPU has_el3 prop during VE init Greg Bellows
2014-12-15 17:06   ` Peter Maydell
2014-12-15 17:44     ` Greg Bellows
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 12/15] target-arm: Set CPU has_el3 prop during virt init Greg Bellows
2014-12-15 17:07   ` Peter Maydell
2014-12-15 17:44     ` Greg Bellows
2014-12-11 23:29 ` Greg Bellows [this message]
2014-12-15 17:08   ` [Qemu-devel] [PATCH v2 13/15] target-arm: Breakout integratorcp and versatilepb cpu init Peter Maydell
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 14/15] target-arm: Disable EL3 on unsupported machines Greg Bellows
2014-12-15 17:09   ` Peter Maydell
2014-12-15 21:45     ` Greg Bellows
2014-12-15 22:39       ` Peter Maydell
2014-12-11 23:29 ` [Qemu-devel] [PATCH v2 15/15] target-arm: add cpu feature EL3 to CPUs with Security Extensions Greg Bellows
2014-12-15 17:10   ` 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=1418340569-30519-14-git-send-email-greg.bellows@linaro.org \
    --to=greg.bellows@linaro.org \
    --cc=aggelerf@ethz.ch \
    --cc=edgar.iglesias@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=serge.fdrv@gmail.com \
    /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).