Skip to contentSkip to conversation

microblaze: s3adsp: Instantiate CPU using QOM

PATCH In review Peter Crosthwaite 3 participants 3 messages May 25, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 microblaze: s3adsp: Instantiate CPU using QOM

Instantiate and realise the CPU directly, rather than using cpu_mb_init. Microblazes cpu_model argument is a dummy so remove the default cpu_model set logic.

---
 hw/microblaze/petalogix_s3adsp1800_mmu.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
hw/microblaze/petalogix_s3adsp1800_mmu.c +2 -6
index 84f6e74..4dbbd1e 100644
@@ -62,7 +62,6 @@ static void
 petalogix_s3adsp1800_init(MachineState *machine)
 {
     ram_addr_t ram_size = machine->ram_size;
-    const char *cpu_model = machine->cpu_model;
     DeviceState *dev;
     MicroBlazeCPU *cpu;
     DriveInfo *dinfo;
@@ -73,11 +72,8 @@ petalogix_s3adsp1800_init(MachineState *machine)
     qemu_irq irq[32];
     MemoryRegion *sysmem = get_system_memory();
 
-    /* init CPUs */
-    if (cpu_model == NULL) {
-        cpu_model = "microblaze";
-    }
-    cpu = cpu_mb_init(cpu_model);
+    cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
+    object_property_set_bool(OBJECT(cpu), true, "realized", &error_abort);
 
     /* Attach emulated BRAM through the LMB.  */
     memory_region_init_ram(phys_lmb_bram, NULL,
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Peter Crosthwaite

Instantiate and realise the CPU directly, rather than using cpu_mb_init. Microblazes cpu_model argument is a dummy so remove the default cpu_model set logic.

I've put this in my mb queue.
BTW, you've got a typo in my email address.

Cheers,
Edgar

Quoted 36 lines
---
 hw/microblaze/petalogix_s3adsp1800_mmu.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
hw/microblaze/petalogix_s3adsp1800_mmu.c +2 -6
index 84f6e74..4dbbd1e 100644
@@ -62,7 +62,6 @@ static void
 petalogix_s3adsp1800_init(MachineState *machine)
 {
     ram_addr_t ram_size = machine->ram_size;
-    const char *cpu_model = machine->cpu_model;
     DeviceState *dev;
     MicroBlazeCPU *cpu;
     DriveInfo *dinfo;
@@ -73,11 +72,8 @@ petalogix_s3adsp1800_init(MachineState *machine)
     qemu_irq irq[32];
     MemoryRegion *sysmem = get_system_memory();
 
-    /* init CPUs */
-    if (cpu_model == NULL) {
-        cpu_model = "microblaze";
-    }
-    cpu = cpu_mb_init(cpu_model);
+    cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
+    object_property_set_bool(OBJECT(cpu), true, "realized", &error_abort);
 
     /* Attach emulated BRAM through the LMB.  */
     memory_region_init_ram(phys_lmb_bram, NULL,
Signature · 1 line
1.9.1
#2 lore raw
Quoted 10 lines · Edgar E. Iglesias
Quoted 3 lines · Peter Crosthwaite

Instantiate and realise the CPU directly, rather than using cpu_mb_init. Microblazes cpu_model argument is a dummy so remove the default cpu_model set logic.

I've put this in my mb queue.
BTW, you've got a typo in my email address.

Fixed my new mailrc. Thanks,

Regards,
Peter

Quoted 42 lines

Cheers,
Edgar

Quoted 36 lines
---
 hw/microblaze/petalogix_s3adsp1800_mmu.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
hw/microblaze/petalogix_s3adsp1800_mmu.c +2 -7
index 84f6e74..4dbbd1e 100644
@@ -62,7 +62,6 @@ static void
 petalogix_s3adsp1800_init(MachineState *machine)
 {
     ram_addr_t ram_size = machine->ram_size;
-    const char *cpu_model = machine->cpu_model;
     DeviceState *dev;
     MicroBlazeCPU *cpu;
     DriveInfo *dinfo;
@@ -73,11 +72,8 @@ petalogix_s3adsp1800_init(MachineState *machine)
     qemu_irq irq[32];
     MemoryRegion *sysmem = get_system_memory();
 
-    /* init CPUs */
-    if (cpu_model == NULL) {
-        cpu_model = "microblaze";
-    }
-    cpu = cpu_mb_init(cpu_model);
+    cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
+    object_property_set_bool(OBJECT(cpu), true, "realized", &error_abort);
 
     /* Attach emulated BRAM through the LMB.  */
     memory_region_init_ram(phys_lmb_bram, NULL,
--

1.9.1