From patchwork Wed May 23 03:07:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 160818 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2D495B7019 for ; Wed, 23 May 2012 14:45:58 +1000 (EST) Received: from localhost ([::1]:36824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SX1yD-0002ly-GH for incoming@patchwork.ozlabs.org; Tue, 22 May 2012 23:10:41 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SX1wf-0000KF-K7 for qemu-devel@nongnu.org; Tue, 22 May 2012 23:09:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SX1wc-0005aE-Gh for qemu-devel@nongnu.org; Tue, 22 May 2012 23:09:05 -0400 Received: from cantor2.suse.de ([195.135.220.15]:35556 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SX1wc-0005ZW-8N for qemu-devel@nongnu.org; Tue, 22 May 2012 23:09:02 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id E081C975D0; Wed, 23 May 2012 05:08:59 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Wed, 23 May 2012 05:07:27 +0200 Message-Id: <1337742502-28565-5-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1337742502-28565-1-git-send-email-afaerber@suse.de> References: <1337742502-28565-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: Anthony Liguori , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Igor Mammedov Subject: [Qemu-devel] [PATCH qom-next 04/59] pc: Add CPU as /machine/cpu[n] X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Using the cpu_index, give the X86CPU a canonical path. This must be done before initializing the APIC. Signed-off-by: Igor Mammedov Signed-off-by: Andreas Färber --- hw/pc.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 4167782..e9d7e05 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -945,6 +945,8 @@ static X86CPU *pc_new_cpu(const char *cpu_model) { X86CPU *cpu; CPUX86State *env; + char *name; + Error *error = NULL; cpu = cpu_x86_init(cpu_model); if (cpu == NULL) { @@ -952,6 +954,16 @@ static X86CPU *pc_new_cpu(const char *cpu_model) exit(1); } env = &cpu->env; + + name = g_strdup_printf("cpu[%d]", env->cpu_index); + object_property_add_child(OBJECT(qdev_get_machine()), name, + OBJECT(cpu), &error); + g_free(name); + if (error_is_set(&error)) { + qerror_report_err(error); + exit(1); + } + if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) { env->apic_state = apic_init(env, env->cpuid_apic_id); }