| #include <linux/init.h> |
| #include <linux/smp.h> |
| #include <linux/module.h> |
| |
| /* Number of siblings per CPU package */ |
| int smp_num_siblings = 1; |
| EXPORT_SYMBOL(smp_num_siblings); |
| |
| /* Last level cache ID of each logical CPU */ |
| DEFINE_PER_CPU(u16, cpu_llc_id) = BAD_APICID; |
| |
| /* bitmap of online cpus */ |
| cpumask_t cpu_online_map __read_mostly; |
| EXPORT_SYMBOL(cpu_online_map); |
| |
| cpumask_t cpu_callin_map; |
| cpumask_t cpu_callout_map; |
| cpumask_t cpu_possible_map; |
| EXPORT_SYMBOL(cpu_possible_map); |
| |
| /* representing HT siblings of each logical CPU */ |
| DEFINE_PER_CPU(cpumask_t, cpu_sibling_map); |
| EXPORT_PER_CPU_SYMBOL(cpu_sibling_map); |
| |
| /* representing HT and core siblings of each logical CPU */ |
| DEFINE_PER_CPU(cpumask_t, cpu_core_map); |
| EXPORT_PER_CPU_SYMBOL(cpu_core_map); |
| |
| /* Per CPU bogomips and other parameters */ |
| DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); |
| EXPORT_PER_CPU_SYMBOL(cpu_info); |
| #ifdef CONFIG_HOTPLUG_CPU |
| |
| int additional_cpus __initdata = -1; |
| |
| static __init int setup_additional_cpus(char *s) |
| { |
| return s && get_option(&s, &additional_cpus) ? 0 : -EINVAL; |
| } |
| early_param("additional_cpus", setup_additional_cpus); |
| |
| /* |
| * cpu_possible_map 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. |
| * In case when cpu_hotplug is not compiled, then we resort to current |
| * behaviour, which is cpu_possible == cpu_present. |
| * - Ashok Raj |
| * |
| * Three ways to find out the number of additional hotplug CPUs: |
| * - If the BIOS specified disabled CPUs in ACPI/mptables use that. |
| * - The user can overwrite it with additional_cpus=NUM |
| * - Otherwise don't reserve additional CPUs. |
| * We do this because additional CPUs waste a lot of memory. |
| * -AK |
| */ |
| __init void prefill_possible_map(void) |
| { |
| int i; |
| int possible; |
| |
| if (additional_cpus == -1) { |
| if (disabled_cpus > 0) |
| additional_cpus = disabled_cpus; |
| else |
| additional_cpus = 0; |
| } |
| possible = num_processors + additional_cpus; |
| if (possible > NR_CPUS) |
| possible = NR_CPUS; |
| |
| printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n", |
| possible, max_t(int, possible - num_processors, 0)); |
| |
| for (i = 0; i < possible; i++) |
| cpu_set(i, cpu_possible_map); |
| } |
| #endif |
| |