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