aboutsummaryrefslogtreecommitdiff
path: root/target-i386/cpu.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2016-07-06 08:20:52 +0200
committerEduardo Habkost <ehabkost@redhat.com>2016-07-20 12:02:18 -0300
commit6816b1b3811e839540df22855d975b6d76ae438b (patch)
tree2e1584ded54bdcdbc28bc53d2030ecff61762a68 /target-i386/cpu.c
parentc2f193b538032accb9db504998bf2ea7c0ef65af (diff)
target-i386: cpu: Do not ignore error and fix apic parent
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 <imammedo@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'target-i386/cpu.c')
-rw-r--r--target-i386/cpu.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index c36441d30c..6c36b137b8 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2826,8 +2826,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);