Received: from eggs.gnu.org ([2001:4830:134:3::10]:58251) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNjus-0003WW-FG for qemu-devel@nongnu.org; Thu, 14 Jul 2016 12:55:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNjuq-0000IF-1r for qemu-devel@nongnu.org; Thu, 14 Jul 2016 12:55:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40959) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNjup-0000Hr-SB for qemu-devel@nongnu.org; Thu, 14 Jul 2016 12:55:11 -0400 From: Igor Mammedov Date: Thu, 14 Jul 2016 18:54:42 +0200 Message-Id: <1468515285-173356-14-git-send-email-imammedo@redhat.com> In-Reply-To: <1468515285-173356-1-git-send-email-imammedo@redhat.com> References: <1468515285-173356-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH v4 13/16] target-i386: cpu: do not ignore error and fix apic parent List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pkrempa@redhat.com, ehabkost@redhat.com, mst@redhat.com, eduardo.otubo@profitbricks.com, Bandan Das object_property_add_child() silently fails with error that it can't create duplicate propery 'apic' as we already have 'apic' property registered for 'apic' feature. As result generic device_realize puts apic into unattached container. As it's programming error, abort if name collision happens in future and fix property name for apic_state to 'lapic', this way apic is a child of cpu instance. Signed-off-by: Igor Mammedov Reviewed-by: Eduardo Habkost --- target-i386/cpu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index c6d8704..fb528de 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2829,8 +2829,9 @@ static void x86_cpu_apic_create(X86CPU *cpu, Error **errp) cpu->apic_state = DEVICE(object_new(apic_type)); - object_property_add_child(OBJECT(cpu), "apic", - OBJECT(cpu->apic_state), NULL); + object_property_add_child(OBJECT(cpu), "lapic", + OBJECT(cpu->apic_state), &error_abort); + qdev_prop_set_uint8(cpu->apic_state, "id", cpu->apic_id); /* TODO: convert to link<> */ apic = APIC_COMMON(cpu->apic_state); -- 2.7.4