]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - arch/x86/kernel/smpboot.c
x86: move hotplug related extern definitions to smp.h
[mirror_ubuntu-jammy-kernel.git] / arch / x86 / kernel / smpboot.c
CommitLineData
68a1c3f8
GC
1#include <linux/init.h>
2#include <linux/smp.h>
a355352b 3#include <linux/module.h>
68a1c3f8 4
a355352b
GC
5/* Number of siblings per CPU package */
6int smp_num_siblings = 1;
7EXPORT_SYMBOL(smp_num_siblings);
8
9/* Last level cache ID of each logical CPU */
10DEFINE_PER_CPU(u16, cpu_llc_id) = BAD_APICID;
11
12/* bitmap of online cpus */
13cpumask_t cpu_online_map __read_mostly;
14EXPORT_SYMBOL(cpu_online_map);
15
16cpumask_t cpu_callin_map;
17cpumask_t cpu_callout_map;
18cpumask_t cpu_possible_map;
19EXPORT_SYMBOL(cpu_possible_map);
20
21/* representing HT siblings of each logical CPU */
22DEFINE_PER_CPU(cpumask_t, cpu_sibling_map);
23EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
24
25/* representing HT and core siblings of each logical CPU */
26DEFINE_PER_CPU(cpumask_t, cpu_core_map);
27EXPORT_PER_CPU_SYMBOL(cpu_core_map);
28
29/* Per CPU bogomips and other parameters */
30DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
31EXPORT_PER_CPU_SYMBOL(cpu_info);
68a1c3f8
GC
32#ifdef CONFIG_HOTPLUG_CPU
33
34int additional_cpus __initdata = -1;
35
36static __init int setup_additional_cpus(char *s)
37{
38 return s && get_option(&s, &additional_cpus) ? 0 : -EINVAL;
39}
40early_param("additional_cpus", setup_additional_cpus);
41
42/*
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.
50 * - Ashok Raj
51 *
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.
57 * -AK
58 */
59__init void prefill_possible_map(void)
60{
61 int i;
62 int possible;
63
64 if (additional_cpus == -1) {
65 if (disabled_cpus > 0)
66 additional_cpus = disabled_cpus;
67 else
68 additional_cpus = 0;
69 }
70 possible = num_processors + additional_cpus;
71 if (possible > NR_CPUS)
72 possible = NR_CPUS;
73
74 printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n",
75 possible, max_t(int, possible - num_processors, 0));
76
77 for (i = 0; i < possible; i++)
78 cpu_set(i, cpu_possible_map);
79}
80#endif
81