x86 module: merge the rest functions with macros
[safe/jmp/linux-2.6] / arch / x86 / kernel / smpboot.c
index c55639b..7c80007 100644 (file)
@@ -123,7 +123,7 @@ EXPORT_SYMBOL(cpu_to_node_map);
 static void map_cpu_to_node(int cpu, int node)
 {
        printk(KERN_INFO "Mapping cpu %d to node %d\n", cpu, node);
-       cpumask_set_cpu(cpu, &node_to_cpumask_map[node]);
+       cpumask_set_cpu(cpu, node_to_cpumask_map[node]);
        cpu_to_node_map[cpu] = node;
 }
 
@@ -134,7 +134,7 @@ static void unmap_cpu_to_node(int cpu)
 
        printk(KERN_INFO "Unmapping cpu %d from all nodes\n", cpu);
        for (node = 0; node < MAX_NUMNODES; node++)
-               cpumask_clear_cpu(cpu, &node_to_cpumask_map[node]);
+               cpumask_clear_cpu(cpu, node_to_cpumask_map[node]);
        cpu_to_node_map[cpu] = 0;
 }
 #else /* !(CONFIG_NUMA && CONFIG_X86_32) */
@@ -296,7 +296,7 @@ notrace static void __cpuinit start_secondary(void *unused)
        __flush_tlb_all();
 #endif
 
-       /* This must be done before setting cpu_online_map */
+       /* This must be done before setting cpu_online_mask */
        set_cpu_sibling_map(raw_smp_processor_id());
        wmb();
 
@@ -329,6 +329,23 @@ notrace static void __cpuinit start_secondary(void *unused)
        cpu_idle();
 }
 
+#ifdef CONFIG_CPUMASK_OFFSTACK
+/* In this case, llc_shared_map is a pointer to a cpumask. */
+static inline void copy_cpuinfo_x86(struct cpuinfo_x86 *dst,
+                                   const struct cpuinfo_x86 *src)
+{
+       struct cpumask *llc = dst->llc_shared_map;
+       *dst = *src;
+       dst->llc_shared_map = llc;
+}
+#else
+static inline void copy_cpuinfo_x86(struct cpuinfo_x86 *dst,
+                                   const struct cpuinfo_x86 *src)
+{
+       *dst = *src;
+}
+#endif /* CONFIG_CPUMASK_OFFSTACK */
+
 /*
  * The bootstrap kernel entry code has set these up. Save them for
  * a given CPU
@@ -338,7 +355,7 @@ void __cpuinit smp_store_cpu_info(int id)
 {
        struct cpuinfo_x86 *c = &cpu_data(id);
 
-       *c = boot_cpu_data;
+       copy_cpuinfo_x86(c, &boot_cpu_data);
        c->cpu_index = id;
        if (id != 0)
                identify_secondary_cpu(c);
@@ -362,15 +379,15 @@ void __cpuinit set_cpu_sibling_map(int cpu)
                                cpumask_set_cpu(cpu, cpu_sibling_mask(i));
                                cpumask_set_cpu(i, cpu_core_mask(cpu));
                                cpumask_set_cpu(cpu, cpu_core_mask(i));
-                               cpumask_set_cpu(i, &c->llc_shared_map);
-                               cpumask_set_cpu(cpu, &o->llc_shared_map);
+                               cpumask_set_cpu(i, c->llc_shared_map);
+                               cpumask_set_cpu(cpu, o->llc_shared_map);
                        }
                }
        } else {
                cpumask_set_cpu(cpu, cpu_sibling_mask(cpu));
        }
 
-       cpumask_set_cpu(cpu, &c->llc_shared_map);
+       cpumask_set_cpu(cpu, c->llc_shared_map);
 
        if (current_cpu_data.x86_max_cores == 1) {
                cpumask_copy(cpu_core_mask(cpu), cpu_sibling_mask(cpu));
@@ -381,8 +398,8 @@ void __cpuinit set_cpu_sibling_map(int cpu)
        for_each_cpu(i, cpu_sibling_setup_mask) {
                if (per_cpu(cpu_llc_id, cpu) != BAD_APICID &&
                    per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) {
-                       cpumask_set_cpu(i, &c->llc_shared_map);
-                       cpumask_set_cpu(cpu, &cpu_data(i).llc_shared_map);
+                       cpumask_set_cpu(i, c->llc_shared_map);
+                       cpumask_set_cpu(cpu, cpu_data(i).llc_shared_map);
                }
                if (c->phys_proc_id == cpu_data(i).phys_proc_id) {
                        cpumask_set_cpu(i, cpu_core_mask(cpu));
@@ -420,7 +437,7 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
        if (sched_mc_power_savings || sched_smt_power_savings)
                return cpu_core_mask(cpu);
        else
-               return &c->llc_shared_map;
+               return c->llc_shared_map;
 }
 
 static void impress_friends(void)
@@ -487,7 +504,7 @@ void __inquire_remote_apic(int apicid)
  * INIT, INIT, STARTUP sequence will reset the chip hard for us, and this
  * won't ... remember to clear down the APIC, etc later.
  */
