Skip to contentSkip to conversation

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

PATCH RESEND New Gleb Natapov 1 participant 1 message Jun 18, 2009

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 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.

hw/pc.c +3 -7
index 160506f..db20501 100644
@@ -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.