From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVMqS-0001X5-Vh for qemu-devel@nongnu.org; Thu, 25 Apr 2013 10:08:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVMqO-0005Wc-B5 for qemu-devel@nongnu.org; Thu, 25 Apr 2013 10:08:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVMqN-0005WO-Tu for qemu-devel@nongnu.org; Thu, 25 Apr 2013 10:08:16 -0400 From: Igor Mammedov Date: Thu, 25 Apr 2013 16:05:28 +0200 Message-Id: <1366898737-6201-7-git-send-email-imammedo@redhat.com> In-Reply-To: <1366898737-6201-1-git-send-email-imammedo@redhat.com> References: <1366898737-6201-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH 06/15] target-i386: cpu: attach ICC bus to CPU on its creation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, ehabkost@redhat.com, mst@redhat.com, stefano.stabellini@eu.citrix.com, quintela@redhat.com, anthony.perard@citrix.com, pbonzini@redhat.com, afaerber@suse.de X86CPU should have parent bus so it would be possible to unplug it later. Set bus_type to TYPE_ICC_BUS for X86CPU type to make device_add attach hotplugged CPU to ICC bus. Signed-off-by: Igor Mammedov --- v2: * make sure that missing or ambiguous icc-bus will cause error on softmmu target. --- target-i386/cpu.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index b0eb6ca..25eb158 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -41,6 +41,7 @@ #endif #include "sysemu/sysemu.h" +#include "hw/cpu/icc_bus.h" #ifndef CONFIG_USER_ONLY #include "hw/xen/xen.h" #include "hw/sysbus.h" @@ -1619,6 +1620,19 @@ X86CPU *cpu_x86_create(const char *cpu_model, Error **errp) features = model_pieces[1]; cpu = X86_CPU(object_new(TYPE_X86_CPU)); +#ifndef CONFIG_USER_ONLY + do { + bool ambiguous = false; + Object *icc_bus = object_resolve_path_type("icc-bus", TYPE_ICC_BUS, + &ambiguous); + if ((icc_bus == NULL) || ambiguous) { + error_setg(&error, "Invalid icc-bus value"); + goto out; + } + qdev_set_parent_bus(DEVICE(cpu), BUS(icc_bus)); + object_unref(OBJECT(cpu)); + } while (0); +#endif env = &cpu->env; env->cpu_model_str = cpu_model; @@ -2330,6 +2344,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) xcc->parent_realize = dc->realize; dc->realize = x86_cpu_realizefn; + dc->bus_type = TYPE_ICC_BUS; xcc->parent_reset = cc->reset; cc->reset = x86_cpu_reset; -- 1.7.1