diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2006-12-06 20:14:02 -0500 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-12-06 20:14:02 -0500 |
commit | 62111195800d80c66cdc69063ea3145878c99fbf (patch) | |
tree | 35bc9792b3ac232e70e106ff2f4c0193c3bb72ff /arch/i386/mach-voyager/voyager_smp.c | |
parent | 9ca36101a8d74704d78f10910f89d62de96f9dc8 (diff) |
[PATCH] i386: Initialize the per-CPU data area
When a CPU is brought up, a PDA and GDT are allocated for it. The GDT's
__KERNEL_PDA entry is pointed to the allocated PDA memory, so that all
references using this segment descriptor will refer to the PDA.
This patch rearranges CPU initialization a bit, so that the GDT/PDA are set up
as early as possible in cpu_init(). Also for secondary CPUs, GDT+PDA are
preallocated and initialized so all the secondary CPU needs to do is set up
the ldt and load %gs. This will be important once smp_processor_id() and
current use the PDA.
In all cases, the PDA is set up in head.S, before a CPU starts running C code,
so the PDA is always available.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Chuck Ebbert <76306.1226@compuserve.com>
Cc: Zachary Amsden <zach@vmware.com>
Cc: Jan Beulich <jbeulich@novell.com>
Cc: Andi Kleen <ak@suse.de>
Cc: James Bottomley <James.Bottomley@SteelEye.com>
Cc: Matt Tolentino <matthew.e.tolentino@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'arch/i386/mach-voyager/voyager_smp.c')
-rw-r--r-- | arch/i386/mach-voyager/voyager_smp.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c index f3fea2ad50fe..55428e656a3f 100644 --- a/arch/i386/mach-voyager/voyager_smp.c +++ b/arch/i386/mach-voyager/voyager_smp.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <asm/pgalloc.h> | 28 | #include <asm/pgalloc.h> |
29 | #include <asm/tlbflush.h> | 29 | #include <asm/tlbflush.h> |
30 | #include <asm/arch_hooks.h> | 30 | #include <asm/arch_hooks.h> |
31 | #include <asm/pda.h> | ||
31 | 32 | ||
32 | /* TLB state -- visible externally, indexed physically */ | 33 | /* TLB state -- visible externally, indexed physically */ |
33 | DEFINE_PER_CPU(struct tlb_state, cpu_tlbstate) ____cacheline_aligned = { &init_mm, 0 }; | 34 | DEFINE_PER_CPU(struct tlb_state, cpu_tlbstate) ____cacheline_aligned = { &init_mm, 0 }; |
@@ -422,6 +423,7 @@ find_smp_config(void) | |||
422 | VOYAGER_SUS_IN_CONTROL_PORT); | 423 | VOYAGER_SUS_IN_CONTROL_PORT); |
423 | 424 | ||
424 | current_thread_info()->cpu = boot_cpu_id; | 425 | current_thread_info()->cpu = boot_cpu_id; |
426 | write_pda(cpu_number, boot_cpu_id); | ||
425 | } | 427 | } |
426 | 428 | ||
427 | /* | 429 | /* |
@@ -458,7 +460,7 @@ start_secondary(void *unused) | |||
458 | /* external functions not defined in the headers */ | 460 | /* external functions not defined in the headers */ |
459 | extern void calibrate_delay(void); | 461 | extern void calibrate_delay(void); |
460 | 462 | ||
461 | cpu_init(); | 463 | secondary_cpu_init(); |
462 | 464 | ||
463 | /* OK, we're in the routine */ | 465 | /* OK, we're in the routine */ |
464 | ack_CPI(VIC_CPU_BOOT_CPI); | 466 | ack_CPI(VIC_CPU_BOOT_CPI); |
@@ -578,6 +580,15 @@ do_boot_cpu(__u8 cpu) | |||
578 | /* init_tasks (in sched.c) is indexed logically */ | 580 | /* init_tasks (in sched.c) is indexed logically */ |
579 | stack_start.esp = (void *) idle->thread.esp; | 581 | stack_start.esp = (void *) idle->thread.esp; |
580 | 582 | ||
583 | /* Pre-allocate and initialize the CPU's GDT and PDA so it | ||
584 | doesn't have to do any memory allocation during the | ||
585 | delicate CPU-bringup phase. */ | ||
586 | if (!init_gdt(cpu, idle)) { | ||
587 | printk(KERN_INFO "Couldn't allocate GDT/PDA for CPU %d\n", cpu); | ||
588 | cpucount--; | ||
589 | return; | ||
590 | } | ||
591 | |||
581 | irq_ctx_init(cpu); | 592 | irq_ctx_init(cpu); |
582 | 593 | ||
583 | /* Note: Don't modify initial ss override */ | 594 | /* Note: Don't modify initial ss override */ |
@@ -1963,4 +1974,5 @@ void __init | |||
1963 | smp_setup_processor_id(void) | 1974 | smp_setup_processor_id(void) |
1964 | { | 1975 | { |
1965 | current_thread_info()->cpu = hard_smp_processor_id(); | 1976 | current_thread_info()->cpu = hard_smp_processor_id(); |
1977 | write_pda(cpu_number, hard_smp_processor_id()); | ||
1966 | } | 1978 | } |