aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/smp.c
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@hp.com>2007-09-10 13:58:56 -0600
committerAlex Williamson <alex.williamson@hp.com>2007-09-10 13:58:56 -0600
commitf012ee16fb230dbd226cca9de4b41935ba33d140 (patch)
tree2090afa9a9cb69f94e8b1a15e3ae48bad039a32f /xen/arch/x86/smp.c
parent37eb10eb5998d0775b07f80ddc36ee59c35784a5 (diff)
parent4694a6028ca07e4008a59b02a1d1f0aa9887a00b (diff)
downloadxen-f012ee16fb230dbd226cca9de4b41935ba33d140.tar.gz
xen-f012ee16fb230dbd226cca9de4b41935ba33d140.tar.bz2
xen-f012ee16fb230dbd226cca9de4b41935ba33d140.zip
merge with xen-unstable.hg (staging)
Diffstat (limited to 'xen/arch/x86/smp.c')
-rw-r--r--xen/arch/x86/smp.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 31fc8adbe6..550faf069b 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -279,6 +279,19 @@ int on_selected_cpus(
ASSERT(local_irq_is_enabled());
+ /* Legacy UP system with no APIC to deliver IPIs? */
+ if ( unlikely(!cpu_has_apic) )
+ {
+ ASSERT(num_online_cpus() == 1);
+ if ( cpu_isset(0, selected) )
+ {
+ local_irq_disable();
+ func(info);
+ local_irq_enable();
+ }
+ return 0;
+ }
+
if ( nr_cpus == 0 )
return 0;
@@ -306,23 +319,33 @@ int on_selected_cpus(
static void stop_this_cpu (void *dummy)
{
- cpu_clear(smp_processor_id(), cpu_online_map);
-
- local_irq_disable();
disable_local_APIC();
hvm_cpu_down();
+ cpu_clear(smp_processor_id(), cpu_online_map);
+
for ( ; ; )
__asm__ __volatile__ ( "hlt" );
}
+/*
+ * Stop all CPUs and turn off local APICs and the IO-APIC, so other OSs see a
+ * clean IRQ state.
+ */
void smp_send_stop(void)
{
- /* Stop all other CPUs in the system. */
+ int timeout = 10;
+
smp_call_function(stop_this_cpu, NULL, 1, 0);
+ /* Wait 10ms for all other CPUs to go offline. */
+ while ( (num_online_cpus() > 1) && (timeout-- > 0) )
+ mdelay(1);
+
local_irq_disable();
disable_local_APIC();
+ disable_IO_APIC();
+ hvm_cpu_down();
local_irq_enable();
}