Commit cd57c0f317c75cad3f553c76dbf59f261b69e33b

Authored by Gleb Natapov
Committed by Anthony Liguori
1 parent c2cc47a4

Don't register cpu reset handler for cpu with APIC.

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 <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 1 changed file with 3 additions and 7 deletions
@@ -751,12 +751,6 @@ static void load_linux(target_phys_addr_t option_rom, @@ -751,12 +751,6 @@ static void load_linux(target_phys_addr_t option_rom,
751 generate_bootsect(option_rom, gpr, seg, 0); 751 generate_bootsect(option_rom, gpr, seg, 0);
752 } 752 }
753 753
754 -static void main_cpu_reset(void *opaque)  
755 -{  
756 - CPUState *env = opaque;  
757 - cpu_reset(env);  
758 -}  
759 -  
760 static const int ide_iobase[2] = { 0x1f0, 0x170 }; 754 static const int ide_iobase[2] = { 0x1f0, 0x170 };
761 static const int ide_iobase2[2] = { 0x3f6, 0x376 }; 755 static const int ide_iobase2[2] = { 0x3f6, 0x376 };
762 static const int ide_irq[2] = { 14, 15 }; 756 static const int ide_irq[2] = { 14, 15 };
@@ -884,9 +878,11 @@ static void pc_init1(ram_addr_t ram_size, @@ -884,9 +878,11 @@ static void pc_init1(ram_addr_t ram_size,
884 } 878 }
885 if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) { 879 if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) {
886 env->cpuid_apic_id = env->cpu_index; 880 env->cpuid_apic_id = env->cpu_index;
  881 + /* APIC reset callback resets cpu */
887 apic_init(env); 882 apic_init(env);
  883 + } else {
  884 + qemu_register_reset((QEMUResetHandler*)cpu_reset, 0, env);
888 } 885 }
889 - qemu_register_reset(main_cpu_reset, 0, env);  
890 } 886 }
891 887
892 vmport_init(); 888 vmport_init();