1 #include <linux/init.h>
3 #include <linux/module.h>
5 /* Number of siblings per CPU package */
6 int smp_num_siblings = 1;
7 EXPORT_SYMBOL(smp_num_siblings);
9 /* Last level cache ID of each logical CPU */
10 DEFINE_PER_CPU(u16, cpu_llc_id) = BAD_APICID;
12 /* bitmap of online cpus */
13 cpumask_t cpu_online_map __read_mostly;
14 EXPORT_SYMBOL(cpu_online_map);
16 cpumask_t cpu_callin_map;
17 cpumask_t cpu_callout_map;
18 cpumask_t cpu_possible_map;
19 EXPORT_SYMBOL(cpu_possible_map);
21 /* representing HT siblings of each logical CPU */
22 DEFINE_PER_CPU(cpumask_t, cpu_sibling_map);
23 EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
25 /* representing HT and core siblings of each logical CPU */
26 DEFINE_PER_CPU(cpumask_t, cpu_core_map);
27 EXPORT_PER_CPU_SYMBOL(cpu_core_map);
29 /* Per CPU bogomips and other parameters */
30 DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
31 EXPORT_PER_CPU_SYMBOL(cpu_info);
32 #ifdef CONFIG_HOTPLUG_CPU
34 int additional_cpus __initdata = -1;
36 static __init int setup_additional_cpus(char *s)
38 return s && get_option(&s, &additional_cpus) ? 0 : -EINVAL;
40 early_param("additional_cpus", setup_additional_cpus);
43 * cpu_possible_map should be static, it cannot change as cpu's
44 * are onlined, or offlined. The reason is per-cpu data-structures
45 * are allocated by some modules at init time, and dont expect to
46 * do this dynamically on cpu arrival/departure.
47 * cpu_present_map on the other hand can change dynamically.
48 * In case when cpu_hotplug is not compiled, then we resort to current
49 * behaviour, which is cpu_possible == cpu_present.
52 * Three ways to find out the number of additional hotplug CPUs:
53 * - If the BIOS specified disabled CPUs in ACPI/mptables use that.
54 * - The user can overwrite it with additional_cpus=NUM
55 * - Otherwise don't reserve additional CPUs.
56 * We do this because additional CPUs waste a lot of memory.
59 __init void prefill_possible_map(void)
64 if (additional_cpus == -1) {
65 if (disabled_cpus > 0)
66 additional_cpus = disabled_cpus;
70 possible = num_processors + additional_cpus;
71 if (possible > NR_CPUS)
74 printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n",
75 possible, max_t(int, possible - num_processors, 0));
77 for (i = 0; i < possible; i++)
78 cpu_set(i, cpu_possible_map);