qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH qom-next 05/59] apic: Replace cpu_env pointer by


From: Igor Mammedov
Subject: Re: [Qemu-devel] [PATCH qom-next 05/59] apic: Replace cpu_env pointer by X86CPU link
Date: Wed, 11 Jul 2012 12:47:23 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1



On 05/23/2012 05:07 AM, Andreas Färber wrote:
Needed for converting cpu_is_bsp().

Signed-off-by: Andreas Färber <address@hidden>
Cc: Paolo Bonzini <address@hidden>
---
...
@@ -899,7 +900,13 @@ static DeviceState *apic_init(void *env, uint8_t apic_id)
      }

      qdev_prop_set_uint8(dev, "id", apic_id);
-    qdev_prop_set_ptr(dev, "cpu_env", env);
+    object_property_set_link(OBJECT(dev), OBJECT(ENV_GET_CPU(env)), "cpu",
+                             &error);

Setting back-link should be done before or inside of x86_cpu_realize(),
i.e. no CPU internals outside of CPU object.
But that depends on CPU becoming a child of something between 
object_new(TYPE_X86_CPU)
and x86_cpu_realize(), otherwise it would crash in object_property_set_link ().

Currently it could be done in target-i386/helper.c:cpu_x86_init()but not in
hw/pc.c:pc_new_cpu() because cpu_x86_init() returns realized CPU.

Perhaps we should wait with this and previous patch till APIC is moved inside 
of CPU.

As a way to avoid back-link issue we could make CPU a child of /machine in
cpu_x86_init() before callling x86_cpu_realize(). Yes, it won't be at board 
level but it won't
hurt *-user target and might be acceptable sacrifice for i386-softmmu in effort 
of QOMifing
x86cpu and converting from qdev_prop_set_ptr() to object_property_set_link().

--
-----
 Igor





reply via email to

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