Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_X86_CPUMASK_H
0003 #define _ASM_X86_CPUMASK_H
0004 #ifndef __ASSEMBLY__
0005 #include <linux/cpumask.h>
0006 
0007 extern cpumask_var_t cpu_callin_mask;
0008 extern cpumask_var_t cpu_callout_mask;
0009 extern cpumask_var_t cpu_initialized_mask;
0010 extern cpumask_var_t cpu_sibling_setup_mask;
0011 
0012 extern void setup_cpu_local_masks(void);
0013 
0014 /*
0015  * NMI and MCE exceptions need cpu_is_offline() _really_ early,
0016  * provide an arch_ special for them to avoid instrumentation.
0017  */
0018 #if NR_CPUS > 1
0019 static __always_inline bool arch_cpu_online(int cpu)
0020 {
0021     return arch_test_bit(cpu, cpumask_bits(cpu_online_mask));
0022 }
0023 
0024 static __always_inline void arch_cpumask_clear_cpu(int cpu, struct cpumask *dstp)
0025 {
0026     arch_clear_bit(cpumask_check(cpu), cpumask_bits(dstp));
0027 }
0028 #else
0029 static __always_inline bool arch_cpu_online(int cpu)
0030 {
0031     return cpu == 0;
0032 }
0033 
0034 static __always_inline void arch_cpumask_clear_cpu(int cpu, struct cpumask *dstp)
0035 {
0036     return;
0037 }
0038 #endif
0039 
0040 #define arch_cpu_is_offline(cpu)    unlikely(!arch_cpu_online(cpu))
0041 
0042 #endif /* __ASSEMBLY__ */
0043 #endif /* _ASM_X86_CPUMASK_H */