Commit 38341432 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by H. Peter Anvin

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: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent 327641da
...@@ -66,6 +66,8 @@ EXPORT_SYMBOL_GPL(xen_start_info); ...@@ -66,6 +66,8 @@ EXPORT_SYMBOL_GPL(xen_start_info);
struct shared_info xen_dummy_shared_info; struct shared_info xen_dummy_shared_info;
void *xen_initial_gdt;
/* /*
* Point at some empty memory to start with. We map the real shared_info * Point at some empty memory to start with. We map the real shared_info
* page as soon as fixmap is up and running. * page as soon as fixmap is up and running.
...@@ -917,8 +919,19 @@ asmlinkage void __init xen_start_kernel(void) ...@@ -917,8 +919,19 @@ asmlinkage void __init xen_start_kernel(void)
have_vcpu_info_placement = 0; have_vcpu_info_placement = 0;
#endif #endif
/* setup percpu state */ #ifdef CONFIG_X86_64
/*
* Setup percpu state. We only need to do this for 64-bit
* because 32-bit already has %fs set properly.
*/
load_percpu_segment(0); load_percpu_segment(0);
#endif
/*
* The only reliable way to retain the initial address of the
* percpu gdt_page is to remember it here, so we can go and
* mark it RW later, when the initial percpu area is freed.
*/
xen_initial_gdt = &per_cpu(gdt_page, 0);
xen_smp_init(); xen_smp_init();
......
...@@ -170,8 +170,7 @@ static void __init xen_smp_prepare_boot_cpu(void) ...@@ -170,8 +170,7 @@ static void __init xen_smp_prepare_boot_cpu(void)
/* We've switched to the "real" per-cpu gdt, so make sure the /* We've switched to the "real" per-cpu gdt, so make sure the
old memory can be recycled */ old memory can be recycled */
make_lowmem_page_readwrite(__per_cpu_load + make_lowmem_page_readwrite(xen_initial_gdt);
(unsigned long)&per_cpu_var(gdt_page));
xen_setup_vcpu_info_placement(); xen_setup_vcpu_info_placement();
} }
...@@ -287,6 +286,9 @@ static int __cpuinit xen_cpu_up(unsigned int cpu) ...@@ -287,6 +286,9 @@ static int __cpuinit xen_cpu_up(unsigned int cpu)
irq_ctx_init(cpu); irq_ctx_init(cpu);
#else #else
clear_tsk_thread_flag(idle, TIF_FORK); clear_tsk_thread_flag(idle, TIF_FORK);
per_cpu(kernel_stack, cpu) =
(unsigned long)task_stack_page(idle) -
KERNEL_STACK_OFFSET + THREAD_SIZE;
#endif #endif
xen_setup_timer(cpu); xen_setup_timer(cpu);
xen_init_lock_cpu(cpu); xen_init_lock_cpu(cpu);
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
extern const char xen_hypervisor_callback[]; extern const char xen_hypervisor_callback[];
extern const char xen_failsafe_callback[]; extern const char xen_failsafe_callback[];
extern void *xen_initial_gdt;
struct trap_info; struct trap_info;
void xen_copy_trap_info(struct trap_info *traps); void xen_copy_trap_info(struct trap_info *traps);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment