qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 05/23] q800: move CPU object into Q800MachineState


From: Mark Cave-Ayland
Subject: Re: [PATCH v2 05/23] q800: move CPU object into Q800MachineState
Date: Thu, 1 Jun 2023 09:00:42 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

On 31/05/2023 16:00, Markus Armbruster wrote:

Philippe Mathieu-Daudé <philmd@linaro.org> writes:

On 31/5/23 14:53, Mark Cave-Ayland wrote:
Also change the instantiation of the CPU to use object_initialize_child()
followed by a separate realisation.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
   hw/m68k/q800.c         | 13 ++++++++-----
   include/hw/m68k/q800.h |  2 ++
   2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index 3730b30dd1..c34b2548ca 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -364,7 +364,7 @@ static uint8_t fake_mac_rom[] = {
     static void q800_machine_init(MachineState *machine)
   {
-    M68kCPU *cpu = NULL;
+    Q800MachineState *m = Q800_MACHINE(machine);
       int linux_boot;
       int32_t kernel_size;
       uint64_t elf_entry;
@@ -407,8 +407,10 @@ static void q800_machine_init(MachineState *machine)
       }
         /* init CPUs */
-    cpu = M68K_CPU(cpu_create(machine->cpu_type));
-    qemu_register_reset(main_cpu_reset, cpu);
+    object_initialize_child(OBJECT(machine), "cpu", &m->cpu,
+                            M68K_CPU_TYPE_NAME("m68040"));
+    object_property_set_bool(OBJECT(&m->cpu), "realized", true, &error_fatal);

CPUs are QDev-based, shouldn't we use qdev_realize()?

Yes, we should.

[...]

Interesting. I remember thinking that CPUs were different, so I'm fairly sure I borrowed this from some similar code in hw/arm :)

Shouldn't the above be directly equivalent to qdev_realize(dev, NULL, &error_fatal) given that the CPU doesn't connect to a bus?


ATB,

Mark.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]