- Update to 2.6.25-rc3.
[linux-flexiantxendom0-3.2.10.git] / arch / x86 / kernel / setup64.c
index 3558ac7..309366f 100644 (file)
 #include <asm/sections.h>
 #include <asm/setup.h>
 
+#ifndef CONFIG_DEBUG_BOOT_PARAMS
 struct boot_params __initdata boot_params;
+#else
+struct boot_params boot_params;
+#endif
 
 cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
 
@@ -37,6 +41,8 @@ struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table };
 char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
 
 unsigned long __supported_pte_mask __read_mostly = ~0UL;
+EXPORT_SYMBOL_GPL(__supported_pte_mask);
+
 static int do_not_nx __cpuinitdata = 0;
 
 /* noexec=on|off
@@ -80,6 +86,43 @@ static int __init nonx32_setup(char *str)
 __setup("noexec32=", nonx32_setup);
 
 /*
+ * Copy data used in early init routines from the initial arrays to the
+ * per cpu data areas.  These arrays then become expendable and the
+ * *_early_ptr's are zeroed indicating that the static arrays are gone.
+ */
+static void __init setup_per_cpu_maps(void)
+{
+       int cpu;
+
+       for_each_possible_cpu(cpu) {
+#ifdef CONFIG_SMP
+               if (per_cpu_offset(cpu)) {
+#endif
+                       per_cpu(x86_cpu_to_apicid, cpu) =
+                                               x86_cpu_to_apicid_init[cpu];
+                       per_cpu(x86_bios_cpu_apicid, cpu) =
+                                               x86_bios_cpu_apicid_init[cpu];
+#ifdef CONFIG_NUMA
+                       per_cpu(x86_cpu_to_node_map, cpu) =
+                                               x86_cpu_to_node_map_init[cpu];
+#endif
+#ifdef CONFIG_SMP
+               }
+               else
+                       printk(KERN_NOTICE "per_cpu_offset zero for cpu %d\n",
+                                                                       cpu);
+#endif
+       }
+
+       /* indicate the early static arrays will soon be gone */
+       x86_cpu_to_apicid_early_ptr = NULL;
+       x86_bios_cpu_apicid_early_ptr = NULL;
+#ifdef CONFIG_NUMA
+       x86_cpu_to_node_map_early_ptr = NULL;
+#endif
+}
+
+/*
  * Great future plan:
  * Declare PDA itself and support (irqstack,tss,pgd) as per cpu data.
  * Always point %gs to its beginning
@@ -100,18 +143,21 @@ void __init setup_per_cpu_areas(void)
        for_each_cpu_mask (i, cpu_possible_map) {
                char *ptr;
 
-               if (!NODE_DATA(cpu_to_node(i))) {
+               if (!NODE_DATA(early_cpu_to_node(i))) {
                        printk("cpu with no node %d, num_online_nodes %d\n",
                               i, num_online_nodes());
                        ptr = alloc_bootmem_pages(size);
                } else { 
-                       ptr = alloc_bootmem_pages_node(NODE_DATA(cpu_to_node(i)), size);
+                       ptr = alloc_bootmem_pages_node(NODE_DATA(early_cpu_to_node(i)), size);
                }
                if (!ptr)
                        panic("Cannot allocate cpu data for CPU %d\n", i);
                cpu_pda(i)->data_offset = ptr - __per_cpu_start;
                memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
        }
+
+       /* setup percpu data maps early */
+       setup_per_cpu_maps();
 } 
 
 void pda_init(int cpu)
@@ -169,7 +215,8 @@ void syscall_init(void)
 #endif
 
        /* Flags to clear on syscall */
-       wrmsrl(MSR_SYSCALL_MASK, EF_TF|EF_DF|EF_IE|0x3000); 
+       wrmsrl(MSR_SYSCALL_MASK,
+              X86_EFLAGS_TF|X86_EFLAGS_DF|X86_EFLAGS_IF|X86_EFLAGS_IOPL);
 }
 
 void __cpuinit check_efer(void)
@@ -227,7 +274,7 @@ void __cpuinit cpu_init (void)
         * and set up the GDT descriptor:
         */
        if (cpu)
-               memcpy(cpu_gdt(cpu), cpu_gdt_table, GDT_SIZE);
+               memcpy(get_cpu_gdt_table(cpu), cpu_gdt_table, GDT_SIZE);
 
        cpu_gdt_descr[cpu].size = GDT_SIZE;
        load_gdt((const struct desc_ptr *)&cpu_gdt_descr[cpu]);
@@ -257,10 +304,10 @@ void __cpuinit cpu_init (void)
                                      v, cpu); 
                }
                estacks += PAGE_SIZE << order[v];
-               orig_ist->ist[v] = t->ist[v] = (unsigned long)estacks;
+               orig_ist->ist[v] = t->x86_tss.ist[v] = (unsigned long)estacks;
        }
 
-       t->io_bitmap_base = offsetof(struct tss_struct, io_bitmap);
+       t->x86_tss.io_bitmap_base = offsetof(struct tss_struct, io_bitmap);
        /*
         * <= is required because the CPU will access up to
         * 8 bits beyond the end of the IO permission bitmap.