[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 18/31] target-arm: Breakout integratorcp and versatil
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 18/31] target-arm: Breakout integratorcp and versatilepb cpu init |
Date: |
Tue, 23 Dec 2014 13:54:14 +0000 |
From: Greg Bellows <address@hidden>
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 <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
---
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.9.1
- [Qemu-devel] [PULL 15/31] target-arm: Add arm_boot_info secure_boot control, (continued)
- [Qemu-devel] [PULL 15/31] target-arm: Add arm_boot_info secure_boot control, Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 14/31] target-arm: Add ARMCPU secure property, Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 12/31] target-arm: Add virt machine secure property, Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 01/31] audio: Don't free hw resources until after hw backend is stopped, Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 09/31] target-arm: Add vexpress machine secure property, Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 02/31] target-arm: Merge EL3 CP15 register lists, Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 27/31] fw_cfg_mem: expose the "data_width" property with fw_cfg_init_mem_wide(), Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 29/31] hw/loader: split out load_image_gzipped_buffer(), Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 24/31] fw_cfg_mem: flip ctl_mem_ops and data_mem_ops to DEVICE_BIG_ENDIAN, Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 22/31] fw_cfg: move boards to fw_cfg_init_io() / fw_cfg_init_mem(), Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 18/31] target-arm: Breakout integratorcp and versatilepb cpu init,
Peter Maydell <=
- [Qemu-devel] [PULL 16/31] target-arm: Enable CPU has_el3 prop during VE init, Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 07/31] target-arm: Add vexpress a9 & a15 machine objects, Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 19/31] target-arm: Disable EL3 on unsupported machines, Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 06/31] target-arm: Add vexpress class and machine types, Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 11/31] target-arm: Add virt class and machine types, Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 05/31] vl.c: add HMP help to machine, Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 04/31] vl.c: simplified machine_set_property, Peter Maydell, 2014/12/23
- [Qemu-devel] [PULL 21/31] fw_cfg: hard separation between the MMIO and I/O port mappings, Peter Maydell, 2014/12/23
- Re: [Qemu-devel] [PULL 00/31] target-arm queue, Peter Maydell, 2014/12/23