ia64/xen-unstable
changeset 15868:154769114a82
x86: Cleanup system restart code, and wait 10ms for APs to offline.
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author | kfraser@localhost.localdomain |
---|---|
date | Mon Sep 10 18:09:38 2007 +0100 (2007-09-10) |
parents | aaae02dbe269 |
children | 42b925c00d8a |
files | xen/arch/x86/machine_kexec.c xen/arch/x86/shutdown.c xen/arch/x86/smp.c |
line diff
1.1 --- a/xen/arch/x86/machine_kexec.c Mon Sep 10 17:49:58 2007 +0100 1.2 +++ b/xen/arch/x86/machine_kexec.c Mon Sep 10 18:09:38 2007 +0100 1.3 @@ -82,9 +82,6 @@ static void __machine_reboot_kexec(void 1.4 1.5 smp_send_stop(); 1.6 1.7 - disable_IO_APIC(); 1.8 - hvm_cpu_down(); 1.9 - 1.10 machine_kexec(image); 1.11 } 1.12
2.1 --- a/xen/arch/x86/shutdown.c Mon Sep 10 17:49:58 2007 +0100 2.2 +++ b/xen/arch/x86/shutdown.c Mon Sep 10 18:09:38 2007 +0100 2.3 @@ -216,18 +216,12 @@ void machine_restart(void) 2.4 safe_halt(); 2.5 } 2.6 2.7 - /* 2.8 - * Stop all CPUs and turn off local APICs and the IO-APIC, so 2.9 - * other OSs see a clean IRQ state. 2.10 - */ 2.11 smp_send_stop(); 2.12 - disable_IO_APIC(); 2.13 - hvm_cpu_down(); 2.14 2.15 /* Rebooting needs to touch the page at absolute address 0. */ 2.16 *((unsigned short *)__va(0x472)) = reboot_mode; 2.17 2.18 - if (reboot_thru_bios <= 0) 2.19 + if ( reboot_thru_bios <= 0 ) 2.20 { 2.21 for ( ; ; ) 2.22 {
3.1 --- a/xen/arch/x86/smp.c Mon Sep 10 17:49:58 2007 +0100 3.2 +++ b/xen/arch/x86/smp.c Mon Sep 10 18:09:38 2007 +0100 3.3 @@ -319,23 +319,33 @@ int on_selected_cpus( 3.4 3.5 static void stop_this_cpu (void *dummy) 3.6 { 3.7 - cpu_clear(smp_processor_id(), cpu_online_map); 3.8 - 3.9 - local_irq_disable(); 3.10 disable_local_APIC(); 3.11 hvm_cpu_down(); 3.12 3.13 + cpu_clear(smp_processor_id(), cpu_online_map); 3.14 + 3.15 for ( ; ; ) 3.16 __asm__ __volatile__ ( "hlt" ); 3.17 } 3.18 3.19 +/* 3.20 + * Stop all CPUs and turn off local APICs and the IO-APIC, so other OSs see a 3.21 + * clean IRQ state. 3.22 + */ 3.23 void smp_send_stop(void) 3.24 { 3.25 - /* Stop all other CPUs in the system. */ 3.26 + int timeout = 10; 3.27 + 3.28 smp_call_function(stop_this_cpu, NULL, 1, 0); 3.29 3.30 + /* Wait 10ms for all other CPUs to go offline. */ 3.31 + while ( (num_online_cpus() > 1) && (timeout-- > 0) ) 3.32 + mdelay(1); 3.33 + 3.34 local_irq_disable(); 3.35 disable_local_APIC(); 3.36 + disable_IO_APIC(); 3.37 + hvm_cpu_down(); 3.38 local_irq_enable(); 3.39 } 3.40