smp_64.h 847 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef __ASM_SMP_H
  2. #define __ASM_SMP_H
  3. extern cpumask_t cpu_initialized;
  4. extern cpumask_t cpu_callin_map;
  5. extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *),
  6. void *info, int wait);
  7. #ifdef CONFIG_SMP
  8. #define raw_smp_processor_id() read_pda(cpunumber)
  9. #define stack_smp_processor_id() \
  10. ({ \
  11. struct thread_info *ti; \
  12. asm("andq %%rsp,%0; ":"=r" (ti) : "0" (CURRENT_MASK)); \
  13. ti->cpu; \
  14. })
  15. /*
  16. * On x86 all CPUs are mapped 1:1 to the APIC space. This simplifies
  17. * scheduling and IPI sending and compresses data structures.
  18. */
  19. static inline int num_booting_cpus(void)
  20. {
  21. return cpus_weight(cpu_callout_map);
  22. }
  23. #define safe_smp_processor_id() smp_processor_id()
  24. #else /* CONFIG_SMP */
  25. #define stack_smp_processor_id() 0
  26. #define safe_smp_processor_id() 0
  27. #endif /* !CONFIG_SMP */
  28. #endif