VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / include / asm-s390 / smp.h
1 /*
2  *  include/asm-s390/smp.h
3  *
4  *  S390 version
5  *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6  *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
7  *               Martin Schwidefsky (schwidefsky@de.ibm.com)
8  *               Heiko Carstens (heiko.carstens@de.ibm.com)
9  */
10 #ifndef __ASM_SMP_H
11 #define __ASM_SMP_H
12
13 #include <linux/config.h>
14 #include <linux/threads.h>
15 #include <linux/cpumask.h>
16 #include <linux/bitops.h>
17
18 #if defined(__KERNEL__) && defined(CONFIG_SMP) && !defined(__ASSEMBLY__)
19
20 #include <asm/lowcore.h>
21
22 /*
23   s390 specific smp.c headers
24  */
25 typedef struct
26 {
27         int        intresting;
28         sigp_ccode ccode; 
29         __u32      status;
30         __u16      cpu;
31 } sigp_info;
32
33 extern int smp_call_function_on(void (*func) (void *info), void *info,
34                                 int nonatomic, int wait, int cpu);
35 #define NO_PROC_ID              0xFF            /* No processor magic marker */
36
37 /*
38  *      This magic constant controls our willingness to transfer
39  *      a process across CPUs. Such a transfer incurs misses on the L1
40  *      cache, and on a P6 or P5 with multiple L2 caches L2 hits. My
41  *      gut feeling is this will vary by board in value. For a board
42  *      with separate L2 cache it probably depends also on the RSS, and
43  *      for a board with shared L2 cache it ought to decay fast as other
44  *      processes are run.
45  */
46  
47 #define PROC_CHANGE_PENALTY     20              /* Schedule penalty */
48
49 #define smp_processor_id() (S390_lowcore.cpu_data.cpu_nr)
50
51 extern int smp_get_cpu(cpumask_t cpu_map);
52 extern void smp_put_cpu(int cpu);
53
54 extern __inline__ __u16 hard_smp_processor_id(void)
55 {
56         __u16 cpu_address;
57  
58         __asm__ ("stap %0\n" : "=m" (cpu_address));
59         return cpu_address;
60 }
61
62 #define cpu_logical_map(cpu) (cpu)
63
64 extern int __cpu_disable (void);
65 extern void __cpu_die (unsigned int cpu);
66 extern void cpu_die (void) __attribute__ ((noreturn));
67 extern int __cpu_up (unsigned int cpu);
68
69 #endif
70
71 #ifndef CONFIG_SMP
72 static inline int
73 smp_call_function_on(void (*func) (void *info), void *info,
74                      int nonatomic, int wait, int cpu)
75 {
76         func(info);
77         return 0;
78 }
79 #define smp_get_cpu(cpu) ({ 0; })
80 #define smp_put_cpu(cpu) ({ 0; })
81 #endif
82
83 #endif