From patchwork Tue May 22 10:35:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 160591 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 54F2EB6F86 for ; Tue, 22 May 2012 20:36:53 +1000 (EST) Received: from localhost ([::1]:36712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWmSR-00044n-3r for incoming@patchwork.ozlabs.org; Tue, 22 May 2012 06:36:51 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWmRz-0003So-U9 for qemu-devel@nongnu.org; Tue, 22 May 2012 06:36:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SWmRt-0003yP-FH for qemu-devel@nongnu.org; Tue, 22 May 2012 06:36:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9582) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWmRt-0003xs-85 for qemu-devel@nongnu.org; Tue, 22 May 2012 06:36:17 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4MAaBTr001121 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 May 2012 06:36:11 -0400 Received: from nial.brq.redhat.com (dhcp-1-247.brq.redhat.com [10.34.1.247]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q4MAZsSx005874; Tue, 22 May 2012 06:36:09 -0400 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Tue, 22 May 2012 12:35:54 +0200 Message-Id: <1337682954-20618-6-git-send-email-imammedo@redhat.com> In-Reply-To: <1337682954-20618-1-git-send-email-imammedo@redhat.com> References: <1337682954-20618-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com, ehabkost@redhat.com, sw@weilnetz.de, mtosatti@redhat.com, blauwirbel@gmail.com, avi@redhat.com, jan.kiszka@siemens.com, pbonzini@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH qom-next 5/5] target-i386: move reset callback to cpu.c 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 Moving reset callback into cpu object from board level will allow properly create object during run-time (hotplug). When reset over QOM hierarchy is implemented, this reset callback should be removed. Signed-off-by: Igor Mammedov --- hw/pc.c | 7 ------- target-i386/cpu.c | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 677f9e0..70dd0e6 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -888,12 +888,6 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level) } } -static void pc_cpu_reset(void *opaque) -{ - X86CPU *cpu = opaque; - cpu_reset(CPU(cpu)); -} - void pc_cpus_init(const char *cpu_model) { X86CPU *cpu; @@ -904,7 +898,6 @@ void pc_cpus_init(const char *cpu_model) if (cpu == NULL) { exit(1); } - qemu_register_reset(pc_cpu_reset, cpu); } } diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 0e804ea..87f4f5a 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1716,6 +1716,13 @@ static void x86_cpu_reset(CPUState *s) env->halted = !(cpu_get_apic_base(env->apic_state) & MSR_IA32_APICBASE_BSP); } +/* TODO: remove me, when reset over QOM tree is implemented */ +static void x86_cpu_machine_reset_cb(void *opaque) +{ + X86CPU *cpu = opaque; + cpu_reset(CPU(cpu)); +} + static void mce_init(X86CPU *cpu) { CPUX86State *cenv = &cpu->env; @@ -1812,6 +1819,7 @@ void x86_cpu_realize(Object *obj, Error **errp) mce_init(cpu); qemu_init_vcpu(env); + qemu_register_reset(x86_cpu_machine_reset_cb, cpu); cpu_reset(CPU(cpu)); }