blob: be323364e68f6d7522194f7b2d2941df8edd6d19 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __ASM_MACH_IPI_H
2#define __ASM_MACH_IPI_H
3
Keith Owense77deac2006-06-26 13:59:56 +02004/* Avoid include hell */
5#define NMI_VECTOR 0x02
6
Linus Torvalds1da177e2005-04-16 15:20:36 -07007void send_IPI_mask_bitmask(cpumask_t mask, int vector);
8void __send_IPI_shortcut(unsigned int shortcut, int vector);
9
Ashok Raj67664c82005-06-25 14:54:52 -070010extern int no_broadcast;
11
Glauber Costa5af55732008-03-25 13:28:56 -030012#ifdef CONFIG_X86_64
13#include <asm/genapic.h>
14#define send_IPI_mask (genapic->send_IPI_mask)
15#else
Linus Torvalds1da177e2005-04-16 15:20:36 -070016static inline void send_IPI_mask(cpumask_t mask, int vector)
17{
18 send_IPI_mask_bitmask(mask, vector);
19}
Glauber Costa5af55732008-03-25 13:28:56 -030020#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
Ashok Raj67664c82005-06-25 14:54:52 -070022static inline void __local_send_IPI_allbutself(int vector)
23{
Keith Owense77deac2006-06-26 13:59:56 +020024 if (no_broadcast || vector == NMI_VECTOR) {
Ashok Raj67664c82005-06-25 14:54:52 -070025 cpumask_t mask = cpu_online_map;
Ashok Raj67664c82005-06-25 14:54:52 -070026
Zwane Mwaikambo329d4002006-01-11 22:43:09 +010027 cpu_clear(smp_processor_id(), mask);
Ashok Raj67664c82005-06-25 14:54:52 -070028 send_IPI_mask(mask, vector);
Ashok Raj67664c82005-06-25 14:54:52 -070029 } else
30 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector);
31}
32
33static inline void __local_send_IPI_all(int vector)
34{
Keith Owense77deac2006-06-26 13:59:56 +020035 if (no_broadcast || vector == NMI_VECTOR)
Ashok Raj67664c82005-06-25 14:54:52 -070036 send_IPI_mask(cpu_online_map, vector);
37 else
38 __send_IPI_shortcut(APIC_DEST_ALLINC, vector);
39}
40
Glauber Costa5af55732008-03-25 13:28:56 -030041#ifdef CONFIG_X86_64
42#define send_IPI_allbutself (genapic->send_IPI_allbutself)
43#define send_IPI_all (genapic->send_IPI_all)
44#else
Linus Torvalds1da177e2005-04-16 15:20:36 -070045static inline void send_IPI_allbutself(int vector)
46{
47 /*
48 * if there are no other CPUs in the system then we get an APIC send
49 * error if we try to broadcast, thus avoid sending IPIs in this case.
50 */
51 if (!(num_online_cpus() > 1))
52 return;
53
Ashok Raj67664c82005-06-25 14:54:52 -070054 __local_send_IPI_allbutself(vector);
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 return;
56}
57
58static inline void send_IPI_all(int vector)
59{
Ashok Raj67664c82005-06-25 14:54:52 -070060 __local_send_IPI_all(vector);
Linus Torvalds1da177e2005-04-16 15:20:36 -070061}
Glauber Costa5af55732008-03-25 13:28:56 -030062#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
64#endif /* __ASM_MACH_IPI_H */