diff options
author | Brian Gerst <brgerst@gmail.com> | 2009-01-30 03:47:53 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-01-31 00:28:50 -0500 |
commit | 552be871e67ff577ed36beb2f53d078b42304739 (patch) | |
tree | fa8a1160674f319db5c9dfe9360e22fb44ade300 /arch/x86/kernel | |
parent | 2749ebe320ff9f77548d10fcc0a3464ac21c8e58 (diff) |
x86: pass in cpu number to switch_to_new_gdt()
Impact: cleanup, prepare for xen boot fix.
Xen needs to call this function very early to setup the GDT and
per-cpu segments. Remove the call to smp_processor_id() and just
pass in the cpu number.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/setup_percpu.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 2 |
3 files changed, 5 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 652fdc9a757a..6eacd64b602e 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -255,10 +255,9 @@ __u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata; | |||
255 | 255 | ||
256 | /* Current gdt points %fs at the "master" per-cpu area: after this, | 256 | /* Current gdt points %fs at the "master" per-cpu area: after this, |
257 | * it's on the real one. */ | 257 | * it's on the real one. */ |
258 | void switch_to_new_gdt(void) | 258 | void switch_to_new_gdt(int cpu) |
259 | { | 259 | { |
260 | struct desc_ptr gdt_descr; | 260 | struct desc_ptr gdt_descr; |
261 | int cpu = smp_processor_id(); | ||
262 | 261 | ||
263 | gdt_descr.address = (long)get_cpu_gdt_table(cpu); | 262 | gdt_descr.address = (long)get_cpu_gdt_table(cpu); |
264 | gdt_descr.size = GDT_SIZE - 1; | 263 | gdt_descr.size = GDT_SIZE - 1; |
@@ -993,7 +992,7 @@ void __cpuinit cpu_init(void) | |||
993 | * and set up the GDT descriptor: | 992 | * and set up the GDT descriptor: |
994 | */ | 993 | */ |
995 | 994 | ||
996 | switch_to_new_gdt(); | 995 | switch_to_new_gdt(cpu); |
997 | loadsegment(fs, 0); | 996 | loadsegment(fs, 0); |
998 | 997 | ||
999 | load_idt((const struct desc_ptr *)&idt_descr); | 998 | load_idt((const struct desc_ptr *)&idt_descr); |
@@ -1098,7 +1097,7 @@ void __cpuinit cpu_init(void) | |||
1098 | clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); | 1097 | clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); |
1099 | 1098 | ||
1100 | load_idt(&idt_descr); | 1099 | load_idt(&idt_descr); |
1101 | switch_to_new_gdt(); | 1100 | switch_to_new_gdt(cpu); |
1102 | 1101 | ||
1103 | /* | 1102 | /* |
1104 | * Set up and load the per-CPU TSS and LDT | 1103 | * Set up and load the per-CPU TSS and LDT |
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c index 0d1e7ac439f4..ef91747bbed5 100644 --- a/arch/x86/kernel/setup_percpu.c +++ b/arch/x86/kernel/setup_percpu.c | |||
@@ -122,7 +122,7 @@ void __init setup_per_cpu_areas(void) | |||
122 | * area. Reload any changed state for the boot CPU. | 122 | * area. Reload any changed state for the boot CPU. |
123 | */ | 123 | */ |
124 | if (cpu == boot_cpu_id) | 124 | if (cpu == boot_cpu_id) |
125 | switch_to_new_gdt(); | 125 | switch_to_new_gdt(cpu); |
126 | 126 | ||
127 | DBG("PERCPU: cpu %4d %p\n", cpu, ptr); | 127 | DBG("PERCPU: cpu %4d %p\n", cpu, ptr); |
128 | } | 128 | } |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index f9dbcff43546..612d3c74f6a3 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -1185,7 +1185,7 @@ out: | |||
1185 | void __init native_smp_prepare_boot_cpu(void) | 1185 | void __init native_smp_prepare_boot_cpu(void) |
1186 | { | 1186 | { |
1187 | int me = smp_processor_id(); | 1187 | int me = smp_processor_id(); |
1188 | switch_to_new_gdt(); | 1188 | switch_to_new_gdt(me); |
1189 | /* already set me in cpu_online_mask in boot_cpu_init() */ | 1189 | /* already set me in cpu_online_mask in boot_cpu_init() */ |
1190 | cpumask_set_cpu(me, cpu_callout_mask); | 1190 | cpumask_set_cpu(me, cpu_callout_mask); |
1191 | per_cpu(cpu_state, me) = CPU_ONLINE; | 1191 | per_cpu(cpu_state, me) = CPU_ONLINE; |