xen: HVM X2APIC support
[pandora-kernel.git] / arch / x86 / xen / smp.c
index 25f232b..72a4c79 100644 (file)
@@ -28,6 +28,7 @@
 #include <asm/xen/interface.h>
 #include <asm/xen/hypercall.h>
 
+#include <xen/xen.h>
 #include <xen/page.h>
 #include <xen/events.h>
 
@@ -156,11 +157,35 @@ static void __init xen_fill_possible_map(void)
 {
        int i, rc;
 
+       if (xen_initial_domain())
+               return;
+
+       for (i = 0; i < nr_cpu_ids; i++) {
+               rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
+               if (rc >= 0) {
+                       num_processors++;
+                       set_cpu_possible(i, true);
+               }
+       }
+}
+
+static void __init xen_filter_cpu_maps(void)
+{
+       int i, rc;
+
+       if (!xen_initial_domain())
+               return;
+
+       num_processors = 0;
+       disabled_cpus = 0;
        for (i = 0; i < nr_cpu_ids; i++) {
                rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
                if (rc >= 0) {
                        num_processors++;
                        set_cpu_possible(i, true);
+               } else {
+                       set_cpu_possible(i, false);
+                       set_cpu_present(i, false);
                }
        }
 }
@@ -174,6 +199,7 @@ static void __init xen_smp_prepare_boot_cpu(void)
           old memory can be recycled */
        make_lowmem_page_readwrite(xen_initial_gdt);
 
+       xen_filter_cpu_maps();
        xen_setup_vcpu_info_placement();
 }
 
@@ -400,9 +426,9 @@ static void stop_self(void *v)
        BUG();
 }
 
-static void xen_smp_send_stop(void)
+static void xen_stop_other_cpus(int wait)
 {
-       smp_call_function(stop_self, NULL, 0);
+       smp_call_function(stop_self, NULL, wait);
 }
 
 static void xen_smp_send_reschedule(int cpu)
@@ -470,7 +496,7 @@ static const struct smp_ops xen_smp_ops __initdata = {
        .cpu_disable = xen_cpu_disable,
        .play_dead = xen_play_dead,
 
-       .smp_send_stop = xen_smp_send_stop,
+       .stop_other_cpus = xen_stop_other_cpus,
        .smp_send_reschedule = xen_smp_send_reschedule,
 
        .send_call_func_ipi = xen_smp_send_call_function_ipi,