aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/smp_32.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/smp_32.h')
-rw-r--r--include/asm-x86/smp_32.h119
1 files changed, 50 insertions, 69 deletions
diff --git a/include/asm-x86/smp_32.h b/include/asm-x86/smp_32.h
index e10b7affdfe..56152e31228 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__) 19extern cpumask_t cpu_callout_map;
14#include <linux/bitops.h> 20extern 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 22extern int smp_num_siblings;
23#ifdef CONFIG_SMP 23extern unsigned int num_processors;
24#ifndef __ASSEMBLY__
25 24
26/*
27 * Private routines/data
28 */
29
30extern void smp_alloc_memory(void); 25extern void smp_alloc_memory(void);
31extern int pic_mode; 26extern void lock_ipi_call_lock(void);
32extern int smp_num_siblings; 27extern void unlock_ipi_call_lock(void);
33DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
34DECLARE_PER_CPU(cpumask_t, cpu_core_map);
35 28
36extern void (*mtrr_hook) (void); 29extern void (*mtrr_hook) (void);
37extern void zap_low_mappings (void); 30extern void zap_low_mappings (void);
38extern void lock_ipi_call_lock(void);
39extern void unlock_ipi_call_lock(void);
40 31
41#define MAX_APICID 256
42extern u8 __initdata x86_cpu_to_apicid_init[]; 32extern u8 __initdata x86_cpu_to_apicid_init[];
43extern void *x86_cpu_to_apicid_ptr; 33extern void *x86_cpu_to_apicid_early_ptr;
44DECLARE_PER_CPU(u8, x86_cpu_to_apicid);
45
46#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
47 34
48extern void set_cpu_sibling_map(int cpu); 35DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
36DECLARE_PER_CPU(cpumask_t, cpu_core_map);
37DECLARE_PER_CPU(u8, cpu_llc_id);
38DECLARE_PER_CPU(u8, x86_cpu_to_apicid);
49 39
50#ifdef CONFIG_HOTPLUG_CPU 40#ifdef CONFIG_HOTPLUG_CPU
51extern void cpu_exit_clear(void); 41extern void cpu_exit_clear(void);
@@ -53,6 +43,9 @@ extern void cpu_uninit(void);
53extern void remove_siblinginfo(int cpu); 43extern void remove_siblinginfo(int cpu);
54#endif 44#endif
55 45
46/* Globals due to paravirt */
47extern void set_cpu_sibling_map(int cpu);
48
56struct smp_ops 49struct 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
70extern struct smp_ops smp_ops; 64extern struct smp_ops smp_ops;
71 65
72static inline void smp_prepare_boot_cpu(void) 66static inline void smp_prepare_boot_cpu(void)
@@ -107,10 +101,12 @@ int native_cpu_up(unsigned int cpunum);
107void native_smp_cpus_done(unsigned int max_cpus); 101void 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)
111do { } while (0)
112#endif 105#endif
113 106
107extern int __cpu_disable(void);
108extern 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)
119DECLARE_PER_CPU(int, cpu_number); 115DECLARE_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
122extern cpumask_t cpu_callout_map; 118#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
123extern cpumask_t cpu_callin_map; 119
124extern cpumask_t cpu_possible_map; 120extern int safe_smp_processor_id(void);
121
122void __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 */
127static inline int num_booting_cpus(void) 125static 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
132extern int safe_smp_processor_id(void);
133extern int __cpu_disable(void);
134extern void __cpu_die(unsigned int cpu);
135extern unsigned int num_processors;
136
137void __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 139static __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
155extern int hard_smp_processor_id(void); 146extern int hard_smp_processor_id(void);
156#else 147# else
157#include <mach_apicdef.h> 148# include <mach_apicdef.h>
158static inline int hard_smp_processor_id(void) 149static 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
173extern u8 apicid_2_node[]; 164#endif /* !ASSEMBLY */
174
175#ifdef CONFIG_X86_LOCAL_APIC
176static __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