aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/smpboot.c
diff options
context:
space:
mode:
authorGlauber Costa <gcosta@redhat.com>2008-05-28 19:19:53 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-08 06:48:16 -0400
commita939098afcfa5f81d3474782ec15c6d114e57763 (patch)
tree62c21fb10d6b58dc8247c34e68ab5562e045b8d0 /arch/x86/kernel/smpboot.c
parent736f12bff9d9e7b4e895c64f73b190c8383fc2a1 (diff)
x86: move x86_64 gdt closer to i386
i386 and x86_64 used two different schemes for maintaining the gdt. With this patch, x86_64 initial gdt table is defined in a .c file, same way as i386 is now. Also, we call it "gdt_page", and the descriptor, "early_gdt_descr". This way we achieve common naming, which can allow for more code integration. Signed-off-by: Glauber Costa <gcosta@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/smpboot.c')
-rw-r--r--arch/x86/kernel/smpboot.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index a71e3cad5470..fe2bd515d6cc 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -849,14 +849,8 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
849 .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done), 849 .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
850 }; 850 };
851 INIT_WORK(&c_idle.work, do_fork_idle); 851 INIT_WORK(&c_idle.work, do_fork_idle);
852#ifdef CONFIG_X86_64
853 /* allocate memory for gdts of secondary cpus. Hotplug is considered */
854 if (!cpu_gdt_descr[cpu].address &&
855 !(cpu_gdt_descr[cpu].address = get_zeroed_page(GFP_KERNEL))) {
856 printk(KERN_ERR "Failed to allocate GDT for CPU %d\n", cpu);
857 return -1;
858 }
859 852
853#ifdef CONFIG_X86_64
860 /* Allocate node local memory for AP pdas */ 854 /* Allocate node local memory for AP pdas */
861 if (cpu > 0) { 855 if (cpu > 0) {
862 boot_error = get_local_pda(cpu); 856 boot_error = get_local_pda(cpu);
@@ -898,7 +892,6 @@ do_rest:
898#ifdef CONFIG_X86_32 892#ifdef CONFIG_X86_32
899 per_cpu(current_task, cpu) = c_idle.idle; 893 per_cpu(current_task, cpu) = c_idle.idle;
900 init_gdt(cpu); 894 init_gdt(cpu);
901 early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu);
902 c_idle.idle->thread.ip = (unsigned long) start_secondary; 895 c_idle.idle->thread.ip = (unsigned long) start_secondary;
903 /* Stack for startup_32 can be just as for start_secondary onwards */ 896 /* Stack for startup_32 can be just as for start_secondary onwards */
904 irq_ctx_init(cpu); 897 irq_ctx_init(cpu);
@@ -908,6 +901,7 @@ do_rest:
908 initial_code = (unsigned long)start_secondary; 901 initial_code = (unsigned long)start_secondary;
909 clear_tsk_thread_flag(c_idle.idle, TIF_FORK); 902 clear_tsk_thread_flag(c_idle.idle, TIF_FORK);
910#endif 903#endif
904 early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu);
911 stack_start.sp = (void *) c_idle.idle->thread.sp; 905 stack_start.sp = (void *) c_idle.idle->thread.sp;
912 906
913 /* start_ip had better be page-aligned! */ 907 /* start_ip had better be page-aligned! */
@@ -1252,8 +1246,8 @@ void __init native_smp_prepare_boot_cpu(void)
1252 int me = smp_processor_id(); 1246 int me = smp_processor_id();
1253#ifdef CONFIG_X86_32 1247#ifdef CONFIG_X86_32
1254 init_gdt(me); 1248 init_gdt(me);
1255 switch_to_new_gdt();
1256#endif 1249#endif
1250 switch_to_new_gdt();
1257 /* already set me in cpu_online_map in boot_cpu_init() */ 1251 /* already set me in cpu_online_map in boot_cpu_init() */
1258 cpu_set(me, cpu_callout_map); 1252 cpu_set(me, cpu_callout_map);
1259 per_cpu(cpu_state, me) = CPU_ONLINE; 1253 per_cpu(cpu_state, me) = CPU_ONLINE;