cpumask.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. extern cpumask_var_t cpu_callin_mask;
  7. extern cpumask_var_t cpu_callout_mask;
  8. extern cpumask_var_t cpu_initialized_mask;
  9. extern cpumask_var_t cpu_sibling_setup_mask;
  10. extern void setup_cpu_local_masks(void);
  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
  16. static __always_inline bool arch_cpu_online(int cpu)
  17. {
  18. return arch_test_bit(cpu, cpumask_bits(cpu_online_mask));
  19. }
  20. static __always_inline void arch_cpumask_clear_cpu(int cpu, struct cpumask *dstp)
  21. {
  22. arch_clear_bit(cpumask_check(cpu), cpumask_bits(dstp));
  23. }
  24. #else
  25. static __always_inline bool arch_cpu_online(int cpu)
  26. {
  27. return cpu == 0;
  28. }
  29. static __always_inline void arch_cpumask_clear_cpu(int cpu, struct cpumask *dstp)
  30. {
  31. return;
  32. }
  33. #endif
  34. #define arch_cpu_is_offline(cpu) unlikely(!arch_cpu_online(cpu))
  35. #endif /* __ASSEMBLY__ */
  36. #endif /* _ASM_X86_CPUMASK_H */