ia64/xen-unstable

view xen/include/xen/smp.h @ 9353:eb2a2529f96c

New SMP IPI interface function called on_selected_cpus(), currently implemented
only for x86. The x86 implementation of smp_call_function has been simplified
and is now based on on_slected_cpus().

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Mar 21 11:28:03 2006 +0100 (2006-03-21)
parents b32cad914390
children 034df2dca608
line source
1 #ifndef __LINUX_SMP_H
2 #define __LINUX_SMP_H
4 /*
5 * Generic SMP support
6 * Alan Cox. <alan@redhat.com>
7 */
9 #include <xen/config.h>
11 #ifdef CONFIG_SMP
13 #include <asm/smp.h>
15 /*
16 * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc.
17 * (defined in asm header):
18 */
20 /*
21 * stops all CPUs but the current one:
22 */
23 extern void smp_send_stop(void);
25 extern void smp_send_event_check_mask(cpumask_t mask);
26 #define smp_send_event_check_cpu(cpu) \
27 smp_send_event_check_mask(cpumask_of_cpu(cpu))
29 /*
30 * Prepare machine for booting other CPUs.
31 */
32 extern void smp_prepare_cpus(unsigned int max_cpus);
34 /*
35 * Bring a CPU up
36 */
37 extern int __cpu_up(unsigned int cpunum);
39 /*
40 * Final polishing of CPUs
41 */
42 extern void smp_cpus_done(unsigned int max_cpus);
44 /*
45 * Call a function on all other processors
46 */
47 extern int smp_call_function(
48 void (*func) (void *info),
49 void *info,
50 int retry,
51 int wait);
53 /*
54 * Call a function on a selection of processors
55 */
56 extern int on_selected_cpus(
57 cpumask_t selected,
58 void (*func) (void *info),
59 void *info,
60 int retry,
61 int wait);
63 /*
64 * Call a function on all processors
65 */
66 static inline int on_each_cpu(
67 void (*func) (void *info),
68 void *info,
69 int retry,
70 int wait)
71 {
72 int ret = smp_call_function(func, info, retry, wait);
73 func(info);
74 return ret;
75 }
77 /*
78 * Mark the boot cpu "online" so that it can call console drivers in
79 * printk() and can access its per-cpu storage.
80 */
81 void smp_prepare_boot_cpu(void);
83 #else
85 /*
86 * These macros fold the SMP functionality into a single CPU system
87 */
89 #define smp_send_event_check_mask(m) ((void)0)
90 #define smp_send_event_check_cpu(p) ((void)0)
91 #define raw_smp_processor_id() 0
92 #define hard_smp_processor_id() 0
93 #define smp_call_function(func,info,retry,wait) ({ do {} while (0); 0; })
94 #define on_each_cpu(func,info,retry,wait) ({ func(info); 0; })
95 #define num_booting_cpus() 1
96 #define smp_prepare_boot_cpu() do {} while (0)
98 static inline int on_selected_cpus(
99 cpumask_t selected,
100 void (*func) (void *info),
101 void *info,
102 int retry,
103 int wait)
104 {
105 if ( cpu_isset(0, selected) )
106 func(info);
107 return 0;
108 }
110 #endif
112 #define smp_processor_id() raw_smp_processor_id()
114 #endif