smp_64.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef __ASM_SMP_H
  2. #define __ASM_SMP_H
  3. #include <linux/cpumask.h>
  4. #include <linux/init.h>
  5. /*
  6. * We need the APIC definitions automatically as part of 'smp.h'
  7. */
  8. #include <asm/apic.h>
  9. #include <asm/io_apic.h>
  10. #include <asm/mpspec.h>
  11. #include <asm/pda.h>
  12. #include <asm/thread_info.h>
  13. extern cpumask_t cpu_initialized;
  14. extern cpumask_t cpu_callin_map;
  15. extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *),
  16. void *info, int wait);
  17. #ifdef CONFIG_SMP
  18. #define raw_smp_processor_id() read_pda(cpunumber)
  19. #define stack_smp_processor_id() \
  20. ({ \
  21. struct thread_info *ti; \
  22. asm("andq %%rsp,%0; ":"=r" (ti) : "0" (CURRENT_MASK)); \
  23. ti->cpu; \
  24. })
  25. /*
  26. * On x86 all CPUs are mapped 1:1 to the APIC space. This simplifies
  27. * scheduling and IPI sending and compresses data structures.
  28. */
  29. static inline int num_booting_cpus(void)
  30. {
  31. return cpus_weight(cpu_callout_map);
  32. }
  33. #else /* CONFIG_SMP */
  34. #define stack_smp_processor_id() 0
  35. #endif /* !CONFIG_SMP */
  36. #define safe_smp_processor_id() smp_processor_id()
  37. #endif