[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH arm-devs v2 6/8] arm/xilinx_zynq: Use object_new() r
From: |
Peter Crosthwaite |
Subject: |
[Qemu-devel] [PATCH arm-devs v2 6/8] arm/xilinx_zynq: Use object_new() rather than cpu_arm_init() |
Date: |
Wed, 27 Nov 2013 19:29:58 -0800 |
To allow the machine model to set device properties before CPU
realization.
Signed-off-by: Peter Crosthwaite <address@hidden>
---
changed since v1:
use error report rather than fprintf(stderr
hw/arm/xilinx_zynq.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index 46924a0..1c954a3 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -25,6 +25,7 @@
#include "sysemu/blockdev.h"
#include "hw/loader.h"
#include "hw/ssi.h"
+#include "qemu/error-report.h"
#define NUM_SPI_FLASHES 4
#define NUM_QSPI_FLASHES 2
@@ -102,6 +103,7 @@ static void zynq_init(QEMUMachineInitArgs *args)
const char *kernel_filename = args->kernel_filename;
const char *kernel_cmdline = args->kernel_cmdline;
const char *initrd_filename = args->initrd_filename;
+ ObjectClass *cpu_oc;
ARMCPU *cpu;
MemoryRegion *address_space_mem = get_system_memory();
MemoryRegion *ext_ram = g_new(MemoryRegion, 1);
@@ -110,15 +112,19 @@ static void zynq_init(QEMUMachineInitArgs *args)
SysBusDevice *busdev;
qemu_irq pic[64];
NICInfo *nd;
+ Error *err = NULL;
int n;
if (!cpu_model) {
cpu_model = "cortex-a9";
}
+ cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model);
- cpu = cpu_arm_init(cpu_model);
- if (!cpu) {
- fprintf(stderr, "Unable to find CPU definition\n");
+ cpu = ARM_CPU(object_new(object_class_get_name(cpu_oc)));
+
+ object_property_set_bool(OBJECT(cpu), true, "realized", &err);
+ if (err) {
+ error_report("%s", error_get_pretty(err));
exit(1);
}
--
1.8.4.4
- [Qemu-devel] [PATCH arm-devs v2 0/8] Fix Support for ARM A9 CBAR, Peter Crosthwaite, 2013/11/27
- [Qemu-devel] [PATCH arm-devs v2 1/8] qom/object: Make uintXX added properties writable, Peter Crosthwaite, 2013/11/27
- [Qemu-devel] [PATCH arm-devs v2 2/8] target-arm: Define and use ARM_FEATURE_CBAR, Peter Crosthwaite, 2013/11/27
- [Qemu-devel] [PATCH arm-devs v2 3/8] target-arm/cpu: Convert reset CBAR to a property, Peter Crosthwaite, 2013/11/27
- [Qemu-devel] [PATCH arm-devs v2 4/8] arm/highbank: Use object_new() rather than cpu_arm_init(), Peter Crosthwaite, 2013/11/27
- [Qemu-devel] [PATCH arm-devs v2 5/8] arm/highbank: Fix CBAR intialisation, Peter Crosthwaite, 2013/11/27
- [Qemu-devel] [PATCH arm-devs v2 6/8] arm/xilinx_zynq: Use object_new() rather than cpu_arm_init(),
Peter Crosthwaite <=
- [Qemu-devel] [PATCH arm-devs v2 7/8] arm/xilinx_zynq: Implement CBAR intialisation, Peter Crosthwaite, 2013/11/27
- [Qemu-devel] [PATCH arm-devs v2 8/8] arm/highbank.c: Fix MPCore periphbase name, Peter Crosthwaite, 2013/11/27