1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_CPUMASK_H
3#define _ASM_X86_CPUMASK_H
4#ifndef __ASSEMBLY__
5#include <linux/cpumask.h>
6
7extern cpumask_var_t cpu_callin_mask;
8extern cpumask_var_t cpu_callout_mask;
9extern cpumask_var_t cpu_initialized_mask;
10extern cpumask_var_t cpu_sibling_setup_mask;
11
12extern void setup_cpu_local_masks(void);
13
14/*
15 * NMI and MCE exceptions need cpu_is_offline() _really_ early,
16 * provide an arch_ special for them to avoid instrumentation.
17 */
18#if NR_CPUS > 1
19static __always_inline bool arch_cpu_online(int cpu)
20{
21 return arch_test_bit(cpu, cpumask_bits(cpu_online_mask));
22}
23
24static __always_inline void arch_cpumask_clear_cpu(int cpu, struct cpumask *dstp)
25{
26 arch_clear_bit(cpumask_check(cpu), cpumask_bits(dstp));
27}
28#else
29static __always_inline bool arch_cpu_online(int cpu)
30{
31 return cpu == 0;
32}
33
34static __always_inline void arch_cpumask_clear_cpu(int cpu, struct cpumask *dstp)
35{
36 return;
37}
38#endif
39
40#define arch_cpu_is_offline(cpu) unlikely(!arch_cpu_online(cpu))
41
42#endif /* __ASSEMBLY__ */
43#endif /* _ASM_X86_CPUMASK_H */
44

source code of linux/arch/x86/include/asm/cpumask.h