From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoW4e-0005Fk-TT for qemu-devel@nongnu.org; Tue, 10 Jul 2012 04:45:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SoW4Y-0003VH-6c for qemu-devel@nongnu.org; Tue, 10 Jul 2012 04:45:36 -0400 Received: from mail-gg0-f173.google.com ([209.85.161.173]:35128) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoW4X-0003Ss-Vc for qemu-devel@nongnu.org; Tue, 10 Jul 2012 04:45:30 -0400 Received: by ggnp1 with SMTP id p1so11837269ggn.4 for ; Tue, 10 Jul 2012 01:45:28 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4FFBEBA0.3080609@redhat.com> Date: Tue, 10 Jul 2012 10:45:20 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1341900967-4344-1-git-send-email-qemulist@gmail.com> <1341900967-4344-6-git-send-email-qemulist@gmail.com> In-Reply-To: <1341900967-4344-6-git-send-email-qemulist@gmail.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 5/5] apic: create apic as a child of cpu, not system_bus any longer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Ping Fan Cc: Blue Swirl , Jan Kiszka , qemu-devel@nongnu.org, Anthony Liguori , =?ISO-8859-15?Q?Andreas_F=E4rber?= Il 10/07/2012 08:16, Liu Ping Fan ha scritto: > Signed-off-by: Liu Ping Fan > --- > hw/pc.c | 10 +++++----- > 1 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/hw/pc.c b/hw/pc.c > index c7e9ab3..8df58c9 100644 > --- a/hw/pc.c > +++ b/hw/pc.c > @@ -886,17 +886,17 @@ DeviceState *cpu_get_current_apic(void) > } > } > > -static DeviceState *apic_init(void *env, uint8_t apic_id) > +static DeviceState *apic_init(void *cpu, void *env, uint8_t apic_id) > { > DeviceState *dev; > static int apic_mapped; > > if (kvm_irqchip_in_kernel()) { > - dev = qdev_create(NULL, "kvm-apic"); > + dev = qdev_create_kid(OBJECT(cpu), "kvm-apic"); > } else if (xen_enabled()) { > - dev = qdev_create(NULL, "xen-apic"); > + dev = qdev_create_kid(OBJECT(cpu), "xen-apic"); > } else { > - dev = qdev_create(NULL, "apic"); > + dev = qdev_create_kid(OBJECT(cpu), "apic"); > } Does it make sense instead to do this in the realize method of the CPU? Paolo > > qdev_prop_set_uint8(dev, "id", apic_id); > @@ -945,7 +945,7 @@ static X86CPU *pc_new_cpu(const char *cpu_model) > } > env = &cpu->env; > if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) { > - env->apic_state = apic_init(env, env->cpuid_apic_id); > + env->apic_state = apic_init(cpu, env, env->cpuid_apic_id); > } > qemu_register_reset(pc_cpu_reset, cpu); > pc_cpu_reset(cpu); >