]> err.no Git - linux-2.6/blobdiff - arch/x86/kernel/smpboot.c
Merge git://git.infradead.org/~dedekind/ubi-2.6
[linux-2.6] / arch / x86 / kernel / smpboot.c
index d3402e2c57eb5df1711e146fd5ad7fbd78061e50..6a925394bc7e646e70cd17a54fd6da0710a11e80 100644 (file)
@@ -53,6 +53,7 @@
 #include <asm/nmi.h>
 #include <asm/irq.h>
 #include <asm/smp.h>
+#include <asm/trampoline.h>
 #include <asm/cpu.h>
 #include <asm/numa.h>
 #include <asm/pgtable.h>
@@ -60,6 +61,7 @@
 #include <asm/mtrr.h>
 #include <asm/nmi.h>
 #include <asm/vmi.h>
+#include <asm/genapic.h>
 #include <linux/mc146818rtc.h>
 
 #include <mach_apic.h>
  * integrate apic between arches, we can probably do a better job, but
  * right now, they'll stay here -- glommer
  */
-#ifdef CONFIG_X86_32
+
 /* which logical CPU number maps to which CPU (physical APIC ID) */
 u16 x86_cpu_to_apicid_init[NR_CPUS] __initdata =
                        { [0 ... NR_CPUS-1] = BAD_APICID };
 void *x86_cpu_to_apicid_early_ptr;
-DEFINE_PER_CPU(u16, x86_cpu_to_apicid) = BAD_APICID;
-EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid);
 
 u16 x86_bios_cpu_apicid_init[NR_CPUS] __initdata
                                = { [0 ... NR_CPUS-1] = BAD_APICID };
 void *x86_bios_cpu_apicid_early_ptr;
-DEFINE_PER_CPU(u16, x86_bios_cpu_apicid) = BAD_APICID;
-EXPORT_PER_CPU_SYMBOL(x86_bios_cpu_apicid);
-
-/* Internal processor count */
-unsigned int num_processors;
-unsigned disabled_cpus __cpuinitdata;
-
-/* Bitmask of physically existing CPUs */
-physid_mask_t phys_cpu_present_map;
 
+#ifdef CONFIG_X86_32
 u8 apicid_2_node[MAX_APICID];
 #endif
 
@@ -149,9 +141,6 @@ static atomic_t init_deasserted;
 
 static int boot_cpu_logical_apicid;
 
-/* ready for x86_64, no harm for x86, since it will overwrite after alloc */
-unsigned char *trampoline_base = __va(SMP_TRAMPOLINE_BASE);
-
 /* representing cpus for which sibling maps can be computed */
 static cpumask_t cpu_sibling_setup_map;
 
@@ -238,7 +227,7 @@ void __cpuinit smp_callin(void)
        /*
         * (This works even if the APIC is not enabled.)
         */
-       phys_id = GET_APIC_ID(apic_read(APIC_ID));
+       phys_id = GET_APIC_ID(read_apic_id());
        cpuid = smp_processor_id();
        if (cpu_isset(cpuid, cpu_callin_map)) {
                panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__,
@@ -447,7 +436,7 @@ valid_k7:
 #endif
 }
 