-int __devinit
+int __cpuinit
 wakeup_secondary_cpu_via_nmi(int logical_apicid, unsigned long start_eip)
 {
        unsigned long send_status, accept_status = 0;
@@ -521,7 +538,7 @@ wakeup_secondary_cpu_via_nmi(int logical_apicid, unsigned long start_eip)
        return (send_status | accept_status);
 }
 
-int __devinit
+static int __cpuinit
 wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
 {
        unsigned long send_status, accept_status = 0;
@@ -805,10 +822,12 @@ do_rest:
        /* mark "stuck" area as not stuck */
        *((volatile unsigned long *)trampoline_base) = 0;
 
-       /*
-        * Cleanup possible dangling ends...
-        */
-       smpboot_restore_warm_reset_vector();
+       if (get_uv_system_type() != UV_NON_UNIQUE_APIC) {
+               /*
+                * Cleanup possible dangling ends...
+                */
+               smpboot_restore_warm_reset_vector();
+       }
 
        return boot_error;
 }
@@ -887,9 +906,8 @@ int __cpuinit native_cpu_up(unsigned int cpu)
  */
 static __init void disable_smp(void)
 {
-       /* use the read/write pointers to the present and possible maps */
-       cpumask_copy(&cpu_present_map, cpumask_of(0));
-       cpumask_copy(&cpu_possible_map, cpumask_of(0));
+       init_cpu_present(cpumask_of(0));
+       init_cpu_possible(cpumask_of(0));
        smpboot_clear_io_apic_irqs();
 
        if (smp_found_config)
@@ -974,10 +992,12 @@ static int __init smp_sanity_check(unsigned max_cpus)
         */
        if (APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid]) &&
            !cpu_has_apic) {
-               printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",
-                       boot_cpu_physical_apicid);
-               printk(KERN_ERR "... forcing use of dummy APIC emulation."
+               if (!disable_apic) {
+                       pr_err("BIOS bug, local APIC #%d not detected!...\n",
+                               boot_cpu_physical_apicid);
+                       pr_err("... forcing use of dummy APIC emulation."
                                "(tell your hw vendor)\n");
+               }
                smpboot_clear_io_apic();
                arch_disable_smp_support();
                return -1;
@@ -1039,8 +1059,10 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
        for_each_possible_cpu(i) {
                alloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL);
                alloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
+               alloc_cpumask_var(&cpu_data(i).llc_shared_map, GFP_KERNEL);
                cpumask_clear(per_cpu(cpu_core_map, i));
                cpumask_clear(per_cpu(cpu_sibling_map, i));
+               cpumask_clear(cpu_data(i).llc_shared_map);
        }
        set_cpu_sibling_map(0);
 
@@ -1130,11 +1152,11 @@ early_param("possible_cpus", _setup_possible_cpus);
 
 
 /*
- * cpu_possible_map should be static, it cannot change as cpu's
+ * cpu_possible_mask should be static, it cannot change as cpu's
  * are onlined, or offlined. The reason is per-cpu data-structures
  * are allocated by some modules at init time, and dont expect to
  * do this dynamically on cpu arrival/departure.
- * cpu_present_map on the other hand can change dynamically.
+ * cpu_present_mask on the other hand can change dynamically.
  * In case when cpu_hotplug is not compiled, then we resort to current
  * behaviour, which is cpu_possible == cpu_present.
  * - Ashok Raj