aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/setup64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/setup64.c')
-rw-r--r--arch/x86/kernel/setup64.c97
1 files changed, 20 insertions, 77 deletions
diff --git a/arch/x86/kernel/setup64.c b/arch/x86/kernel/setup64.c
index e24c45677094..9042fb0e36f5 100644
--- a/arch/x86/kernel/setup64.c
+++ b/arch/x86/kernel/setup64.c
@@ -11,6 +11,7 @@
11#include <linux/bootmem.h> 11#include <linux/bootmem.h>
12#include <linux/bitops.h> 12#include <linux/bitops.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/kgdb.h>
14#include <asm/pda.h> 15#include <asm/pda.h>
15#include <asm/pgtable.h> 16#include <asm/pgtable.h>
16#include <asm/processor.h> 17#include <asm/processor.h>
@@ -23,6 +24,7 @@
23#include <asm/proto.h> 24#include <asm/proto.h>
24#include <asm/sections.h> 25#include <asm/sections.h>
25#include <asm/setup.h> 26#include <asm/setup.h>
27#include <asm/genapic.h>
26 28
27#ifndef CONFIG_DEBUG_BOOT_PARAMS 29#ifndef CONFIG_DEBUG_BOOT_PARAMS
28struct boot_params __initdata boot_params; 30struct boot_params __initdata boot_params;
@@ -85,83 +87,6 @@ static int __init nonx32_setup(char *str)
85} 87}
86__setup("noexec32=", nonx32_setup); 88__setup("noexec32=", nonx32_setup);
87 89
88/*
89 * Copy data used in early init routines from the initial arrays to the
90 * per cpu data areas. These arrays then become expendable and the
91 * *_early_ptr's are zeroed indicating that the static arrays are gone.
92 */
93static void __init setup_per_cpu_maps(void)
94{
95 int cpu;
96
97 for_each_possible_cpu(cpu) {
98#ifdef CONFIG_SMP
99 if (per_cpu_offset(cpu)) {
100#endif
101 per_cpu(x86_cpu_to_apicid, cpu) =
102 x86_cpu_to_apicid_init[cpu];
103 per_cpu(x86_bios_cpu_apicid, cpu) =
104 x86_bios_cpu_apicid_init[cpu];
105#ifdef CONFIG_NUMA
106 per_cpu(x86_cpu_to_node_map, cpu) =
107 x86_cpu_to_node_map_init[cpu];
108#endif
109#ifdef CONFIG_SMP
110 }
111 else
112 printk(KERN_NOTICE "per_cpu_offset zero for cpu %d\n",
113 cpu);
114#endif
115 }
116
117 /* indicate the early static arrays will soon be gone */
118 x86_cpu_to_apicid_early_ptr = NULL;
119 x86_bios_cpu_apicid_early_ptr = NULL;
120#ifdef CONFIG_NUMA
121 x86_cpu_to_node_map_early_ptr = NULL;
122#endif
123}
124
125/*
126 * Great future plan:
127 * Declare PDA itself and support (irqstack,tss,pgd) as per cpu data.
128 * Always point %gs to its beginning
129 */
130void __init setup_per_cpu_areas(void)
131{
132 int i;
133 unsigned long size;
134
135#ifdef CONFIG_HOTPLUG_CPU
136 prefill_possible_map();
137#endif
138
139 /* Copy section for each CPU (we discard the original) */
140 size = PERCPU_ENOUGH_ROOM;
141
142 printk(KERN_INFO "PERCPU: Allocating %lu bytes of per cpu data\n", size);
143 for_each_cpu_mask (i, cpu_possible_map) {
144 char *ptr;
145#ifndef CONFIG_NEED_MULTIPLE_NODES
146 ptr = alloc_bootmem_pages(size);
147#else
148 int node = early_cpu_to_node(i);
149
150 if (!node_online(node) || !NODE_DATA(node))
151 ptr = alloc_bootmem_pages(size);
152 else
153 ptr = alloc_bootmem_pages_node(NODE_DATA(node), size);
154#endif
155 if (!ptr)
156 panic("Cannot allocate cpu data for CPU %d\n", i);
157 cpu_pda(i)->data_offset = ptr - __per_cpu_start;
158 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
159 }
160
161 /* setup percpu data maps early */
162 setup_per_cpu_maps();
163}
164
165void pda_init(int cpu) 90void pda_init(int cpu)
166{ 91{
167 struct x8664_pda *pda = cpu_pda(cpu); 92 struct x8664_pda *pda = cpu_pda(cpu);
@@ -327,6 +252,17 @@ void __cpuinit cpu_init (void)
327 load_TR_desc(); 252 load_TR_desc();
328 load_LDT(&init_mm.context); 253 load_LDT(&init_mm.context);
329 254
255#ifdef CONFIG_KGDB
256 /*
257 * If the kgdb is connected no debug regs should be altered. This
258 * is only applicable when KGDB and a KGDB I/O module are built
259 * into the kernel and you are using early debugging with
260 * kgdbwait. KGDB will control the kernel HW breakpoint registers.
261 */
262 if (kgdb_connected && arch_kgdb_ops.correct_hw_break)
263 arch_kgdb_ops.correct_hw_break();
264 else {
265#endif
330 /* 266 /*
331 * Clear all 6 debug registers: 267 * Clear all 6 debug registers:
332 */ 268 */
@@ -337,8 +273,15 @@ void __cpuinit cpu_init (void)
337 set_debugreg(0UL, 3); 273 set_debugreg(0UL, 3);
338 set_debugreg(0UL, 6); 274 set_debugreg(0UL, 6);
339 set_debugreg(0UL, 7); 275 set_debugreg(0UL, 7);
276#ifdef CONFIG_KGDB
277 /* If the kgdb is connected no debug regs should be altered. */
278 }
279#endif
340 280
341 fpu_init(); 281 fpu_init();
342 282
343 raw_local_save_flags(kernel_eflags); 283 raw_local_save_flags(kernel_eflags);
284
285 if (is_uv_system())
286 uv_cpu_init();
344} 287}