ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[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  */
9 #ifndef __ASM_SMP_H
10 #define __ASM_SMP_H
11
12 #include <linux/config.h>
13 #include <linux/threads.h>
14 #include <linux/cpumask.h>
15 #include <linux/bitops.h>
16
17 #if defined(__KERNEL__) && defined(CONFIG_SMP) && !defined(__ASSEMBLY__)
18
19 #include <asm/lowcore.h>
20
21 /*
22   s390 specific smp.c headers
23  */
24 typedef struct
25 {
26         int        intresting;
27         sigp_ccode ccode; 
28         __u32      status;
29         __u16      cpu;
30 } sigp_info;
31
32 extern int smp_call_function_on(void (*func) (void *info), void *info,
33                                 int nonatomic, int wait, int cpu);
34
35 extern cpumask_t cpu_online_map;
36 extern cpumask_t cpu_possible_map;
37
38 #define NO_PROC_ID              0xFF            /* No processor magic marker */
39
40 /*
41  *      This magic constant controls our willingness to transfer
42  *      a process across CPUs. Such a transfer incurs misses on the L1
43  *      cache, and on a P6 or P5 with multiple L2 caches L2 hits. My
44  *      gut feeling is this will vary by board in value. For a board
45  *      with separate L2 cache it probably depends also on the RSS, and
46  *      for a board with shared L2 cache it ought to decay fast as other
47  *      processes are run.
48  */
49  
50 #define PROC_CHANGE_PENALTY     20              /* Schedule penalty */
51
52 #define smp_processor_id() (S390_lowcore.cpu_data.cpu_nr)
53
54 #define cpu_online(cpu) cpu_isset(cpu, cpu_online_map)
55
56 extern __inline__ __u16 hard_smp_processor_id(void)
57 {
58         __u16 cpu_address;
59  
60         __asm__ ("stap %0\n" : "=m" (cpu_address));
61         return cpu_address;
62 }
63
64 #define cpu_logical_map(cpu) (cpu)
65
66 #endif
67
68 #ifndef CONFIG_SMP
69 #define smp_call_function_on(func,info,nonatomic,wait,cpu)      ({ 0; })
70 #endif
71
72 #endif