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

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