diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-01-30 07:30:36 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:30:36 -0500 |
commit | ae9d983be1eefac4b5efad69a188e7ac89a75797 (patch) | |
tree | ecdf7ad736e1fe98dff2277649b573135d1381fd /include/asm-x86/smp_32.h | |
parent | c2805aa1d8ae51c7582d2ccbd736afa545cf5cc4 (diff) |
x86: cleanup smp.h variants
Bring the smp.h variants into sync to prepare merging and
paravirt support.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/smp_32.h')
-rw-r--r-- | include/asm-x86/smp_32.h | 117 |
1 files changed, 49 insertions, 68 deletions
diff --git a/include/asm-x86/smp_32.h b/include/asm-x86/smp_32.h index e10b7affdfe5..c69e960429cc 100644 --- a/include/asm-x86/smp_32.h +++ b/include/asm-x86/smp_32.h | |||
@@ -1,51 +1,41 @@ | |||
1 | #ifndef __ASM_SMP_H | 1 | #ifndef __ASM_SMP_H |
2 | #define __ASM_SMP_H | 2 | #define __ASM_SMP_H |
3 | 3 | ||
4 | #ifndef __ASSEMBLY__ | ||
5 | #include <linux/cpumask.h> | ||
6 | #include <linux/init.h> | ||
7 | |||
4 | /* | 8 | /* |
5 | * We need the APIC definitions automatically as part of 'smp.h' | 9 | * We need the APIC definitions automatically as part of 'smp.h' |
6 | */ | 10 | */ |
7 | #ifndef __ASSEMBLY__ | 11 | #ifdef CONFIG_X86_LOCAL_APIC |
8 | #include <linux/kernel.h> | 12 | # include <asm/mpspec.h> |
9 | #include <linux/threads.h> | 13 | # include <asm/apic.h> |
10 | #include <linux/cpumask.h> | 14 | # ifdef CONFIG_X86_IO_APIC |
15 | # include <asm/io_apic.h> | ||
16 | # endif | ||
11 | #endif | 17 | #endif |
12 | 18 | ||
13 | #if defined(CONFIG_X86_LOCAL_APIC) && !defined(__ASSEMBLY__) | 19 | extern cpumask_t cpu_callout_map; |
14 | #include <linux/bitops.h> | 20 | extern cpumask_t cpu_callin_map; |
15 | #include <asm/mpspec.h> | ||
16 | #include <asm/apic.h> | ||
17 | #ifdef CONFIG_X86_IO_APIC | ||
18 | #include <asm/io_apic.h> | ||
19 | #endif | ||
20 | #endif | ||
21 | 21 | ||
22 | #define BAD_APICID 0xFFu | 22 | extern int smp_num_siblings; |
23 | #ifdef CONFIG_SMP | 23 | extern unsigned int num_processors; |
24 | #ifndef __ASSEMBLY__ | ||
25 | 24 | ||
26 | /* | ||
27 | * Private routines/data | ||
28 | */ | ||
29 | |||
30 | extern void smp_alloc_memory(void); | 25 | extern void smp_alloc_memory(void); |
31 | extern int pic_mode; | 26 | extern void lock_ipi_call_lock(void); |
32 | extern int smp_num_siblings; | 27 | extern void unlock_ipi_call_lock(void); |
33 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); | ||
34 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); | ||
35 | 28 | ||
36 | extern void (*mtrr_hook) (void); | 29 | extern void (*mtrr_hook) (void); |
37 | extern void zap_low_mappings (void); | 30 | extern void zap_low_mappings (void); |
38 | extern void lock_ipi_call_lock(void); | ||
39 | extern void unlock_ipi_call_lock(void); | ||
40 | 31 | ||
41 | #define MAX_APICID 256 | ||
42 | extern u8 __initdata x86_cpu_to_apicid_init[]; | 32 | extern u8 __initdata x86_cpu_to_apicid_init[]; |
43 | extern void *x86_cpu_to_apicid_ptr; | 33 | extern void *x86_cpu_to_apicid_ptr; |
44 | DECLARE_PER_CPU(u8, x86_cpu_to_apicid); | ||
45 | |||
46 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) | ||
47 | 34 | ||
48 | extern void set_cpu_sibling_map(int cpu); | 35 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); |
36 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); | ||
37 | DECLARE_PER_CPU(u8, cpu_llc_id); | ||
38 | DECLARE_PER_CPU(u8, x86_cpu_to_apicid); | ||
49 | 39 | ||
50 | #ifdef CONFIG_HOTPLUG_CPU | 40 | #ifdef CONFIG_HOTPLUG_CPU |
51 | extern void cpu_exit_clear(void); | 41 | extern void cpu_exit_clear(void); |
@@ -53,6 +43,9 @@ extern void cpu_uninit(void); | |||
53 | extern void remove_siblinginfo(int cpu); | 43 | extern void remove_siblinginfo(int cpu); |
54 | #endif | 44 | #endif |
55 | 45 | ||
46 | /* Globals due to paravirt */ | ||
47 | extern void set_cpu_sibling_map(int cpu); | ||
48 | |||
56 | struct smp_ops | 49 | struct smp_ops |
57 | { | 50 | { |
58 | void (*smp_prepare_boot_cpu)(void); | 51 | void (*smp_prepare_boot_cpu)(void); |
@@ -67,6 +60,7 @@ struct smp_ops | |||
67 | int wait); | 60 | int wait); |
68 | }; | 61 | }; |
69 | 62 | ||
63 | #ifdef CONFIG_SMP | ||
70 | extern struct smp_ops smp_ops; | 64 | extern struct smp_ops smp_ops; |
71 | 65 | ||
72 | static inline void smp_prepare_boot_cpu(void) | 66 | static inline void smp_prepare_boot_cpu(void) |
@@ -107,10 +101,12 @@ int native_cpu_up(unsigned int cpunum); | |||
107 | void native_smp_cpus_done(unsigned int max_cpus); | 101 | void native_smp_cpus_done(unsigned int max_cpus); |
108 | 102 | ||
109 | #ifndef CONFIG_PARAVIRT | 103 | #ifndef CONFIG_PARAVIRT |
110 | #define startup_ipi_hook(phys_apicid, start_eip, start_esp) \ | 104 | #define startup_ipi_hook(phys_apicid, start_eip, start_esp) do { } while (0) |
111 | do { } while (0) | ||
112 | #endif | 105 | #endif |
113 | 106 | ||
107 | extern int __cpu_disable(void); | ||
108 | extern void __cpu_die(unsigned int cpu); | ||
109 | |||
114 | /* | 110 | /* |
115 | * This function is needed by all SMP systems. It must _always_ be valid | 111 | * This function is needed by all SMP systems. It must _always_ be valid |
116 | * from the initial startup. We map APIC_BASE very early in page_setup(), | 112 | * from the initial startup. We map APIC_BASE very early in page_setup(), |
@@ -119,9 +115,11 @@ do { } while (0) | |||
119 | DECLARE_PER_CPU(int, cpu_number); | 115 | DECLARE_PER_CPU(int, cpu_number); |
120 | #define raw_smp_processor_id() (x86_read_percpu(cpu_number)) | 116 | #define raw_smp_processor_id() (x86_read_percpu(cpu_number)) |
121 | 117 | ||
122 | extern cpumask_t cpu_callout_map; | 118 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) |
123 | extern cpumask_t cpu_callin_map; | 119 | |
124 | extern cpumask_t cpu_possible_map; | 120 | extern int safe_smp_processor_id(void); |
121 | |||
122 | void __cpuinit smp_store_cpu_info(int id); | ||
125 | 123 | ||
126 | /* We don't mark CPUs online until __cpu_up(), so we need another measure */ | 124 | /* We don't mark CPUs online until __cpu_up(), so we need another measure */ |
127 | static inline int num_booting_cpus(void) | 125 | static inline int num_booting_cpus(void) |
@@ -129,56 +127,39 @@ static inline int num_booting_cpus(void) | |||
129 | return cpus_weight(cpu_callout_map); | 127 | return cpus_weight(cpu_callout_map); |
130 | } | 128 | } |
131 | 129 | ||
132 | extern int safe_smp_processor_id(void); | ||
133 | extern int __cpu_disable(void); | ||
134 | extern void __cpu_die(unsigned int cpu); | ||
135 | extern unsigned int num_processors; | ||
136 | |||
137 | void __cpuinit smp_store_cpu_info(int id); | ||
138 | |||
139 | #endif /* !__ASSEMBLY__ */ | ||
140 | |||
141 | #else /* CONFIG_SMP */ | 130 | #else /* CONFIG_SMP */ |
142 | 131 | ||
143 | #define safe_smp_processor_id() 0 | 132 | #define safe_smp_processor_id() 0 |
144 | #define cpu_physical_id(cpu) boot_cpu_physical_apicid | 133 | #define cpu_physical_id(cpu) boot_cpu_physical_apicid |
145 | 134 | ||
146 | #define NO_PROC_ID 0xFF /* No processor magic marker */ | 135 | #endif /* !CONFIG_SMP */ |
147 | |||
148 | #endif /* CONFIG_SMP */ | ||
149 | |||
150 | #ifndef __ASSEMBLY__ | ||
151 | 136 | ||
152 | #ifdef CONFIG_X86_LOCAL_APIC | 137 | #ifdef CONFIG_X86_LOCAL_APIC |
153 | 138 | ||
154 | #ifdef APIC_DEFINITION | 139 | static __inline int logical_smp_processor_id(void) |
140 | { | ||
141 | /* we don't want to mark this access volatile - bad code generation */ | ||
142 | return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR)); | ||
143 | } | ||
144 | |||
145 | # ifdef APIC_DEFINITION | ||
155 | extern int hard_smp_processor_id(void); | 146 | extern int hard_smp_processor_id(void); |
156 | #else | 147 | # else |
157 | #include <mach_apicdef.h> | 148 | # include <mach_apicdef.h> |
158 | static inline int hard_smp_processor_id(void) | 149 | static inline int hard_smp_processor_id(void) |
159 | { | 150 | { |
160 | /* we don't want to mark this access volatile - bad code generation */ | 151 | /* we don't want to mark this access volatile - bad code generation */ |
161 | return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID)); | 152 | return GET_APIC_ID(*(u32 *)(APIC_BASE + APIC_ID)); |
162 | } | 153 | } |
163 | #endif /* APIC_DEFINITION */ | 154 | # endif /* APIC_DEFINITION */ |
164 | 155 | ||
165 | #else /* CONFIG_X86_LOCAL_APIC */ | 156 | #else /* CONFIG_X86_LOCAL_APIC */ |
166 | 157 | ||
167 | #ifndef CONFIG_SMP | 158 | # ifndef CONFIG_SMP |
168 | #define hard_smp_processor_id() 0 | 159 | # define hard_smp_processor_id() 0 |
169 | #endif | 160 | # endif |
170 | 161 | ||
171 | #endif /* CONFIG_X86_LOCAL_APIC */ | 162 | #endif /* CONFIG_X86_LOCAL_APIC */ |
172 | 163 | ||
173 | extern u8 apicid_2_node[]; | 164 | #endif /* !ASSEMBLY */ |
174 | |||
175 | #ifdef CONFIG_X86_LOCAL_APIC | ||
176 | static __inline int logical_smp_processor_id(void) | ||
177 | { | ||
178 | /* we don't want to mark this access volatile - bad code generation */ | ||
179 | return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); | ||
180 | } | ||
181 | #endif | ||
182 | #endif | ||
183 | |||
184 | #endif | 165 | #endif |