aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2009-02-02 16:55:31 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2009-02-04 19:59:02 -0500
commit383414322b3b3ced0cbc146801e0cc6c60a6c5f4 (patch)
treef6abd0c09f3f15c1fd78d81a443ae4bf985bdc84
parent327641da8e3e227f42690479182b896fd19486be (diff)
xen: setup percpu data pointers
We need to access percpu data fairly early, so set up the percpu registers as soon as possible. We only need to load the appropriate segment register. We already have a GDT, but its hard to change it early because we need to manipulate the pagetable to do so, and that hasn't been set up yet. Also, set the kernel stack when bringing up secondary CPUs. If we don't they all end up sharing the same stack... Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--arch/x86/xen/enlighten.c15
-rw-r--r--arch/x86/xen/smp.c6
-rw-r--r--arch/x86/xen/xen-ops.h2
3 files changed, 20 insertions, 3 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index cd022c43dfb..aed7ceeb4b6 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -66,6 +66,8 @@ EXPORT_SYMBOL_GPL(xen_start_info);
66 66
67struct shared_info xen_dummy_shared_info; 67struct shared_info xen_dummy_shared_info;
68 68
69void *xen_initial_gdt;
70
69/* 71/*
70 * Point at some empty memory to start with. We map the real shared_info 72 * Point at some empty memory to start with. We map the real shared_info
71 * page as soon as fixmap is up and running. 73 * page as soon as fixmap is up and running.
@@ -917,8 +919,19 @@ asmlinkage void __init xen_start_kernel(void)
917 have_vcpu_info_placement = 0; 919 have_vcpu_info_placement = 0;
918#endif 920#endif
919 921
920 /* setup percpu state */ 922#ifdef CONFIG_X86_64
923 /*
924 * Setup percpu state. We only need to do this for 64-bit
925 * because 32-bit already has %fs set properly.
926 */
921 load_percpu_segment(0); 927 load_percpu_segment(0);
928#endif
929 /*
930 * The only reliable way to retain the initial address of the
931 * percpu gdt_page is to remember it here, so we can go and
932 * mark it RW later, when the initial percpu area is freed.
933 */
934 xen_initial_gdt = &per_cpu(gdt_page, 0);
922 935
923 xen_smp_init(); 936 xen_smp_init();
924 937
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 88d5d5ec6be..035582ae815 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -170,8 +170,7 @@ static void __init xen_smp_prepare_boot_cpu(void)
170 170
171 /* We've switched to the "real" per-cpu gdt, so make sure the 171 /* We've switched to the "real" per-cpu gdt, so make sure the
172 old memory can be recycled */ 172 old memory can be recycled */
173 make_lowmem_page_readwrite(__per_cpu_load + 173 make_lowmem_page_readwrite(xen_initial_gdt);
174 (unsigned long)&per_cpu_var(gdt_page));
175 174
176 xen_setup_vcpu_info_placement(); 175 xen_setup_vcpu_info_placement();
177} 176}
@@ -287,6 +286,9 @@ static int __cpuinit xen_cpu_up(unsigned int cpu)
287 irq_ctx_init(cpu); 286 irq_ctx_init(cpu);
288#else 287#else
289 clear_tsk_thread_flag(idle, TIF_FORK); 288 clear_tsk_thread_flag(idle, TIF_FORK);
289 per_cpu(kernel_stack, cpu) =
290 (unsigned long)task_stack_page(idle) -
291 KERNEL_STACK_OFFSET + THREAD_SIZE;
290#endif 292#endif
291 xen_setup_timer(cpu); 293 xen_setup_timer(cpu);
292 xen_init_lock_cpu(cpu); 294 xen_init_lock_cpu(cpu);
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 11913fc94c1..2f5ef2632ea 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -10,6 +10,8 @@
10extern const char xen_hypervisor_callback[]; 10extern const char xen_hypervisor_callback[];
11extern const char xen_failsafe_callback[]; 11extern const char xen_failsafe_callback[];
12 12
13extern void *xen_initial_gdt;
14
13struct trap_info; 15struct trap_info;
14void xen_copy_trap_info(struct trap_info *traps); 16void xen_copy_trap_info(struct trap_info *traps);
15 17