blob: 0dba244c86db570bc4c02f1c681b027118cd0bd7 [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
Linus Torvalds1da177e2005-04-16 15:20:36 -070012static inline void send_IPI_mask(cpumask_t mask, int vector)
13{
14 send_IPI_mask_bitmask(mask, vector);
15}
16
Ashok Raj67664c82005-06-25 14:54:52 -070017static inline void __local_send_IPI_allbutself(int vector)
18{
Keith Owense77deac2006-06-26 13:59:56 +020019 if (no_broadcast || vector == NMI_VECTOR) {
Ashok Raj67664c82005-06-25 14:54:52 -070020 cpumask_t mask = cpu_online_map;
Ashok Raj67664c82005-06-25 14:54:52 -070021
Zwane Mwaikambo329d4002006-01-11 22:43:09 +010022 cpu_clear(smp_processor_id(), mask);
Ashok Raj67664c82005-06-25 14:54:52 -070023 send_IPI_mask(mask, vector);
Ashok Raj67664c82005-06-25 14:54:52 -070024 } else
25 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector);
26}
27
28static inline void __local_send_IPI_all(int vector)
29{
Keith Owense77deac2006-06-26 13:59:56 +020030 if (no_broadcast || vector == NMI_VECTOR)
Ashok Raj67664c82005-06-25 14:54:52 -070031 send_IPI_mask(cpu_online_map, vector);
32 else
33 __send_IPI_shortcut(APIC_DEST_ALLINC, vector);
34}
35
Linus Torvalds1da177e2005-04-16 15:20:36 -070036static inline void send_IPI_allbutself(int vector)
37{
38 /*
39 * if there are no other CPUs in the system then we get an APIC send
40 * error if we try to broadcast, thus avoid sending IPIs in this case.
41 */
42 if (!(num_online_cpus() > 1))
43 return;
44
Ashok Raj67664c82005-06-25 14:54:52 -070045 __local_send_IPI_allbutself(vector);
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 return;
47}
48
49static inline void send_IPI_all(int vector)
50{
Ashok Raj67664c82005-06-25 14:54:52 -070051 __local_send_IPI_all(vector);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052}
53
54#endif /* __ASM_MACH_IPI_H */