aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/common.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-23 04:20:15 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-23 04:20:15 -0500
commitbfe2a3c3b5bf479788d5d5c5561346be6b169043 (patch)
tree652c987279db7cd841d556f7bb1a589b57fbd6cc /arch/x86/kernel/cpu/common.c
parent77835492ed489c0b870f82f4c50687bd267acc0a (diff)
parent35d266a24796f02f63299cfe5009dfc0d5a0e820 (diff)
Merge branch 'core/percpu' into perfcounters/core
Conflicts: arch/x86/include/asm/hardirq_32.h arch/x86/include/asm/hardirq_64.h Semantic merge: arch/x86/include/asm/hardirq.h [ added apic_perf_irqs field. ] Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu/common.c')
-rw-r--r--arch/x86/kernel/cpu/common.c44
1 files changed, 18 insertions, 26 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 95eb30e1e677..6fd316689c47 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -29,9 +29,9 @@
29#include <asm/apic.h> 29#include <asm/apic.h>
30#include <mach_apic.h> 30#include <mach_apic.h>
31#include <asm/genapic.h> 31#include <asm/genapic.h>
32#include <asm/uv/uv.h>
32#endif 33#endif
33 34
34#include <asm/pda.h>
35#include <asm/pgtable.h> 35#include <asm/pgtable.h>
36#include <asm/processor.h> 36#include <asm/processor.h>
37#include <asm/desc.h> 37#include <asm/desc.h>
@@ -65,23 +65,23 @@ cpumask_t cpu_sibling_setup_map;
65 65
66static struct cpu_dev *this_cpu __cpuinitdata; 66static struct cpu_dev *this_cpu __cpuinitdata;
67 67
68DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = {
68#ifdef CONFIG_X86_64 69#ifdef CONFIG_X86_64
69/* We need valid kernel segments for data and code in long mode too 70 /*
70 * IRET will check the segment types kkeil 2000/10/28 71 * We need valid kernel segments for data and code in long mode too
71 * Also sysret mandates a special GDT layout 72 * IRET will check the segment types kkeil 2000/10/28
72 */ 73 * Also sysret mandates a special GDT layout
73/* The TLS descriptors are currently at a different place compared to i386. 74 *
74 Hopefully nobody expects them at a fixed place (Wine?) */ 75 * The TLS descriptors are currently at a different place compared to i386.
75DEFINE_PER_CPU(struct gdt_page, gdt_page) = { .gdt = { 76 * Hopefully nobody expects them at a fixed place (Wine?)
77 */
76 [GDT_ENTRY_KERNEL32_CS] = { { { 0x0000ffff, 0x00cf9b00 } } }, 78 [GDT_ENTRY_KERNEL32_CS] = { { { 0x0000ffff, 0x00cf9b00 } } },
77 [GDT_ENTRY_KERNEL_CS] = { { { 0x0000ffff, 0x00af9b00 } } }, 79 [GDT_ENTRY_KERNEL_CS] = { { { 0x0000ffff, 0x00af9b00 } } },
78 [GDT_ENTRY_KERNEL_DS] = { { { 0x0000ffff, 0x00cf9300 } } }, 80 [GDT_ENTRY_KERNEL_DS] = { { { 0x0000ffff, 0x00cf9300 } } },
79 [GDT_ENTRY_DEFAULT_USER32_CS] = { { { 0x0000ffff, 0x00cffb00 } } }, 81 [GDT_ENTRY_DEFAULT_USER32_CS] = { { { 0x0000ffff, 0x00cffb00 } } },
80 [GDT_ENTRY_DEFAULT_USER_DS] = { { { 0x0000ffff, 0x00cff300 } } }, 82 [GDT_ENTRY_DEFAULT_USER_DS] = { { { 0x0000ffff, 0x00cff300 } } },
81 [GDT_ENTRY_DEFAULT_USER_CS] = { { { 0x0000ffff, 0x00affb00 } } }, 83 [GDT_ENTRY_DEFAULT_USER_CS] = { { { 0x0000ffff, 0x00affb00 } } },
82} };
83#else 84#else
84DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = {
85 [GDT_ENTRY_KERNEL_CS] = { { { 0x0000ffff, 0x00cf9a00 } } }, 85 [GDT_ENTRY_KERNEL_CS] = { { { 0x0000ffff, 0x00cf9a00 } } },
86 [GDT_ENTRY_KERNEL_DS] = { { { 0x0000ffff, 0x00cf9200 } } }, 86 [GDT_ENTRY_KERNEL_DS] = { { { 0x0000ffff, 0x00cf9200 } } },
87 [GDT_ENTRY_DEFAULT_USER_CS] = { { { 0x0000ffff, 0x00cffa00 } } }, 87 [GDT_ENTRY_DEFAULT_USER_CS] = { { { 0x0000ffff, 0x00cffa00 } } },
@@ -113,9 +113,9 @@ DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = {
113 [GDT_ENTRY_APMBIOS_BASE+2] = { { { 0x0000ffff, 0x00409200 } } }, 113 [GDT_ENTRY_APMBIOS_BASE+2] = { { { 0x0000ffff, 0x00409200 } } },
114 114
115 [GDT_ENTRY_ESPFIX_SS] = { { { 0x00000000, 0x00c09200 } } }, 115 [GDT_ENTRY_ESPFIX_SS] = { { { 0x00000000, 0x00c09200 } } },
116 [GDT_ENTRY_PERCPU] = { { { 0x00000000, 0x00000000 } } }, 116 [GDT_ENTRY_PERCPU] = { { { 0x0000ffff, 0x00cf9200 } } },
117} };
118#endif 117#endif
118} };
119EXPORT_PER_CPU_SYMBOL_GPL(gdt_page); 119EXPORT_PER_CPU_SYMBOL_GPL(gdt_page);
120 120
121#ifdef CONFIG_X86_32 121#ifdef CONFIG_X86_32
@@ -883,12 +883,13 @@ __setup("clearcpuid=", setup_disablecpuid);
883#ifdef CONFIG_X86_64 883#ifdef CONFIG_X86_64
884struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table }; 884struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table };
885 885
886DEFINE_PER_CPU_PAGE_ALIGNED(char[IRQ_STACK_SIZE], irq_stack); 886DEFINE_PER_CPU_FIRST(union irq_stack_union,
887 irq_stack_union) __aligned(PAGE_SIZE);
887#ifdef CONFIG_SMP 888#ifdef CONFIG_SMP
888DEFINE_PER_CPU(char *, irq_stack_ptr); /* will be set during per cpu init */ 889DEFINE_PER_CPU(char *, irq_stack_ptr); /* will be set during per cpu init */
889#else 890#else
890DEFINE_PER_CPU(char *, irq_stack_ptr) = 891DEFINE_PER_CPU(char *, irq_stack_ptr) =
891 per_cpu_var(irq_stack) + IRQ_STACK_SIZE - 64; 892 per_cpu_var(irq_stack_union.irq_stack) + IRQ_STACK_SIZE - 64;
892#endif 893#endif
893 894
894DEFINE_PER_CPU(unsigned long, kernel_stack) = 895DEFINE_PER_CPU(unsigned long, kernel_stack) =
@@ -897,15 +898,6 @@ EXPORT_PER_CPU_SYMBOL(kernel_stack);
897 898
898DEFINE_PER_CPU(unsigned int, irq_count) = -1; 899DEFINE_PER_CPU(unsigned int, irq_count) = -1;
899 900
900void __cpuinit pda_init(int cpu)
901{
902 /* Setup up data that may be needed in __get_free_pages early */
903 loadsegment(fs, 0);
904 loadsegment(gs, 0);
905
906 load_pda_offset(cpu);
907}
908
909static DEFINE_PER_CPU_PAGE_ALIGNED(char, exception_stacks 901static DEFINE_PER_CPU_PAGE_ALIGNED(char, exception_stacks
910 [(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ]) 902 [(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ])
911 __aligned(PAGE_SIZE); 903 __aligned(PAGE_SIZE);
@@ -969,9 +961,9 @@ void __cpuinit cpu_init(void)
969 struct task_struct *me; 961 struct task_struct *me;
970 int i; 962 int i;
971 963
972 /* CPU 0 is initialised in head64.c */ 964 loadsegment(fs, 0);
973 if (cpu != 0) 965 loadsegment(gs, 0);
974 pda_init(cpu); 966 load_gs_base(cpu);
975 967
976#ifdef CONFIG_NUMA 968#ifdef CONFIG_NUMA
977 if (cpu != 0 && percpu_read(node_number) == 0 && 969 if (cpu != 0 && percpu_read(node_number) == 0 &&