aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBrian Gerst <brgerst@gmail.com>2009-01-18 10:38:58 -0500
committerTejun Heo <tj@kernel.org>2009-01-18 10:38:58 -0500
commitea9279066de44053d0c20ea855bc9f4706652d84 (patch)
tree73c19b9112375ee0df8373b004105f05e1a196f4 /arch
parent92d65b2371d86d40807e1dbfdccadc4d501edcde (diff)
x86-64: Move cpu number from PDA to per-cpu and consolidate with 32-bit.
tj: moved cpu_number definition out of CONFIG_HAVE_SETUP_PER_CPU_AREA for voyager. Signed-off-by: Brian Gerst <brgerst@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/pda.h2
-rw-r--r--arch/x86/include/asm/smp.h4
-rw-r--r--arch/x86/kernel/asm-offsets_64.c1
-rw-r--r--arch/x86/kernel/cpu/common.c1
-rw-r--r--arch/x86/kernel/process_32.c3
-rw-r--r--arch/x86/kernel/setup_percpu.c10
-rw-r--r--arch/x86/kernel/smpcommon.c2
7 files changed, 12 insertions, 11 deletions
diff --git a/arch/x86/include/asm/pda.h b/arch/x86/include/asm/pda.h
index 09965f7a2165..668d5a5b6f70 100644
--- a/arch/x86/include/asm/pda.h
+++ b/arch/x86/include/asm/pda.h
@@ -16,7 +16,7 @@ struct x8664_pda {
16 unsigned long kernelstack; /* 16 top of kernel stack for current */ 16 unsigned long kernelstack; /* 16 top of kernel stack for current */
17 unsigned long oldrsp; /* 24 user rsp for system call */ 17 unsigned long oldrsp; /* 24 user rsp for system call */
18 int irqcount; /* 32 Irq nesting counter. Starts -1 */ 18 int irqcount; /* 32 Irq nesting counter. Starts -1 */
19 unsigned int cpunumber; /* 36 Logical CPU number */ 19 unsigned int unused6; /* 36 was cpunumber */
20#ifdef CONFIG_CC_STACKPROTECTOR 20#ifdef CONFIG_CC_STACKPROTECTOR
21 unsigned long stack_canary; /* 40 stack canary value */ 21 unsigned long stack_canary; /* 40 stack canary value */
22 /* gcc-ABI: this canary MUST be at 22 /* gcc-ABI: this canary MUST be at
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index c7bbbbe65d3f..68636e767a91 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -25,9 +25,7 @@ extern unsigned int num_processors;
25DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); 25DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
26DECLARE_PER_CPU(cpumask_t, cpu_core_map); 26DECLARE_PER_CPU(cpumask_t, cpu_core_map);
27DECLARE_PER_CPU(u16, cpu_llc_id); 27DECLARE_PER_CPU(u16, cpu_llc_id);
28#ifdef CONFIG_X86_32
29DECLARE_PER_CPU(int, cpu_number); 28DECLARE_PER_CPU(int, cpu_number);
30#endif
31 29
32static inline struct cpumask *cpu_sibling_mask(int cpu) 30static inline struct cpumask *cpu_sibling_mask(int cpu)
33{ 31{
@@ -164,7 +162,7 @@ extern unsigned disabled_cpus __cpuinitdata;
164extern int safe_smp_processor_id(void); 162extern int safe_smp_processor_id(void);
165 163
166#elif defined(CONFIG_X86_64_SMP) 164#elif defined(CONFIG_X86_64_SMP)
167#define raw_smp_processor_id() read_pda(cpunumber) 165#define raw_smp_processor_id() (percpu_read(cpu_number))
168 166
169#define stack_smp_processor_id() \ 167#define stack_smp_processor_id() \
170({ \ 168({ \
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index 5b821fbdaf7b..cae6697c0991 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -53,7 +53,6 @@ int main(void)
53 ENTRY(oldrsp); 53 ENTRY(oldrsp);
54 ENTRY(pcurrent); 54 ENTRY(pcurrent);
55 ENTRY(irqcount); 55 ENTRY(irqcount);
56 ENTRY(cpunumber);
57 DEFINE(pda_size, sizeof(struct x8664_pda)); 56 DEFINE(pda_size, sizeof(struct x8664_pda));
58 BLANK(); 57 BLANK();
59#undef ENTRY 58#undef ENTRY
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index b6d7eec0be77..4221e920886d 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -899,7 +899,6 @@ void __cpuinit pda_init(int cpu)
899 899
900 load_pda_offset(cpu); 900 load_pda_offset(cpu);
901 901
902 pda->cpunumber = cpu;
903 pda->irqcount = -1; 902 pda->irqcount = -1;
904 pda->kernelstack = (unsigned long)stack_thread_info() - 903 pda->kernelstack = (unsigned long)stack_thread_info() -
905 PDA_STACKOFFSET + THREAD_SIZE; 904 PDA_STACKOFFSET + THREAD_SIZE;
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 77d546817d94..2c00a57ccb90 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -66,9 +66,6 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
66DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task; 66DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task;
67EXPORT_PER_CPU_SYMBOL(current_task); 67EXPORT_PER_CPU_SYMBOL(current_task);
68 68
69DEFINE_PER_CPU(int, cpu_number);
70EXPORT_PER_CPU_SYMBOL(cpu_number);
71
72/* 69/*
73 * Return saved PC of a blocked thread. 70 * Return saved PC of a blocked thread.
74 */ 71 */
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 8b53ef83c611..258497f93f4d 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -22,6 +22,15 @@
22# define DBG(x...) 22# define DBG(x...)
23#endif 23#endif
24 24
25/*
26 * Could be inside CONFIG_HAVE_SETUP_PER_CPU_AREA with other stuff but
27 * voyager wants cpu_number too.
28 */
29#ifdef CONFIG_SMP
30DEFINE_PER_CPU(int, cpu_number);
31EXPORT_PER_CPU_SYMBOL(cpu_number);
32#endif
33
25#ifdef CONFIG_X86_LOCAL_APIC 34#ifdef CONFIG_X86_LOCAL_APIC
26unsigned int num_processors; 35unsigned int num_processors;
27unsigned disabled_cpus __cpuinitdata; 36unsigned disabled_cpus __cpuinitdata;
@@ -193,6 +202,7 @@ void __init setup_per_cpu_areas(void)
193 memcpy(ptr, __per_cpu_load, __per_cpu_end - __per_cpu_start); 202 memcpy(ptr, __per_cpu_load, __per_cpu_end - __per_cpu_start);
194 per_cpu_offset(cpu) = ptr - __per_cpu_start; 203 per_cpu_offset(cpu) = ptr - __per_cpu_start;
195 per_cpu(this_cpu_off, cpu) = per_cpu_offset(cpu); 204 per_cpu(this_cpu_off, cpu) = per_cpu_offset(cpu);
205 per_cpu(cpu_number, cpu) = cpu;
196#ifdef CONFIG_X86_64 206#ifdef CONFIG_X86_64
197 per_cpu(irq_stack_ptr, cpu) = 207 per_cpu(irq_stack_ptr, cpu) =
198 (char *)per_cpu(irq_stack, cpu) + IRQ_STACK_SIZE - 64; 208 (char *)per_cpu(irq_stack, cpu) + IRQ_STACK_SIZE - 64;
diff --git a/arch/x86/kernel/smpcommon.c b/arch/x86/kernel/smpcommon.c
index 7e157810062f..add36b4e37c9 100644
--- a/arch/x86/kernel/smpcommon.c
+++ b/arch/x86/kernel/smpcommon.c
@@ -28,7 +28,5 @@ __cpuinit void init_gdt(int cpu)
28 28
29 write_gdt_entry(get_cpu_gdt_table(cpu), 29 write_gdt_entry(get_cpu_gdt_table(cpu),
30 GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S); 30 GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S);
31
32 per_cpu(cpu_number, cpu) = cpu;
33} 31}
34#endif 32#endif