mach_ipi.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef ASM_X86__MACH_DEFAULT__MACH_IPI_H
  2. #define ASM_X86__MACH_DEFAULT__MACH_IPI_H
  3. /* Avoid include hell */
  4. #define NMI_VECTOR 0x02
  5. void send_IPI_mask_bitmask(cpumask_t mask, int vector);
  6. void __send_IPI_shortcut(unsigned int shortcut, int vector);
  7. extern int no_broadcast;
  8. #ifdef CONFIG_X86_64
  9. #include <asm/genapic.h>
  10. #define send_IPI_mask (genapic->send_IPI_mask)
  11. #else
  12. static inline void send_IPI_mask(cpumask_t mask, int vector)
  13. {
  14. send_IPI_mask_bitmask(mask, vector);
  15. }
  16. #endif
  17. static inline void __local_send_IPI_allbutself(int vector)
  18. {
  19. if (no_broadcast || vector == NMI_VECTOR) {
  20. cpumask_t mask = cpu_online_map;
  21. cpu_clear(smp_processor_id(), mask);
  22. send_IPI_mask(mask, vector);
  23. } else
  24. __send_IPI_shortcut(APIC_DEST_ALLBUT, vector);
  25. }
  26. static inline void __local_send_IPI_all(int vector)
  27. {
  28. if (no_broadcast || vector == NMI_VECTOR)
  29. send_IPI_mask(cpu_online_map, vector);
  30. else
  31. __send_IPI_shortcut(APIC_DEST_ALLINC, vector);
  32. }
  33. #ifdef CONFIG_X86_64
  34. #define send_IPI_allbutself (genapic->send_IPI_allbutself)
  35. #define send_IPI_all (genapic->send_IPI_all)
  36. #else
  37. static inline void send_IPI_allbutself(int vector)
  38. {
  39. /*
  40. * if there are no other CPUs in the system then we get an APIC send
  41. * error if we try to broadcast, thus avoid sending IPIs in this case.
  42. */
  43. if (!(num_online_cpus() > 1))
  44. return;
  45. __local_send_IPI_allbutself(vector);
  46. return;
  47. }
  48. static inline void send_IPI_all(int vector)
  49. {
  50. __local_send_IPI_all(vector);
  51. }
  52. #endif
  53. #endif /* ASM_X86__MACH_DEFAULT__MACH_IPI_H */