From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MHHgF-0000F3-5y for qemu-devel@nongnu.org; Thu, 18 Jun 2009 09:29:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MHHgA-00006j-AA for qemu-devel@nongnu.org; Thu, 18 Jun 2009 09:29:26 -0400 Received: from [199.232.76.173] (port=60887 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MHHgA-00006S-1b for qemu-devel@nongnu.org; Thu, 18 Jun 2009 09:29:22 -0400 Received: from mx2.redhat.com ([66.187.237.31]:40319) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MHHg9-000664-I5 for qemu-devel@nongnu.org; Thu, 18 Jun 2009 09:29:21 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5IDTKjM028523 for ; Thu, 18 Jun 2009 09:29:20 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5IDTJdY030907 for ; Thu, 18 Jun 2009 09:29:20 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5IDTJBD028786 for ; Thu, 18 Jun 2009 09:29:19 -0400 Date: Thu, 18 Jun 2009 16:29:18 +0300 From: Gleb Natapov Message-ID: <20090618132918.GF20289@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH][RESEND] Don't register cpu reset handler for cpu with APIC. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org APIC reset handler already resets cpu, no need to reset it twice. Also register cpu_reset handler directly to make it impossible to add additional code to main_cpu_reset() by mistake. Signed-off-by: Gleb Natapov diff --git a/hw/pc.c b/hw/pc.c index 160506f..db20501 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -962,12 +962,6 @@ static void load_linux(void *fw_cfg, generate_bootsect(option_rom, gpr, seg, 0); } -static void main_cpu_reset(void *opaque) -{ - CPUState *env = opaque; - cpu_reset(env); -} - static const int ide_iobase[2] = { 0x1f0, 0x170 }; static const int ide_iobase2[2] = { 0x3f6, 0x376 }; static const int ide_irq[2] = { 14, 15 }; @@ -1095,9 +1089,11 @@ static void pc_init1(ram_addr_t ram_size, } if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) { env->cpuid_apic_id = env->cpu_index; + /* APIC reset callback resets cpu */ apic_init(env); + } else { + qemu_register_reset((QEMUResetHandler*)cpu_reset, 0, env); } - qemu_register_reset(main_cpu_reset, 0, env); } vmport_init(); -- Gleb.