ia64/xen-unstable

view xen/include/xen/smp.h @ 7451:6450e40ad21a

smp_call_function() must be usable as an expression
return an integer.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Oct 20 11:27:51 2005 +0100 (2005-10-20)
parents 5d746b39e873
children b32cad914390
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), void *info, int retry, int wait);
50 /*
51 * Call a function on all processors
52 */
53 static inline int on_each_cpu(void (*func) (void *info), void *info,
54 int retry, int wait)
55 {
56 int ret = smp_call_function(func, info, retry, wait);
57 func(info);
58 return ret;
59 }
61 extern volatile unsigned long smp_msg_data;
62 extern volatile int smp_src_cpu;
63 extern volatile int smp_msg_id;
65 #define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */
66 #define MSG_ALL 0x8001
68 #define MSG_INVALIDATE_TLB 0x0001 /* Remote processor TLB invalidate */
69 #define MSG_STOP_CPU 0x0002 /* Sent to shut down slave CPU's
70 * when rebooting
71 */
72 #define MSG_RESCHEDULE 0x0003 /* Reschedule request from master CPU*/
73 #define MSG_CALL_FUNCTION 0x0004 /* Call function on all other CPUs */
75 /*
76 * Mark the boot cpu "online" so that it can call console drivers in
77 * printk() and can access its per-cpu storage.
78 */
79 void smp_prepare_boot_cpu(void);
81 #else
83 /*
84 * These macros fold the SMP functionality into a single CPU system
85 */
87 #define smp_send_event_check_mask(m) ((void)0)
88 #define smp_send_event_check_cpu(p) ((void)0)
89 #ifndef __smp_processor_id
90 #define smp_processor_id() 0
91 #endif
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 #endif
100 #ifdef __smp_processor_id
101 #define smp_processor_id() __smp_processor_id()
102 #else
103 extern unsigned int smp_processor_id(void);
104 #endif
106 #endif