diff options
Diffstat (limited to 'arch/x86/include/asm/smp.h')
| -rw-r--r-- | arch/x86/include/asm/smp.h | 82 |
1 files changed, 10 insertions, 72 deletions
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 19953df61c52..19e0d88b966d 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h | |||
| @@ -15,53 +15,25 @@ | |||
| 15 | # include <asm/io_apic.h> | 15 | # include <asm/io_apic.h> |
| 16 | # endif | 16 | # endif |
| 17 | #endif | 17 | #endif |
| 18 | #include <asm/pda.h> | ||
| 19 | #include <asm/thread_info.h> | 18 | #include <asm/thread_info.h> |
| 20 | 19 | #include <asm/cpumask.h> | |
| 21 | #ifdef CONFIG_X86_64 | ||
| 22 | |||
| 23 | extern cpumask_var_t cpu_callin_mask; | ||
| 24 | extern cpumask_var_t cpu_callout_mask; | ||
| 25 | extern cpumask_var_t cpu_initialized_mask; | ||
| 26 | extern cpumask_var_t cpu_sibling_setup_mask; | ||
| 27 | |||
| 28 | #else /* CONFIG_X86_32 */ | ||
| 29 | |||
| 30 | extern cpumask_t cpu_callin_map; | ||
| 31 | extern cpumask_t cpu_callout_map; | ||
| 32 | extern cpumask_t cpu_initialized; | ||
| 33 | extern cpumask_t cpu_sibling_setup_map; | ||
| 34 | |||
| 35 | #define cpu_callin_mask ((struct cpumask *)&cpu_callin_map) | ||
| 36 | #define cpu_callout_mask ((struct cpumask *)&cpu_callout_map) | ||
| 37 | #define cpu_initialized_mask ((struct cpumask *)&cpu_initialized) | ||
| 38 | #define cpu_sibling_setup_mask ((struct cpumask *)&cpu_sibling_setup_map) | ||
| 39 | |||
| 40 | #endif /* CONFIG_X86_32 */ | ||
| 41 | |||
| 42 | extern void (*mtrr_hook)(void); | ||
| 43 | extern void zap_low_mappings(void); | ||
| 44 | |||
| 45 | extern int __cpuinit get_local_pda(int cpu); | ||
| 46 | 20 | ||
| 47 | extern int smp_num_siblings; | 21 | extern int smp_num_siblings; |
| 48 | extern unsigned int num_processors; | 22 | extern unsigned int num_processors; |
| 49 | 23 | ||
| 50 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); | 24 | DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_map); |
| 51 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); | 25 | DECLARE_PER_CPU(cpumask_var_t, cpu_core_map); |
| 52 | DECLARE_PER_CPU(u16, cpu_llc_id); | 26 | DECLARE_PER_CPU(u16, cpu_llc_id); |
| 53 | #ifdef CONFIG_X86_32 | ||
| 54 | DECLARE_PER_CPU(int, cpu_number); | 27 | DECLARE_PER_CPU(int, cpu_number); |
| 55 | #endif | ||
| 56 | 28 | ||
| 57 | static inline struct cpumask *cpu_sibling_mask(int cpu) | 29 | static inline struct cpumask *cpu_sibling_mask(int cpu) |
| 58 | { | 30 | { |
| 59 | return &per_cpu(cpu_sibling_map, cpu); | 31 | return per_cpu(cpu_sibling_map, cpu); |
| 60 | } | 32 | } |
| 61 | 33 | ||
| 62 | static inline struct cpumask *cpu_core_mask(int cpu) | 34 | static inline struct cpumask *cpu_core_mask(int cpu) |
| 63 | { | 35 | { |
| 64 | return &per_cpu(cpu_core_map, cpu); | 36 | return per_cpu(cpu_core_map, cpu); |
| 65 | } | 37 | } |
| 66 | 38 | ||
| 67 | DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid); | 39 | DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid); |
| @@ -149,9 +121,10 @@ static inline void arch_send_call_function_single_ipi(int cpu) | |||
| 149 | smp_ops.send_call_func_single_ipi(cpu); | 121 | smp_ops.send_call_func_single_ipi(cpu); |
| 150 | } | 122 | } |
| 151 | 123 | ||
| 152 | static inline void arch_send_call_function_ipi(cpumask_t mask) | 124 | #define arch_send_call_function_ipi_mask arch_send_call_function_ipi_mask |
| 125 | static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask) | ||
| 153 | { | 126 | { |
| 154 | smp_ops.send_call_func_ipi(&mask); | 127 | smp_ops.send_call_func_ipi(mask); |
| 155 | } | 128 | } |
| 156 | 129 | ||
| 157 | void cpu_disable_common(void); | 130 | void cpu_disable_common(void); |
| @@ -167,8 +140,6 @@ void play_dead_common(void); | |||
| 167 | void native_send_call_func_ipi(const struct cpumask *mask); | 140 | void native_send_call_func_ipi(const struct cpumask *mask); |
| 168 | void native_send_call_func_single_ipi(int cpu); | 141 | void native_send_call_func_single_ipi(int cpu); |
| 169 | 142 | ||
| 170 | extern void prefill_possible_map(void); | ||
| 171 | |||
| 172 | void smp_store_cpu_info(int id); | 143 | void smp_store_cpu_info(int id); |
| 173 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) | 144 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) |
| 174 | 145 | ||
| @@ -177,10 +148,6 @@ static inline int num_booting_cpus(void) | |||
| 177 | { | 148 | { |
| 178 | return cpumask_weight(cpu_callout_mask); | 149 | return cpumask_weight(cpu_callout_mask); |
| 179 | } | 150 | } |
| 180 | #else | ||
| 181 | static inline void prefill_possible_map(void) | ||
| 182 | { | ||
| 183 | } | ||
| 184 | #endif /* CONFIG_SMP */ | 151 | #endif /* CONFIG_SMP */ |
| 185 | 152 | ||
| 186 | extern unsigned disabled_cpus __cpuinitdata; | 153 | extern unsigned disabled_cpus __cpuinitdata; |
| @@ -191,11 +158,11 @@ extern unsigned disabled_cpus __cpuinitdata; | |||
| 191 | * from the initial startup. We map APIC_BASE very early in page_setup(), | 158 | * from the initial startup. We map APIC_BASE very early in page_setup(), |
| 192 | * so this is correct in the x86 case. | 159 | * so this is correct in the x86 case. |
| 193 | */ | 160 | */ |
| 194 | #define raw_smp_processor_id() (x86_read_percpu(cpu_number)) | 161 | #define raw_smp_processor_id() (percpu_read(cpu_number)) |
| 195 | extern int safe_smp_processor_id(void); | 162 | extern int safe_smp_processor_id(void); |
| 196 | 163 | ||
| 197 | #elif defined(CONFIG_X86_64_SMP) | 164 | #elif defined(CONFIG_X86_64_SMP) |
| 198 | #define raw_smp_processor_id() read_pda(cpunumber) | 165 | #define raw_smp_processor_id() (percpu_read(cpu_number)) |
| 199 | 166 | ||
| 200 | #define stack_smp_processor_id() \ | 167 | #define stack_smp_processor_id() \ |
| 201 | ({ \ | 168 | ({ \ |
| @@ -205,10 +172,6 @@ extern int safe_smp_processor_id(void); | |||
| 205 | }) | 172 | }) |
| 206 | #define safe_smp_processor_id() smp_processor_id() | 173 | #define safe_smp_processor_id() smp_processor_id() |
| 207 | 174 | ||
| 208 | #else /* !CONFIG_X86_32_SMP && !CONFIG_X86_64_SMP */ | ||
| 209 | #define cpu_physical_id(cpu) boot_cpu_physical_apicid | ||
| 210 | #define safe_smp_processor_id() 0 | ||
| 211 | #define stack_smp_processor_id() 0 | ||
| 212 | #endif | 175 | #endif |
| 213 | 176 | ||
| 214 | #ifdef CONFIG_X86_LOCAL_APIC | 177 | #ifdef CONFIG_X86_LOCAL_APIC |
| @@ -220,28 +183,9 @@ static inline int logical_smp_processor_id(void) | |||
| 220 | return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR)); | 183 | return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR)); |
| 221 | } | 184 | } |
| 222 | 185 | ||
| 223 | #include <mach_apicdef.h> | ||
| 224 | static inline unsigned int read_apic_id(void) | ||
| 225 | { | ||
| 226 | unsigned int reg; | ||
| 227 | |||
| 228 | reg = *(u32 *)(APIC_BASE + APIC_ID); | ||
| 229 | |||
| 230 | return GET_APIC_ID(reg); | ||
| 231 | } | ||
| 232 | #endif | 186 | #endif |
| 233 | 187 | ||
| 234 | |||
| 235 | # if defined(APIC_DEFINITION) || defined(CONFIG_X86_64) | ||
| 236 | extern int hard_smp_processor_id(void); | 188 | extern int hard_smp_processor_id(void); |
| 237 | # else | ||
| 238 | #include <mach_apicdef.h> | ||
| 239 | static inline int hard_smp_processor_id(void) | ||
| 240 | { | ||
| 241 | /* we don't want to mark this access volatile - bad code generation */ | ||
| 242 | return read_apic_id(); | ||
| 243 | } | ||
| 244 | # endif /* APIC_DEFINITION */ | ||
| 245 | 189 | ||
| 246 | #else /* CONFIG_X86_LOCAL_APIC */ | 190 | #else /* CONFIG_X86_LOCAL_APIC */ |
| 247 | 191 | ||
| @@ -251,11 +195,5 @@ static inline int hard_smp_processor_id(void) | |||
| 251 | 195 | ||
| 252 | #endif /* CONFIG_X86_LOCAL_APIC */ | 196 | #endif /* CONFIG_X86_LOCAL_APIC */ |
| 253 | 197 | ||
| 254 | #ifdef CONFIG_X86_HAS_BOOT_CPU_ID | ||
| 255 | extern unsigned char boot_cpu_id; | ||
| 256 | #else | ||
| 257 | #define boot_cpu_id 0 | ||
| 258 | #endif | ||
| 259 | |||
| 260 | #endif /* __ASSEMBLY__ */ | 198 | #endif /* __ASSEMBLY__ */ |
| 261 | #endif /* _ASM_X86_SMP_H */ | 199 | #endif /* _ASM_X86_SMP_H */ |