-void smp_checks(void)
+void __cpuinit smp_checks(void)
 {
        if (smp_b_stepping)
                printk(KERN_WARNING "WARNING: SMP operation may be unreliable"
@@ -559,19 +548,6 @@ cpumask_t cpu_coregroup_map(int cpu)
                return c->llc_shared_map;
 }
 
-/*
- * Currently trivial. Write the real->protected mode
- * bootstrap into the page concerned. The caller
- * has made sure it's suitably aligned.
- */
-
-unsigned long __cpuinit setup_trampoline(void)
-{
-       memcpy(trampoline_base, trampoline_data,
-              trampoline_end - trampoline_data);
-       return virt_to_phys(trampoline_base);
-}
-
 #ifdef CONFIG_X86_32
 /*
  * We are called very early to get the low memory for the
@@ -702,6 +678,12 @@ wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
        unsigned long send_status, accept_status = 0;
        int maxlvt, num_starts, j;
 
+       if (get_uv_system_type() == UV_NON_UNIQUE_APIC) {
+               send_status = uv_wakeup_secondary(phys_apicid, start_eip);
+               atomic_set(&init_deasserted, 1);
+               return send_status;
+       }
+
        /*
         * Be paranoid about clearing APIC errors.
         */
@@ -943,16 +925,19 @@ do_rest:
 
        atomic_set(&init_deasserted, 0);
 
-       Dprintk("Setting warm reset code and vector.\n");
+       if (get_uv_system_type() != UV_NON_UNIQUE_APIC) {
 
-       store_NMI_vector(&nmi_high, &nmi_low);
+               Dprintk("Setting warm reset code and vector.\n");
 
-       smpboot_setup_warm_reset_vector(start_ip);
-       /*
-        * Be paranoid about clearing APIC errors.
-        */
-       apic_write(APIC_ESR, 0);
-       apic_read(APIC_ESR);
+               store_NMI_vector(&nmi_high, &nmi_low);
+
+               smpboot_setup_warm_reset_vector(start_ip);
+               /*
+                * Be paranoid about clearing APIC errors.
+               */
+               apic_write(APIC_ESR, 0);
+               apic_read(APIC_ESR);
+       }
 
        /*
         * Starting actual IPI sequence...
@@ -991,7 +976,8 @@ do_rest:
                        else
                                /* trampoline code not run */
                                printk(KERN_ERR "Not responding.\n");
-                       inquire_remote_apic(apicid);
+                       if (get_uv_system_type() != UV_NON_UNIQUE_APIC)
+                               inquire_remote_apic(apicid);
                }
        }
 
@@ -1011,6 +997,11 @@ do_rest:
        /* mark "stuck" area as not stuck */
        *((volatile unsigned long *)trampoline_base) = 0;
 
+       /*
+        * Cleanup possible dangling ends...
+        */
+       smpboot_restore_warm_reset_vector();
+
        return boot_error;
 }
 
@@ -1102,6 +1093,7 @@ static __init void disable_smp(void)
  */
 static int __init smp_sanity_check(unsigned max_cpus)
 {
+       preempt_disable();
        if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) {
                printk(KERN_WARNING "weird, boot CPU (#%d) not listed"
                                    "by the BIOS.\n", hard_smp_processor_id());
@@ -1113,6 +1105,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
         * get out of here now!
         */
        if (!smp_found_config && !acpi_lapic) {
+               preempt_enable();
                printk(KERN_NOTICE "SMP motherboard not detected.\n");
                disable_smp();
                if (APIC_init_uniprocessor())
@@ -1131,6 +1124,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
                        boot_cpu_physical_apicid);
                physid_set(hard_smp_processor_id(), phys_cpu_present_map);
        }
+       preempt_enable();
 
        /*
         * If we couldn't find a local APIC, then get out of here now!
@@ -1206,11 +1200,13 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
                return;
        }
 
-       if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_physical_apicid) {
+       preempt_disable();
+       if (GET_APIC_ID(read_apic_id()) != boot_cpu_physical_apicid) {
                panic("Boot APIC ID in local APIC unexpected (%d vs %d)",
-                    GET_APIC_ID(apic_read(APIC_ID)), boot_cpu_physical_apicid);
+                    GET_APIC_ID(read_apic_id()), boot_cpu_physical_apicid);
                /* Or can we switch back to PIC here? */
        }
+       preempt_enable();
 
 #ifdef CONFIG_X86_32
        connect_bsp_APIC();
@@ -1259,11 +1255,6 @@ void __init native_smp_prepare_boot_cpu(void)
 
 void __init native_smp_cpus_done(unsigned int max_cpus)
 {
-       /*
-        * Cleanup possible dangling ends...
-        */
-       smpboot_restore_warm_reset_vector();
-
        Dprintk("Boot done.\n");
 
        impress_friends();