diff mbox

[v1,21/22] petalogix-ml605: Create the CPU with object_new()

Message ID 1387181170-23267-22-git-send-email-edgar.iglesias@gmail.com
State New
Headers show

Commit Message

Edgar E. Iglesias Dec. 16, 2013, 8:06 a.m. UTC
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>

This is to allow future patches to set properties before cpu::realize().

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/microblaze/petalogix_ml605_mmu.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Andreas Färber Dec. 16, 2013, 12:14 p.m. UTC | #1
Am 16.12.2013 09:06, schrieb edgar.iglesias@gmail.com:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> This is to allow future patches to set properties before cpu::realize().
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>

Reviewed-by: Andreas Färber <afaerber@suse.de>

/-F
diff mbox

Patch

diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c
index 10970e0..4009ff5 100644
--- a/hw/microblaze/petalogix_ml605_mmu.c
+++ b/hw/microblaze/petalogix_ml605_mmu.c
@@ -76,7 +76,7 @@  static void
 petalogix_ml605_init(QEMUMachineInitArgs *args)
 {
     ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
+    Error *err = NULL;
     MemoryRegion *address_space_mem = get_system_memory();
     DeviceState *dev, *dma, *eth0;
     Object *ds, *cs;
@@ -91,10 +91,13 @@  petalogix_ml605_init(QEMUMachineInitArgs *args)
     qemu_irq irq[32], *cpu_irq;
 
     /* init CPUs */
-    if (cpu_model == NULL) {
-        cpu_model = "microblaze";
+    cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
+    object_property_set_bool(OBJECT(cpu), true, "realized", &err);
+    if (err) {
+        error_report("%s", error_get_pretty(err));
+        exit(EXIT_FAILURE);
     }
-    cpu = cpu_mb_init(cpu_model);
+
     env = &cpu->env;
 
     /* Attach emulated BRAM through the LMB.  */