diff options
276 files changed, 6030 insertions, 6506 deletions
diff --git a/Documentation/cputopology.txt b/Documentation/cputopology.txt index 45932ec21cee..b41f3e58aefa 100644 --- a/Documentation/cputopology.txt +++ b/Documentation/cputopology.txt | |||
@@ -18,11 +18,11 @@ For an architecture to support this feature, it must define some of | |||
18 | these macros in include/asm-XXX/topology.h: | 18 | these macros in include/asm-XXX/topology.h: |
19 | #define topology_physical_package_id(cpu) | 19 | #define topology_physical_package_id(cpu) |
20 | #define topology_core_id(cpu) | 20 | #define topology_core_id(cpu) |
21 | #define topology_thread_siblings(cpu) | 21 | #define topology_thread_cpumask(cpu) |
22 | #define topology_core_siblings(cpu) | 22 | #define topology_core_cpumask(cpu) |
23 | 23 | ||
24 | The type of **_id is int. | 24 | The type of **_id is int. |
25 | The type of siblings is cpumask_t. | 25 | The type of siblings is (const) struct cpumask *. |
26 | 26 | ||
27 | To be consistent on all architectures, include/linux/topology.h | 27 | To be consistent on all architectures, include/linux/topology.h |
28 | provides default definitions for any of the above macros that are | 28 | provides default definitions for any of the above macros that are |
diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt index 7b4596ac4120..12299697b7cd 100644 --- a/Documentation/x86/boot.txt +++ b/Documentation/x86/boot.txt | |||
@@ -158,7 +158,7 @@ Offset Proto Name Meaning | |||
158 | 0202/4 2.00+ header Magic signature "HdrS" | 158 | 0202/4 2.00+ header Magic signature "HdrS" |
159 | 0206/2 2.00+ version Boot protocol version supported | 159 | 0206/2 2.00+ version Boot protocol version supported |
160 | 0208/4 2.00+ realmode_swtch Boot loader hook (see below) | 160 | 0208/4 2.00+ realmode_swtch Boot loader hook (see below) |
161 | 020C/2 2.00+ start_sys The load-low segment (0x1000) (obsolete) | 161 | 020C/2 2.00+ start_sys_seg The load-low segment (0x1000) (obsolete) |
162 | 020E/2 2.00+ kernel_version Pointer to kernel version string | 162 | 020E/2 2.00+ kernel_version Pointer to kernel version string |
163 | 0210/1 2.00+ type_of_loader Boot loader identifier | 163 | 0210/1 2.00+ type_of_loader Boot loader identifier |
164 | 0211/1 2.00+ loadflags Boot protocol option flags | 164 | 0211/1 2.00+ loadflags Boot protocol option flags |
@@ -170,10 +170,11 @@ Offset Proto Name Meaning | |||
170 | 0224/2 2.01+ heap_end_ptr Free memory after setup end | 170 | 0224/2 2.01+ heap_end_ptr Free memory after setup end |
171 | 0226/2 N/A pad1 Unused | 171 | 0226/2 N/A pad1 Unused |
172 | 0228/4 2.02+ cmd_line_ptr 32-bit pointer to the kernel command line | 172 | 0228/4 2.02+ cmd_line_ptr 32-bit pointer to the kernel command line |
173 | 022C/4 2.03+ initrd_addr_max Highest legal initrd address | 173 | 022C/4 2.03+ ramdisk_max Highest legal initrd address |
174 | 0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel | 174 | 0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel |
175 | 0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not | 175 | 0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not |
176 | 0235/3 N/A pad2 Unused | 176 | 0235/1 N/A pad2 Unused |
177 | 0236/2 N/A pad3 Unused | ||
177 | 0238/4 2.06+ cmdline_size Maximum size of the kernel command line | 178 | 0238/4 2.06+ cmdline_size Maximum size of the kernel command line |
178 | 023C/4 2.07+ hardware_subarch Hardware subarchitecture | 179 | 023C/4 2.07+ hardware_subarch Hardware subarchitecture |
179 | 0240/8 2.07+ hardware_subarch_data Subarchitecture-specific data | 180 | 0240/8 2.07+ hardware_subarch_data Subarchitecture-specific data |
@@ -299,14 +300,14 @@ Protocol: 2.00+ | |||
299 | e.g. 0x0204 for version 2.04, and 0x0a11 for a hypothetical version | 300 | e.g. 0x0204 for version 2.04, and 0x0a11 for a hypothetical version |
300 | 10.17. | 301 | 10.17. |
301 | 302 | ||
302 | Field name: readmode_swtch | 303 | Field name: realmode_swtch |
303 | Type: modify (optional) | 304 | Type: modify (optional) |
304 | Offset/size: 0x208/4 | 305 | Offset/size: 0x208/4 |
305 | Protocol: 2.00+ | 306 | Protocol: 2.00+ |
306 | 307 | ||
307 | Boot loader hook (see ADVANCED BOOT LOADER HOOKS below.) | 308 | Boot loader hook (see ADVANCED BOOT LOADER HOOKS below.) |
308 | 309 | ||
309 | Field name: start_sys | 310 | Field name: start_sys_seg |
310 | Type: read | 311 | Type: read |
311 | Offset/size: 0x20c/2 | 312 | Offset/size: 0x20c/2 |
312 | Protocol: 2.00+ | 313 | Protocol: 2.00+ |
@@ -468,7 +469,7 @@ Protocol: 2.02+ | |||
468 | zero, the kernel will assume that your boot loader does not support | 469 | zero, the kernel will assume that your boot loader does not support |
469 | the 2.02+ protocol. | 470 | the 2.02+ protocol. |
470 | 471 | ||
471 | Field name: initrd_addr_max | 472 | Field name: ramdisk_max |
472 | Type: read | 473 | Type: read |
473 | Offset/size: 0x22c/4 | 474 | Offset/size: 0x22c/4 |
474 | Protocol: 2.03+ | 475 | Protocol: 2.03+ |
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c index 703731accda6..7bc7489223f3 100644 --- a/arch/alpha/kernel/irq.c +++ b/arch/alpha/kernel/irq.c | |||
@@ -55,7 +55,7 @@ int irq_select_affinity(unsigned int irq) | |||
55 | cpu = (cpu < (NR_CPUS-1) ? cpu + 1 : 0); | 55 | cpu = (cpu < (NR_CPUS-1) ? cpu + 1 : 0); |
56 | last_cpu = cpu; | 56 | last_cpu = cpu; |
57 | 57 | ||
58 | irq_desc[irq].affinity = cpumask_of_cpu(cpu); | 58 | cpumask_copy(irq_desc[irq].affinity, cpumask_of(cpu)); |
59 | irq_desc[irq].chip->set_affinity(irq, cpumask_of(cpu)); | 59 | irq_desc[irq].chip->set_affinity(irq, cpumask_of(cpu)); |
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 7141cee1fab7..4bb723eadad1 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c | |||
@@ -104,6 +104,11 @@ static struct irq_desc bad_irq_desc = { | |||
104 | .lock = SPIN_LOCK_UNLOCKED | 104 | .lock = SPIN_LOCK_UNLOCKED |
105 | }; | 105 | }; |
106 | 106 | ||
107 | #ifdef CONFIG_CPUMASK_OFFSTACK | ||
108 | /* We are not allocating bad_irq_desc.affinity or .pending_mask */ | ||
109 | #error "ARM architecture does not support CONFIG_CPUMASK_OFFSTACK." | ||
110 | #endif | ||
111 | |||
107 | /* | 112 | /* |
108 | * do_IRQ handles all hardware IRQ's. Decoded IRQs should not | 113 | * do_IRQ handles all hardware IRQ's. Decoded IRQs should not |
109 | * come via this function. Instead, they should provide their | 114 | * come via this function. Instead, they should provide their |
@@ -161,7 +166,7 @@ void __init init_IRQ(void) | |||
161 | irq_desc[irq].status |= IRQ_NOREQUEST | IRQ_NOPROBE; | 166 | irq_desc[irq].status |= IRQ_NOREQUEST | IRQ_NOPROBE; |
162 | 167 | ||
163 | #ifdef CONFIG_SMP | 168 | #ifdef CONFIG_SMP |
164 | bad_irq_desc.affinity = CPU_MASK_ALL; | 169 | cpumask_setall(bad_irq_desc.affinity); |
165 | bad_irq_desc.cpu = smp_processor_id(); | 170 | bad_irq_desc.cpu = smp_processor_id(); |
166 | #endif | 171 | #endif |
167 | init_arch_irq(); | 172 | init_arch_irq(); |
@@ -191,15 +196,16 @@ void migrate_irqs(void) | |||
191 | struct irq_desc *desc = irq_desc + i; | 196 | struct irq_desc *desc = irq_desc + i; |
192 | 197 | ||
193 | if (desc->cpu == cpu) { | 198 | if (desc->cpu == cpu) { |
194 | unsigned int newcpu = any_online_cpu(desc->affinity); | 199 | unsigned int newcpu = cpumask_any_and(desc->affinity, |
195 | 200 | cpu_online_mask); | |
196 | if (newcpu == NR_CPUS) { | 201 | if (newcpu >= nr_cpu_ids) { |
197 | if (printk_ratelimit()) | 202 | if (printk_ratelimit()) |
198 | printk(KERN_INFO "IRQ%u no longer affine to CPU%u\n", | 203 | printk(KERN_INFO "IRQ%u no longer affine to CPU%u\n", |
199 | i, cpu); | 204 | i, cpu); |
200 | 205 | ||
201 | cpus_setall(desc->affinity); | 206 | cpumask_setall(desc->affinity); |
202 | newcpu = any_online_cpu(desc->affinity); | 207 | newcpu = cpumask_any_and(desc->affinity, |
208 | cpu_online_mask); | ||
203 | } | 209 | } |
204 | 210 | ||
205 | route_irq(desc, i, newcpu); | 211 | route_irq(desc, i, newcpu); |
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 00216071eaf7..85598f7da407 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S | |||
@@ -65,6 +65,7 @@ SECTIONS | |||
65 | #endif | 65 | #endif |
66 | . = ALIGN(4096); | 66 | . = ALIGN(4096); |
67 | __per_cpu_start = .; | 67 | __per_cpu_start = .; |
68 | *(.data.percpu.page_aligned) | ||
68 | *(.data.percpu) | 69 | *(.data.percpu) |
69 | *(.data.percpu.shared_aligned) | 70 | *(.data.percpu.shared_aligned) |
70 | __per_cpu_end = .; | 71 | __per_cpu_end = .; |
diff --git a/arch/arm/oprofile/op_model_mpcore.c b/arch/arm/oprofile/op_model_mpcore.c index 6d6bd5899240..853d42bb8682 100644 --- a/arch/arm/oprofile/op_model_mpcore.c +++ b/arch/arm/oprofile/op_model_mpcore.c | |||
@@ -263,7 +263,7 @@ static void em_route_irq(int irq, unsigned int cpu) | |||
263 | const struct cpumask *mask = cpumask_of(cpu); | 263 | const struct cpumask *mask = cpumask_of(cpu); |
264 | 264 | ||
265 | spin_lock_irq(&desc->lock); | 265 | spin_lock_irq(&desc->lock); |
266 | desc->affinity = *mask; | 266 | cpumask_copy(desc->affinity, mask); |
267 | desc->chip->set_affinity(irq, mask); | 267 | desc->chip->set_affinity(irq, mask); |
268 | spin_unlock_irq(&desc->lock); | 268 | spin_unlock_irq(&desc->lock); |
269 | } | 269 | } |
diff --git a/arch/blackfin/kernel/irqchip.c b/arch/blackfin/kernel/irqchip.c index ab8209cbbad0..5780d6df1542 100644 --- a/arch/blackfin/kernel/irqchip.c +++ b/arch/blackfin/kernel/irqchip.c | |||
@@ -69,6 +69,11 @@ static struct irq_desc bad_irq_desc = { | |||
69 | #endif | 69 | #endif |
70 | }; | 70 | }; |
71 | 71 | ||
72 | #ifdef CONFIG_CPUMASK_OFFSTACK | ||
73 | /* We are not allocating a variable-sized bad_irq_desc.affinity */ | ||
74 | #error "Blackfin architecture does not support CONFIG_CPUMASK_OFFSTACK." | ||
75 | #endif | ||
76 | |||
72 | int show_interrupts(struct seq_file *p, void *v) | 77 | int show_interrupts(struct seq_file *p, void *v) |
73 | { | 78 | { |
74 | int i = *(loff_t *) v, j; | 79 | int i = *(loff_t *) v, j; |
diff --git a/arch/ia64/include/asm/topology.h b/arch/ia64/include/asm/topology.h index 32f3af1641c5..3193f4417e16 100644 --- a/arch/ia64/include/asm/topology.h +++ b/arch/ia64/include/asm/topology.h | |||
@@ -84,7 +84,7 @@ void build_cpu_to_node_map(void); | |||
84 | .child = NULL, \ | 84 | .child = NULL, \ |
85 | .groups = NULL, \ | 85 | .groups = NULL, \ |
86 | .min_interval = 8, \ | 86 | .min_interval = 8, \ |
87 | .max_interval = 8*(min(num_online_cpus(), 32)), \ | 87 | .max_interval = 8*(min(num_online_cpus(), 32U)), \ |
88 | .busy_factor = 64, \ | 88 | .busy_factor = 64, \ |
89 | .imbalance_pct = 125, \ | 89 | .imbalance_pct = 125, \ |
90 | .cache_nice_tries = 2, \ | 90 | .cache_nice_tries = 2, \ |
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c index 5cfd3d91001a..006ad366a454 100644 --- a/arch/ia64/kernel/iosapic.c +++ b/arch/ia64/kernel/iosapic.c | |||
@@ -880,7 +880,7 @@ iosapic_unregister_intr (unsigned int gsi) | |||
880 | if (iosapic_intr_info[irq].count == 0) { | 880 | if (iosapic_intr_info[irq].count == 0) { |
881 | #ifdef CONFIG_SMP | 881 | #ifdef CONFIG_SMP |
882 | /* Clear affinity */ | 882 | /* Clear affinity */ |
883 | cpus_setall(idesc->affinity); | 883 | cpumask_setall(idesc->affinity); |
884 | #endif | 884 | #endif |
885 | /* Clear the interrupt information */ | 885 | /* Clear the interrupt information */ |
886 | iosapic_intr_info[irq].dest = 0; | 886 | iosapic_intr_info[irq].dest = 0; |
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c index a58f64ca9f0e..226233a6fa19 100644 --- a/arch/ia64/kernel/irq.c +++ b/arch/ia64/kernel/irq.c | |||
@@ -103,7 +103,7 @@ static char irq_redir [NR_IRQS]; // = { [0 ... NR_IRQS-1] = 1 }; | |||
103 | void set_irq_affinity_info (unsigned int irq, int hwid, int redir) | 103 | void set_irq_affinity_info (unsigned int irq, int hwid, int redir) |
104 | { | 104 | { |
105 | if (irq < NR_IRQS) { | 105 | if (irq < NR_IRQS) { |
106 | cpumask_copy(&irq_desc[irq].affinity, | 106 | cpumask_copy(irq_desc[irq].affinity, |
107 | cpumask_of(cpu_logical_id(hwid))); | 107 | cpumask_of(cpu_logical_id(hwid))); |
108 | irq_redir[irq] = (char) (redir & 0xff); | 108 | irq_redir[irq] = (char) (redir & 0xff); |
109 | } | 109 | } |
@@ -148,7 +148,7 @@ static void migrate_irqs(void) | |||
148 | if (desc->status == IRQ_PER_CPU) | 148 | if (desc->status == IRQ_PER_CPU) |
149 | continue; | 149 | continue; |
150 | 150 | ||
151 | if (cpumask_any_and(&irq_desc[irq].affinity, cpu_online_mask) | 151 | if (cpumask_any_and(irq_desc[irq].affinity, cpu_online_mask) |
152 | >= nr_cpu_ids) { | 152 | >= nr_cpu_ids) { |
153 | /* | 153 | /* |
154 | * Save it for phase 2 processing | 154 | * Save it for phase 2 processing |
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c index 28d3d483db92..927ad027820c 100644 --- a/arch/ia64/kernel/irq_ia64.c +++ b/arch/ia64/kernel/irq_ia64.c | |||
@@ -493,11 +493,13 @@ ia64_handle_irq (ia64_vector vector, struct pt_regs *regs) | |||
493 | saved_tpr = ia64_getreg(_IA64_REG_CR_TPR); | 493 | saved_tpr = ia64_getreg(_IA64_REG_CR_TPR); |
494 | ia64_srlz_d(); | 494 | ia64_srlz_d(); |
495 | while (vector != IA64_SPURIOUS_INT_VECTOR) { | 495 | while (vector != IA64_SPURIOUS_INT_VECTOR) { |
496 | struct irq_desc *desc = irq_to_desc(vector); | ||
497 | |||
496 | if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) { | 498 | if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) { |
497 | smp_local_flush_tlb(); | 499 | smp_local_flush_tlb(); |
498 | kstat_this_cpu.irqs[vector]++; | 500 | kstat_incr_irqs_this_cpu(vector, desc); |
499 | } else if (unlikely(IS_RESCHEDULE(vector))) | 501 | } else if (unlikely(IS_RESCHEDULE(vector))) |
500 | kstat_this_cpu.irqs[vector]++; | 502 | kstat_incr_irqs_this_cpu(vector, desc); |
501 | else { | 503 | else { |
502 | int irq = local_vector_to_irq(vector); | 504 | int irq = local_vector_to_irq(vector); |
503 | 505 | ||
@@ -551,11 +553,13 @@ void ia64_process_pending_intr(void) | |||
551 | * Perform normal interrupt style processing | 553 | * Perform normal interrupt style processing |
552 | */ | 554 | */ |
553 | while (vector != IA64_SPURIOUS_INT_VECTOR) { | 555 | while (vector != IA64_SPURIOUS_INT_VECTOR) { |
556 | struct irq_desc *desc = irq_to_desc(vector); | ||
557 | |||
554 | if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) { | 558 | if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) { |
555 | smp_local_flush_tlb(); | 559 | smp_local_flush_tlb(); |
556 | kstat_this_cpu.irqs[vector]++; | 560 | kstat_incr_irqs_this_cpu(vector, desc); |
557 | } else if (unlikely(IS_RESCHEDULE(vector))) | 561 | } else if (unlikely(IS_RESCHEDULE(vector))) |
558 | kstat_this_cpu.irqs[vector]++; | 562 | kstat_incr_irqs_this_cpu(vector, desc); |
559 | else { | 563 | else { |
560 | struct pt_regs *old_regs = set_irq_regs(NULL); | 564 | struct pt_regs *old_regs = set_irq_regs(NULL); |
561 | int irq = local_vector_to_irq(vector); | 565 | int irq = local_vector_to_irq(vector); |
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c index 890339339035..dcb6b7c51ea7 100644 --- a/arch/ia64/kernel/msi_ia64.c +++ b/arch/ia64/kernel/msi_ia64.c | |||
@@ -75,7 +75,7 @@ static void ia64_set_msi_irq_affinity(unsigned int irq, | |||
75 | msg.data = data; | 75 | msg.data = data; |
76 | 76 | ||
77 | write_msi_msg(irq, &msg); | 77 | write_msi_msg(irq, &msg); |
78 | irq_desc[irq].affinity = cpumask_of_cpu(cpu); | 78 | cpumask_copy(irq_desc[irq].affinity, cpumask_of(cpu)); |
79 | } | 79 | } |
80 | #endif /* CONFIG_SMP */ | 80 | #endif /* CONFIG_SMP */ |
81 | 81 | ||
@@ -187,7 +187,7 @@ static void dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) | |||
187 | msg.address_lo |= MSI_ADDR_DESTID_CPU(cpu_physical_id(cpu)); | 187 | msg.address_lo |= MSI_ADDR_DESTID_CPU(cpu_physical_id(cpu)); |
188 | 188 | ||
189 | dmar_msi_write(irq, &msg); | 189 | dmar_msi_write(irq, &msg); |
190 | irq_desc[irq].affinity = *mask; | 190 | cpumask_copy(irq_desc[irq].affinity, mask); |
191 | } | 191 | } |
192 | #endif /* CONFIG_SMP */ | 192 | #endif /* CONFIG_SMP */ |
193 | 193 | ||
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S index 10a7d47e8510..f45e4e508eca 100644 --- a/arch/ia64/kernel/vmlinux.lds.S +++ b/arch/ia64/kernel/vmlinux.lds.S | |||
@@ -219,6 +219,7 @@ SECTIONS | |||
219 | .data.percpu PERCPU_ADDR : AT(__phys_per_cpu_start - LOAD_OFFSET) | 219 | .data.percpu PERCPU_ADDR : AT(__phys_per_cpu_start - LOAD_OFFSET) |
220 | { | 220 | { |
221 | __per_cpu_start = .; | 221 | __per_cpu_start = .; |
222 | *(.data.percpu.page_aligned) | ||
222 | *(.data.percpu) | 223 | *(.data.percpu) |
223 | *(.data.percpu.shared_aligned) | 224 | *(.data.percpu.shared_aligned) |
224 | __per_cpu_end = .; | 225 | __per_cpu_end = .; |
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c index ca553b0429ce..81e428943d73 100644 --- a/arch/ia64/sn/kernel/msi_sn.c +++ b/arch/ia64/sn/kernel/msi_sn.c | |||
@@ -205,7 +205,7 @@ static void sn_set_msi_irq_affinity(unsigned int irq, | |||
205 | msg.address_lo = (u32)(bus_addr & 0x00000000ffffffff); | 205 | msg.address_lo = (u32)(bus_addr & 0x00000000ffffffff); |
206 | 206 | ||
207 | write_msi_msg(irq, &msg); | 207 | write_msi_msg(irq, &msg); |
208 | irq_desc[irq].affinity = *cpu_mask; | 208 | cpumask_copy(irq_desc[irq].affinity, cpu_mask); |
209 | } | 209 | } |
210 | #endif /* CONFIG_SMP */ | 210 | #endif /* CONFIG_SMP */ |
211 | 211 | ||
diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h index abc62aa744ac..3214ade02d10 100644 --- a/arch/mips/include/asm/irq.h +++ b/arch/mips/include/asm/irq.h | |||
@@ -66,7 +66,7 @@ extern void smtc_forward_irq(unsigned int irq); | |||
66 | */ | 66 | */ |
67 | #define IRQ_AFFINITY_HOOK(irq) \ | 67 | #define IRQ_AFFINITY_HOOK(irq) \ |
68 | do { \ | 68 | do { \ |
69 | if (!cpu_isset(smp_processor_id(), irq_desc[irq].affinity)) { \ | 69 | if (!cpumask_test_cpu(smp_processor_id(), irq_desc[irq].affinity)) {\ |
70 | smtc_forward_irq(irq); \ | 70 | smtc_forward_irq(irq); \ |
71 | irq_exit(); \ | 71 | irq_exit(); \ |
72 | return; \ | 72 | return; \ |
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c index 494a49a317e9..87deb8f6c458 100644 --- a/arch/mips/kernel/irq-gic.c +++ b/arch/mips/kernel/irq-gic.c | |||
@@ -187,7 +187,7 @@ static void gic_set_affinity(unsigned int irq, const struct cpumask *cpumask) | |||
187 | set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask); | 187 | set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask); |
188 | 188 | ||
189 | } | 189 | } |
190 | irq_desc[irq].affinity = *cpumask; | 190 | cpumask_copy(irq_desc[irq].affinity, cpumask); |
191 | spin_unlock_irqrestore(&gic_lock, flags); | 191 | spin_unlock_irqrestore(&gic_lock, flags); |
192 | 192 | ||
193 | } | 193 | } |
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c index b6cca01ff82b..5f5af7d4c890 100644 --- a/arch/mips/kernel/smtc.c +++ b/arch/mips/kernel/smtc.c | |||
@@ -686,7 +686,7 @@ void smtc_forward_irq(unsigned int irq) | |||
686 | * and efficiency, we just pick the easiest one to find. | 686 | * and efficiency, we just pick the easiest one to find. |
687 | */ | 687 | */ |
688 | 688 | ||
689 | target = first_cpu(irq_desc[irq].affinity); | 689 | target = cpumask_first(irq_desc[irq].affinity); |
690 | 690 | ||
691 | /* | 691 | /* |
692 | * We depend on the platform code to have correctly processed | 692 | * We depend on the platform code to have correctly processed |
@@ -921,11 +921,13 @@ void ipi_decode(struct smtc_ipi *pipi) | |||
921 | struct clock_event_device *cd; | 921 | struct clock_event_device *cd; |
922 | void *arg_copy = pipi->arg; | 922 | void *arg_copy = pipi->arg; |
923 | int type_copy = pipi->type; | 923 | int type_copy = pipi->type; |
924 | int irq = MIPS_CPU_IRQ_BASE + 1; | ||
925 | |||
924 | smtc_ipi_nq(&freeIPIq, pipi); | 926 | smtc_ipi_nq(&freeIPIq, pipi); |
925 | switch (type_copy) { | 927 | switch (type_copy) { |
926 | case SMTC_CLOCK_TICK: | 928 | case SMTC_CLOCK_TICK: |
927 | irq_enter(); | 929 | irq_enter(); |
928 | kstat_this_cpu.irqs[MIPS_CPU_IRQ_BASE + 1]++; | 930 | kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq)); |
929 | cd = &per_cpu(mips_clockevent_device, cpu); | 931 | cd = &per_cpu(mips_clockevent_device, cpu); |
930 | cd->event_handler(cd); | 932 | cd->event_handler(cd); |
931 | irq_exit(); | 933 | irq_exit(); |
diff --git a/arch/mips/mti-malta/malta-smtc.c b/arch/mips/mti-malta/malta-smtc.c index aabd7274507b..5ba31888fefb 100644 --- a/arch/mips/mti-malta/malta-smtc.c +++ b/arch/mips/mti-malta/malta-smtc.c | |||
@@ -116,7 +116,7 @@ struct plat_smp_ops msmtc_smp_ops = { | |||
116 | 116 | ||
117 | void plat_set_irq_affinity(unsigned int irq, const struct cpumask *affinity) | 117 | void plat_set_irq_affinity(unsigned int irq, const struct cpumask *affinity) |
118 | { | 118 | { |
119 | cpumask_t tmask = *affinity; | 119 | cpumask_t tmask; |
120 | int cpu = 0; | 120 | int cpu = 0; |
121 | void smtc_set_irq_affinity(unsigned int irq, cpumask_t aff); | 121 | void smtc_set_irq_affinity(unsigned int irq, cpumask_t aff); |
122 | 122 | ||
@@ -139,11 +139,12 @@ void plat_set_irq_affinity(unsigned int irq, const struct cpumask *affinity) | |||
139 | * be made to forward to an offline "CPU". | 139 | * be made to forward to an offline "CPU". |
140 | */ | 140 | */ |
141 | 141 | ||
142 | cpumask_copy(&tmask, affinity); | ||
142 | for_each_cpu(cpu, affinity) { | 143 | for_each_cpu(cpu, affinity) { |
143 | if ((cpu_data[cpu].vpe_id != 0) || !cpu_online(cpu)) | 144 | if ((cpu_data[cpu].vpe_id != 0) || !cpu_online(cpu)) |
144 | cpu_clear(cpu, tmask); | 145 | cpu_clear(cpu, tmask); |
145 | } | 146 | } |
146 | irq_desc[irq].affinity = tmask; | 147 | cpumask_copy(irq_desc[irq].affinity, &tmask); |
147 | 148 | ||
148 | if (cpus_empty(tmask)) | 149 | if (cpus_empty(tmask)) |
149 | /* | 150 | /* |
diff --git a/arch/mips/sgi-ip22/ip22-int.c b/arch/mips/sgi-ip22/ip22-int.c index f8b18af141a1..0ecd5fe9486e 100644 --- a/arch/mips/sgi-ip22/ip22-int.c +++ b/arch/mips/sgi-ip22/ip22-int.c | |||
@@ -155,7 +155,7 @@ static void indy_buserror_irq(void) | |||
155 | int irq = SGI_BUSERR_IRQ; | 155 | int irq = SGI_BUSERR_IRQ; |
156 | 156 | ||
157 | irq_enter(); | 157 | irq_enter(); |
158 | kstat_this_cpu.irqs[irq]++; | 158 | kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq)); |
159 | ip22_be_interrupt(irq); | 159 | ip22_be_interrupt(irq); |
160 | irq_exit(); | 160 | irq_exit(); |
161 | } | 161 | } |
diff --git a/arch/mips/sgi-ip22/ip22-time.c b/arch/mips/sgi-ip22/ip22-time.c index 3dcb27ec0c53..c8f7d2328b24 100644 --- a/arch/mips/sgi-ip22/ip22-time.c +++ b/arch/mips/sgi-ip22/ip22-time.c | |||
@@ -122,7 +122,7 @@ void indy_8254timer_irq(void) | |||
122 | char c; | 122 | char c; |
123 | 123 | ||
124 | irq_enter(); | 124 | irq_enter(); |
125 | kstat_this_cpu.irqs[irq]++; | 125 | kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq)); |
126 | printk(KERN_ALERT "Oops, got 8254 interrupt.\n"); | 126 | printk(KERN_ALERT "Oops, got 8254 interrupt.\n"); |
127 | ArcRead(0, &c, 1, &cnt); | 127 | ArcRead(0, &c, 1, &cnt); |
128 | ArcEnterInteractiveMode(); | 128 | ArcEnterInteractiveMode(); |
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c index dddfda8e8294..314691648c97 100644 --- a/arch/mips/sibyte/bcm1480/smp.c +++ b/arch/mips/sibyte/bcm1480/smp.c | |||
@@ -178,9 +178,10 @@ struct plat_smp_ops bcm1480_smp_ops = { | |||
178 | void bcm1480_mailbox_interrupt(void) | 178 | void bcm1480_mailbox_interrupt(void) |
179 | { | 179 | { |
180 | int cpu = smp_processor_id(); | 180 | int cpu = smp_processor_id(); |
181 | int irq = K_BCM1480_INT_MBOX_0_0; | ||
181 | unsigned int action; | 182 | unsigned int action; |
182 | 183 | ||
183 | kstat_this_cpu.irqs[K_BCM1480_INT_MBOX_0_0]++; | 184 | kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq)); |
184 | /* Load the mailbox register to figure out what we're supposed to do */ | 185 | /* Load the mailbox register to figure out what we're supposed to do */ |
185 | action = (__raw_readq(mailbox_0_regs[cpu]) >> 48) & 0xffff; | 186 | action = (__raw_readq(mailbox_0_regs[cpu]) >> 48) & 0xffff; |
186 | 187 | ||
diff --git a/arch/mips/sibyte/sb1250/smp.c b/arch/mips/sibyte/sb1250/smp.c index 5950a288a7da..cad14003b84f 100644 --- a/arch/mips/sibyte/sb1250/smp.c +++ b/arch/mips/sibyte/sb1250/smp.c | |||
@@ -166,9 +166,10 @@ struct plat_smp_ops sb_smp_ops = { | |||
166 | void sb1250_mailbox_interrupt(void) | 166 | void sb1250_mailbox_interrupt(void) |
167 | { | 167 | { |
168 | int cpu = smp_processor_id(); | 168 | int cpu = smp_processor_id(); |
169 | int irq = K_INT_MBOX_0; | ||
169 | unsigned int action; | 170 | unsigned int action; |
170 | 171 | ||
171 | kstat_this_cpu.irqs[K_INT_MBOX_0]++; | 172 | kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq)); |
172 | /* Load the mailbox register to figure out what we're supposed to do */ | 173 | /* Load the mailbox register to figure out what we're supposed to do */ |
173 | action = (____raw_readq(mailbox_regs[cpu]) >> 48) & 0xffff; | 174 | action = (____raw_readq(mailbox_regs[cpu]) >> 48) & 0xffff; |
174 | 175 | ||
diff --git a/arch/mn10300/kernel/mn10300-watchdog.c b/arch/mn10300/kernel/mn10300-watchdog.c index 10811e981d20..2e370d88a87a 100644 --- a/arch/mn10300/kernel/mn10300-watchdog.c +++ b/arch/mn10300/kernel/mn10300-watchdog.c | |||
@@ -130,6 +130,7 @@ void watchdog_interrupt(struct pt_regs *regs, enum exception_code excep) | |||
130 | * the stack NMI-atomically, it's safe to use smp_processor_id(). | 130 | * the stack NMI-atomically, it's safe to use smp_processor_id(). |
131 | */ | 131 | */ |
132 | int sum, cpu = smp_processor_id(); | 132 | int sum, cpu = smp_processor_id(); |
133 | int irq = NMIIRQ; | ||
133 | u8 wdt, tmp; | 134 | u8 wdt, tmp; |
134 | 135 | ||
135 | wdt = WDCTR & ~WDCTR_WDCNE; | 136 | wdt = WDCTR & ~WDCTR_WDCNE; |
@@ -138,7 +139,7 @@ void watchdog_interrupt(struct pt_regs *regs, enum exception_code excep) | |||
138 | NMICR = NMICR_WDIF; | 139 | NMICR = NMICR_WDIF; |
139 | 140 | ||
140 | nmi_count(cpu)++; | 141 | nmi_count(cpu)++; |
141 | kstat_this_cpu.irqs[NMIIRQ]++; | 142 | kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq)); |
142 | sum = irq_stat[cpu].__irq_count; | 143 | sum = irq_stat[cpu].__irq_count; |
143 | 144 | ||
144 | if (last_irq_sums[cpu] == sum) { | 145 | if (last_irq_sums[cpu] == sum) { |
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c index ac2c822928c7..49482806863f 100644 --- a/arch/parisc/kernel/irq.c +++ b/arch/parisc/kernel/irq.c | |||
@@ -120,7 +120,7 @@ int cpu_check_affinity(unsigned int irq, cpumask_t *dest) | |||
120 | if (CHECK_IRQ_PER_CPU(irq)) { | 120 | if (CHECK_IRQ_PER_CPU(irq)) { |
121 | /* Bad linux design decision. The mask has already | 121 | /* Bad linux design decision. The mask has already |
122 | * been set; we must reset it */ | 122 | * been set; we must reset it */ |
123 | irq_desc[irq].affinity = CPU_MASK_ALL; | 123 | cpumask_setall(irq_desc[irq].affinity); |
124 | return -EINVAL; | 124 | return -EINVAL; |
125 | } | 125 | } |
126 | 126 | ||
@@ -136,7 +136,7 @@ static void cpu_set_affinity_irq(unsigned int irq, const struct cpumask *dest) | |||
136 | if (cpu_check_affinity(irq, dest)) | 136 | if (cpu_check_affinity(irq, dest)) |
137 | return; | 137 | return; |
138 | 138 | ||
139 | irq_desc[irq].affinity = *dest; | 139 | cpumask_copy(irq_desc[irq].affinity, dest); |
140 | } | 140 | } |
141 | #endif | 141 | #endif |
142 | 142 | ||
@@ -295,7 +295,7 @@ int txn_alloc_irq(unsigned int bits_wide) | |||
295 | unsigned long txn_affinity_addr(unsigned int irq, int cpu) | 295 | unsigned long txn_affinity_addr(unsigned int irq, int cpu) |
296 | { | 296 | { |
297 | #ifdef CONFIG_SMP | 297 | #ifdef CONFIG_SMP |
298 | irq_desc[irq].affinity = cpumask_of_cpu(cpu); | 298 | cpumask_copy(irq_desc[irq].affinity, cpumask_of(cpu)); |
299 | #endif | 299 | #endif |
300 | 300 | ||
301 | return per_cpu(cpu_data, cpu).txn_addr; | 301 | return per_cpu(cpu_data, cpu).txn_addr; |
@@ -352,7 +352,7 @@ void do_cpu_irq_mask(struct pt_regs *regs) | |||
352 | irq = eirr_to_irq(eirr_val); | 352 | irq = eirr_to_irq(eirr_val); |
353 | 353 | ||
354 | #ifdef CONFIG_SMP | 354 | #ifdef CONFIG_SMP |
355 | dest = irq_desc[irq].affinity; | 355 | cpumask_copy(&dest, irq_desc[irq].affinity); |
356 | if (CHECK_IRQ_PER_CPU(irq_desc[irq].status) && | 356 | if (CHECK_IRQ_PER_CPU(irq_desc[irq].status) && |
357 | !cpu_isset(smp_processor_id(), dest)) { | 357 | !cpu_isset(smp_processor_id(), dest)) { |
358 | int cpu = first_cpu(dest); | 358 | int cpu = first_cpu(dest); |
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 23b8b5e36f98..ad1e5ac721d8 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -231,7 +231,7 @@ void fixup_irqs(cpumask_t map) | |||
231 | if (irq_desc[irq].status & IRQ_PER_CPU) | 231 | if (irq_desc[irq].status & IRQ_PER_CPU) |
232 | continue; | 232 | continue; |
233 | 233 | ||
234 | cpus_and(mask, irq_desc[irq].affinity, map); | 234 | cpumask_and(&mask, irq_desc[irq].affinity, &map); |
235 | if (any_online_cpu(mask) == NR_CPUS) { | 235 | if (any_online_cpu(mask) == NR_CPUS) { |
236 | printk("Breaking affinity for irq %i\n", irq); | 236 | printk("Breaking affinity for irq %i\n", irq); |
237 | mask = map; | 237 | mask = map; |
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 161b9b9691f0..295ccc5e86b1 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S | |||
@@ -184,6 +184,7 @@ SECTIONS | |||
184 | . = ALIGN(PAGE_SIZE); | 184 | . = ALIGN(PAGE_SIZE); |
185 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { | 185 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { |
186 | __per_cpu_start = .; | 186 | __per_cpu_start = .; |
187 | *(.data.percpu.page_aligned) | ||
187 | *(.data.percpu) | 188 | *(.data.percpu) |
188 | *(.data.percpu.shared_aligned) | 189 | *(.data.percpu.shared_aligned) |
189 | __per_cpu_end = .; | 190 | __per_cpu_end = .; |
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c index 84e058f1e1cc..80b513449f4c 100644 --- a/arch/powerpc/platforms/pseries/xics.c +++ b/arch/powerpc/platforms/pseries/xics.c | |||
@@ -153,9 +153,10 @@ static int get_irq_server(unsigned int virq, unsigned int strict_check) | |||
153 | { | 153 | { |
154 | int server; | 154 | int server; |
155 | /* For the moment only implement delivery to all cpus or one cpu */ | 155 | /* For the moment only implement delivery to all cpus or one cpu */ |
156 | cpumask_t cpumask = irq_desc[virq].affinity; | 156 | cpumask_t cpumask; |
157 | cpumask_t tmp = CPU_MASK_NONE; | 157 | cpumask_t tmp = CPU_MASK_NONE; |
158 | 158 | ||
159 | cpumask_copy(&cpumask, irq_desc[virq].affinity); | ||
159 | if (!distribute_irqs) | 160 | if (!distribute_irqs) |
160 | return default_server; | 161 | return default_server; |
161 | 162 | ||
@@ -869,7 +870,7 @@ void xics_migrate_irqs_away(void) | |||
869 | virq, cpu); | 870 | virq, cpu); |
870 | 871 | ||
871 | /* Reset affinity to all cpus */ | 872 | /* Reset affinity to all cpus */ |
872 | irq_desc[virq].affinity = CPU_MASK_ALL; | 873 | cpumask_setall(irq_desc[virq].affinity); |
873 | desc->chip->set_affinity(virq, cpu_all_mask); | 874 | desc->chip->set_affinity(virq, cpu_all_mask); |
874 | unlock: | 875 | unlock: |
875 | spin_unlock_irqrestore(&desc->lock, flags); | 876 | spin_unlock_irqrestore(&desc->lock, flags); |
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index a35297dbac28..532e205303a2 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c | |||
@@ -566,9 +566,10 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic) | |||
566 | #ifdef CONFIG_SMP | 566 | #ifdef CONFIG_SMP |
567 | static int irq_choose_cpu(unsigned int virt_irq) | 567 | static int irq_choose_cpu(unsigned int virt_irq) |
568 | { | 568 | { |
569 | cpumask_t mask = irq_desc[virt_irq].affinity; | 569 | cpumask_t mask; |
570 | int cpuid; | 570 | int cpuid; |
571 | 571 | ||
572 | cpumask_copy(&mask, irq_desc[virt_irq].affinity); | ||
572 | if (cpus_equal(mask, CPU_MASK_ALL)) { | 573 | if (cpus_equal(mask, CPU_MASK_ALL)) { |
573 | static int irq_rover; | 574 | static int irq_rover; |
574 | static DEFINE_SPINLOCK(irq_rover_lock); | 575 | static DEFINE_SPINLOCK(irq_rover_lock); |
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c index cab8e0286871..4ac5c651e00d 100644 --- a/arch/sparc/kernel/irq_64.c +++ b/arch/sparc/kernel/irq_64.c | |||
@@ -247,9 +247,10 @@ struct irq_handler_data { | |||
247 | #ifdef CONFIG_SMP | 247 | #ifdef CONFIG_SMP |
248 | static int irq_choose_cpu(unsigned int virt_irq) | 248 | static int irq_choose_cpu(unsigned int virt_irq) |
249 | { | 249 | { |
250 | cpumask_t mask = irq_desc[virt_irq].affinity; | 250 | cpumask_t mask; |
251 | int cpuid; | 251 | int cpuid; |
252 | 252 | ||
253 | cpumask_copy(&mask, irq_desc[virt_irq].affinity); | ||
253 | if (cpus_equal(mask, CPU_MASK_ALL)) { | 254 | if (cpus_equal(mask, CPU_MASK_ALL)) { |
254 | static int irq_rover; | 255 | static int irq_rover; |
255 | static DEFINE_SPINLOCK(irq_rover_lock); | 256 | static DEFINE_SPINLOCK(irq_rover_lock); |
@@ -854,7 +855,7 @@ void fixup_irqs(void) | |||
854 | !(irq_desc[irq].status & IRQ_PER_CPU)) { | 855 | !(irq_desc[irq].status & IRQ_PER_CPU)) { |
855 | if (irq_desc[irq].chip->set_affinity) | 856 | if (irq_desc[irq].chip->set_affinity) |
856 | irq_desc[irq].chip->set_affinity(irq, | 857 | irq_desc[irq].chip->set_affinity(irq, |
857 | &irq_desc[irq].affinity); | 858 | irq_desc[irq].affinity); |
858 | } | 859 | } |
859 | spin_unlock_irqrestore(&irq_desc[irq].lock, flags); | 860 | spin_unlock_irqrestore(&irq_desc[irq].lock, flags); |
860 | } | 861 | } |
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c index 2db3c2229b95..db310aa00183 100644 --- a/arch/sparc/kernel/time_64.c +++ b/arch/sparc/kernel/time_64.c | |||
@@ -729,7 +729,7 @@ void timer_interrupt(int irq, struct pt_regs *regs) | |||
729 | 729 | ||
730 | irq_enter(); | 730 | irq_enter(); |
731 | 731 | ||
732 | kstat_this_cpu.irqs[0]++; | 732 | kstat_incr_irqs_this_cpu(0, irq_to_desc(0)); |
733 | 733 | ||
734 | if (unlikely(!evt->event_handler)) { | 734 | if (unlikely(!evt->event_handler)) { |
735 | printk(KERN_WARNING | 735 | printk(KERN_WARNING |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 9c39095b33fc..80291f749b66 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -34,8 +34,8 @@ config X86 | |||
34 | select HAVE_FUNCTION_TRACER | 34 | select HAVE_FUNCTION_TRACER |
35 | select HAVE_FUNCTION_GRAPH_TRACER | 35 | select HAVE_FUNCTION_GRAPH_TRACER |
36 | select HAVE_FUNCTION_TRACE_MCOUNT_TEST | 36 | select HAVE_FUNCTION_TRACE_MCOUNT_TEST |
37 | select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) | 37 | select HAVE_KVM |
38 | select HAVE_ARCH_KGDB if !X86_VOYAGER | 38 | select HAVE_ARCH_KGDB |
39 | select HAVE_ARCH_TRACEHOOK | 39 | select HAVE_ARCH_TRACEHOOK |
40 | select HAVE_GENERIC_DMA_COHERENT if X86_32 | 40 | select HAVE_GENERIC_DMA_COHERENT if X86_32 |
41 | select HAVE_EFFICIENT_UNALIGNED_ACCESS | 41 | select HAVE_EFFICIENT_UNALIGNED_ACCESS |
@@ -133,18 +133,17 @@ config ARCH_HAS_CACHE_LINE_SIZE | |||
133 | def_bool y | 133 | def_bool y |
134 | 134 | ||
135 | config HAVE_SETUP_PER_CPU_AREA | 135 | config HAVE_SETUP_PER_CPU_AREA |
136 | def_bool X86_64_SMP || (X86_SMP && !X86_VOYAGER) | 136 | def_bool y |
137 | 137 | ||
138 | config HAVE_CPUMASK_OF_CPU_MAP | 138 | config HAVE_CPUMASK_OF_CPU_MAP |
139 | def_bool X86_64_SMP | 139 | def_bool X86_64_SMP |
140 | 140 | ||
141 | config ARCH_HIBERNATION_POSSIBLE | 141 | config ARCH_HIBERNATION_POSSIBLE |
142 | def_bool y | 142 | def_bool y |
143 | depends on !SMP || !X86_VOYAGER | 143 | depends on !SMP |
144 | 144 | ||
145 | config ARCH_SUSPEND_POSSIBLE | 145 | config ARCH_SUSPEND_POSSIBLE |
146 | def_bool y | 146 | def_bool y |
147 | depends on !X86_VOYAGER | ||
148 | 147 | ||
149 | config ZONE_DMA32 | 148 | config ZONE_DMA32 |
150 | bool | 149 | bool |
@@ -174,11 +173,6 @@ config GENERIC_PENDING_IRQ | |||
174 | depends on GENERIC_HARDIRQS && SMP | 173 | depends on GENERIC_HARDIRQS && SMP |
175 | default y | 174 | default y |
176 | 175 | ||
177 | config X86_SMP | ||
178 | bool | ||
179 | depends on SMP && ((X86_32 && !X86_VOYAGER) || X86_64) | ||
180 | default y | ||
181 | |||
182 | config USE_GENERIC_SMP_HELPERS | 176 | config USE_GENERIC_SMP_HELPERS |
183 | def_bool y | 177 | def_bool y |
184 | depends on SMP | 178 | depends on SMP |
@@ -194,17 +188,11 @@ config X86_64_SMP | |||
194 | config X86_HT | 188 | config X86_HT |
195 | bool | 189 | bool |
196 | depends on SMP | 190 | depends on SMP |
197 | depends on (X86_32 && !X86_VOYAGER) || X86_64 | ||
198 | default y | ||
199 | |||
200 | config X86_BIOS_REBOOT | ||
201 | bool | ||
202 | depends on !X86_VOYAGER | ||
203 | default y | 191 | default y |
204 | 192 | ||
205 | config X86_TRAMPOLINE | 193 | config X86_TRAMPOLINE |
206 | bool | 194 | bool |
207 | depends on X86_SMP || (X86_VOYAGER && SMP) || (64BIT && ACPI_SLEEP) | 195 | depends on SMP || (64BIT && ACPI_SLEEP) |
208 | default y | 196 | default y |
209 | 197 | ||
210 | config KTIME_SCALAR | 198 | config KTIME_SCALAR |
@@ -244,10 +232,6 @@ config SMP | |||
244 | 232 | ||
245 | If you don't know what to do here, say N. | 233 | If you don't know what to do here, say N. |
246 | 234 | ||
247 | config X86_HAS_BOOT_CPU_ID | ||
248 | def_bool y | ||
249 | depends on X86_VOYAGER | ||
250 | |||
251 | config SPARSE_IRQ | 235 | config SPARSE_IRQ |
252 | bool "Support sparse irq numbering" | 236 | bool "Support sparse irq numbering" |
253 | depends on PCI_MSI || HT_IRQ | 237 | depends on PCI_MSI || HT_IRQ |
@@ -270,10 +254,6 @@ config NUMA_MIGRATE_IRQ_DESC | |||
270 | 254 | ||
271 | If you don't know what to do here, say N. | 255 | If you don't know what to do here, say N. |
272 | 256 | ||
273 | config X86_FIND_SMP_CONFIG | ||
274 | def_bool y | ||
275 | depends on X86_MPPARSE || X86_VOYAGER | ||
276 | |||
277 | config X86_MPPARSE | 257 | config X86_MPPARSE |
278 | bool "Enable MPS table" if ACPI | 258 | bool "Enable MPS table" if ACPI |
279 | default y | 259 | default y |
@@ -282,18 +262,71 @@ config X86_MPPARSE | |||
282 | For old smp systems that do not have proper acpi support. Newer systems | 262 | For old smp systems that do not have proper acpi support. Newer systems |
283 | (esp with 64bit cpus) with acpi support, MADT and DSDT will override it | 263 | (esp with 64bit cpus) with acpi support, MADT and DSDT will override it |
284 | 264 | ||
285 | choice | 265 | config X86_BIGSMP |
286 | prompt "Subarchitecture Type" | 266 | bool "Support for big SMP systems with more than 8 CPUs" |
287 | default X86_PC | 267 | depends on X86_32 && SMP |
268 | help | ||
269 | This option is needed for the systems that have more than 8 CPUs | ||
270 | |||
271 | config X86_NON_STANDARD | ||
272 | bool "Support for non-standard x86 platforms" | ||
273 | help | ||
274 | If you disable this option then the kernel will only support | ||
275 | standard PC platforms. (which covers the vast majority of | ||
276 | systems out there.) | ||
288 | 277 | ||
289 | config X86_PC | 278 | If you enable this option then you'll be able to select a number |
290 | bool "PC-compatible" | 279 | of less common non-PC x86 platforms: VisWS, RDC321, SGI/UV. |
280 | |||
281 | If you have one of these systems, or if you want to build a | ||
282 | generic distribution kernel, say Y here - otherwise say N. | ||
283 | |||
284 | config X86_VISWS | ||
285 | bool "SGI 320/540 (Visual Workstation)" | ||
286 | depends on X86_32 && PCI && X86_MPPARSE && PCI_GODIRECT | ||
287 | depends on X86_NON_STANDARD | ||
291 | help | 288 | help |
292 | Choose this option if your computer is a standard PC or compatible. | 289 | The SGI Visual Workstation series is an IA32-based workstation |
290 | based on SGI systems chips with some legacy PC hardware attached. | ||
291 | |||
292 | Say Y here to create a kernel to run on the SGI 320 or 540. | ||
293 | |||
294 | A kernel compiled for the Visual Workstation will run on general | ||
295 | PCs as well. See <file:Documentation/sgi-visws.txt> for details. | ||
296 | |||
297 | config X86_RDC321X | ||
298 | bool "RDC R-321x SoC" | ||
299 | depends on X86_32 | ||
300 | depends on X86_NON_STANDARD | ||
301 | select M486 | ||
302 | select X86_REBOOTFIXUPS | ||
303 | help | ||
304 | This option is needed for RDC R-321x system-on-chip, also known | ||
305 | as R-8610-(G). | ||
306 | If you don't have one of these chips, you should say N here. | ||
307 | |||
308 | config X86_UV | ||
309 | bool "SGI Ultraviolet" | ||
310 | depends on X86_64 | ||
311 | depends on X86_NON_STANDARD | ||
312 | help | ||
313 | This option is needed in order to support SGI Ultraviolet systems. | ||
314 | If you don't have one of these, you should say N here. | ||
315 | |||
316 | config X86_VSMP | ||
317 | bool "Support for ScaleMP vSMP" | ||
318 | select PARAVIRT | ||
319 | depends on X86_64 && PCI | ||
320 | depends on X86_NON_STANDARD | ||
321 | help | ||
322 | Support for ScaleMP vSMP systems. Say 'Y' here if this kernel is | ||
323 | supposed to run on these EM64T-based machines. Only choose this option | ||
324 | if you have one of these machines. | ||
293 | 325 | ||
294 | config X86_ELAN | 326 | config X86_ELAN |
295 | bool "AMD Elan" | 327 | bool "AMD Elan" |
296 | depends on X86_32 | 328 | depends on X86_32 |
329 | depends on X86_NON_STANDARD | ||
297 | help | 330 | help |
298 | Select this for an AMD Elan processor. | 331 | Select this for an AMD Elan processor. |
299 | 332 | ||
@@ -301,33 +334,21 @@ config X86_ELAN | |||
301 | 334 | ||
302 | If unsure, choose "PC-compatible" instead. | 335 | If unsure, choose "PC-compatible" instead. |
303 | 336 | ||
304 | config X86_VOYAGER | 337 | config X86_32_NON_STANDARD |
305 | bool "Voyager (NCR)" | 338 | bool "Support non-standard 32-bit SMP architectures" |
306 | depends on X86_32 && (SMP || BROKEN) && !PCI | 339 | depends on X86_32 && SMP |
340 | depends on X86_NON_STANDARD | ||
307 | help | 341 | help |
308 | Voyager is an MCA-based 32-way capable SMP architecture proprietary | ||
309 | to NCR Corp. Machine classes 345x/35xx/4100/51xx are Voyager-based. | ||
310 | |||
311 | *** WARNING *** | ||
312 | |||
313 | If you do not specifically know you have a Voyager based machine, | ||
314 | say N here, otherwise the kernel you build will not be bootable. | ||
315 | |||
316 | config X86_GENERICARCH | ||
317 | bool "Generic architecture" | ||
318 | depends on X86_32 | ||
319 | help | ||
320 | This option compiles in the NUMAQ, Summit, bigsmp, ES7000, default | 342 | This option compiles in the NUMAQ, Summit, bigsmp, ES7000, default |
321 | subarchitectures. It is intended for a generic binary kernel. | 343 | subarchitectures. It is intended for a generic binary kernel. |
322 | if you select them all, kernel will probe it one by one. and will | 344 | if you select them all, kernel will probe it one by one. and will |
323 | fallback to default. | 345 | fallback to default. |
324 | 346 | ||
325 | if X86_GENERICARCH | ||
326 | |||
327 | config X86_NUMAQ | 347 | config X86_NUMAQ |
328 | bool "NUMAQ (IBM/Sequent)" | 348 | bool "NUMAQ (IBM/Sequent)" |
329 | depends on SMP && X86_32 && PCI && X86_MPPARSE | 349 | depends on X86_32_NON_STANDARD |
330 | select NUMA | 350 | select NUMA |
351 | select X86_MPPARSE | ||
331 | help | 352 | help |
332 | This option is used for getting Linux to run on a NUMAQ (IBM/Sequent) | 353 | This option is used for getting Linux to run on a NUMAQ (IBM/Sequent) |
333 | NUMA multiquad box. This changes the way that processors are | 354 | NUMA multiquad box. This changes the way that processors are |
@@ -337,59 +358,30 @@ config X86_NUMAQ | |||
337 | 358 | ||
338 | config X86_SUMMIT | 359 | config X86_SUMMIT |
339 | bool "Summit/EXA (IBM x440)" | 360 | bool "Summit/EXA (IBM x440)" |
340 | depends on X86_32 && SMP | 361 | depends on X86_32_NON_STANDARD |
341 | help | 362 | help |
342 | This option is needed for IBM systems that use the Summit/EXA chipset. | 363 | This option is needed for IBM systems that use the Summit/EXA chipset. |
343 | In particular, it is needed for the x440. | 364 | In particular, it is needed for the x440. |
344 | 365 | ||
345 | config X86_ES7000 | 366 | config X86_ES7000 |
346 | bool "Support for Unisys ES7000 IA32 series" | 367 | bool "Support for Unisys ES7000 IA32 series" |
347 | depends on X86_32 && SMP | 368 | depends on X86_32_NON_STANDARD && X86_BIGSMP |
348 | help | 369 | help |
349 | Support for Unisys ES7000 systems. Say 'Y' here if this kernel is | 370 | Support for Unisys ES7000 systems. Say 'Y' here if this kernel is |
350 | supposed to run on an IA32-based Unisys ES7000 system. | 371 | supposed to run on an IA32-based Unisys ES7000 system. |
351 | 372 | ||
352 | config X86_BIGSMP | 373 | config X86_VOYAGER |
353 | bool "Support for big SMP systems with more than 8 CPUs" | 374 | bool "Voyager (NCR)" |
354 | depends on X86_32 && SMP | 375 | depends on SMP && !PCI && BROKEN |
355 | help | 376 | depends on X86_32_NON_STANDARD |
356 | This option is needed for the systems that have more than 8 CPUs | ||
357 | and if the system is not of any sub-arch type above. | ||
358 | |||
359 | endif | ||
360 | |||
361 | config X86_VSMP | ||
362 | bool "Support for ScaleMP vSMP" | ||
363 | select PARAVIRT | ||
364 | depends on X86_64 && PCI | ||
365 | help | ||
366 | Support for ScaleMP vSMP systems. Say 'Y' here if this kernel is | ||
367 | supposed to run on these EM64T-based machines. Only choose this option | ||
368 | if you have one of these machines. | ||
369 | |||
370 | endchoice | ||
371 | |||
372 | config X86_VISWS | ||
373 | bool "SGI 320/540 (Visual Workstation)" | ||
374 | depends on X86_32 && PCI && !X86_VOYAGER && X86_MPPARSE && PCI_GODIRECT | ||
375 | help | 377 | help |
376 | The SGI Visual Workstation series is an IA32-based workstation | 378 | Voyager is an MCA-based 32-way capable SMP architecture proprietary |
377 | based on SGI systems chips with some legacy PC hardware attached. | 379 | to NCR Corp. Machine classes 345x/35xx/4100/51xx are Voyager-based. |
378 | |||
379 | Say Y here to create a kernel to run on the SGI 320 or 540. | ||
380 | 380 | ||
381 | A kernel compiled for the Visual Workstation will run on general | 381 | *** WARNING *** |
382 | PCs as well. See <file:Documentation/sgi-visws.txt> for details. | ||
383 | 382 | ||
384 | config X86_RDC321X | 383 | If you do not specifically know you have a Voyager based machine, |
385 | bool "RDC R-321x SoC" | 384 | say N here, otherwise the kernel you build will not be bootable. |
386 | depends on X86_32 | ||
387 | select M486 | ||
388 | select X86_REBOOTFIXUPS | ||
389 | help | ||
390 | This option is needed for RDC R-321x system-on-chip, also known | ||
391 | as R-8610-(G). | ||
392 | If you don't have one of these chips, you should say N here. | ||
393 | 385 | ||
394 | config SCHED_OMIT_FRAME_POINTER | 386 | config SCHED_OMIT_FRAME_POINTER |
395 | def_bool y | 387 | def_bool y |
@@ -419,7 +411,6 @@ config VMI | |||
419 | bool "VMI Guest support" | 411 | bool "VMI Guest support" |
420 | select PARAVIRT | 412 | select PARAVIRT |
421 | depends on X86_32 | 413 | depends on X86_32 |
422 | depends on !X86_VOYAGER | ||
423 | help | 414 | help |
424 | VMI provides a paravirtualized interface to the VMware ESX server | 415 | VMI provides a paravirtualized interface to the VMware ESX server |
425 | (it could be used by other hypervisors in theory too, but is not | 416 | (it could be used by other hypervisors in theory too, but is not |
@@ -430,7 +421,6 @@ config KVM_CLOCK | |||
430 | bool "KVM paravirtualized clock" | 421 | bool "KVM paravirtualized clock" |
431 | select PARAVIRT | 422 | select PARAVIRT |
432 | select PARAVIRT_CLOCK | 423 | select PARAVIRT_CLOCK |
433 | depends on !X86_VOYAGER | ||
434 | help | 424 | help |
435 | Turning on this option will allow you to run a paravirtualized clock | 425 | Turning on this option will allow you to run a paravirtualized clock |
436 | when running over the KVM hypervisor. Instead of relying on a PIT | 426 | when running over the KVM hypervisor. Instead of relying on a PIT |
@@ -441,7 +431,6 @@ config KVM_CLOCK | |||
441 | config KVM_GUEST | 431 | config KVM_GUEST |
442 | bool "KVM Guest support" | 432 | bool "KVM Guest support" |
443 | select PARAVIRT | 433 | select PARAVIRT |
444 | depends on !X86_VOYAGER | ||
445 | help | 434 | help |
446 | This option enables various optimizations for running under the KVM | 435 | This option enables various optimizations for running under the KVM |
447 | hypervisor. | 436 | hypervisor. |
@@ -450,7 +439,6 @@ source "arch/x86/lguest/Kconfig" | |||
450 | 439 | ||
451 | config PARAVIRT | 440 | config PARAVIRT |
452 | bool "Enable paravirtualization code" | 441 | bool "Enable paravirtualization code" |
453 | depends on !X86_VOYAGER | ||
454 | help | 442 | help |
455 | This changes the kernel so it can modify itself when it is run | 443 | This changes the kernel so it can modify itself when it is run |
456 | under a hypervisor, potentially improving performance significantly | 444 | under a hypervisor, potentially improving performance significantly |
@@ -483,11 +471,11 @@ config MEMTEST | |||
483 | 471 | ||
484 | config X86_SUMMIT_NUMA | 472 | config X86_SUMMIT_NUMA |
485 | def_bool y | 473 | def_bool y |
486 | depends on X86_32 && NUMA && X86_GENERICARCH | 474 | depends on X86_32 && NUMA && X86_32_NON_STANDARD |
487 | 475 | ||
488 | config X86_CYCLONE_TIMER | 476 | config X86_CYCLONE_TIMER |
489 | def_bool y | 477 | def_bool y |
490 | depends on X86_GENERICARCH | 478 | depends on X86_32_NON_STANDARD |
491 | 479 | ||
492 | source "arch/x86/Kconfig.cpu" | 480 | source "arch/x86/Kconfig.cpu" |
493 | 481 | ||
@@ -659,7 +647,7 @@ source "kernel/Kconfig.preempt" | |||
659 | 647 | ||
660 | config X86_UP_APIC | 648 | config X86_UP_APIC |
661 | bool "Local APIC support on uniprocessors" | 649 | bool "Local APIC support on uniprocessors" |
662 | depends on X86_32 && !SMP && !(X86_VOYAGER || X86_GENERICARCH) | 650 | depends on X86_32 && !SMP && !X86_32_NON_STANDARD |
663 | help | 651 | help |
664 | A local APIC (Advanced Programmable Interrupt Controller) is an | 652 | A local APIC (Advanced Programmable Interrupt Controller) is an |
665 | integrated interrupt controller in the CPU. If you have a single-CPU | 653 | integrated interrupt controller in the CPU. If you have a single-CPU |
@@ -684,11 +672,11 @@ config X86_UP_IOAPIC | |||
684 | 672 | ||
685 | config X86_LOCAL_APIC | 673 | config X86_LOCAL_APIC |
686 | def_bool y | 674 | def_bool y |
687 | depends on X86_64 || (X86_32 && (X86_UP_APIC || (SMP && !X86_VOYAGER) || X86_GENERICARCH)) | 675 | depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC |
688 | 676 | ||
689 | config X86_IO_APIC | 677 | config X86_IO_APIC |
690 | def_bool y | 678 | def_bool y |
691 | depends on X86_64 || (X86_32 && (X86_UP_IOAPIC || (SMP && !X86_VOYAGER) || X86_GENERICARCH)) | 679 | depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC |
692 | 680 | ||
693 | config X86_VISWS_APIC | 681 | config X86_VISWS_APIC |
694 | def_bool y | 682 | def_bool y |
@@ -720,7 +708,6 @@ config X86_REROUTE_FOR_BROKEN_BOOT_IRQS | |||
720 | 708 | ||
721 | config X86_MCE | 709 | config X86_MCE |
722 | bool "Machine Check Exception" | 710 | bool "Machine Check Exception" |
723 | depends on !X86_VOYAGER | ||
724 | ---help--- | 711 | ---help--- |
725 | Machine Check Exception support allows the processor to notify the | 712 | Machine Check Exception support allows the processor to notify the |
726 | kernel if it detects a problem (e.g. overheating, component failure). | 713 | kernel if it detects a problem (e.g. overheating, component failure). |
@@ -1028,7 +1015,6 @@ config NUMA | |||
1028 | bool "Numa Memory Allocation and Scheduler Support" | 1015 | bool "Numa Memory Allocation and Scheduler Support" |
1029 | depends on SMP | 1016 | depends on SMP |
1030 | depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || X86_BIGSMP || X86_SUMMIT && ACPI) && EXPERIMENTAL) | 1017 | depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || X86_BIGSMP || X86_SUMMIT && ACPI) && EXPERIMENTAL) |
1031 | default n if X86_PC | ||
1032 | default y if (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP) | 1018 | default y if (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP) |
1033 | help | 1019 | help |
1034 | Enable NUMA (Non Uniform Memory Access) support. | 1020 | Enable NUMA (Non Uniform Memory Access) support. |
@@ -1131,7 +1117,7 @@ config ARCH_SPARSEMEM_DEFAULT | |||
1131 | 1117 | ||
1132 | config ARCH_SPARSEMEM_ENABLE | 1118 | config ARCH_SPARSEMEM_ENABLE |
1133 | def_bool y | 1119 | def_bool y |
1134 | depends on X86_64 || NUMA || (EXPERIMENTAL && X86_PC) || X86_GENERICARCH | 1120 | depends on X86_64 || NUMA || (EXPERIMENTAL && X86_32) || X86_32_NON_STANDARD |
1135 | select SPARSEMEM_STATIC if X86_32 | 1121 | select SPARSEMEM_STATIC if X86_32 |
1136 | select SPARSEMEM_VMEMMAP_ENABLE if X86_64 | 1122 | select SPARSEMEM_VMEMMAP_ENABLE if X86_64 |
1137 | 1123 | ||
@@ -1340,13 +1326,17 @@ config SECCOMP | |||
1340 | 1326 | ||
1341 | If unsure, say Y. Only embedded should say N here. | 1327 | If unsure, say Y. Only embedded should say N here. |
1342 | 1328 | ||
1329 | config CC_STACKPROTECTOR_ALL | ||
1330 | bool | ||
1331 | |||
1343 | config CC_STACKPROTECTOR | 1332 | config CC_STACKPROTECTOR |
1344 | bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)" | 1333 | bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)" |
1345 | depends on X86_64 && EXPERIMENTAL && BROKEN | 1334 | depends on X86_64 |
1335 | select CC_STACKPROTECTOR_ALL | ||
1346 | help | 1336 | help |
1347 | This option turns on the -fstack-protector GCC feature. This | 1337 | This option turns on the -fstack-protector GCC feature. This |
1348 | feature puts, at the beginning of critical functions, a canary | 1338 | feature puts, at the beginning of functions, a canary value on |
1349 | value on the stack just before the return address, and validates | 1339 | the stack just before the return address, and validates |
1350 | the value just before actually returning. Stack based buffer | 1340 | the value just before actually returning. Stack based buffer |
1351 | overflows (that need to overwrite this return address) now also | 1341 | overflows (that need to overwrite this return address) now also |
1352 | overwrite the canary, which gets detected and the attack is then | 1342 | overwrite the canary, which gets detected and the attack is then |
@@ -1354,21 +1344,13 @@ config CC_STACKPROTECTOR | |||
1354 | 1344 | ||
1355 | This feature requires gcc version 4.2 or above, or a distribution | 1345 | This feature requires gcc version 4.2 or above, or a distribution |
1356 | gcc with the feature backported. Older versions are automatically | 1346 | gcc with the feature backported. Older versions are automatically |
1357 | detected and for those versions, this configuration option is ignored. | 1347 | detected and for those versions, this configuration option is |
1358 | 1348 | ignored. (and a warning is printed during bootup) | |
1359 | config CC_STACKPROTECTOR_ALL | ||
1360 | bool "Use stack-protector for all functions" | ||
1361 | depends on CC_STACKPROTECTOR | ||
1362 | help | ||
1363 | Normally, GCC only inserts the canary value protection for | ||
1364 | functions that use large-ish on-stack buffers. By enabling | ||
1365 | this option, GCC will be asked to do this for ALL functions. | ||
1366 | 1349 | ||
1367 | source kernel/Kconfig.hz | 1350 | source kernel/Kconfig.hz |
1368 | 1351 | ||
1369 | config KEXEC | 1352 | config KEXEC |
1370 | bool "kexec system call" | 1353 | bool "kexec system call" |
1371 | depends on X86_BIOS_REBOOT | ||
1372 | help | 1354 | help |
1373 | kexec is a system call that implements the ability to shutdown your | 1355 | kexec is a system call that implements the ability to shutdown your |
1374 | current kernel, and to start another kernel. It is like a reboot | 1356 | current kernel, and to start another kernel. It is like a reboot |
@@ -1492,7 +1474,7 @@ config PHYSICAL_ALIGN | |||
1492 | 1474 | ||
1493 | config HOTPLUG_CPU | 1475 | config HOTPLUG_CPU |
1494 | bool "Support for hot-pluggable CPUs" | 1476 | bool "Support for hot-pluggable CPUs" |
1495 | depends on SMP && HOTPLUG && !X86_VOYAGER | 1477 | depends on SMP && HOTPLUG |
1496 | ---help--- | 1478 | ---help--- |
1497 | Say Y here to allow turning CPUs off and on. CPUs can be | 1479 | Say Y here to allow turning CPUs off and on. CPUs can be |
1498 | controlled through /sys/devices/system/cpu. | 1480 | controlled through /sys/devices/system/cpu. |
@@ -1573,7 +1555,6 @@ config HAVE_ARCH_EARLY_PFN_TO_NID | |||
1573 | depends on NUMA | 1555 | depends on NUMA |
1574 | 1556 | ||
1575 | menu "Power management and ACPI options" | 1557 | menu "Power management and ACPI options" |
1576 | depends on !X86_VOYAGER | ||
1577 | 1558 | ||
1578 | config ARCH_HIBERNATION_HEADER | 1559 | config ARCH_HIBERNATION_HEADER |
1579 | def_bool y | 1560 | def_bool y |
@@ -1853,7 +1834,6 @@ if X86_32 | |||
1853 | 1834 | ||
1854 | config ISA | 1835 | config ISA |
1855 | bool "ISA support" | 1836 | bool "ISA support" |
1856 | depends on !X86_VOYAGER | ||
1857 | help | 1837 | help |
1858 | Find out whether you have ISA slots on your motherboard. ISA is the | 1838 | Find out whether you have ISA slots on your motherboard. ISA is the |
1859 | name of a bus system, i.e. the way the CPU talks to the other stuff | 1839 | name of a bus system, i.e. the way the CPU talks to the other stuff |
@@ -1880,8 +1860,7 @@ config EISA | |||
1880 | source "drivers/eisa/Kconfig" | 1860 | source "drivers/eisa/Kconfig" |
1881 | 1861 | ||
1882 | config MCA | 1862 | config MCA |
1883 | bool "MCA support" if !X86_VOYAGER | 1863 | bool "MCA support" |
1884 | default y if X86_VOYAGER | ||
1885 | help | 1864 | help |
1886 | MicroChannel Architecture is found in some IBM PS/2 machines and | 1865 | MicroChannel Architecture is found in some IBM PS/2 machines and |
1887 | laptops. It is a bus system similar to PCI or ISA. See | 1866 | laptops. It is a bus system similar to PCI or ISA. See |
@@ -1892,7 +1871,6 @@ source "drivers/mca/Kconfig" | |||
1892 | 1871 | ||
1893 | config SCx200 | 1872 | config SCx200 |
1894 | tristate "NatSemi SCx200 support" | 1873 | tristate "NatSemi SCx200 support" |
1895 | depends on !X86_VOYAGER | ||
1896 | help | 1874 | help |
1897 | This provides basic support for National Semiconductor's | 1875 | This provides basic support for National Semiconductor's |
1898 | (now AMD's) Geode processors. The driver probes for the | 1876 | (now AMD's) Geode processors. The driver probes for the |
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu index c98d52e82966..085fef4d8660 100644 --- a/arch/x86/Kconfig.cpu +++ b/arch/x86/Kconfig.cpu | |||
@@ -294,25 +294,23 @@ config X86_CPU | |||
294 | # Define implied options from the CPU selection here | 294 | # Define implied options from the CPU selection here |
295 | config X86_L1_CACHE_BYTES | 295 | config X86_L1_CACHE_BYTES |
296 | int | 296 | int |
297 | default "128" if GENERIC_CPU || MPSC | 297 | default "128" if MPSC |
298 | default "64" if MK8 || MCORE2 | 298 | default "64" if GENERIC_CPU || MK8 || MCORE2 || X86_32 |
299 | depends on X86_64 | ||
300 | 299 | ||
301 | config X86_INTERNODE_CACHE_BYTES | 300 | config X86_INTERNODE_CACHE_BYTES |
302 | int | 301 | int |
303 | default "4096" if X86_VSMP | 302 | default "4096" if X86_VSMP |
304 | default X86_L1_CACHE_BYTES if !X86_VSMP | 303 | default X86_L1_CACHE_BYTES if !X86_VSMP |
305 | depends on X86_64 | ||
306 | 304 | ||
307 | config X86_CMPXCHG | 305 | config X86_CMPXCHG |
308 | def_bool X86_64 || (X86_32 && !M386) | 306 | def_bool X86_64 || (X86_32 && !M386) |
309 | 307 | ||
310 | config X86_L1_CACHE_SHIFT | 308 | config X86_L1_CACHE_SHIFT |
311 | int | 309 | int |
312 | default "7" if MPENTIUM4 || X86_GENERIC || GENERIC_CPU || MPSC | 310 | default "7" if MPENTIUM4 || MPSC |
313 | default "4" if X86_ELAN || M486 || M386 || MGEODEGX1 | 311 | default "4" if X86_ELAN || M486 || M386 || MGEODEGX1 |
314 | default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX | 312 | default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX |
315 | default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MVIAC7 | 313 | default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MVIAC7 || X86_GENERIC || GENERIC_CPU |
316 | 314 | ||
317 | config X86_XADD | 315 | config X86_XADD |
318 | def_bool y | 316 | def_bool y |
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index 10d6cc3fd052..a38dd6064f10 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -83,7 +83,7 @@ config DEBUG_PAGEALLOC | |||
83 | config DEBUG_PER_CPU_MAPS | 83 | config DEBUG_PER_CPU_MAPS |
84 | bool "Debug access to per_cpu maps" | 84 | bool "Debug access to per_cpu maps" |
85 | depends on DEBUG_KERNEL | 85 | depends on DEBUG_KERNEL |
86 | depends on X86_SMP | 86 | depends on SMP |
87 | default n | 87 | default n |
88 | help | 88 | help |
89 | Say Y to verify that the per_cpu map being accessed has | 89 | Say Y to verify that the per_cpu map being accessed has |
@@ -117,6 +117,7 @@ config DEBUG_RODATA | |||
117 | config DEBUG_RODATA_TEST | 117 | config DEBUG_RODATA_TEST |
118 | bool "Testcase for the DEBUG_RODATA feature" | 118 | bool "Testcase for the DEBUG_RODATA feature" |
119 | depends on DEBUG_RODATA | 119 | depends on DEBUG_RODATA |
120 | default y | ||
120 | help | 121 | help |
121 | This option enables a testcase for the DEBUG_RODATA | 122 | This option enables a testcase for the DEBUG_RODATA |
122 | feature as well as for the change_page_attr() infrastructure. | 123 | feature as well as for the change_page_attr() infrastructure. |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index d1a47adb5aec..99550c407990 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -73,7 +73,7 @@ else | |||
73 | 73 | ||
74 | stackp := $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh | 74 | stackp := $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh |
75 | stackp-$(CONFIG_CC_STACKPROTECTOR) := $(shell $(stackp) \ | 75 | stackp-$(CONFIG_CC_STACKPROTECTOR) := $(shell $(stackp) \ |
76 | "$(CC)" -fstack-protector ) | 76 | "$(CC)" "-fstack-protector -DGCC_HAS_SP" ) |
77 | stackp-$(CONFIG_CC_STACKPROTECTOR_ALL) += $(shell $(stackp) \ | 77 | stackp-$(CONFIG_CC_STACKPROTECTOR_ALL) += $(shell $(stackp) \ |
78 | "$(CC)" -fstack-protector-all ) | 78 | "$(CC)" -fstack-protector-all ) |
79 | 79 | ||
@@ -102,29 +102,6 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables | |||
102 | # prevent gcc from generating any FP code by mistake | 102 | # prevent gcc from generating any FP code by mistake |
103 | KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,) | 103 | KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,) |
104 | 104 | ||
105 | ### | ||
106 | # Sub architecture support | ||
107 | # fcore-y is linked before mcore-y files. | ||
108 | |||
109 | # Default subarch .c files | ||
110 | mcore-y := arch/x86/mach-default/ | ||
111 | |||
112 | # Voyager subarch support | ||
113 | mflags-$(CONFIG_X86_VOYAGER) := -Iarch/x86/include/asm/mach-voyager | ||
114 | mcore-$(CONFIG_X86_VOYAGER) := arch/x86/mach-voyager/ | ||
115 | |||
116 | # generic subarchitecture | ||
117 | mflags-$(CONFIG_X86_GENERICARCH):= -Iarch/x86/include/asm/mach-generic | ||
118 | fcore-$(CONFIG_X86_GENERICARCH) += arch/x86/mach-generic/ | ||
119 | mcore-$(CONFIG_X86_GENERICARCH) := arch/x86/mach-default/ | ||
120 | |||
121 | # default subarch .h files | ||
122 | mflags-y += -Iarch/x86/include/asm/mach-default | ||
123 | |||
124 | # 64 bit does not support subarch support - clear sub arch variables | ||
125 | fcore-$(CONFIG_X86_64) := | ||
126 | mcore-$(CONFIG_X86_64) := | ||
127 | |||
128 | KBUILD_CFLAGS += $(mflags-y) | 105 | KBUILD_CFLAGS += $(mflags-y) |
129 | KBUILD_AFLAGS += $(mflags-y) | 106 | KBUILD_AFLAGS += $(mflags-y) |
130 | 107 | ||
@@ -150,9 +127,6 @@ core-$(CONFIG_LGUEST_GUEST) += arch/x86/lguest/ | |||
150 | core-y += arch/x86/kernel/ | 127 | core-y += arch/x86/kernel/ |
151 | core-y += arch/x86/mm/ | 128 | core-y += arch/x86/mm/ |
152 | 129 | ||
153 | # Remaining sub architecture files | ||
154 | core-y += $(mcore-y) | ||
155 | |||
156 | core-y += arch/x86/crypto/ | 130 | core-y += arch/x86/crypto/ |
157 | core-y += arch/x86/vdso/ | 131 | core-y += arch/x86/vdso/ |
158 | core-$(CONFIG_IA32_EMULATION) += arch/x86/ia32/ | 132 | core-$(CONFIG_IA32_EMULATION) += arch/x86/ia32/ |
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig index edba00d98ac3..739bce993b56 100644 --- a/arch/x86/configs/i386_defconfig +++ b/arch/x86/configs/i386_defconfig | |||
@@ -188,7 +188,6 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y | |||
188 | CONFIG_SMP=y | 188 | CONFIG_SMP=y |
189 | CONFIG_X86_FIND_SMP_CONFIG=y | 189 | CONFIG_X86_FIND_SMP_CONFIG=y |
190 | CONFIG_X86_MPPARSE=y | 190 | CONFIG_X86_MPPARSE=y |
191 | CONFIG_X86_PC=y | ||
192 | # CONFIG_X86_ELAN is not set | 191 | # CONFIG_X86_ELAN is not set |
193 | # CONFIG_X86_VOYAGER is not set | 192 | # CONFIG_X86_VOYAGER is not set |
194 | # CONFIG_X86_GENERICARCH is not set | 193 | # CONFIG_X86_GENERICARCH is not set |
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig index 322dd2748fc9..02b514e8f4c4 100644 --- a/arch/x86/configs/x86_64_defconfig +++ b/arch/x86/configs/x86_64_defconfig | |||
@@ -187,7 +187,6 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y | |||
187 | CONFIG_SMP=y | 187 | CONFIG_SMP=y |
188 | CONFIG_X86_FIND_SMP_CONFIG=y | 188 | CONFIG_X86_FIND_SMP_CONFIG=y |
189 | CONFIG_X86_MPPARSE=y | 189 | CONFIG_X86_MPPARSE=y |
190 | CONFIG_X86_PC=y | ||
191 | # CONFIG_X86_ELAN is not set | 190 | # CONFIG_X86_ELAN is not set |
192 | # CONFIG_X86_VOYAGER is not set | 191 | # CONFIG_X86_VOYAGER is not set |
193 | # CONFIG_X86_GENERICARCH is not set | 192 | # CONFIG_X86_GENERICARCH is not set |
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c index 9dabd00e9805..dd77ac0cac46 100644 --- a/arch/x86/ia32/ia32_signal.c +++ b/arch/x86/ia32/ia32_signal.c | |||
@@ -46,78 +46,83 @@ void signal_fault(struct pt_regs *regs, void __user *frame, char *where); | |||
46 | 46 | ||
47 | int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) | 47 | int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) |
48 | { | 48 | { |
49 | int err; | 49 | int err = 0; |
50 | 50 | ||
51 | if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t))) | 51 | if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t))) |
52 | return -EFAULT; | 52 | return -EFAULT; |
53 | 53 | ||
54 | /* If you change siginfo_t structure, please make sure that | 54 | put_user_try { |
55 | this code is fixed accordingly. | 55 | /* If you change siginfo_t structure, please make sure that |
56 | It should never copy any pad contained in the structure | 56 | this code is fixed accordingly. |
57 | to avoid security leaks, but must copy the generic | 57 | It should never copy any pad contained in the structure |
58 | 3 ints plus the relevant union member. */ | 58 | to avoid security leaks, but must copy the generic |
59 | err = __put_user(from->si_signo, &to->si_signo); | 59 | 3 ints plus the relevant union member. */ |
60 | err |= __put_user(from->si_errno, &to->si_errno); | 60 | put_user_ex(from->si_signo, &to->si_signo); |
61 | err |= __put_user((short)from->si_code, &to->si_code); | 61 | put_user_ex(from->si_errno, &to->si_errno); |
62 | 62 | put_user_ex((short)from->si_code, &to->si_code); | |
63 | if (from->si_code < 0) { | 63 | |
64 | err |= __put_user(from->si_pid, &to->si_pid); | 64 | if (from->si_code < 0) { |
65 | err |= __put_user(from->si_uid, &to->si_uid); | 65 | put_user_ex(from->si_pid, &to->si_pid); |
66 | err |= __put_user(ptr_to_compat(from->si_ptr), &to->si_ptr); | 66 | put_user_ex(from->si_uid, &to->si_uid); |
67 | } else { | 67 | put_user_ex(ptr_to_compat(from->si_ptr), &to->si_ptr); |
68 | /* | 68 | } else { |
69 | * First 32bits of unions are always present: | 69 | /* |
70 | * si_pid === si_band === si_tid === si_addr(LS half) | 70 | * First 32bits of unions are always present: |
71 | */ | 71 | * si_pid === si_band === si_tid === si_addr(LS half) |
72 | err |= __put_user(from->_sifields._pad[0], | 72 | */ |
73 | &to->_sifields._pad[0]); | 73 | put_user_ex(from->_sifields._pad[0], |
74 | switch (from->si_code >> 16) { | 74 | &to->_sifields._pad[0]); |
75 | case __SI_FAULT >> 16: | 75 | switch (from->si_code >> 16) { |
76 | break; | 76 | case __SI_FAULT >> 16: |
77 | case __SI_CHLD >> 16: | 77 | break; |
78 | err |= __put_user(from->si_utime, &to->si_utime); | 78 | case __SI_CHLD >> 16: |
79 | err |= __put_user(from->si_stime, &to->si_stime); | 79 | put_user_ex(from->si_utime, &to->si_utime); |
80 | err |= __put_user(from->si_status, &to->si_status); | 80 | put_user_ex(from->si_stime, &to->si_stime); |
81 | /* FALL THROUGH */ | 81 | put_user_ex(from->si_status, &to->si_status); |
82 | default: | 82 | /* FALL THROUGH */ |
83 | case __SI_KILL >> 16: | 83 | default: |
84 | err |= __put_user(from->si_uid, &to->si_uid); | 84 | case __SI_KILL >> 16: |
85 | break; | 85 | put_user_ex(from->si_uid, &to->si_uid); |
86 | case __SI_POLL >> 16: | 86 | break; |
87 | err |= __put_user(from->si_fd, &to->si_fd); | 87 | case __SI_POLL >> 16: |
88 | break; | 88 | put_user_ex(from->si_fd, &to->si_fd); |
89 | case __SI_TIMER >> 16: | 89 | break; |
90 | err |= __put_user(from->si_overrun, &to->si_overrun); | 90 | case __SI_TIMER >> 16: |
91 | err |= __put_user(ptr_to_compat(from->si_ptr), | 91 | put_user_ex(from->si_overrun, &to->si_overrun); |
92 | &to->si_ptr); | 92 | put_user_ex(ptr_to_compat(from->si_ptr), |
93 | break; | 93 | &to->si_ptr); |
94 | /* This is not generated by the kernel as of now. */ | 94 | break; |
95 | case __SI_RT >> 16: | 95 | /* This is not generated by the kernel as of now. */ |
96 | case __SI_MESGQ >> 16: | 96 | case __SI_RT >> 16: |
97 | err |= __put_user(from->si_uid, &to->si_uid); | 97 | case __SI_MESGQ >> 16: |
98 | err |= __put_user(from->si_int, &to->si_int); | 98 | put_user_ex(from->si_uid, &to->si_uid); |
99 | break; | 99 | put_user_ex(from->si_int, &to->si_int); |
100 | break; | ||
101 | } | ||
100 | } | 102 | } |
101 | } | 103 | } put_user_catch(err); |
104 | |||
102 | return err; | 105 | return err; |
103 | } | 106 | } |
104 | 107 | ||
105 | int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) | 108 | int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) |
106 | { | 109 | { |
107 | int err; | 110 | int err = 0; |
108 | u32 ptr32; | 111 | u32 ptr32; |
109 | 112 | ||
110 | if (!access_ok(VERIFY_READ, from, sizeof(compat_siginfo_t))) | 113 | if (!access_ok(VERIFY_READ, from, sizeof(compat_siginfo_t))) |
111 | return -EFAULT; | 114 | return -EFAULT; |
112 | 115 | ||
113 | err = __get_user(to->si_signo, &from->si_signo); | 116 | get_user_try { |
114 | err |= __get_user(to->si_errno, &from->si_errno); | 117 | get_user_ex(to->si_signo, &from->si_signo); |
115 | err |= __get_user(to->si_code, &from->si_code); | 118 | get_user_ex(to->si_errno, &from->si_errno); |
119 | get_user_ex(to->si_code, &from->si_code); | ||
116 | 120 | ||
117 | err |= __get_user(to->si_pid, &from->si_pid); | 121 | get_user_ex(to->si_pid, &from->si_pid); |
118 | err |= __get_user(to->si_uid, &from->si_uid); | 122 | get_user_ex(to->si_uid, &from->si_uid); |
119 | err |= __get_user(ptr32, &from->si_ptr); | 123 | get_user_ex(ptr32, &from->si_ptr); |
120 | to->si_ptr = compat_ptr(ptr32); | 124 | to->si_ptr = compat_ptr(ptr32); |
125 | } get_user_catch(err); | ||
121 | 126 | ||
122 | return err; | 127 | return err; |
123 | } | 128 | } |
@@ -142,17 +147,23 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr, | |||
142 | struct pt_regs *regs) | 147 | struct pt_regs *regs) |
143 | { | 148 | { |
144 | stack_t uss, uoss; | 149 | stack_t uss, uoss; |
145 | int ret; | 150 | int ret, err = 0; |
146 | mm_segment_t seg; | 151 | mm_segment_t seg; |
147 | 152 | ||
148 | if (uss_ptr) { | 153 | if (uss_ptr) { |
149 | u32 ptr; | 154 | u32 ptr; |
150 | 155 | ||
151 | memset(&uss, 0, sizeof(stack_t)); | 156 | memset(&uss, 0, sizeof(stack_t)); |
152 | if (!access_ok(VERIFY_READ, uss_ptr, sizeof(stack_ia32_t)) || | 157 | if (!access_ok(VERIFY_READ, uss_ptr, sizeof(stack_ia32_t))) |
153 | __get_user(ptr, &uss_ptr->ss_sp) || | 158 | return -EFAULT; |
154 | __get_user(uss.ss_flags, &uss_ptr->ss_flags) || | 159 | |
155 | __get_user(uss.ss_size, &uss_ptr->ss_size)) | 160 | get_user_try { |
161 | get_user_ex(ptr, &uss_ptr->ss_sp); | ||
162 | get_user_ex(uss.ss_flags, &uss_ptr->ss_flags); | ||
163 | get_user_ex(uss.ss_size, &uss_ptr->ss_size); | ||
164 | } get_user_catch(err); | ||
165 | |||
166 | if (err) | ||
156 | return -EFAULT; | 167 | return -EFAULT; |
157 | uss.ss_sp = compat_ptr(ptr); | 168 | uss.ss_sp = compat_ptr(ptr); |
158 | } | 169 | } |
@@ -161,10 +172,16 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr, | |||
161 | ret = do_sigaltstack(uss_ptr ? &uss : NULL, &uoss, regs->sp); | 172 | ret = do_sigaltstack(uss_ptr ? &uss : NULL, &uoss, regs->sp); |
162 | set_fs(seg); | 173 | set_fs(seg); |
163 | if (ret >= 0 && uoss_ptr) { | 174 | if (ret >= 0 && uoss_ptr) { |
164 | if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(stack_ia32_t)) || | 175 | if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(stack_ia32_t))) |
165 | __put_user(ptr_to_compat(uoss.ss_sp), &uoss_ptr->ss_sp) || | 176 | return -EFAULT; |
166 | __put_user(uoss.ss_flags, &uoss_ptr->ss_flags) || | 177 | |
167 | __put_user(uoss.ss_size, &uoss_ptr->ss_size)) | 178 | put_user_try { |
179 | put_user_ex(ptr_to_compat(uoss.ss_sp), &uoss_ptr->ss_sp); | ||
180 | put_user_ex(uoss.ss_flags, &uoss_ptr->ss_flags); | ||
181 | put_user_ex(uoss.ss_size, &uoss_ptr->ss_size); | ||
182 | } put_user_catch(err); | ||
183 | |||
184 | if (err) | ||
168 | ret = -EFAULT; | 185 | ret = -EFAULT; |
169 | } | 186 | } |
170 | return ret; | 187 | return ret; |
@@ -174,18 +191,18 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr, | |||
174 | * Do a signal return; undo the signal stack. | 191 | * Do a signal return; undo the signal stack. |
175 | */ | 192 | */ |
176 | #define COPY(x) { \ | 193 | #define COPY(x) { \ |
177 | err |= __get_user(regs->x, &sc->x); \ | 194 | get_user_ex(regs->x, &sc->x); \ |
178 | } | 195 | } |
179 | 196 | ||
180 | #define COPY_SEG_CPL3(seg) { \ | 197 | #define COPY_SEG_CPL3(seg) { \ |
181 | unsigned short tmp; \ | 198 | unsigned short tmp; \ |
182 | err |= __get_user(tmp, &sc->seg); \ | 199 | get_user_ex(tmp, &sc->seg); \ |
183 | regs->seg = tmp | 3; \ | 200 | regs->seg = tmp | 3; \ |
184 | } | 201 | } |
185 | 202 | ||
186 | #define RELOAD_SEG(seg) { \ | 203 | #define RELOAD_SEG(seg) { \ |
187 | unsigned int cur, pre; \ | 204 | unsigned int cur, pre; \ |
188 | err |= __get_user(pre, &sc->seg); \ | 205 | get_user_ex(pre, &sc->seg); \ |
189 | savesegment(seg, cur); \ | 206 | savesegment(seg, cur); \ |
190 | pre |= 3; \ | 207 | pre |= 3; \ |
191 | if (pre != cur) \ | 208 | if (pre != cur) \ |
@@ -209,39 +226,42 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, | |||
209 | sc, sc->err, sc->ip, sc->cs, sc->flags); | 226 | sc, sc->err, sc->ip, sc->cs, sc->flags); |
210 | #endif | 227 | #endif |
211 | 228 | ||
212 | /* | 229 | get_user_try { |
213 | * Reload fs and gs if they have changed in the signal | 230 | /* |
214 | * handler. This does not handle long fs/gs base changes in | 231 | * Reload fs and gs if they have changed in the signal |
215 | * the handler, but does not clobber them at least in the | 232 | * handler. This does not handle long fs/gs base changes in |
216 | * normal case. | 233 | * the handler, but does not clobber them at least in the |
217 | */ | 234 | * normal case. |
218 | err |= __get_user(gs, &sc->gs); | 235 | */ |
219 | gs |= 3; | 236 | get_user_ex(gs, &sc->gs); |
220 | savesegment(gs, oldgs); | 237 | gs |= 3; |
221 | if (gs != oldgs) | 238 | savesegment(gs, oldgs); |
222 | load_gs_index(gs); | 239 | if (gs != oldgs) |
223 | 240 | load_gs_index(gs); | |
224 | RELOAD_SEG(fs); | 241 | |
225 | RELOAD_SEG(ds); | 242 | RELOAD_SEG(fs); |
226 | RELOAD_SEG(es); | 243 | RELOAD_SEG(ds); |
227 | 244 | RELOAD_SEG(es); | |
228 | COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); | 245 | |
229 | COPY(dx); COPY(cx); COPY(ip); | 246 | COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); |
230 | /* Don't touch extended registers */ | 247 | COPY(dx); COPY(cx); COPY(ip); |
231 | 248 | /* Don't touch extended registers */ | |
232 | COPY_SEG_CPL3(cs); | 249 | |
233 | COPY_SEG_CPL3(ss); | 250 | COPY_SEG_CPL3(cs); |
234 | 251 | COPY_SEG_CPL3(ss); | |
235 | err |= __get_user(tmpflags, &sc->flags); | 252 | |
236 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); | 253 | get_user_ex(tmpflags, &sc->flags); |
237 | /* disable syscall checks */ | 254 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); |
238 | regs->orig_ax = -1; | 255 | /* disable syscall checks */ |
239 | 256 | regs->orig_ax = -1; | |
240 | err |= __get_user(tmp, &sc->fpstate); | 257 | |
241 | buf = compat_ptr(tmp); | 258 | get_user_ex(tmp, &sc->fpstate); |
242 | err |= restore_i387_xstate_ia32(buf); | 259 | buf = compat_ptr(tmp); |
243 | 260 | err |= restore_i387_xstate_ia32(buf); | |
244 | err |= __get_user(*pax, &sc->ax); | 261 | |
262 | get_user_ex(*pax, &sc->ax); | ||
263 | } get_user_catch(err); | ||
264 | |||
245 | return err; | 265 | return err; |
246 | } | 266 | } |
247 | 267 | ||
@@ -319,36 +339,38 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, | |||
319 | { | 339 | { |
320 | int tmp, err = 0; | 340 | int tmp, err = 0; |
321 | 341 | ||
322 | savesegment(gs, tmp); | 342 | put_user_try { |
323 | err |= __put_user(tmp, (unsigned int __user *)&sc->gs); | 343 | savesegment(gs, tmp); |
324 | savesegment(fs, tmp); | 344 | put_user_ex(tmp, (unsigned int __user *)&sc->gs); |
325 | err |= __put_user(tmp, (unsigned int __user *)&sc->fs); | 345 | savesegment(fs, tmp); |
326 | savesegment(ds, tmp); | 346 | put_user_ex(tmp, (unsigned int __user *)&sc->fs); |
327 | err |= __put_user(tmp, (unsigned int __user *)&sc->ds); | 347 | savesegment(ds, tmp); |
328 | savesegment(es, tmp); | 348 | put_user_ex(tmp, (unsigned int __user *)&sc->ds); |
329 | err |= __put_user(tmp, (unsigned int __user *)&sc->es); | 349 | savesegment(es, tmp); |
330 | 350 | put_user_ex(tmp, (unsigned int __user *)&sc->es); | |
331 | err |= __put_user(regs->di, &sc->di); | 351 | |
332 | err |= __put_user(regs->si, &sc->si); | 352 | put_user_ex(regs->di, &sc->di); |
333 | err |= __put_user(regs->bp, &sc->bp); | 353 | put_user_ex(regs->si, &sc->si); |
334 | err |= __put_user(regs->sp, &sc->sp); | 354 | put_user_ex(regs->bp, &sc->bp); |
335 | err |= __put_user(regs->bx, &sc->bx); | 355 | put_user_ex(regs->sp, &sc->sp); |
336 | err |= __put_user(regs->dx, &sc->dx); | 356 | put_user_ex(regs->bx, &sc->bx); |
337 | err |= __put_user(regs->cx, &sc->cx); | 357 | put_user_ex(regs->dx, &sc->dx); |
338 | err |= __put_user(regs->ax, &sc->ax); | 358 | put_user_ex(regs->cx, &sc->cx); |
339 | err |= __put_user(current->thread.trap_no, &sc->trapno); | 359 | put_user_ex(regs->ax, &sc->ax); |
340 | err |= __put_user(current->thread.error_code, &sc->err); | 360 | put_user_ex(current->thread.trap_no, &sc->trapno); |
341 | err |= __put_user(regs->ip, &sc->ip); | 361 | put_user_ex(current->thread.error_code, &sc->err); |
342 | err |= __put_user(regs->cs, (unsigned int __user *)&sc->cs); | 362 | put_user_ex(regs->ip, &sc->ip); |
343 | err |= __put_user(regs->flags, &sc->flags); | 363 | put_user_ex(regs->cs, (unsigned int __user *)&sc->cs); |
344 | err |= __put_user(regs->sp, &sc->sp_at_signal); | 364 | put_user_ex(regs->flags, &sc->flags); |
345 | err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss); | 365 | put_user_ex(regs->sp, &sc->sp_at_signal); |
346 | 366 | put_user_ex(regs->ss, (unsigned int __user *)&sc->ss); | |
347 | err |= __put_user(ptr_to_compat(fpstate), &sc->fpstate); | 367 | |
348 | 368 | put_user_ex(ptr_to_compat(fpstate), &sc->fpstate); | |
349 | /* non-iBCS2 extensions.. */ | 369 | |
350 | err |= __put_user(mask, &sc->oldmask); | 370 | /* non-iBCS2 extensions.. */ |
351 | err |= __put_user(current->thread.cr2, &sc->cr2); | 371 | put_user_ex(mask, &sc->oldmask); |
372 | put_user_ex(current->thread.cr2, &sc->cr2); | ||
373 | } put_user_catch(err); | ||
352 | 374 | ||
353 | return err; | 375 | return err; |
354 | } | 376 | } |
@@ -437,13 +459,17 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
437 | else | 459 | else |
438 | restorer = &frame->retcode; | 460 | restorer = &frame->retcode; |
439 | } | 461 | } |
440 | err |= __put_user(ptr_to_compat(restorer), &frame->pretcode); | ||
441 | 462 | ||
442 | /* | 463 | put_user_try { |
443 | * These are actually not used anymore, but left because some | 464 | put_user_ex(ptr_to_compat(restorer), &frame->pretcode); |
444 | * gdb versions depend on them as a marker. | 465 | |
445 | */ | 466 | /* |
446 | err |= __put_user(*((u64 *)&code), (u64 *)frame->retcode); | 467 | * These are actually not used anymore, but left because some |
468 | * gdb versions depend on them as a marker. | ||
469 | */ | ||
470 | put_user_ex(*((u64 *)&code), (u64 *)frame->retcode); | ||
471 | } put_user_catch(err); | ||
472 | |||
447 | if (err) | 473 | if (err) |
448 | return -EFAULT; | 474 | return -EFAULT; |
449 | 475 | ||
@@ -496,41 +522,40 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
496 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 522 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
497 | return -EFAULT; | 523 | return -EFAULT; |
498 | 524 | ||
499 | err |= __put_user(sig, &frame->sig); | 525 | put_user_try { |
500 | err |= __put_user(ptr_to_compat(&frame->info), &frame->pinfo); | 526 | put_user_ex(sig, &frame->sig); |
501 | err |= __put_user(ptr_to_compat(&frame->uc), &frame->puc); | 527 | put_user_ex(ptr_to_compat(&frame->info), &frame->pinfo); |
502 | err |= copy_siginfo_to_user32(&frame->info, info); | 528 | put_user_ex(ptr_to_compat(&frame->uc), &frame->puc); |
503 | if (err) | 529 | err |= copy_siginfo_to_user32(&frame->info, info); |
504 | return -EFAULT; | ||
505 | 530 | ||
506 | /* Create the ucontext. */ | 531 | /* Create the ucontext. */ |
507 | if (cpu_has_xsave) | 532 | if (cpu_has_xsave) |
508 | err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags); | 533 | put_user_ex(UC_FP_XSTATE, &frame->uc.uc_flags); |
509 | else | 534 | else |
510 | err |= __put_user(0, &frame->uc.uc_flags); | 535 | put_user_ex(0, &frame->uc.uc_flags); |
511 | err |= __put_user(0, &frame->uc.uc_link); | 536 | put_user_ex(0, &frame->uc.uc_link); |
512 | err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); | 537 | put_user_ex(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); |
513 | err |= __put_user(sas_ss_flags(regs->sp), | 538 | put_user_ex(sas_ss_flags(regs->sp), |
514 | &frame->uc.uc_stack.ss_flags); | 539 | &frame->uc.uc_stack.ss_flags); |
515 | err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); | 540 | put_user_ex(current->sas_ss_size, &frame->uc.uc_stack.ss_size); |
516 | err |= ia32_setup_sigcontext(&frame->uc.uc_mcontext, fpstate, | 541 | err |= ia32_setup_sigcontext(&frame->uc.uc_mcontext, fpstate, |
517 | regs, set->sig[0]); | 542 | regs, set->sig[0]); |
518 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 543 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); |
519 | if (err) | 544 | |
520 | return -EFAULT; | 545 | if (ka->sa.sa_flags & SA_RESTORER) |
546 | restorer = ka->sa.sa_restorer; | ||
547 | else | ||
548 | restorer = VDSO32_SYMBOL(current->mm->context.vdso, | ||
549 | rt_sigreturn); | ||
550 | put_user_ex(ptr_to_compat(restorer), &frame->pretcode); | ||
551 | |||
552 | /* | ||
553 | * Not actually used anymore, but left because some gdb | ||
554 | * versions need it. | ||
555 | */ | ||
556 | put_user_ex(*((u64 *)&code), (u64 *)frame->retcode); | ||
557 | } put_user_catch(err); | ||
521 | 558 | ||
522 | if (ka->sa.sa_flags & SA_RESTORER) | ||
523 | restorer = ka->sa.sa_restorer; | ||
524 | else | ||
525 | restorer = VDSO32_SYMBOL(current->mm->context.vdso, | ||
526 | rt_sigreturn); | ||
527 | err |= __put_user(ptr_to_compat(restorer), &frame->pretcode); | ||
528 | |||
529 | /* | ||
530 | * Not actually used anymore, but left because some gdb | ||
531 | * versions need it. | ||
532 | */ | ||
533 | err |= __put_user(*((u64 *)&code), (u64 *)frame->retcode); | ||
534 | if (err) | 559 | if (err) |
535 | return -EFAULT; | 560 | return -EFAULT; |
536 | 561 | ||
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index 256b00b61892..9c79b2477008 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
@@ -112,8 +112,8 @@ ENTRY(ia32_sysenter_target) | |||
112 | CFI_DEF_CFA rsp,0 | 112 | CFI_DEF_CFA rsp,0 |
113 | CFI_REGISTER rsp,rbp | 113 | CFI_REGISTER rsp,rbp |
114 | SWAPGS_UNSAFE_STACK | 114 | SWAPGS_UNSAFE_STACK |
115 | movq %gs:pda_kernelstack, %rsp | 115 | movq PER_CPU_VAR(kernel_stack), %rsp |
116 | addq $(PDA_STACKOFFSET),%rsp | 116 | addq $(KERNEL_STACK_OFFSET),%rsp |
117 | /* | 117 | /* |
118 | * No need to follow this irqs on/off section: the syscall | 118 | * No need to follow this irqs on/off section: the syscall |
119 | * disabled irqs, here we enable it straight after entry: | 119 | * disabled irqs, here we enable it straight after entry: |
@@ -273,13 +273,13 @@ ENDPROC(ia32_sysenter_target) | |||
273 | ENTRY(ia32_cstar_target) | 273 | ENTRY(ia32_cstar_target) |
274 | CFI_STARTPROC32 simple | 274 | CFI_STARTPROC32 simple |
275 | CFI_SIGNAL_FRAME | 275 | CFI_SIGNAL_FRAME |
276 | CFI_DEF_CFA rsp,PDA_STACKOFFSET | 276 | CFI_DEF_CFA rsp,KERNEL_STACK_OFFSET |
277 | CFI_REGISTER rip,rcx | 277 | CFI_REGISTER rip,rcx |
278 | /*CFI_REGISTER rflags,r11*/ | 278 | /*CFI_REGISTER rflags,r11*/ |
279 | SWAPGS_UNSAFE_STACK | 279 | SWAPGS_UNSAFE_STACK |
280 | movl %esp,%r8d | 280 | movl %esp,%r8d |
281 | CFI_REGISTER rsp,r8 | 281 | CFI_REGISTER rsp,r8 |
282 | movq %gs:pda_kernelstack,%rsp | 282 | movq PER_CPU_VAR(kernel_stack),%rsp |
283 | /* | 283 | /* |
284 | * No need to follow this irqs on/off section: the syscall | 284 | * No need to follow this irqs on/off section: the syscall |
285 | * disabled irqs and here we enable it straight after entry: | 285 | * disabled irqs and here we enable it straight after entry: |
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index ab1d51a8855e..b03711d7990b 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -41,6 +41,21 @@ extern unsigned int apic_verbosity; | |||
41 | extern int local_apic_timer_c2_ok; | 41 | extern int local_apic_timer_c2_ok; |
42 | 42 | ||
43 | extern int disable_apic; | 43 | extern int disable_apic; |
44 | |||
45 | #ifdef CONFIG_SMP | ||
46 | extern void __inquire_remote_apic(int apicid); | ||
47 | #else /* CONFIG_SMP */ | ||
48 | static inline void __inquire_remote_apic(int apicid) | ||
49 | { | ||
50 | } | ||
51 | #endif /* CONFIG_SMP */ | ||
52 | |||
53 | static inline void default_inquire_remote_apic(int apicid) | ||
54 | { | ||
55 | if (apic_verbosity >= APIC_DEBUG) | ||
56 | __inquire_remote_apic(apicid); | ||
57 | } | ||
58 | |||
44 | /* | 59 | /* |
45 | * Basic functions accessing APICs. | 60 | * Basic functions accessing APICs. |
46 | */ | 61 | */ |
@@ -196,4 +211,22 @@ static inline void disable_local_APIC(void) { } | |||
196 | 211 | ||
197 | #endif /* !CONFIG_X86_LOCAL_APIC */ | 212 | #endif /* !CONFIG_X86_LOCAL_APIC */ |
198 | 213 | ||
214 | #ifdef CONFIG_X86_64 | ||
215 | #define SET_APIC_ID(x) (apic->set_apic_id(x)) | ||
216 | #else | ||
217 | |||
218 | #ifdef CONFIG_X86_LOCAL_APIC | ||
219 | static inline unsigned default_get_apic_id(unsigned long x) | ||
220 | { | ||
221 | unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); | ||
222 | |||
223 | if (APIC_XAPIC(ver)) | ||
224 | return (x >> 24) & 0xFF; | ||
225 | else | ||
226 | return (x >> 24) & 0x0F; | ||
227 | } | ||
228 | #endif | ||
229 | |||
230 | #endif | ||
231 | |||
199 | #endif /* _ASM_X86_APIC_H */ | 232 | #endif /* _ASM_X86_APIC_H */ |
diff --git a/arch/x86/include/asm/apicnum.h b/arch/x86/include/asm/apicnum.h new file mode 100644 index 000000000000..82f613c607ce --- /dev/null +++ b/arch/x86/include/asm/apicnum.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _ASM_X86_APICNUM_H | ||
2 | #define _ASM_X86_APICNUM_H | ||
3 | |||
4 | /* define MAX_IO_APICS */ | ||
5 | #ifdef CONFIG_X86_32 | ||
6 | # define MAX_IO_APICS 64 | ||
7 | #else | ||
8 | # define MAX_IO_APICS 128 | ||
9 | # define MAX_LOCAL_APIC 32768 | ||
10 | #endif | ||
11 | |||
12 | #endif /* _ASM_X86_APICNUM_H */ | ||
diff --git a/arch/x86/include/asm/mach-default/apm.h b/arch/x86/include/asm/apm.h index 20370c6db74b..20370c6db74b 100644 --- a/arch/x86/include/asm/mach-default/apm.h +++ b/arch/x86/include/asm/apm.h | |||
diff --git a/arch/x86/include/asm/bigsmp/apic.h b/arch/x86/include/asm/bigsmp/apic.h deleted file mode 100644 index d8dd9f537911..000000000000 --- a/arch/x86/include/asm/bigsmp/apic.h +++ /dev/null | |||
@@ -1,155 +0,0 @@ | |||
1 | #ifndef __ASM_MACH_APIC_H | ||
2 | #define __ASM_MACH_APIC_H | ||
3 | |||
4 | #define xapic_phys_to_log_apicid(cpu) (per_cpu(x86_bios_cpu_apicid, cpu)) | ||
5 | #define esr_disable (1) | ||
6 | |||
7 | static inline int apic_id_registered(void) | ||
8 | { | ||
9 | return (1); | ||
10 | } | ||
11 | |||
12 | static inline const cpumask_t *target_cpus(void) | ||
13 | { | ||
14 | #ifdef CONFIG_SMP | ||
15 | return &cpu_online_map; | ||
16 | #else | ||
17 | return &cpumask_of_cpu(0); | ||
18 | #endif | ||
19 | } | ||
20 | |||
21 | #undef APIC_DEST_LOGICAL | ||
22 | #define APIC_DEST_LOGICAL 0 | ||
23 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
24 | #define INT_DELIVERY_MODE (dest_Fixed) | ||
25 | #define INT_DEST_MODE (0) /* phys delivery to target proc */ | ||
26 | #define NO_BALANCE_IRQ (0) | ||
27 | |||
28 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) | ||
29 | { | ||
30 | return (0); | ||
31 | } | ||
32 | |||
33 | static inline unsigned long check_apicid_present(int bit) | ||
34 | { | ||
35 | return (1); | ||
36 | } | ||
37 | |||
38 | static inline unsigned long calculate_ldr(int cpu) | ||
39 | { | ||
40 | unsigned long val, id; | ||
41 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | ||
42 | id = xapic_phys_to_log_apicid(cpu); | ||
43 | val |= SET_APIC_LOGICAL_ID(id); | ||
44 | return val; | ||
45 | } | ||
46 | |||
47 | /* | ||
48 | * Set up the logical destination ID. | ||
49 | * | ||
50 | * Intel recommends to set DFR, LDR and TPR before enabling | ||
51 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
52 | * document number 292116). So here it goes... | ||
53 | */ | ||
54 | static inline void init_apic_ldr(void) | ||
55 | { | ||
56 | unsigned long val; | ||
57 | int cpu = smp_processor_id(); | ||
58 | |||
59 | apic_write(APIC_DFR, APIC_DFR_VALUE); | ||
60 | val = calculate_ldr(cpu); | ||
61 | apic_write(APIC_LDR, val); | ||
62 | } | ||
63 | |||
64 | static inline void setup_apic_routing(void) | ||
65 | { | ||
66 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | ||
67 | "Physflat", nr_ioapics); | ||
68 | } | ||
69 | |||
70 | static inline int multi_timer_check(int apic, int irq) | ||
71 | { | ||
72 | return (0); | ||
73 | } | ||
74 | |||
75 | static inline int apicid_to_node(int logical_apicid) | ||
76 | { | ||
77 | return apicid_2_node[hard_smp_processor_id()]; | ||
78 | } | ||
79 | |||
80 | static inline int cpu_present_to_apicid(int mps_cpu) | ||
81 | { | ||
82 | if (mps_cpu < nr_cpu_ids) | ||
83 | return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
84 | |||
85 | return BAD_APICID; | ||
86 | } | ||
87 | |||
88 | static inline physid_mask_t apicid_to_cpu_present(int phys_apicid) | ||
89 | { | ||
90 | return physid_mask_of_physid(phys_apicid); | ||
91 | } | ||
92 | |||
93 | extern u8 cpu_2_logical_apicid[]; | ||
94 | /* Mapping from cpu number to logical apicid */ | ||
95 | static inline int cpu_to_logical_apicid(int cpu) | ||
96 | { | ||
97 | if (cpu >= nr_cpu_ids) | ||
98 | return BAD_APICID; | ||
99 | return cpu_physical_id(cpu); | ||
100 | } | ||
101 | |||
102 | static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map) | ||
103 | { | ||
104 | /* For clustered we don't have a good way to do this yet - hack */ | ||
105 | return physids_promote(0xFFL); | ||
106 | } | ||
107 | |||
108 | static inline void setup_portio_remap(void) | ||
109 | { | ||
110 | } | ||
111 | |||
112 | static inline void enable_apic_mode(void) | ||
113 | { | ||
114 | } | ||
115 | |||
116 | static inline int check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
117 | { | ||
118 | return (1); | ||
119 | } | ||
120 | |||
121 | /* As we are using single CPU as destination, pick only one CPU here */ | ||
122 | static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | ||
123 | { | ||
124 | int cpu; | ||
125 | int apicid; | ||
126 | |||
127 | cpu = first_cpu(*cpumask); | ||
128 | apicid = cpu_to_logical_apicid(cpu); | ||
129 | return apicid; | ||
130 | } | ||
131 | |||
132 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
133 | const struct cpumask *andmask) | ||
134 | { | ||
135 | int cpu; | ||
136 | |||
137 | /* | ||
138 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | ||
139 | * May as well be the first. | ||
140 | */ | ||
141 | for_each_cpu_and(cpu, cpumask, andmask) | ||
142 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | ||
143 | break; | ||
144 | if (cpu < nr_cpu_ids) | ||
145 | return cpu_to_logical_apicid(cpu); | ||
146 | |||
147 | return BAD_APICID; | ||
148 | } | ||
149 | |||
150 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | ||
151 | { | ||
152 | return cpuid_apic >> index_msb; | ||
153 | } | ||
154 | |||
155 | #endif /* __ASM_MACH_APIC_H */ | ||
diff --git a/arch/x86/include/asm/bigsmp/apicdef.h b/arch/x86/include/asm/bigsmp/apicdef.h deleted file mode 100644 index 392c3f5ef2fe..000000000000 --- a/arch/x86/include/asm/bigsmp/apicdef.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #ifndef __ASM_MACH_APICDEF_H | ||
2 | #define __ASM_MACH_APICDEF_H | ||
3 | |||
4 | #define APIC_ID_MASK (0xFF<<24) | ||
5 | |||
6 | static inline unsigned get_apic_id(unsigned long x) | ||
7 | { | ||
8 | return (((x)>>24)&0xFF); | ||
9 | } | ||
10 | |||
11 | #define GET_APIC_ID(x) get_apic_id(x) | ||
12 | |||
13 | #endif | ||
diff --git a/arch/x86/include/asm/bigsmp/ipi.h b/arch/x86/include/asm/bigsmp/ipi.h deleted file mode 100644 index 27fcd01b3ae6..000000000000 --- a/arch/x86/include/asm/bigsmp/ipi.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | #ifndef __ASM_MACH_IPI_H | ||
2 | #define __ASM_MACH_IPI_H | ||
3 | |||
4 | void send_IPI_mask_sequence(const struct cpumask *mask, int vector); | ||
5 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | ||
6 | |||
7 | static inline void send_IPI_mask(const struct cpumask *mask, int vector) | ||
8 | { | ||
9 | send_IPI_mask_sequence(mask, vector); | ||
10 | } | ||
11 | |||
12 | static inline void send_IPI_allbutself(int vector) | ||
13 | { | ||
14 | send_IPI_mask_allbutself(cpu_online_mask, vector); | ||
15 | } | ||
16 | |||
17 | static inline void send_IPI_all(int vector) | ||
18 | { | ||
19 | send_IPI_mask(cpu_online_mask, vector); | ||
20 | } | ||
21 | |||
22 | #endif /* __ASM_MACH_IPI_H */ | ||
diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h index bae482df6039..b185091bf19c 100644 --- a/arch/x86/include/asm/cpu.h +++ b/arch/x86/include/asm/cpu.h | |||
@@ -7,6 +7,20 @@ | |||
7 | #include <linux/nodemask.h> | 7 | #include <linux/nodemask.h> |
8 | #include <linux/percpu.h> | 8 | #include <linux/percpu.h> |
9 | 9 | ||
10 | #ifdef CONFIG_SMP | ||
11 | |||
12 | extern void prefill_possible_map(void); | ||
13 | |||
14 | #else /* CONFIG_SMP */ | ||
15 | |||
16 | static inline void prefill_possible_map(void) {} | ||
17 | |||
18 | #define cpu_physical_id(cpu) boot_cpu_physical_apicid | ||
19 | #define safe_smp_processor_id() 0 | ||
20 | #define stack_smp_processor_id() 0 | ||
21 | |||
22 | #endif /* CONFIG_SMP */ | ||
23 | |||
10 | struct x86_cpu { | 24 | struct x86_cpu { |
11 | struct cpu cpu; | 25 | struct cpu cpu; |
12 | }; | 26 | }; |
@@ -17,4 +31,7 @@ extern void arch_unregister_cpu(int); | |||
17 | #endif | 31 | #endif |
18 | 32 | ||
19 | DECLARE_PER_CPU(int, cpu_state); | 33 | DECLARE_PER_CPU(int, cpu_state); |
34 | |||
35 | extern unsigned int boot_cpu_id; | ||
36 | |||
20 | #endif /* _ASM_X86_CPU_H */ | 37 | #endif /* _ASM_X86_CPU_H */ |
diff --git a/arch/x86/include/asm/cpumask.h b/arch/x86/include/asm/cpumask.h new file mode 100644 index 000000000000..a7f3c75f8ad7 --- /dev/null +++ b/arch/x86/include/asm/cpumask.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef _ASM_X86_CPUMASK_H | ||
2 | #define _ASM_X86_CPUMASK_H | ||
3 | #ifndef __ASSEMBLY__ | ||
4 | #include <linux/cpumask.h> | ||
5 | |||
6 | #ifdef CONFIG_X86_64 | ||
7 | |||
8 | extern cpumask_var_t cpu_callin_mask; | ||
9 | extern cpumask_var_t cpu_callout_mask; | ||
10 | extern cpumask_var_t cpu_initialized_mask; | ||
11 | extern cpumask_var_t cpu_sibling_setup_mask; | ||
12 | |||
13 | extern void setup_cpu_local_masks(void); | ||
14 | |||
15 | #else /* CONFIG_X86_32 */ | ||
16 | |||
17 | extern cpumask_t cpu_callin_map; | ||
18 | extern cpumask_t cpu_callout_map; | ||
19 | extern cpumask_t cpu_initialized; | ||
20 | extern cpumask_t cpu_sibling_setup_map; | ||
21 | |||
22 | #define cpu_callin_mask ((struct cpumask *)&cpu_callin_map) | ||
23 | #define cpu_callout_mask ((struct cpumask *)&cpu_callout_map) | ||
24 | #define cpu_initialized_mask ((struct cpumask *)&cpu_initialized) | ||
25 | #define cpu_sibling_setup_mask ((struct cpumask *)&cpu_sibling_setup_map) | ||
26 | |||
27 | static inline void setup_cpu_local_masks(void) { } | ||
28 | |||
29 | #endif /* CONFIG_X86_32 */ | ||
30 | |||
31 | #endif /* __ASSEMBLY__ */ | ||
32 | #endif /* _ASM_X86_CPUMASK_H */ | ||
diff --git a/arch/x86/include/asm/current.h b/arch/x86/include/asm/current.h index 0930b4f8d672..c68c361697e1 100644 --- a/arch/x86/include/asm/current.h +++ b/arch/x86/include/asm/current.h | |||
@@ -1,39 +1,21 @@ | |||
1 | #ifndef _ASM_X86_CURRENT_H | 1 | #ifndef _ASM_X86_CURRENT_H |
2 | #define _ASM_X86_CURRENT_H | 2 | #define _ASM_X86_CURRENT_H |
3 | 3 | ||
4 | #ifdef CONFIG_X86_32 | ||
5 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
6 | #include <asm/percpu.h> | 5 | #include <asm/percpu.h> |
7 | 6 | ||
7 | #ifndef __ASSEMBLY__ | ||
8 | struct task_struct; | 8 | struct task_struct; |
9 | 9 | ||
10 | DECLARE_PER_CPU(struct task_struct *, current_task); | 10 | DECLARE_PER_CPU(struct task_struct *, current_task); |
11 | static __always_inline struct task_struct *get_current(void) | ||
12 | { | ||
13 | return x86_read_percpu(current_task); | ||
14 | } | ||
15 | |||
16 | #else /* X86_32 */ | ||
17 | |||
18 | #ifndef __ASSEMBLY__ | ||
19 | #include <asm/pda.h> | ||
20 | |||
21 | struct task_struct; | ||
22 | 11 | ||
23 | static __always_inline struct task_struct *get_current(void) | 12 | static __always_inline struct task_struct *get_current(void) |
24 | { | 13 | { |
25 | return read_pda(pcurrent); | 14 | return percpu_read(current_task); |
26 | } | 15 | } |
27 | 16 | ||
28 | #else /* __ASSEMBLY__ */ | 17 | #define current get_current() |
29 | |||
30 | #include <asm/asm-offsets.h> | ||
31 | #define GET_CURRENT(reg) movq %gs:(pda_pcurrent),reg | ||
32 | 18 | ||
33 | #endif /* __ASSEMBLY__ */ | 19 | #endif /* __ASSEMBLY__ */ |
34 | 20 | ||
35 | #endif /* X86_32 */ | ||
36 | |||
37 | #define current get_current() | ||
38 | |||
39 | #endif /* _ASM_X86_CURRENT_H */ | 21 | #endif /* _ASM_X86_CURRENT_H */ |
diff --git a/arch/x86/include/asm/mach-default/do_timer.h b/arch/x86/include/asm/do_timer.h index 23ecda0b28a0..23ecda0b28a0 100644 --- a/arch/x86/include/asm/mach-default/do_timer.h +++ b/arch/x86/include/asm/do_timer.h | |||
diff --git a/arch/x86/include/asm/mach-default/entry_arch.h b/arch/x86/include/asm/entry_arch.h index 6b1add8e31dd..854d538ae857 100644 --- a/arch/x86/include/asm/mach-default/entry_arch.h +++ b/arch/x86/include/asm/entry_arch.h | |||
@@ -9,12 +9,28 @@ | |||
9 | * is no hardware IRQ pin equivalent for them, they are triggered | 9 | * is no hardware IRQ pin equivalent for them, they are triggered |
10 | * through the ICC by us (IPIs) | 10 | * through the ICC by us (IPIs) |
11 | */ | 11 | */ |
12 | #ifdef CONFIG_X86_SMP | 12 | #ifdef CONFIG_SMP |
13 | BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR) | 13 | BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR) |
14 | BUILD_INTERRUPT(invalidate_interrupt,INVALIDATE_TLB_VECTOR) | ||
15 | BUILD_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR) | 14 | BUILD_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR) |
16 | BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR) | 15 | BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR) |
17 | BUILD_INTERRUPT(irq_move_cleanup_interrupt,IRQ_MOVE_CLEANUP_VECTOR) | 16 | BUILD_INTERRUPT(irq_move_cleanup_interrupt,IRQ_MOVE_CLEANUP_VECTOR) |
17 | |||
18 | BUILD_INTERRUPT3(invalidate_interrupt0,INVALIDATE_TLB_VECTOR_START+0, | ||
19 | smp_invalidate_interrupt) | ||
20 | BUILD_INTERRUPT3(invalidate_interrupt1,INVALIDATE_TLB_VECTOR_START+1, | ||
21 | smp_invalidate_interrupt) | ||
22 | BUILD_INTERRUPT3(invalidate_interrupt2,INVALIDATE_TLB_VECTOR_START+2, | ||
23 | smp_invalidate_interrupt) | ||
24 | BUILD_INTERRUPT3(invalidate_interrupt3,INVALIDATE_TLB_VECTOR_START+3, | ||
25 | smp_invalidate_interrupt) | ||
26 | BUILD_INTERRUPT3(invalidate_interrupt4,INVALIDATE_TLB_VECTOR_START+4, | ||
27 | smp_invalidate_interrupt) | ||
28 | BUILD_INTERRUPT3(invalidate_interrupt5,INVALIDATE_TLB_VECTOR_START+5, | ||
29 | smp_invalidate_interrupt) | ||
30 | BUILD_INTERRUPT3(invalidate_interrupt6,INVALIDATE_TLB_VECTOR_START+6, | ||
31 | smp_invalidate_interrupt) | ||
32 | BUILD_INTERRUPT3(invalidate_interrupt7,INVALIDATE_TLB_VECTOR_START+7, | ||
33 | smp_invalidate_interrupt) | ||
18 | #endif | 34 | #endif |
19 | 35 | ||
20 | /* | 36 | /* |
@@ -25,10 +41,15 @@ BUILD_INTERRUPT(irq_move_cleanup_interrupt,IRQ_MOVE_CLEANUP_VECTOR) | |||
25 | * a much simpler SMP time architecture: | 41 | * a much simpler SMP time architecture: |
26 | */ | 42 | */ |
27 | #ifdef CONFIG_X86_LOCAL_APIC | 43 | #ifdef CONFIG_X86_LOCAL_APIC |
44 | |||
28 | BUILD_INTERRUPT(apic_timer_interrupt,LOCAL_TIMER_VECTOR) | 45 | BUILD_INTERRUPT(apic_timer_interrupt,LOCAL_TIMER_VECTOR) |
29 | BUILD_INTERRUPT(error_interrupt,ERROR_APIC_VECTOR) | 46 | BUILD_INTERRUPT(error_interrupt,ERROR_APIC_VECTOR) |
30 | BUILD_INTERRUPT(spurious_interrupt,SPURIOUS_APIC_VECTOR) | 47 | BUILD_INTERRUPT(spurious_interrupt,SPURIOUS_APIC_VECTOR) |
31 | 48 | ||
49 | #ifdef CONFIG_PERF_COUNTERS | ||
50 | BUILD_INTERRUPT(perf_counter_interrupt, LOCAL_PERF_VECTOR) | ||
51 | #endif | ||
52 | |||
32 | #ifdef CONFIG_X86_MCE_P4THERMAL | 53 | #ifdef CONFIG_X86_MCE_P4THERMAL |
33 | BUILD_INTERRUPT(thermal_interrupt,THERMAL_APIC_VECTOR) | 54 | BUILD_INTERRUPT(thermal_interrupt,THERMAL_APIC_VECTOR) |
34 | #endif | 55 | #endif |
diff --git a/arch/x86/include/asm/es7000/apic.h b/arch/x86/include/asm/es7000/apic.h deleted file mode 100644 index c58b9cc74465..000000000000 --- a/arch/x86/include/asm/es7000/apic.h +++ /dev/null | |||
@@ -1,242 +0,0 @@ | |||
1 | #ifndef __ASM_ES7000_APIC_H | ||
2 | #define __ASM_ES7000_APIC_H | ||
3 | |||
4 | #include <linux/gfp.h> | ||
5 | |||
6 | #define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu) | ||
7 | #define esr_disable (1) | ||
8 | |||
9 | static inline int apic_id_registered(void) | ||
10 | { | ||
11 | return (1); | ||
12 | } | ||
13 | |||
14 | static inline const cpumask_t *target_cpus_cluster(void) | ||
15 | { | ||
16 | return &CPU_MASK_ALL; | ||
17 | } | ||
18 | |||
19 | static inline const cpumask_t *target_cpus(void) | ||
20 | { | ||
21 | return &cpumask_of_cpu(smp_processor_id()); | ||
22 | } | ||
23 | |||
24 | #define APIC_DFR_VALUE_CLUSTER (APIC_DFR_CLUSTER) | ||
25 | #define INT_DELIVERY_MODE_CLUSTER (dest_LowestPrio) | ||
26 | #define INT_DEST_MODE_CLUSTER (1) /* logical delivery broadcast to all procs */ | ||
27 | #define NO_BALANCE_IRQ_CLUSTER (1) | ||
28 | |||
29 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
30 | #define INT_DELIVERY_MODE (dest_Fixed) | ||
31 | #define INT_DEST_MODE (0) /* phys delivery to target procs */ | ||
32 | #define NO_BALANCE_IRQ (0) | ||
33 | #undef APIC_DEST_LOGICAL | ||
34 | #define APIC_DEST_LOGICAL 0x0 | ||
35 | |||
36 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) | ||
37 | { | ||
38 | return 0; | ||
39 | } | ||
40 | static inline unsigned long check_apicid_present(int bit) | ||
41 | { | ||
42 | return physid_isset(bit, phys_cpu_present_map); | ||
43 | } | ||
44 | |||
45 | #define apicid_cluster(apicid) (apicid & 0xF0) | ||
46 | |||
47 | static inline unsigned long calculate_ldr(int cpu) | ||
48 | { | ||
49 | unsigned long id; | ||
50 | id = xapic_phys_to_log_apicid(cpu); | ||
51 | return (SET_APIC_LOGICAL_ID(id)); | ||
52 | } | ||
53 | |||
54 | /* | ||
55 | * Set up the logical destination ID. | ||
56 | * | ||
57 | * Intel recommends to set DFR, LdR and TPR before enabling | ||
58 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
59 | * document number 292116). So here it goes... | ||
60 | */ | ||
61 | static inline void init_apic_ldr_cluster(void) | ||
62 | { | ||
63 | unsigned long val; | ||
64 | int cpu = smp_processor_id(); | ||
65 | |||
66 | apic_write(APIC_DFR, APIC_DFR_VALUE_CLUSTER); | ||
67 | val = calculate_ldr(cpu); | ||
68 | apic_write(APIC_LDR, val); | ||
69 | } | ||
70 | |||
71 | static inline void init_apic_ldr(void) | ||
72 | { | ||
73 | unsigned long val; | ||
74 | int cpu = smp_processor_id(); | ||
75 | |||
76 | apic_write(APIC_DFR, APIC_DFR_VALUE); | ||
77 | val = calculate_ldr(cpu); | ||
78 | apic_write(APIC_LDR, val); | ||
79 | } | ||
80 | |||
81 | extern int apic_version [MAX_APICS]; | ||
82 | static inline void setup_apic_routing(void) | ||
83 | { | ||
84 | int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id()); | ||
85 | printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n", | ||
86 | (apic_version[apic] == 0x14) ? | ||
87 | "Physical Cluster" : "Logical Cluster", | ||
88 | nr_ioapics, cpus_addr(*target_cpus())[0]); | ||
89 | } | ||
90 | |||
91 | static inline int multi_timer_check(int apic, int irq) | ||
92 | { | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | static inline int apicid_to_node(int logical_apicid) | ||
97 | { | ||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | |||
102 | static inline int cpu_present_to_apicid(int mps_cpu) | ||
103 | { | ||
104 | if (!mps_cpu) | ||
105 | return boot_cpu_physical_apicid; | ||
106 | else if (mps_cpu < nr_cpu_ids) | ||
107 | return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
108 | else | ||
109 | return BAD_APICID; | ||
110 | } | ||
111 | |||
112 | static inline physid_mask_t apicid_to_cpu_present(int phys_apicid) | ||
113 | { | ||
114 | static int id = 0; | ||
115 | physid_mask_t mask; | ||
116 | mask = physid_mask_of_physid(id); | ||
117 | ++id; | ||
118 | return mask; | ||
119 | } | ||
120 | |||
121 | extern u8 cpu_2_logical_apicid[]; | ||
122 | /* Mapping from cpu number to logical apicid */ | ||
123 | static inline int cpu_to_logical_apicid(int cpu) | ||
124 | { | ||
125 | #ifdef CONFIG_SMP | ||
126 | if (cpu >= nr_cpu_ids) | ||
127 | return BAD_APICID; | ||
128 | return (int)cpu_2_logical_apicid[cpu]; | ||
129 | #else | ||
130 | return logical_smp_processor_id(); | ||
131 | #endif | ||
132 | } | ||
133 | |||
134 | static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map) | ||
135 | { | ||
136 | /* For clustered we don't have a good way to do this yet - hack */ | ||
137 | return physids_promote(0xff); | ||
138 | } | ||
139 | |||
140 | |||
141 | static inline void setup_portio_remap(void) | ||
142 | { | ||
143 | } | ||
144 | |||
145 | extern unsigned int boot_cpu_physical_apicid; | ||
146 | static inline int check_phys_apicid_present(int cpu_physical_apicid) | ||
147 | { | ||
148 | boot_cpu_physical_apicid = read_apic_id(); | ||
149 | return (1); | ||
150 | } | ||
151 | |||
152 | static inline unsigned int | ||
153 | cpu_mask_to_apicid_cluster(const struct cpumask *cpumask) | ||
154 | { | ||
155 | int num_bits_set; | ||
156 | int cpus_found = 0; | ||
157 | int cpu; | ||
158 | int apicid; | ||
159 | |||
160 | num_bits_set = cpumask_weight(cpumask); | ||
161 | /* Return id to all */ | ||
162 | if (num_bits_set == nr_cpu_ids) | ||
163 | return 0xFF; | ||
164 | /* | ||
165 | * The cpus in the mask must all be on the apic cluster. If are not | ||
166 | * on the same apicid cluster return default value of TARGET_CPUS. | ||
167 | */ | ||
168 | cpu = cpumask_first(cpumask); | ||
169 | apicid = cpu_to_logical_apicid(cpu); | ||
170 | while (cpus_found < num_bits_set) { | ||
171 | if (cpumask_test_cpu(cpu, cpumask)) { | ||
172 | int new_apicid = cpu_to_logical_apicid(cpu); | ||
173 | if (apicid_cluster(apicid) != | ||
174 | apicid_cluster(new_apicid)){ | ||
175 | printk ("%s: Not a valid mask!\n", __func__); | ||
176 | return 0xFF; | ||
177 | } | ||
178 | apicid = new_apicid; | ||
179 | cpus_found++; | ||
180 | } | ||
181 | cpu++; | ||
182 | } | ||
183 | return apicid; | ||
184 | } | ||
185 | |||
186 | static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | ||
187 | { | ||
188 | int num_bits_set; | ||
189 | int cpus_found = 0; | ||
190 | int cpu; | ||
191 | int apicid; | ||
192 | |||
193 | num_bits_set = cpus_weight(*cpumask); | ||
194 | /* Return id to all */ | ||
195 | if (num_bits_set == nr_cpu_ids) | ||
196 | return cpu_to_logical_apicid(0); | ||
197 | /* | ||
198 | * The cpus in the mask must all be on the apic cluster. If are not | ||
199 | * on the same apicid cluster return default value of TARGET_CPUS. | ||
200 | */ | ||
201 | cpu = first_cpu(*cpumask); | ||
202 | apicid = cpu_to_logical_apicid(cpu); | ||
203 | while (cpus_found < num_bits_set) { | ||
204 | if (cpu_isset(cpu, *cpumask)) { | ||
205 | int new_apicid = cpu_to_logical_apicid(cpu); | ||
206 | if (apicid_cluster(apicid) != | ||
207 | apicid_cluster(new_apicid)){ | ||
208 | printk ("%s: Not a valid mask!\n", __func__); | ||
209 | return cpu_to_logical_apicid(0); | ||
210 | } | ||
211 | apicid = new_apicid; | ||
212 | cpus_found++; | ||
213 | } | ||
214 | cpu++; | ||
215 | } | ||
216 | return apicid; | ||
217 | } | ||
218 | |||
219 | |||
220 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, | ||
221 | const struct cpumask *andmask) | ||
222 | { | ||
223 | int apicid = cpu_to_logical_apicid(0); | ||
224 | cpumask_var_t cpumask; | ||
225 | |||
226 | if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC)) | ||
227 | return apicid; | ||
228 | |||
229 | cpumask_and(cpumask, inmask, andmask); | ||
230 | cpumask_and(cpumask, cpumask, cpu_online_mask); | ||
231 | apicid = cpu_mask_to_apicid(cpumask); | ||
232 | |||
233 | free_cpumask_var(cpumask); | ||
234 | return apicid; | ||
235 | } | ||
236 | |||
237 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | ||
238 | { | ||
239 | return cpuid_apic >> index_msb; | ||
240 | } | ||
241 | |||
242 | #endif /* __ASM_ES7000_APIC_H */ | ||
diff --git a/arch/x86/include/asm/es7000/apicdef.h b/arch/x86/include/asm/es7000/apicdef.h deleted file mode 100644 index 8b234a3cb851..000000000000 --- a/arch/x86/include/asm/es7000/apicdef.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #ifndef __ASM_ES7000_APICDEF_H | ||
2 | #define __ASM_ES7000_APICDEF_H | ||
3 | |||
4 | #define APIC_ID_MASK (0xFF<<24) | ||
5 | |||
6 | static inline unsigned get_apic_id(unsigned long x) | ||
7 | { | ||
8 | return (((x)>>24)&0xFF); | ||
9 | } | ||
10 | |||
11 | #define GET_APIC_ID(x) get_apic_id(x) | ||
12 | |||
13 | #endif | ||
diff --git a/arch/x86/include/asm/es7000/ipi.h b/arch/x86/include/asm/es7000/ipi.h deleted file mode 100644 index 7e8ed24d4b8a..000000000000 --- a/arch/x86/include/asm/es7000/ipi.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | #ifndef __ASM_ES7000_IPI_H | ||
2 | #define __ASM_ES7000_IPI_H | ||
3 | |||
4 | void send_IPI_mask_sequence(const struct cpumask *mask, int vector); | ||
5 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | ||
6 | |||
7 | static inline void send_IPI_mask(const struct cpumask *mask, int vector) | ||
8 | { | ||
9 | send_IPI_mask_sequence(mask, vector); | ||
10 | } | ||
11 | |||
12 | static inline void send_IPI_allbutself(int vector) | ||
13 | { | ||
14 | send_IPI_mask_allbutself(cpu_online_mask, vector); | ||
15 | } | ||
16 | |||
17 | static inline void send_IPI_all(int vector) | ||
18 | { | ||
19 | send_IPI_mask(cpu_online_mask, vector); | ||
20 | } | ||
21 | |||
22 | #endif /* __ASM_ES7000_IPI_H */ | ||
diff --git a/arch/x86/include/asm/es7000/mpparse.h b/arch/x86/include/asm/es7000/mpparse.h deleted file mode 100644 index c1629b090ec2..000000000000 --- a/arch/x86/include/asm/es7000/mpparse.h +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | #ifndef __ASM_ES7000_MPPARSE_H | ||
2 | #define __ASM_ES7000_MPPARSE_H | ||
3 | |||
4 | #include <linux/acpi.h> | ||
5 | |||
6 | extern int parse_unisys_oem (char *oemptr); | ||
7 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); | ||
8 | extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr); | ||
9 | extern void setup_unisys(void); | ||
10 | |||
11 | #ifndef CONFIG_X86_GENERICARCH | ||
12 | extern int acpi_madt_oem_check(char *oem_id, char *oem_table_id); | ||
13 | extern int mps_oem_check(struct mpc_table *mpc, char *oem, char *productid); | ||
14 | #endif | ||
15 | |||
16 | #ifdef CONFIG_ACPI | ||
17 | |||
18 | static inline int es7000_check_dsdt(void) | ||
19 | { | ||
20 | struct acpi_table_header header; | ||
21 | |||
22 | if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) && | ||
23 | !strncmp(header.oem_id, "UNISYS", 6)) | ||
24 | return 1; | ||
25 | return 0; | ||
26 | } | ||
27 | #endif | ||
28 | |||
29 | #endif /* __ASM_MACH_MPPARSE_H */ | ||
diff --git a/arch/x86/include/asm/es7000/wakecpu.h b/arch/x86/include/asm/es7000/wakecpu.h deleted file mode 100644 index 78f0daaee436..000000000000 --- a/arch/x86/include/asm/es7000/wakecpu.h +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | #ifndef __ASM_ES7000_WAKECPU_H | ||
2 | #define __ASM_ES7000_WAKECPU_H | ||
3 | |||
4 | #define TRAMPOLINE_PHYS_LOW 0x467 | ||
5 | #define TRAMPOLINE_PHYS_HIGH 0x469 | ||
6 | |||
7 | static inline void wait_for_init_deassert(atomic_t *deassert) | ||
8 | { | ||
9 | #ifndef CONFIG_ES7000_CLUSTERED_APIC | ||
10 | while (!atomic_read(deassert)) | ||
11 | cpu_relax(); | ||
12 | #endif | ||
13 | return; | ||
14 | } | ||
15 | |||
16 | /* Nothing to do for most platforms, since cleared by the INIT cycle */ | ||
17 | static inline void smp_callin_clear_local_apic(void) | ||
18 | { | ||
19 | } | ||
20 | |||
21 | static inline void store_NMI_vector(unsigned short *high, unsigned short *low) | ||
22 | { | ||
23 | } | ||
24 | |||
25 | static inline void restore_NMI_vector(unsigned short *high, unsigned short *low) | ||
26 | { | ||
27 | } | ||
28 | |||
29 | extern void __inquire_remote_apic(int apicid); | ||
30 | |||
31 | static inline void inquire_remote_apic(int apicid) | ||
32 | { | ||
33 | if (apic_verbosity >= APIC_DEBUG) | ||
34 | __inquire_remote_apic(apicid); | ||
35 | } | ||
36 | |||
37 | #endif /* __ASM_MACH_WAKECPU_H */ | ||
diff --git a/arch/x86/include/asm/genapic.h b/arch/x86/include/asm/genapic.h index d48bee663a6f..273b99452ae0 100644 --- a/arch/x86/include/asm/genapic.h +++ b/arch/x86/include/asm/genapic.h | |||
@@ -1,5 +1,263 @@ | |||
1 | #ifndef _ASM_X86_GENAPIC_H | ||
2 | #define _ASM_X86_GENAPIC_H | ||
3 | |||
4 | #include <linux/cpumask.h> | ||
5 | |||
6 | #include <asm/mpspec.h> | ||
7 | #include <asm/atomic.h> | ||
8 | |||
9 | /* | ||
10 | * Copyright 2004 James Cleverdon, IBM. | ||
11 | * Subject to the GNU Public License, v.2 | ||
12 | * | ||
13 | * Generic APIC sub-arch data struct. | ||
14 | * | ||
15 | * Hacked for x86-64 by James Cleverdon from i386 architecture code by | ||
16 | * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and | ||
17 | * James Cleverdon. | ||
18 | */ | ||
19 | struct genapic { | ||
20 | char *name; | ||
21 | |||
22 | int (*probe)(void); | ||
23 | int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); | ||
24 | int (*apic_id_registered)(void); | ||
25 | |||
26 | u32 irq_delivery_mode; | ||
27 | u32 irq_dest_mode; | ||
28 | |||
29 | const struct cpumask *(*target_cpus)(void); | ||
30 | |||
31 | int disable_esr; | ||
32 | |||
33 | int dest_logical; | ||
34 | unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid); | ||
35 | unsigned long (*check_apicid_present)(int apicid); | ||
36 | |||
37 | void (*vector_allocation_domain)(int cpu, struct cpumask *retmask); | ||
38 | void (*init_apic_ldr)(void); | ||
39 | |||
40 | physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map); | ||
41 | |||
42 | void (*setup_apic_routing)(void); | ||
43 | int (*multi_timer_check)(int apic, int irq); | ||
44 | int (*apicid_to_node)(int logical_apicid); | ||
45 | int (*cpu_to_logical_apicid)(int cpu); | ||
46 | int (*cpu_present_to_apicid)(int mps_cpu); | ||
47 | physid_mask_t (*apicid_to_cpu_present)(int phys_apicid); | ||
48 | void (*setup_portio_remap)(void); | ||
49 | int (*check_phys_apicid_present)(int boot_cpu_physical_apicid); | ||
50 | void (*enable_apic_mode)(void); | ||
51 | int (*phys_pkg_id)(int cpuid_apic, int index_msb); | ||
52 | |||
53 | /* | ||
54 | * When one of the next two hooks returns 1 the genapic | ||
55 | * is switched to this. Essentially they are additional | ||
56 | * probe functions: | ||
57 | */ | ||
58 | int (*mps_oem_check)(struct mpc_table *mpc, char *oem, char *productid); | ||
59 | |||
60 | unsigned int (*get_apic_id)(unsigned long x); | ||
61 | unsigned long (*set_apic_id)(unsigned int id); | ||
62 | unsigned long apic_id_mask; | ||
63 | |||
64 | unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask); | ||
65 | unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask, | ||
66 | const struct cpumask *andmask); | ||
67 | |||
68 | /* ipi */ | ||
69 | void (*send_IPI_mask)(const struct cpumask *mask, int vector); | ||
70 | void (*send_IPI_mask_allbutself)(const struct cpumask *mask, | ||
71 | int vector); | ||
72 | void (*send_IPI_allbutself)(int vector); | ||
73 | void (*send_IPI_all)(int vector); | ||
74 | void (*send_IPI_self)(int vector); | ||
75 | |||
76 | /* wakeup_secondary_cpu */ | ||
77 | int (*wakeup_cpu)(int apicid, unsigned long start_eip); | ||
78 | |||
79 | int trampoline_phys_low; | ||
80 | int trampoline_phys_high; | ||
81 | |||
82 | void (*wait_for_init_deassert)(atomic_t *deassert); | ||
83 | void (*smp_callin_clear_local_apic)(void); | ||
84 | void (*store_NMI_vector)(unsigned short *high, unsigned short *low); | ||
85 | void (*inquire_remote_apic)(int apicid); | ||
86 | }; | ||
87 | |||
88 | extern struct genapic *apic; | ||
89 | |||
90 | /* | ||
91 | * Warm reset vector default position: | ||
92 | */ | ||
93 | #define DEFAULT_TRAMPOLINE_PHYS_LOW 0x467 | ||
94 | #define DEFAULT_TRAMPOLINE_PHYS_HIGH 0x469 | ||
95 | |||
1 | #ifdef CONFIG_X86_32 | 96 | #ifdef CONFIG_X86_32 |
2 | # include "genapic_32.h" | 97 | extern void es7000_update_genapic_to_cluster(void); |
3 | #else | 98 | #else |
4 | # include "genapic_64.h" | 99 | extern struct genapic apic_flat; |
100 | extern struct genapic apic_physflat; | ||
101 | extern struct genapic apic_x2apic_cluster; | ||
102 | extern struct genapic apic_x2apic_phys; | ||
103 | extern int default_acpi_madt_oem_check(char *, char *); | ||
104 | |||
105 | extern void apic_send_IPI_self(int vector); | ||
106 | |||
107 | extern struct genapic apic_x2apic_uv_x; | ||
108 | DECLARE_PER_CPU(int, x2apic_extra_bits); | ||
109 | |||
110 | extern void default_setup_apic_routing(void); | ||
111 | |||
112 | extern int default_cpu_present_to_apicid(int mps_cpu); | ||
113 | extern int default_check_phys_apicid_present(int boot_cpu_physical_apicid); | ||
5 | #endif | 114 | #endif |
115 | |||
116 | static inline void default_wait_for_init_deassert(atomic_t *deassert) | ||
117 | { | ||
118 | while (!atomic_read(deassert)) | ||
119 | cpu_relax(); | ||
120 | return; | ||
121 | } | ||
122 | |||
123 | extern void generic_bigsmp_probe(void); | ||
124 | |||
125 | |||
126 | #ifdef CONFIG_X86_LOCAL_APIC | ||
127 | |||
128 | #include <asm/smp.h> | ||
129 | |||
130 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
131 | |||
132 | static inline const struct cpumask *default_target_cpus(void) | ||
133 | { | ||
134 | #ifdef CONFIG_SMP | ||
135 | return cpu_online_mask; | ||
136 | #else | ||
137 | return cpumask_of(0); | ||
138 | #endif | ||
139 | } | ||
140 | |||
141 | DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid); | ||
142 | |||
143 | |||
144 | static inline unsigned int read_apic_id(void) | ||
145 | { | ||
146 | unsigned int reg; | ||
147 | |||
148 | reg = apic_read(APIC_ID); | ||
149 | |||
150 | return apic->get_apic_id(reg); | ||
151 | } | ||
152 | |||
153 | #ifdef CONFIG_X86_64 | ||
154 | extern void default_setup_apic_routing(void); | ||
155 | #else | ||
156 | |||
157 | /* | ||
158 | * Set up the logical destination ID. | ||
159 | * | ||
160 | * Intel recommends to set DFR, LDR and TPR before enabling | ||
161 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
162 | * document number 292116). So here it goes... | ||
163 | */ | ||
164 | extern void default_init_apic_ldr(void); | ||
165 | |||
166 | static inline int default_apic_id_registered(void) | ||
167 | { | ||
168 | return physid_isset(read_apic_id(), phys_cpu_present_map); | ||
169 | } | ||
170 | |||
171 | static inline unsigned int | ||
172 | default_cpu_mask_to_apicid(const struct cpumask *cpumask) | ||
173 | { | ||
174 | return cpumask_bits(cpumask)[0]; | ||
175 | } | ||
176 | |||
177 | static inline unsigned int | ||
178 | default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
179 | const struct cpumask *andmask) | ||
180 | { | ||
181 | unsigned long mask1 = cpumask_bits(cpumask)[0]; | ||
182 | unsigned long mask2 = cpumask_bits(andmask)[0]; | ||
183 | unsigned long mask3 = cpumask_bits(cpu_online_mask)[0]; | ||
184 | |||
185 | return (unsigned int)(mask1 & mask2 & mask3); | ||
186 | } | ||
187 | |||
188 | static inline int default_phys_pkg_id(int cpuid_apic, int index_msb) | ||
189 | { | ||
190 | return cpuid_apic >> index_msb; | ||
191 | } | ||
192 | |||
193 | static inline void default_setup_apic_routing(void) | ||
194 | { | ||
195 | #ifdef CONFIG_X86_IO_APIC | ||
196 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | ||
197 | "Flat", nr_ioapics); | ||
198 | #endif | ||
199 | } | ||
200 | |||
201 | extern int default_apicid_to_node(int logical_apicid); | ||
202 | |||
203 | #endif | ||
204 | |||
205 | static inline unsigned long default_check_apicid_used(physid_mask_t bitmap, int apicid) | ||
206 | { | ||
207 | return physid_isset(apicid, bitmap); | ||
208 | } | ||
209 | |||
210 | static inline unsigned long default_check_apicid_present(int bit) | ||
211 | { | ||
212 | return physid_isset(bit, phys_cpu_present_map); | ||
213 | } | ||
214 | |||
215 | static inline physid_mask_t default_ioapic_phys_id_map(physid_mask_t phys_map) | ||
216 | { | ||
217 | return phys_map; | ||
218 | } | ||
219 | |||
220 | /* Mapping from cpu number to logical apicid */ | ||
221 | static inline int default_cpu_to_logical_apicid(int cpu) | ||
222 | { | ||
223 | return 1 << cpu; | ||
224 | } | ||
225 | |||
226 | static inline int __default_cpu_present_to_apicid(int mps_cpu) | ||
227 | { | ||
228 | if (mps_cpu < nr_cpu_ids && cpu_present(mps_cpu)) | ||
229 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
230 | else | ||
231 | return BAD_APICID; | ||
232 | } | ||
233 | |||
234 | static inline int | ||
235 | __default_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
236 | { | ||
237 | return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map); | ||
238 | } | ||
239 | |||
240 | #ifdef CONFIG_X86_32 | ||
241 | static inline int default_cpu_present_to_apicid(int mps_cpu) | ||
242 | { | ||
243 | return __default_cpu_present_to_apicid(mps_cpu); | ||
244 | } | ||
245 | |||
246 | static inline int | ||
247 | default_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
248 | { | ||
249 | return __default_check_phys_apicid_present(boot_cpu_physical_apicid); | ||
250 | } | ||
251 | #else | ||
252 | extern int default_cpu_present_to_apicid(int mps_cpu); | ||
253 | extern int default_check_phys_apicid_present(int boot_cpu_physical_apicid); | ||
254 | #endif | ||
255 | |||
256 | static inline physid_mask_t default_apicid_to_cpu_present(int phys_apicid) | ||
257 | { | ||
258 | return physid_mask_of_physid(phys_apicid); | ||
259 | } | ||
260 | |||
261 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
262 | |||
263 | #endif /* _ASM_X86_GENAPIC_64_H */ | ||
diff --git a/arch/x86/include/asm/genapic_32.h b/arch/x86/include/asm/genapic_32.h deleted file mode 100644 index 2c05b737ee22..000000000000 --- a/arch/x86/include/asm/genapic_32.h +++ /dev/null | |||
@@ -1,148 +0,0 @@ | |||
1 | #ifndef _ASM_X86_GENAPIC_32_H | ||
2 | #define _ASM_X86_GENAPIC_32_H | ||
3 | |||
4 | #include <asm/mpspec.h> | ||
5 | #include <asm/atomic.h> | ||
6 | |||
7 | /* | ||
8 | * Generic APIC driver interface. | ||
9 | * | ||
10 | * An straight forward mapping of the APIC related parts of the | ||
11 | * x86 subarchitecture interface to a dynamic object. | ||
12 | * | ||
13 | * This is used by the "generic" x86 subarchitecture. | ||
14 | * | ||
15 | * Copyright 2003 Andi Kleen, SuSE Labs. | ||
16 | */ | ||
17 | |||
18 | struct mpc_bus; | ||
19 | struct mpc_table; | ||
20 | struct mpc_cpu; | ||
21 | |||
22 | struct genapic { | ||
23 | char *name; | ||
24 | int (*probe)(void); | ||
25 | |||
26 | int (*apic_id_registered)(void); | ||
27 | const struct cpumask *(*target_cpus)(void); | ||
28 | int int_delivery_mode; | ||
29 | int int_dest_mode; | ||
30 | int ESR_DISABLE; | ||
31 | int apic_destination_logical; | ||
32 | unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid); | ||
33 | unsigned long (*check_apicid_present)(int apicid); | ||
34 | int no_balance_irq; | ||
35 | int no_ioapic_check; | ||
36 | void (*init_apic_ldr)(void); | ||
37 | physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map); | ||
38 | |||
39 | void (*setup_apic_routing)(void); | ||
40 | int (*multi_timer_check)(int apic, int irq); | ||
41 | int (*apicid_to_node)(int logical_apicid); | ||
42 | int (*cpu_to_logical_apicid)(int cpu); | ||
43 | int (*cpu_present_to_apicid)(int mps_cpu); | ||
44 | physid_mask_t (*apicid_to_cpu_present)(int phys_apicid); | ||
45 | void (*setup_portio_remap)(void); | ||
46 | int (*check_phys_apicid_present)(int boot_cpu_physical_apicid); | ||
47 | void (*enable_apic_mode)(void); | ||
48 | u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb); | ||
49 | |||
50 | /* mpparse */ | ||
51 | /* When one of the next two hooks returns 1 the genapic | ||
52 | is switched to this. Essentially they are additional probe | ||
53 | functions. */ | ||
54 | int (*mps_oem_check)(struct mpc_table *mpc, char *oem, | ||
55 | char *productid); | ||
56 | int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); | ||
57 | |||
58 | unsigned (*get_apic_id)(unsigned long x); | ||
59 | unsigned long apic_id_mask; | ||
60 | unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask); | ||
61 | unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask, | ||
62 | const struct cpumask *andmask); | ||
63 | void (*vector_allocation_domain)(int cpu, struct cpumask *retmask); | ||
64 | |||
65 | #ifdef CONFIG_SMP | ||
66 | /* ipi */ | ||
67 | void (*send_IPI_mask)(const struct cpumask *mask, int vector); | ||
68 | void (*send_IPI_mask_allbutself)(const struct cpumask *mask, | ||
69 | int vector); | ||
70 | void (*send_IPI_allbutself)(int vector); | ||
71 | void (*send_IPI_all)(int vector); | ||
72 | #endif | ||
73 | int (*wakeup_cpu)(int apicid, unsigned long start_eip); | ||
74 | int trampoline_phys_low; | ||
75 | int trampoline_phys_high; | ||
76 | void (*wait_for_init_deassert)(atomic_t *deassert); | ||
77 | void (*smp_callin_clear_local_apic)(void); | ||
78 | void (*store_NMI_vector)(unsigned short *high, unsigned short *low); | ||
79 | void (*restore_NMI_vector)(unsigned short *high, unsigned short *low); | ||
80 | void (*inquire_remote_apic)(int apicid); | ||
81 | }; | ||
82 | |||
83 | #define APICFUNC(x) .x = x, | ||
84 | |||
85 | /* More functions could be probably marked IPIFUNC and save some space | ||
86 | in UP GENERICARCH kernels, but I don't have the nerve right now | ||
87 | to untangle this mess. -AK */ | ||
88 | #ifdef CONFIG_SMP | ||
89 | #define IPIFUNC(x) APICFUNC(x) | ||
90 | #else | ||
91 | #define IPIFUNC(x) | ||
92 | #endif | ||
93 | |||
94 | #define APIC_INIT(aname, aprobe) \ | ||
95 | { \ | ||
96 | .name = aname, \ | ||
97 | .probe = aprobe, \ | ||
98 | .int_delivery_mode = INT_DELIVERY_MODE, \ | ||
99 | .int_dest_mode = INT_DEST_MODE, \ | ||
100 | .no_balance_irq = NO_BALANCE_IRQ, \ | ||
101 | .ESR_DISABLE = esr_disable, \ | ||
102 | .apic_destination_logical = APIC_DEST_LOGICAL, \ | ||
103 | APICFUNC(apic_id_registered) \ | ||
104 | APICFUNC(target_cpus) \ | ||
105 | APICFUNC(check_apicid_used) \ | ||
106 | APICFUNC(check_apicid_present) \ | ||
107 | APICFUNC(init_apic_ldr) \ | ||
108 | APICFUNC(ioapic_phys_id_map) \ | ||
109 | APICFUNC(setup_apic_routing) \ | ||
110 | APICFUNC(multi_timer_check) \ | ||
111 | APICFUNC(apicid_to_node) \ | ||
112 | APICFUNC(cpu_to_logical_apicid) \ | ||
113 | APICFUNC(cpu_present_to_apicid) \ | ||
114 | APICFUNC(apicid_to_cpu_present) \ | ||
115 | APICFUNC(setup_portio_remap) \ | ||
116 | APICFUNC(check_phys_apicid_present) \ | ||
117 | APICFUNC(mps_oem_check) \ | ||
118 | APICFUNC(get_apic_id) \ | ||
119 | .apic_id_mask = APIC_ID_MASK, \ | ||
120 | APICFUNC(cpu_mask_to_apicid) \ | ||
121 | APICFUNC(cpu_mask_to_apicid_and) \ | ||
122 | APICFUNC(vector_allocation_domain) \ | ||
123 | APICFUNC(acpi_madt_oem_check) \ | ||
124 | IPIFUNC(send_IPI_mask) \ | ||
125 | IPIFUNC(send_IPI_allbutself) \ | ||
126 | IPIFUNC(send_IPI_all) \ | ||
127 | APICFUNC(enable_apic_mode) \ | ||
128 | APICFUNC(phys_pkg_id) \ | ||
129 | .trampoline_phys_low = TRAMPOLINE_PHYS_LOW, \ | ||
130 | .trampoline_phys_high = TRAMPOLINE_PHYS_HIGH, \ | ||
131 | APICFUNC(wait_for_init_deassert) \ | ||
132 | APICFUNC(smp_callin_clear_local_apic) \ | ||
133 | APICFUNC(store_NMI_vector) \ | ||
134 | APICFUNC(restore_NMI_vector) \ | ||
135 | APICFUNC(inquire_remote_apic) \ | ||
136 | } | ||
137 | |||
138 | extern struct genapic *genapic; | ||
139 | extern void es7000_update_genapic_to_cluster(void); | ||
140 | |||
141 | enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC}; | ||
142 | #define get_uv_system_type() UV_NONE | ||
143 | #define is_uv_system() 0 | ||
144 | #define uv_wakeup_secondary(a, b) 1 | ||
145 | #define uv_system_init() do {} while (0) | ||
146 | |||
147 | |||
148 | #endif /* _ASM_X86_GENAPIC_32_H */ | ||
diff --git a/arch/x86/include/asm/genapic_64.h b/arch/x86/include/asm/genapic_64.h deleted file mode 100644 index adf32fb56aa6..000000000000 --- a/arch/x86/include/asm/genapic_64.h +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | #ifndef _ASM_X86_GENAPIC_64_H | ||
2 | #define _ASM_X86_GENAPIC_64_H | ||
3 | |||
4 | #include <linux/cpumask.h> | ||
5 | |||
6 | /* | ||
7 | * Copyright 2004 James Cleverdon, IBM. | ||
8 | * Subject to the GNU Public License, v.2 | ||
9 | * | ||
10 | * Generic APIC sub-arch data struct. | ||
11 | * | ||
12 | * Hacked for x86-64 by James Cleverdon from i386 architecture code by | ||
13 | * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and | ||
14 | * James Cleverdon. | ||
15 | */ | ||
16 | |||
17 | struct genapic { | ||
18 | char *name; | ||
19 | int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); | ||
20 | u32 int_delivery_mode; | ||
21 | u32 int_dest_mode; | ||
22 | int (*apic_id_registered)(void); | ||
23 | const struct cpumask *(*target_cpus)(void); | ||
24 | void (*vector_allocation_domain)(int cpu, struct cpumask *retmask); | ||
25 | void (*init_apic_ldr)(void); | ||
26 | /* ipi */ | ||
27 | void (*send_IPI_mask)(const struct cpumask *mask, int vector); | ||
28 | void (*send_IPI_mask_allbutself)(const struct cpumask *mask, | ||
29 | int vector); | ||
30 | void (*send_IPI_allbutself)(int vector); | ||
31 | void (*send_IPI_all)(int vector); | ||
32 | void (*send_IPI_self)(int vector); | ||
33 | /* */ | ||
34 | unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask); | ||
35 | unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask, | ||
36 | const struct cpumask *andmask); | ||
37 | unsigned int (*phys_pkg_id)(int index_msb); | ||
38 | unsigned int (*get_apic_id)(unsigned long x); | ||
39 | unsigned long (*set_apic_id)(unsigned int id); | ||
40 | unsigned long apic_id_mask; | ||
41 | /* wakeup_secondary_cpu */ | ||
42 | int (*wakeup_cpu)(int apicid, unsigned long start_eip); | ||
43 | }; | ||
44 | |||
45 | extern struct genapic *genapic; | ||
46 | |||
47 | extern struct genapic apic_flat; | ||
48 | extern struct genapic apic_physflat; | ||
49 | extern struct genapic apic_x2apic_cluster; | ||
50 | extern struct genapic apic_x2apic_phys; | ||
51 | extern int acpi_madt_oem_check(char *, char *); | ||
52 | |||
53 | extern void apic_send_IPI_self(int vector); | ||
54 | enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC}; | ||
55 | extern enum uv_system_type get_uv_system_type(void); | ||
56 | extern int is_uv_system(void); | ||
57 | |||
58 | extern struct genapic apic_x2apic_uv_x; | ||
59 | DECLARE_PER_CPU(int, x2apic_extra_bits); | ||
60 | extern void uv_cpu_init(void); | ||
61 | extern void uv_system_init(void); | ||
62 | extern int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip); | ||
63 | |||
64 | extern void setup_apic_routing(void); | ||
65 | |||
66 | #endif /* _ASM_X86_GENAPIC_64_H */ | ||
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h index 000787df66e6..176f058e7159 100644 --- a/arch/x86/include/asm/hardirq.h +++ b/arch/x86/include/asm/hardirq.h | |||
@@ -1,11 +1,52 @@ | |||
1 | #ifdef CONFIG_X86_32 | 1 | #ifndef _ASM_X86_HARDIRQ_H |
2 | # include "hardirq_32.h" | 2 | #define _ASM_X86_HARDIRQ_H |
3 | #else | 3 | |
4 | # include "hardirq_64.h" | 4 | #include <linux/threads.h> |
5 | #include <linux/irq.h> | ||
6 | |||
7 | typedef struct { | ||
8 | unsigned int __softirq_pending; | ||
9 | unsigned int __nmi_count; /* arch dependent */ | ||
10 | unsigned int irq0_irqs; | ||
11 | #ifdef CONFIG_X86_LOCAL_APIC | ||
12 | unsigned int apic_timer_irqs; /* arch dependent */ | ||
13 | unsigned int irq_spurious_count; | ||
14 | #endif | ||
15 | #ifdef CONFIG_SMP | ||
16 | unsigned int irq_resched_count; | ||
17 | unsigned int irq_call_count; | ||
18 | unsigned int irq_tlb_count; | ||
19 | #endif | ||
20 | #ifdef CONFIG_X86_MCE | ||
21 | unsigned int irq_thermal_count; | ||
22 | # ifdef CONFIG_X86_64 | ||
23 | unsigned int irq_threshold_count; | ||
24 | # endif | ||
5 | #endif | 25 | #endif |
26 | } ____cacheline_aligned irq_cpustat_t; | ||
27 | |||
28 | DECLARE_PER_CPU(irq_cpustat_t, irq_stat); | ||
29 | |||
30 | /* We can have at most NR_VECTORS irqs routed to a cpu at a time */ | ||
31 | #define MAX_HARDIRQS_PER_CPU NR_VECTORS | ||
32 | |||
33 | #define __ARCH_IRQ_STAT | ||
34 | |||
35 | #define inc_irq_stat(member) percpu_add(irq_stat.member, 1) | ||
36 | |||
37 | #define local_softirq_pending() percpu_read(irq_stat.__softirq_pending) | ||
38 | |||
39 | #define __ARCH_SET_SOFTIRQ_PENDING | ||
40 | |||
41 | #define set_softirq_pending(x) percpu_write(irq_stat.__softirq_pending, (x)) | ||
42 | #define or_softirq_pending(x) percpu_or(irq_stat.__softirq_pending, (x)) | ||
43 | |||
44 | extern void ack_bad_irq(unsigned int irq); | ||
6 | 45 | ||
7 | extern u64 arch_irq_stat_cpu(unsigned int cpu); | 46 | extern u64 arch_irq_stat_cpu(unsigned int cpu); |
8 | #define arch_irq_stat_cpu arch_irq_stat_cpu | 47 | #define arch_irq_stat_cpu arch_irq_stat_cpu |
9 | 48 | ||
10 | extern u64 arch_irq_stat(void); | 49 | extern u64 arch_irq_stat(void); |
11 | #define arch_irq_stat arch_irq_stat | 50 | #define arch_irq_stat arch_irq_stat |
51 | |||
52 | #endif /* _ASM_X86_HARDIRQ_H */ | ||
diff --git a/arch/x86/include/asm/hardirq_32.h b/arch/x86/include/asm/hardirq_32.h deleted file mode 100644 index cf7954d1405f..000000000000 --- a/arch/x86/include/asm/hardirq_32.h +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | #ifndef _ASM_X86_HARDIRQ_32_H | ||
2 | #define _ASM_X86_HARDIRQ_32_H | ||
3 | |||
4 | #include <linux/threads.h> | ||
5 | #include <linux/irq.h> | ||
6 | |||
7 | typedef struct { | ||
8 | unsigned int __softirq_pending; | ||
9 | unsigned long idle_timestamp; | ||
10 | unsigned int __nmi_count; /* arch dependent */ | ||
11 | unsigned int apic_timer_irqs; /* arch dependent */ | ||
12 | unsigned int irq0_irqs; | ||
13 | unsigned int irq_resched_count; | ||
14 | unsigned int irq_call_count; | ||
15 | unsigned int irq_tlb_count; | ||
16 | unsigned int irq_thermal_count; | ||
17 | unsigned int irq_spurious_count; | ||
18 | } ____cacheline_aligned irq_cpustat_t; | ||
19 | |||
20 | DECLARE_PER_CPU(irq_cpustat_t, irq_stat); | ||
21 | |||
22 | #define __ARCH_IRQ_STAT | ||
23 | #define __IRQ_STAT(cpu, member) (per_cpu(irq_stat, cpu).member) | ||
24 | |||
25 | #define inc_irq_stat(member) (__get_cpu_var(irq_stat).member++) | ||
26 | |||
27 | void ack_bad_irq(unsigned int irq); | ||
28 | #include <linux/irq_cpustat.h> | ||
29 | |||
30 | #endif /* _ASM_X86_HARDIRQ_32_H */ | ||
diff --git a/arch/x86/include/asm/hardirq_64.h b/arch/x86/include/asm/hardirq_64.h deleted file mode 100644 index b5a6b5d56704..000000000000 --- a/arch/x86/include/asm/hardirq_64.h +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | #ifndef _ASM_X86_HARDIRQ_64_H | ||
2 | #define _ASM_X86_HARDIRQ_64_H | ||
3 | |||
4 | #include <linux/threads.h> | ||
5 | #include <linux/irq.h> | ||
6 | #include <asm/pda.h> | ||
7 | #include <asm/apic.h> | ||
8 | |||
9 | /* We can have at most NR_VECTORS irqs routed to a cpu at a time */ | ||
10 | #define MAX_HARDIRQS_PER_CPU NR_VECTORS | ||
11 | |||
12 | #define __ARCH_IRQ_STAT 1 | ||
13 | |||
14 | #define inc_irq_stat(member) add_pda(member, 1) | ||
15 | |||
16 | #define local_softirq_pending() read_pda(__softirq_pending) | ||
17 | |||
18 | #define __ARCH_SET_SOFTIRQ_PENDING 1 | ||
19 | |||
20 | #define set_softirq_pending(x) write_pda(__softirq_pending, (x)) | ||
21 | #define or_softirq_pending(x) or_pda(__softirq_pending, (x)) | ||
22 | |||
23 | extern void ack_bad_irq(unsigned int irq); | ||
24 | |||
25 | #endif /* _ASM_X86_HARDIRQ_64_H */ | ||
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h index 8de644b6b959..1a20e3d12006 100644 --- a/arch/x86/include/asm/hw_irq.h +++ b/arch/x86/include/asm/hw_irq.h | |||
@@ -71,12 +71,6 @@ extern void setup_ioapic_dest(void); | |||
71 | extern void enable_IO_APIC(void); | 71 | extern void enable_IO_APIC(void); |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | /* IPI functions */ | ||
75 | #ifdef CONFIG_X86_32 | ||
76 | extern void send_IPI_self(int vector); | ||
77 | #endif | ||
78 | extern void send_IPI(int dest, int vector); | ||
79 | |||
80 | /* Statistics */ | 74 | /* Statistics */ |
81 | extern atomic_t irq_err_count; | 75 | extern atomic_t irq_err_count; |
82 | extern atomic_t irq_mis_count; | 76 | extern atomic_t irq_mis_count; |
@@ -84,21 +78,11 @@ extern atomic_t irq_mis_count; | |||
84 | /* EISA */ | 78 | /* EISA */ |
85 | extern void eisa_set_level_irq(unsigned int irq); | 79 | extern void eisa_set_level_irq(unsigned int irq); |
86 | 80 | ||
87 | /* Voyager functions */ | ||
88 | extern asmlinkage void vic_cpi_interrupt(void); | ||
89 | extern asmlinkage void vic_sys_interrupt(void); | ||
90 | extern asmlinkage void vic_cmn_interrupt(void); | ||
91 | extern asmlinkage void qic_timer_interrupt(void); | ||
92 | extern asmlinkage void qic_invalidate_interrupt(void); | ||
93 | extern asmlinkage void qic_reschedule_interrupt(void); | ||
94 | extern asmlinkage void qic_enable_irq_interrupt(void); | ||
95 | extern asmlinkage void qic_call_function_interrupt(void); | ||
96 | |||
97 | /* SMP */ | 81 | /* SMP */ |
98 | extern void smp_apic_timer_interrupt(struct pt_regs *); | 82 | extern void smp_apic_timer_interrupt(struct pt_regs *); |
99 | extern void smp_spurious_interrupt(struct pt_regs *); | 83 | extern void smp_spurious_interrupt(struct pt_regs *); |
100 | extern void smp_error_interrupt(struct pt_regs *); | 84 | extern void smp_error_interrupt(struct pt_regs *); |
101 | #ifdef CONFIG_X86_SMP | 85 | #ifdef CONFIG_SMP |
102 | extern void smp_reschedule_interrupt(struct pt_regs *); | 86 | extern void smp_reschedule_interrupt(struct pt_regs *); |
103 | extern void smp_call_function_interrupt(struct pt_regs *); | 87 | extern void smp_call_function_interrupt(struct pt_regs *); |
104 | extern void smp_call_function_single_interrupt(struct pt_regs *); | 88 | extern void smp_call_function_single_interrupt(struct pt_regs *); |
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 1dbbdf4be9b4..bcf7ea4e1367 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h | |||
@@ -91,7 +91,7 @@ extern void unxlate_dev_mem_ptr(unsigned long phys, void *addr); | |||
91 | 91 | ||
92 | extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, | 92 | extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, |
93 | unsigned long prot_val); | 93 | unsigned long prot_val); |
94 | extern void __iomem *ioremap_wc(unsigned long offset, unsigned long size); | 94 | extern void __iomem *ioremap_wc(resource_size_t offset, unsigned long size); |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * early_ioremap() and early_iounmap() are for temporary early boot-time | 97 | * early_ioremap() and early_iounmap() are for temporary early boot-time |
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 7a1f44ac1f17..309d0e23193a 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
@@ -114,38 +114,16 @@ struct IR_IO_APIC_route_entry { | |||
114 | extern int nr_ioapics; | 114 | extern int nr_ioapics; |
115 | extern int nr_ioapic_registers[MAX_IO_APICS]; | 115 | extern int nr_ioapic_registers[MAX_IO_APICS]; |
116 | 116 | ||
117 | /* | ||
118 | * MP-BIOS irq configuration table structures: | ||
119 | */ | ||
120 | |||
121 | #define MP_MAX_IOAPIC_PIN 127 | 117 | #define MP_MAX_IOAPIC_PIN 127 |
122 | 118 | ||
123 | struct mp_config_ioapic { | ||
124 | unsigned long mp_apicaddr; | ||
125 | unsigned int mp_apicid; | ||
126 | unsigned char mp_type; | ||
127 | unsigned char mp_apicver; | ||
128 | unsigned char mp_flags; | ||
129 | }; | ||
130 | |||
131 | struct mp_config_intsrc { | ||
132 | unsigned int mp_dstapic; | ||
133 | unsigned char mp_type; | ||
134 | unsigned char mp_irqtype; | ||
135 | unsigned short mp_irqflag; | ||
136 | unsigned char mp_srcbus; | ||
137 | unsigned char mp_srcbusirq; | ||
138 | unsigned char mp_dstirq; | ||
139 | }; | ||
140 | |||
141 | /* I/O APIC entries */ | 119 | /* I/O APIC entries */ |
142 | extern struct mp_config_ioapic mp_ioapics[MAX_IO_APICS]; | 120 | extern struct mpc_ioapic mp_ioapics[MAX_IO_APICS]; |
143 | 121 | ||
144 | /* # of MP IRQ source entries */ | 122 | /* # of MP IRQ source entries */ |
145 | extern int mp_irq_entries; | 123 | extern int mp_irq_entries; |
146 | 124 | ||
147 | /* MP IRQ source entries */ | 125 | /* MP IRQ source entries */ |
148 | extern struct mp_config_intsrc mp_irqs[MAX_IRQ_SOURCES]; | 126 | extern struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES]; |
149 | 127 | ||
150 | /* non-0 if default (table-less) MP configuration */ | 128 | /* non-0 if default (table-less) MP configuration */ |
151 | extern int mpc_default_type; | 129 | extern int mpc_default_type; |
@@ -165,15 +143,6 @@ extern int noioapicreroute; | |||
165 | /* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */ | 143 | /* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */ |
166 | extern int timer_through_8259; | 144 | extern int timer_through_8259; |
167 | 145 | ||
168 | static inline void disable_ioapic_setup(void) | ||
169 | { | ||
170 | #ifdef CONFIG_PCI | ||
171 | noioapicquirk = 1; | ||
172 | noioapicreroute = -1; | ||
173 | #endif | ||
174 | skip_ioapic_setup = 1; | ||
175 | } | ||
176 | |||
177 | /* | 146 | /* |
178 | * If we use the IO-APIC for IRQ routing, disable automatic | 147 | * If we use the IO-APIC for IRQ routing, disable automatic |
179 | * assignment of PCI IRQ's. | 148 | * assignment of PCI IRQ's. |
diff --git a/arch/x86/include/asm/ipi.h b/arch/x86/include/asm/ipi.h index c745a306f7d3..5f2efc5d9927 100644 --- a/arch/x86/include/asm/ipi.h +++ b/arch/x86/include/asm/ipi.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _ASM_X86_IPI_H | 1 | #ifndef _ASM_X86_IPI_H |
2 | #define _ASM_X86_IPI_H | 2 | #define _ASM_X86_IPI_H |
3 | 3 | ||
4 | #ifdef CONFIG_X86_LOCAL_APIC | ||
5 | |||
4 | /* | 6 | /* |
5 | * Copyright 2004 James Cleverdon, IBM. | 7 | * Copyright 2004 James Cleverdon, IBM. |
6 | * Subject to the GNU Public License, v.2 | 8 | * Subject to the GNU Public License, v.2 |
@@ -55,8 +57,8 @@ static inline void __xapic_wait_icr_idle(void) | |||
55 | cpu_relax(); | 57 | cpu_relax(); |
56 | } | 58 | } |
57 | 59 | ||
58 | static inline void __send_IPI_shortcut(unsigned int shortcut, int vector, | 60 | static inline void |
59 | unsigned int dest) | 61 | __default_send_IPI_shortcut(unsigned int shortcut, int vector, unsigned int dest) |
60 | { | 62 | { |
61 | /* | 63 | /* |
62 | * Subtle. In the case of the 'never do double writes' workaround | 64 | * Subtle. In the case of the 'never do double writes' workaround |
@@ -87,8 +89,8 @@ static inline void __send_IPI_shortcut(unsigned int shortcut, int vector, | |||
87 | * This is used to send an IPI with no shorthand notation (the destination is | 89 | * This is used to send an IPI with no shorthand notation (the destination is |
88 | * specified in bits 56 to 63 of the ICR). | 90 | * specified in bits 56 to 63 of the ICR). |
89 | */ | 91 | */ |
90 | static inline void __send_IPI_dest_field(unsigned int mask, int vector, | 92 | static inline void |
91 | unsigned int dest) | 93 | __default_send_IPI_dest_field(unsigned int mask, int vector, unsigned int dest) |
92 | { | 94 | { |
93 | unsigned long cfg; | 95 | unsigned long cfg; |
94 | 96 | ||
@@ -117,41 +119,46 @@ static inline void __send_IPI_dest_field(unsigned int mask, int vector, | |||
117 | native_apic_mem_write(APIC_ICR, cfg); | 119 | native_apic_mem_write(APIC_ICR, cfg); |
118 | } | 120 | } |
119 | 121 | ||
120 | static inline void send_IPI_mask_sequence(const struct cpumask *mask, | 122 | extern void default_send_IPI_mask_sequence_phys(const struct cpumask *mask, |
121 | int vector) | 123 | int vector); |
122 | { | 124 | extern void default_send_IPI_mask_allbutself_phys(const struct cpumask *mask, |
123 | unsigned long flags; | 125 | int vector); |
124 | unsigned long query_cpu; | 126 | #include <asm/genapic.h> |
125 | 127 | ||
126 | /* | 128 | extern void default_send_IPI_mask_sequence_logical(const struct cpumask *mask, |
127 | * Hack. The clustered APIC addressing mode doesn't allow us to send | 129 | int vector); |
128 | * to an arbitrary mask, so I do a unicast to each CPU instead. | 130 | extern void default_send_IPI_mask_allbutself_logical(const struct cpumask *mask, |
129 | * - mbligh | 131 | int vector); |
130 | */ | 132 | |
131 | local_irq_save(flags); | 133 | /* Avoid include hell */ |
132 | for_each_cpu(query_cpu, mask) { | 134 | #define NMI_VECTOR 0x02 |
133 | __send_IPI_dest_field(per_cpu(x86_cpu_to_apicid, query_cpu), | 135 | |
134 | vector, APIC_DEST_PHYSICAL); | 136 | extern int no_broadcast; |
135 | } | 137 | |
136 | local_irq_restore(flags); | 138 | static inline void __default_local_send_IPI_allbutself(int vector) |
139 | { | ||
140 | if (no_broadcast || vector == NMI_VECTOR) | ||
141 | apic->send_IPI_mask_allbutself(cpu_online_mask, vector); | ||
142 | else | ||
143 | __default_send_IPI_shortcut(APIC_DEST_ALLBUT, vector, apic->dest_logical); | ||
137 | } | 144 | } |
138 | 145 | ||
139 | static inline void send_IPI_mask_allbutself(const struct cpumask *mask, | 146 | static inline void __default_local_send_IPI_all(int vector) |
140 | int vector) | ||
141 | { | 147 | { |
142 | unsigned long flags; | 148 | if (no_broadcast || vector == NMI_VECTOR) |
143 | unsigned int query_cpu; | 149 | apic->send_IPI_mask(cpu_online_mask, vector); |
144 | unsigned int this_cpu = smp_processor_id(); | 150 | else |
145 | 151 | __default_send_IPI_shortcut(APIC_DEST_ALLINC, vector, apic->dest_logical); | |
146 | /* See Hack comment above */ | ||
147 | |||
148 | local_irq_save(flags); | ||
149 | for_each_cpu(query_cpu, mask) | ||
150 | if (query_cpu != this_cpu) | ||
151 | __send_IPI_dest_field( | ||
152 | per_cpu(x86_cpu_to_apicid, query_cpu), | ||
153 | vector, APIC_DEST_PHYSICAL); | ||
154 | local_irq_restore(flags); | ||
155 | } | 152 | } |
156 | 153 | ||
154 | #ifdef CONFIG_X86_32 | ||
155 | extern void default_send_IPI_mask_logical(const struct cpumask *mask, | ||
156 | int vector); | ||
157 | extern void default_send_IPI_allbutself(int vector); | ||
158 | extern void default_send_IPI_all(int vector); | ||
159 | extern void default_send_IPI_self(int vector); | ||
160 | #endif | ||
161 | |||
162 | #endif | ||
163 | |||
157 | #endif /* _ASM_X86_IPI_H */ | 164 | #endif /* _ASM_X86_IPI_H */ |
diff --git a/arch/x86/include/asm/irq_regs.h b/arch/x86/include/asm/irq_regs.h index 89c898ab298b..77843225b7ea 100644 --- a/arch/x86/include/asm/irq_regs.h +++ b/arch/x86/include/asm/irq_regs.h | |||
@@ -1,5 +1,31 @@ | |||
1 | #ifdef CONFIG_X86_32 | 1 | /* |
2 | # include "irq_regs_32.h" | 2 | * Per-cpu current frame pointer - the location of the last exception frame on |
3 | #else | 3 | * the stack, stored in the per-cpu area. |
4 | # include "irq_regs_64.h" | 4 | * |
5 | #endif | 5 | * Jeremy Fitzhardinge <jeremy@goop.org> |
6 | */ | ||
7 | #ifndef _ASM_X86_IRQ_REGS_H | ||
8 | #define _ASM_X86_IRQ_REGS_H | ||
9 | |||
10 | #include <asm/percpu.h> | ||
11 | |||
12 | #define ARCH_HAS_OWN_IRQ_REGS | ||
13 | |||
14 | DECLARE_PER_CPU(struct pt_regs *, irq_regs); | ||
15 | |||
16 | static inline struct pt_regs *get_irq_regs(void) | ||
17 | { | ||
18 | return percpu_read(irq_regs); | ||
19 | } | ||
20 | |||
21 | static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs) | ||
22 | { | ||
23 | struct pt_regs *old_regs; | ||
24 | |||
25 | old_regs = get_irq_regs(); | ||
26 | percpu_write(irq_regs, new_regs); | ||
27 | |||
28 | return old_regs; | ||
29 | } | ||
30 | |||
31 | #endif /* _ASM_X86_IRQ_REGS_32_H */ | ||
diff --git a/arch/x86/include/asm/irq_regs_32.h b/arch/x86/include/asm/irq_regs_32.h deleted file mode 100644 index 86afd7473457..000000000000 --- a/arch/x86/include/asm/irq_regs_32.h +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* | ||
2 | * Per-cpu current frame pointer - the location of the last exception frame on | ||
3 | * the stack, stored in the per-cpu area. | ||
4 | * | ||
5 | * Jeremy Fitzhardinge <jeremy@goop.org> | ||
6 | */ | ||
7 | #ifndef _ASM_X86_IRQ_REGS_32_H | ||
8 | #define _ASM_X86_IRQ_REGS_32_H | ||
9 | |||
10 | #include <asm/percpu.h> | ||
11 | |||
12 | #define ARCH_HAS_OWN_IRQ_REGS | ||
13 | |||
14 | DECLARE_PER_CPU(struct pt_regs *, irq_regs); | ||
15 | |||
16 | static inline struct pt_regs *get_irq_regs(void) | ||
17 | { | ||
18 | return x86_read_percpu(irq_regs); | ||
19 | } | ||
20 | |||
21 | static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs) | ||
22 | { | ||
23 | struct pt_regs *old_regs; | ||
24 | |||
25 | old_regs = get_irq_regs(); | ||
26 | x86_write_percpu(irq_regs, new_regs); | ||
27 | |||
28 | return old_regs; | ||
29 | } | ||
30 | |||
31 | #endif /* _ASM_X86_IRQ_REGS_32_H */ | ||
diff --git a/arch/x86/include/asm/irq_regs_64.h b/arch/x86/include/asm/irq_regs_64.h deleted file mode 100644 index 3dd9c0b70270..000000000000 --- a/arch/x86/include/asm/irq_regs_64.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/irq_regs.h> | ||
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h index f7ff65032b9d..b07278c55e9e 100644 --- a/arch/x86/include/asm/irq_vectors.h +++ b/arch/x86/include/asm/irq_vectors.h | |||
@@ -1,47 +1,69 @@ | |||
1 | #ifndef _ASM_X86_IRQ_VECTORS_H | 1 | #ifndef _ASM_X86_IRQ_VECTORS_H |
2 | #define _ASM_X86_IRQ_VECTORS_H | 2 | #define _ASM_X86_IRQ_VECTORS_H |
3 | 3 | ||
4 | #include <linux/threads.h> | 4 | /* |
5 | * Linux IRQ vector layout. | ||
6 | * | ||
7 | * There are 256 IDT entries (per CPU - each entry is 8 bytes) which can | ||
8 | * be defined by Linux. They are used as a jump table by the CPU when a | ||
9 | * given vector is triggered - by a CPU-external, CPU-internal or | ||
10 | * software-triggered event. | ||
11 | * | ||
12 | * Linux sets the kernel code address each entry jumps to early during | ||
13 | * bootup, and never changes them. This is the general layout of the | ||
14 | * IDT entries: | ||
15 | * | ||
16 | * Vectors 0 ... 31 : system traps and exceptions - hardcoded events | ||
17 | * Vectors 32 ... 127 : device interrupts | ||
18 | * Vector 128 : legacy int80 syscall interface | ||
19 | * Vectors 129 ... 237 : device interrupts | ||
20 | * Vectors 238 ... 255 : special interrupts | ||
21 | * | ||
22 | * 64-bit x86 has per CPU IDT tables, 32-bit has one shared IDT table. | ||
23 | * | ||
24 | * This file enumerates the exact layout of them: | ||
25 | */ | ||
5 | 26 | ||
6 | #define NMI_VECTOR 0x02 | 27 | #define NMI_VECTOR 0x02 |
7 | 28 | ||
8 | /* | 29 | /* |
9 | * IDT vectors usable for external interrupt sources start | 30 | * IDT vectors usable for external interrupt sources start |
10 | * at 0x20: | 31 | * at 0x20: |
11 | */ | 32 | */ |
12 | #define FIRST_EXTERNAL_VECTOR 0x20 | 33 | #define FIRST_EXTERNAL_VECTOR 0x20 |
13 | 34 | ||
14 | #ifdef CONFIG_X86_32 | 35 | #ifdef CONFIG_X86_32 |
15 | # define SYSCALL_VECTOR 0x80 | 36 | # define SYSCALL_VECTOR 0x80 |
16 | #else | 37 | #else |
17 | # define IA32_SYSCALL_VECTOR 0x80 | 38 | # define IA32_SYSCALL_VECTOR 0x80 |
18 | #endif | 39 | #endif |
19 | 40 | ||
20 | /* | 41 | /* |
21 | * Reserve the lowest usable priority level 0x20 - 0x2f for triggering | 42 | * Reserve the lowest usable priority level 0x20 - 0x2f for triggering |
22 | * cleanup after irq migration. | 43 | * cleanup after irq migration. |
23 | */ | 44 | */ |
24 | #define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR | 45 | #define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR |
25 | 46 | ||
26 | /* | 47 | /* |
27 | * Vectors 0x30-0x3f are used for ISA interrupts. | 48 | * Vectors 0x30-0x3f are used for ISA interrupts. |
28 | */ | 49 | */ |
29 | #define IRQ0_VECTOR (FIRST_EXTERNAL_VECTOR + 0x10) | 50 | #define IRQ0_VECTOR (FIRST_EXTERNAL_VECTOR + 0x10) |
30 | #define IRQ1_VECTOR (IRQ0_VECTOR + 1) | 51 | |
31 | #define IRQ2_VECTOR (IRQ0_VECTOR + 2) | 52 | #define IRQ1_VECTOR (IRQ0_VECTOR + 1) |
32 | #define IRQ3_VECTOR (IRQ0_VECTOR + 3) | 53 | #define IRQ2_VECTOR (IRQ0_VECTOR + 2) |
33 | #define IRQ4_VECTOR (IRQ0_VECTOR + 4) | 54 | #define IRQ3_VECTOR (IRQ0_VECTOR + 3) |
34 | #define IRQ5_VECTOR (IRQ0_VECTOR + 5) | 55 | #define IRQ4_VECTOR (IRQ0_VECTOR + 4) |
35 | #define IRQ6_VECTOR (IRQ0_VECTOR + 6) | 56 | #define IRQ5_VECTOR (IRQ0_VECTOR + 5) |
36 | #define IRQ7_VECTOR (IRQ0_VECTOR + 7) | 57 | #define IRQ6_VECTOR (IRQ0_VECTOR + 6) |
37 | #define IRQ8_VECTOR (IRQ0_VECTOR + 8) | 58 | #define IRQ7_VECTOR (IRQ0_VECTOR + 7) |
38 | #define IRQ9_VECTOR (IRQ0_VECTOR + 9) | 59 | #define IRQ8_VECTOR (IRQ0_VECTOR + 8) |
39 | #define IRQ10_VECTOR (IRQ0_VECTOR + 10) | 60 | #define IRQ9_VECTOR (IRQ0_VECTOR + 9) |
40 | #define IRQ11_VECTOR (IRQ0_VECTOR + 11) | 61 | #define IRQ10_VECTOR (IRQ0_VECTOR + 10) |
41 | #define IRQ12_VECTOR (IRQ0_VECTOR + 12) | 62 | #define IRQ11_VECTOR (IRQ0_VECTOR + 11) |
42 | #define IRQ13_VECTOR (IRQ0_VECTOR + 13) | 63 | #define IRQ12_VECTOR (IRQ0_VECTOR + 12) |
43 | #define IRQ14_VECTOR (IRQ0_VECTOR + 14) | 64 | #define IRQ13_VECTOR (IRQ0_VECTOR + 13) |
44 | #define IRQ15_VECTOR (IRQ0_VECTOR + 15) | 65 | #define IRQ14_VECTOR (IRQ0_VECTOR + 14) |
66 | #define IRQ15_VECTOR (IRQ0_VECTOR + 15) | ||
45 | 67 | ||
46 | /* | 68 | /* |
47 | * Special IRQ vectors used by the SMP architecture, 0xf0-0xff | 69 | * Special IRQ vectors used by the SMP architecture, 0xf0-0xff |
@@ -49,119 +71,98 @@ | |||
49 | * some of the following vectors are 'rare', they are merged | 71 | * some of the following vectors are 'rare', they are merged |
50 | * into a single vector (CALL_FUNCTION_VECTOR) to save vector space. | 72 | * into a single vector (CALL_FUNCTION_VECTOR) to save vector space. |
51 | * TLB, reschedule and local APIC vectors are performance-critical. | 73 | * TLB, reschedule and local APIC vectors are performance-critical. |
52 | * | ||
53 | * Vectors 0xf0-0xfa are free (reserved for future Linux use). | ||
54 | */ | 74 | */ |
55 | #ifdef CONFIG_X86_32 | ||
56 | |||
57 | # define SPURIOUS_APIC_VECTOR 0xff | ||
58 | # define ERROR_APIC_VECTOR 0xfe | ||
59 | # define INVALIDATE_TLB_VECTOR 0xfd | ||
60 | # define RESCHEDULE_VECTOR 0xfc | ||
61 | # define CALL_FUNCTION_VECTOR 0xfb | ||
62 | # define CALL_FUNCTION_SINGLE_VECTOR 0xfa | ||
63 | # define THERMAL_APIC_VECTOR 0xf0 | ||
64 | |||
65 | #else | ||
66 | 75 | ||
67 | #define SPURIOUS_APIC_VECTOR 0xff | 76 | #define SPURIOUS_APIC_VECTOR 0xff |
77 | /* | ||
78 | * Sanity check | ||
79 | */ | ||
80 | #if ((SPURIOUS_APIC_VECTOR & 0x0F) != 0x0F) | ||
81 | # error SPURIOUS_APIC_VECTOR definition error | ||
82 | #endif | ||
83 | |||
68 | #define ERROR_APIC_VECTOR 0xfe | 84 | #define ERROR_APIC_VECTOR 0xfe |
69 | #define RESCHEDULE_VECTOR 0xfd | 85 | #define RESCHEDULE_VECTOR 0xfd |
70 | #define CALL_FUNCTION_VECTOR 0xfc | 86 | #define CALL_FUNCTION_VECTOR 0xfc |
71 | #define CALL_FUNCTION_SINGLE_VECTOR 0xfb | 87 | #define CALL_FUNCTION_SINGLE_VECTOR 0xfb |
72 | #define THERMAL_APIC_VECTOR 0xfa | 88 | #define THERMAL_APIC_VECTOR 0xfa |
73 | #define THRESHOLD_APIC_VECTOR 0xf9 | ||
74 | #define UV_BAU_MESSAGE 0xf8 | ||
75 | #define INVALIDATE_TLB_VECTOR_END 0xf7 | ||
76 | #define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f7 used for TLB flush */ | ||
77 | |||
78 | #define NUM_INVALIDATE_TLB_VECTORS 8 | ||
79 | 89 | ||
90 | #ifdef CONFIG_X86_32 | ||
91 | /* 0xf8 - 0xf9 : free */ | ||
92 | #else | ||
93 | # define THRESHOLD_APIC_VECTOR 0xf9 | ||
94 | # define UV_BAU_MESSAGE 0xf8 | ||
80 | #endif | 95 | #endif |
81 | 96 | ||
97 | /* f0-f7 used for spreading out TLB flushes: */ | ||
98 | #define INVALIDATE_TLB_VECTOR_END 0xf7 | ||
99 | #define INVALIDATE_TLB_VECTOR_START 0xf0 | ||
100 | #define NUM_INVALIDATE_TLB_VECTORS 8 | ||
101 | |||
82 | /* | 102 | /* |
83 | * Local APIC timer IRQ vector is on a different priority level, | 103 | * Local APIC timer IRQ vector is on a different priority level, |
84 | * to work around the 'lost local interrupt if more than 2 IRQ | 104 | * to work around the 'lost local interrupt if more than 2 IRQ |
85 | * sources per level' errata. | 105 | * sources per level' errata. |
86 | */ | 106 | */ |
87 | #define LOCAL_TIMER_VECTOR 0xef | 107 | #define LOCAL_TIMER_VECTOR 0xef |
108 | |||
109 | /* | ||
110 | * Performance monitoring interrupt vector: | ||
111 | */ | ||
112 | #define LOCAL_PERF_VECTOR 0xee | ||
88 | 113 | ||
89 | /* | 114 | /* |
90 | * First APIC vector available to drivers: (vectors 0x30-0xee) we | 115 | * First APIC vector available to drivers: (vectors 0x30-0xee) we |
91 | * start at 0x31(0x41) to spread out vectors evenly between priority | 116 | * start at 0x31(0x41) to spread out vectors evenly between priority |
92 | * levels. (0x80 is the syscall vector) | 117 | * levels. (0x80 is the syscall vector) |
93 | */ | 118 | */ |
94 | #define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2) | 119 | #define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2) |
95 | |||
96 | #define NR_VECTORS 256 | ||
97 | 120 | ||
98 | #define FPU_IRQ 13 | 121 | #define NR_VECTORS 256 |
99 | 122 | ||
100 | #define FIRST_VM86_IRQ 3 | 123 | #define FPU_IRQ 13 |
101 | #define LAST_VM86_IRQ 15 | ||
102 | #define invalid_vm86_irq(irq) ((irq) < 3 || (irq) > 15) | ||
103 | 124 | ||
104 | #define NR_IRQS_LEGACY 16 | 125 | #define FIRST_VM86_IRQ 3 |
126 | #define LAST_VM86_IRQ 15 | ||
105 | 127 | ||
106 | #if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_X86_VOYAGER) | 128 | #ifndef __ASSEMBLY__ |
107 | 129 | static inline int invalid_vm86_irq(int irq) | |
108 | #ifndef CONFIG_SPARSE_IRQ | 130 | { |
109 | # if NR_CPUS < MAX_IO_APICS | 131 | return irq < 3 || irq > 15; |
110 | # define NR_IRQS (NR_VECTORS + (32 * NR_CPUS)) | 132 | } |
111 | # else | ||
112 | # define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS)) | ||
113 | # endif | ||
114 | #else | ||
115 | # if (8 * NR_CPUS) > (32 * MAX_IO_APICS) | ||
116 | # define NR_IRQS (NR_VECTORS + (8 * NR_CPUS)) | ||
117 | # else | ||
118 | # define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS)) | ||
119 | # endif | ||
120 | #endif | 133 | #endif |
121 | 134 | ||
122 | #elif defined(CONFIG_X86_VOYAGER) | 135 | /* |
123 | 136 | * Size the maximum number of interrupts. | |
124 | # define NR_IRQS 224 | 137 | * |
138 | * If the irq_desc[] array has a sparse layout, we can size things | ||
139 | * generously - it scales up linearly with the maximum number of CPUs, | ||
140 | * and the maximum number of IO-APICs, whichever is higher. | ||
141 | * | ||
142 | * In other cases we size more conservatively, to not create too large | ||
143 | * static arrays. | ||
144 | */ | ||
125 | 145 | ||
126 | #else /* IO_APIC || VOYAGER */ | 146 | #define NR_IRQS_LEGACY 16 |
127 | 147 | ||
128 | # define NR_IRQS 16 | 148 | #define CPU_VECTOR_LIMIT ( 8 * NR_CPUS ) |
149 | #define IO_APIC_VECTOR_LIMIT ( 32 * MAX_IO_APICS ) | ||
129 | 150 | ||
151 | #ifdef CONFIG_X86_IO_APIC | ||
152 | # ifdef CONFIG_SPARSE_IRQ | ||
153 | # define NR_IRQS \ | ||
154 | (CPU_VECTOR_LIMIT > IO_APIC_VECTOR_LIMIT ? \ | ||
155 | (NR_VECTORS + CPU_VECTOR_LIMIT) : \ | ||
156 | (NR_VECTORS + IO_APIC_VECTOR_LIMIT)) | ||
157 | # else | ||
158 | # if NR_CPUS < MAX_IO_APICS | ||
159 | # define NR_IRQS (NR_VECTORS + 4*CPU_VECTOR_LIMIT) | ||
160 | # else | ||
161 | # define NR_IRQS (NR_VECTORS + IO_APIC_VECTOR_LIMIT) | ||
162 | # endif | ||
163 | # endif | ||
164 | #else /* !CONFIG_X86_IO_APIC: */ | ||
165 | # define NR_IRQS NR_IRQS_LEGACY | ||
130 | #endif | 166 | #endif |
131 | 167 | ||
132 | /* Voyager specific defines */ | ||
133 | /* These define the CPIs we use in linux */ | ||
134 | #define VIC_CPI_LEVEL0 0 | ||
135 | #define VIC_CPI_LEVEL1 1 | ||
136 | /* now the fake CPIs */ | ||
137 | #define VIC_TIMER_CPI 2 | ||
138 | #define VIC_INVALIDATE_CPI 3 | ||
139 | #define VIC_RESCHEDULE_CPI 4 | ||
140 | #define VIC_ENABLE_IRQ_CPI 5 | ||
141 | #define VIC_CALL_FUNCTION_CPI 6 | ||
142 | #define VIC_CALL_FUNCTION_SINGLE_CPI 7 | ||
143 | |||
144 | /* Now the QIC CPIs: Since we don't need the two initial levels, | ||
145 | * these are 2 less than the VIC CPIs */ | ||
146 | #define QIC_CPI_OFFSET 1 | ||
147 | #define QIC_TIMER_CPI (VIC_TIMER_CPI - QIC_CPI_OFFSET) | ||
148 | #define QIC_INVALIDATE_CPI (VIC_INVALIDATE_CPI - QIC_CPI_OFFSET) | ||
149 | #define QIC_RESCHEDULE_CPI (VIC_RESCHEDULE_CPI - QIC_CPI_OFFSET) | ||
150 | #define QIC_ENABLE_IRQ_CPI (VIC_ENABLE_IRQ_CPI - QIC_CPI_OFFSET) | ||
151 | #define QIC_CALL_FUNCTION_CPI (VIC_CALL_FUNCTION_CPI - QIC_CPI_OFFSET) | ||
152 | #define QIC_CALL_FUNCTION_SINGLE_CPI (VIC_CALL_FUNCTION_SINGLE_CPI - QIC_CPI_OFFSET) | ||
153 | |||
154 | #define VIC_START_FAKE_CPI VIC_TIMER_CPI | ||
155 | #define VIC_END_FAKE_CPI VIC_CALL_FUNCTION_SINGLE_CPI | ||
156 | |||
157 | /* this is the SYS_INT CPI. */ | ||
158 | #define VIC_SYS_INT 8 | ||
159 | #define VIC_CMN_INT 15 | ||
160 | |||
161 | /* This is the boot CPI for alternate processors. It gets overwritten | ||
162 | * by the above once the system has activated all available processors */ | ||
163 | #define VIC_CPU_BOOT_CPI VIC_CPI_LEVEL0 | ||
164 | #define VIC_CPU_BOOT_ERRATA_CPI (VIC_CPI_LEVEL0 + 8) | ||
165 | |||
166 | |||
167 | #endif /* _ASM_X86_IRQ_VECTORS_H */ | 168 | #endif /* _ASM_X86_IRQ_VECTORS_H */ |
diff --git a/arch/x86/include/asm/mach-default/mach_apic.h b/arch/x86/include/asm/mach-default/mach_apic.h deleted file mode 100644 index cc09cbbee27e..000000000000 --- a/arch/x86/include/asm/mach-default/mach_apic.h +++ /dev/null | |||
@@ -1,168 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_APIC_H | ||
2 | #define _ASM_X86_MACH_DEFAULT_MACH_APIC_H | ||
3 | |||
4 | #ifdef CONFIG_X86_LOCAL_APIC | ||
5 | |||
6 | #include <mach_apicdef.h> | ||
7 | #include <asm/smp.h> | ||
8 | |||
9 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
10 | |||
11 | static inline const struct cpumask *target_cpus(void) | ||
12 | { | ||
13 | #ifdef CONFIG_SMP | ||
14 | return cpu_online_mask; | ||
15 | #else | ||
16 | return cpumask_of(0); | ||
17 | #endif | ||
18 | } | ||
19 | |||
20 | #define NO_BALANCE_IRQ (0) | ||
21 | #define esr_disable (0) | ||
22 | |||
23 | #ifdef CONFIG_X86_64 | ||
24 | #include <asm/genapic.h> | ||
25 | #define INT_DELIVERY_MODE (genapic->int_delivery_mode) | ||
26 | #define INT_DEST_MODE (genapic->int_dest_mode) | ||
27 | #define TARGET_CPUS (genapic->target_cpus()) | ||
28 | #define apic_id_registered (genapic->apic_id_registered) | ||
29 | #define init_apic_ldr (genapic->init_apic_ldr) | ||
30 | #define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid) | ||
31 | #define cpu_mask_to_apicid_and (genapic->cpu_mask_to_apicid_and) | ||
32 | #define phys_pkg_id (genapic->phys_pkg_id) | ||
33 | #define vector_allocation_domain (genapic->vector_allocation_domain) | ||
34 | #define read_apic_id() (GET_APIC_ID(apic_read(APIC_ID))) | ||
35 | #define send_IPI_self (genapic->send_IPI_self) | ||
36 | #define wakeup_secondary_cpu (genapic->wakeup_cpu) | ||
37 | extern void setup_apic_routing(void); | ||
38 | #else | ||
39 | #define INT_DELIVERY_MODE dest_LowestPrio | ||
40 | #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ | ||
41 | #define TARGET_CPUS (target_cpus()) | ||
42 | #define wakeup_secondary_cpu wakeup_secondary_cpu_via_init | ||
43 | /* | ||
44 | * Set up the logical destination ID. | ||
45 | * | ||
46 | * Intel recommends to set DFR, LDR and TPR before enabling | ||
47 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
48 | * document number 292116). So here it goes... | ||
49 | */ | ||
50 | static inline void init_apic_ldr(void) | ||
51 | { | ||
52 | unsigned long val; | ||
53 | |||
54 | apic_write(APIC_DFR, APIC_DFR_VALUE); | ||
55 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | ||
56 | val |= SET_APIC_LOGICAL_ID(1UL << smp_processor_id()); | ||
57 | apic_write(APIC_LDR, val); | ||
58 | } | ||
59 | |||
60 | static inline int apic_id_registered(void) | ||
61 | { | ||
62 | return physid_isset(read_apic_id(), phys_cpu_present_map); | ||
63 | } | ||
64 | |||
65 | static inline unsigned int cpu_mask_to_apicid(const struct cpumask *cpumask) | ||
66 | { | ||
67 | return cpumask_bits(cpumask)[0]; | ||
68 | } | ||
69 | |||
70 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
71 | const struct cpumask *andmask) | ||
72 | { | ||
73 | unsigned long mask1 = cpumask_bits(cpumask)[0]; | ||
74 | unsigned long mask2 = cpumask_bits(andmask)[0]; | ||
75 | unsigned long mask3 = cpumask_bits(cpu_online_mask)[0]; | ||
76 | |||
77 | return (unsigned int)(mask1 & mask2 & mask3); | ||
78 | } | ||
79 | |||
80 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | ||
81 | { | ||
82 | return cpuid_apic >> index_msb; | ||
83 | } | ||
84 | |||
85 | static inline void setup_apic_routing(void) | ||
86 | { | ||
87 | #ifdef CONFIG_X86_IO_APIC | ||
88 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | ||
89 | "Flat", nr_ioapics); | ||
90 | #endif | ||
91 | } | ||
92 | |||
93 | static inline int apicid_to_node(int logical_apicid) | ||
94 | { | ||
95 | #ifdef CONFIG_SMP | ||
96 | return apicid_2_node[hard_smp_processor_id()]; | ||
97 | #else | ||
98 | return 0; | ||
99 | #endif | ||
100 | } | ||
101 | |||
102 | static inline void vector_allocation_domain(int cpu, struct cpumask *retmask) | ||
103 | { | ||
104 | /* Careful. Some cpus do not strictly honor the set of cpus | ||
105 | * specified in the interrupt destination when using lowest | ||
106 | * priority interrupt delivery mode. | ||
107 | * | ||
108 | * In particular there was a hyperthreading cpu observed to | ||
109 | * deliver interrupts to the wrong hyperthread when only one | ||
110 | * hyperthread was specified in the interrupt desitination. | ||
111 | */ | ||
112 | *retmask = (cpumask_t) { { [0] = APIC_ALL_CPUS } }; | ||
113 | } | ||
114 | #endif | ||
115 | |||
116 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) | ||
117 | { | ||
118 | return physid_isset(apicid, bitmap); | ||
119 | } | ||
120 | |||
121 | static inline unsigned long check_apicid_present(int bit) | ||
122 | { | ||
123 | return physid_isset(bit, phys_cpu_present_map); | ||
124 | } | ||
125 | |||
126 | static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map) | ||
127 | { | ||
128 | return phys_map; | ||
129 | } | ||
130 | |||
131 | static inline int multi_timer_check(int apic, int irq) | ||
132 | { | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | /* Mapping from cpu number to logical apicid */ | ||
137 | static inline int cpu_to_logical_apicid(int cpu) | ||
138 | { | ||
139 | return 1 << cpu; | ||
140 | } | ||
141 | |||
142 | static inline int cpu_present_to_apicid(int mps_cpu) | ||
143 | { | ||
144 | if (mps_cpu < nr_cpu_ids && cpu_present(mps_cpu)) | ||
145 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
146 | else | ||
147 | return BAD_APICID; | ||
148 | } | ||
149 | |||
150 | static inline physid_mask_t apicid_to_cpu_present(int phys_apicid) | ||
151 | { | ||
152 | return physid_mask_of_physid(phys_apicid); | ||
153 | } | ||
154 | |||
155 | static inline void setup_portio_remap(void) | ||
156 | { | ||
157 | } | ||
158 | |||
159 | static inline int check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
160 | { | ||
161 | return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map); | ||
162 | } | ||
163 | |||
164 | static inline void enable_apic_mode(void) | ||
165 | { | ||
166 | } | ||
167 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
168 | #endif /* _ASM_X86_MACH_DEFAULT_MACH_APIC_H */ | ||
diff --git a/arch/x86/include/asm/mach-default/mach_apicdef.h b/arch/x86/include/asm/mach-default/mach_apicdef.h deleted file mode 100644 index 53179936d6c6..000000000000 --- a/arch/x86/include/asm/mach-default/mach_apicdef.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_APICDEF_H | ||
2 | #define _ASM_X86_MACH_DEFAULT_MACH_APICDEF_H | ||
3 | |||
4 | #include <asm/apic.h> | ||
5 | |||
6 | #ifdef CONFIG_X86_64 | ||
7 | #define APIC_ID_MASK (genapic->apic_id_mask) | ||
8 | #define GET_APIC_ID(x) (genapic->get_apic_id(x)) | ||
9 | #define SET_APIC_ID(x) (genapic->set_apic_id(x)) | ||
10 | #else | ||
11 | #define APIC_ID_MASK (0xF<<24) | ||
12 | static inline unsigned get_apic_id(unsigned long x) | ||
13 | { | ||
14 | unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); | ||
15 | if (APIC_XAPIC(ver)) | ||
16 | return (((x)>>24)&0xFF); | ||
17 | else | ||
18 | return (((x)>>24)&0xF); | ||
19 | } | ||
20 | |||
21 | #define GET_APIC_ID(x) get_apic_id(x) | ||
22 | #endif | ||
23 | |||
24 | #endif /* _ASM_X86_MACH_DEFAULT_MACH_APICDEF_H */ | ||
diff --git a/arch/x86/include/asm/mach-default/mach_ipi.h b/arch/x86/include/asm/mach-default/mach_ipi.h deleted file mode 100644 index 191312d155da..000000000000 --- a/arch/x86/include/asm/mach-default/mach_ipi.h +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_IPI_H | ||
2 | #define _ASM_X86_MACH_DEFAULT_MACH_IPI_H | ||
3 | |||
4 | /* Avoid include hell */ | ||
5 | #define NMI_VECTOR 0x02 | ||
6 | |||
7 | void send_IPI_mask_bitmask(const struct cpumask *mask, int vector); | ||
8 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | ||
9 | void __send_IPI_shortcut(unsigned int shortcut, int vector); | ||
10 | |||
11 | extern int no_broadcast; | ||
12 | |||
13 | #ifdef CONFIG_X86_64 | ||
14 | #include <asm/genapic.h> | ||
15 | #define send_IPI_mask (genapic->send_IPI_mask) | ||
16 | #define send_IPI_mask_allbutself (genapic->send_IPI_mask_allbutself) | ||
17 | #else | ||
18 | static inline void send_IPI_mask(const struct cpumask *mask, int vector) | ||
19 | { | ||
20 | send_IPI_mask_bitmask(mask, vector); | ||
21 | } | ||
22 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | ||
23 | #endif | ||
24 | |||
25 | static inline void __local_send_IPI_allbutself(int vector) | ||
26 | { | ||
27 | if (no_broadcast || vector == NMI_VECTOR) | ||
28 | send_IPI_mask_allbutself(cpu_online_mask, vector); | ||
29 | else | ||
30 | __send_IPI_shortcut(APIC_DEST_ALLBUT, vector); | ||
31 | } | ||
32 | |||
33 | static inline void __local_send_IPI_all(int vector) | ||
34 | { | ||
35 | if (no_broadcast || vector == NMI_VECTOR) | ||
36 | send_IPI_mask(cpu_online_mask, vector); | ||
37 | else | ||
38 | __send_IPI_shortcut(APIC_DEST_ALLINC, vector); | ||
39 | } | ||
40 | |||
41 | #ifdef CONFIG_X86_64 | ||
42 | #define send_IPI_allbutself (genapic->send_IPI_allbutself) | ||
43 | #define send_IPI_all (genapic->send_IPI_all) | ||
44 | #else | ||
45 | static inline void send_IPI_allbutself(int vector) | ||
46 | { | ||
47 | /* | ||
48 | * if there are no other CPUs in the system then we get an APIC send | ||
49 | * error if we try to broadcast, thus avoid sending IPIs in this case. | ||
50 | */ | ||
51 | if (!(num_online_cpus() > 1)) | ||
52 | return; | ||
53 | |||
54 | __local_send_IPI_allbutself(vector); | ||
55 | return; | ||
56 | } | ||
57 | |||
58 | static inline void send_IPI_all(int vector) | ||
59 | { | ||
60 | __local_send_IPI_all(vector); | ||
61 | } | ||
62 | #endif | ||
63 | |||
64 | #endif /* _ASM_X86_MACH_DEFAULT_MACH_IPI_H */ | ||
diff --git a/arch/x86/include/asm/mach-default/mach_mpparse.h b/arch/x86/include/asm/mach-default/mach_mpparse.h deleted file mode 100644 index c70a263d68cd..000000000000 --- a/arch/x86/include/asm/mach-default/mach_mpparse.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_MPPARSE_H | ||
2 | #define _ASM_X86_MACH_DEFAULT_MACH_MPPARSE_H | ||
3 | |||
4 | static inline int | ||
5 | mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | ||
6 | { | ||
7 | return 0; | ||
8 | } | ||
9 | |||
10 | /* Hook from generic ACPI tables.c */ | ||
11 | static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
12 | { | ||
13 | return 0; | ||
14 | } | ||
15 | |||
16 | |||
17 | #endif /* _ASM_X86_MACH_DEFAULT_MACH_MPPARSE_H */ | ||
diff --git a/arch/x86/include/asm/mach-default/mach_mpspec.h b/arch/x86/include/asm/mach-default/mach_mpspec.h deleted file mode 100644 index e85ede686be8..000000000000 --- a/arch/x86/include/asm/mach-default/mach_mpspec.h +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_MPSPEC_H | ||
2 | #define _ASM_X86_MACH_DEFAULT_MACH_MPSPEC_H | ||
3 | |||
4 | #define MAX_IRQ_SOURCES 256 | ||
5 | |||
6 | #if CONFIG_BASE_SMALL == 0 | ||
7 | #define MAX_MP_BUSSES 256 | ||
8 | #else | ||
9 | #define MAX_MP_BUSSES 32 | ||
10 | #endif | ||
11 | |||
12 | #endif /* _ASM_X86_MACH_DEFAULT_MACH_MPSPEC_H */ | ||
diff --git a/arch/x86/include/asm/mach-default/mach_wakecpu.h b/arch/x86/include/asm/mach-default/mach_wakecpu.h deleted file mode 100644 index 89897a6a65b9..000000000000 --- a/arch/x86/include/asm/mach-default/mach_wakecpu.h +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H | ||
2 | #define _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H | ||
3 | |||
4 | #define TRAMPOLINE_PHYS_LOW (0x467) | ||
5 | #define TRAMPOLINE_PHYS_HIGH (0x469) | ||
6 | |||
7 | static inline void wait_for_init_deassert(atomic_t *deassert) | ||
8 | { | ||
9 | while (!atomic_read(deassert)) | ||
10 | cpu_relax(); | ||
11 | return; | ||
12 | } | ||
13 | |||
14 | /* Nothing to do for most platforms, since cleared by the INIT cycle */ | ||
15 | static inline void smp_callin_clear_local_apic(void) | ||
16 | { | ||
17 | } | ||
18 | |||
19 | static inline void store_NMI_vector(unsigned short *high, unsigned short *low) | ||
20 | { | ||
21 | } | ||
22 | |||
23 | static inline void restore_NMI_vector(unsigned short *high, unsigned short *low) | ||
24 | { | ||
25 | } | ||
26 | |||
27 | #ifdef CONFIG_SMP | ||
28 | extern void __inquire_remote_apic(int apicid); | ||
29 | #else /* CONFIG_SMP */ | ||
30 | static inline void __inquire_remote_apic(int apicid) | ||
31 | { | ||
32 | } | ||
33 | #endif /* CONFIG_SMP */ | ||
34 | |||
35 | static inline void inquire_remote_apic(int apicid) | ||
36 | { | ||
37 | if (apic_verbosity >= APIC_DEBUG) | ||
38 | __inquire_remote_apic(apicid); | ||
39 | } | ||
40 | |||
41 | #endif /* _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H */ | ||
diff --git a/arch/x86/include/asm/mach-generic/gpio.h b/arch/x86/include/asm/mach-generic/gpio.h deleted file mode 100644 index 995c45efdb33..000000000000 --- a/arch/x86/include/asm/mach-generic/gpio.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_GENERIC_GPIO_H | ||
2 | #define _ASM_X86_MACH_GENERIC_GPIO_H | ||
3 | |||
4 | int gpio_request(unsigned gpio, const char *label); | ||
5 | void gpio_free(unsigned gpio); | ||
6 | int gpio_direction_input(unsigned gpio); | ||
7 | int gpio_direction_output(unsigned gpio, int value); | ||
8 | int gpio_get_value(unsigned gpio); | ||
9 | void gpio_set_value(unsigned gpio, int value); | ||
10 | int gpio_to_irq(unsigned gpio); | ||
11 | int irq_to_gpio(unsigned irq); | ||
12 | |||
13 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | ||
14 | |||
15 | #endif /* _ASM_X86_MACH_GENERIC_GPIO_H */ | ||
diff --git a/arch/x86/include/asm/mach-generic/mach_apic.h b/arch/x86/include/asm/mach-generic/mach_apic.h deleted file mode 100644 index 48553e958ad5..000000000000 --- a/arch/x86/include/asm/mach-generic/mach_apic.h +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_GENERIC_MACH_APIC_H | ||
2 | #define _ASM_X86_MACH_GENERIC_MACH_APIC_H | ||
3 | |||
4 | #include <asm/genapic.h> | ||
5 | |||
6 | #define esr_disable (genapic->ESR_DISABLE) | ||
7 | #define NO_BALANCE_IRQ (genapic->no_balance_irq) | ||
8 | #define INT_DELIVERY_MODE (genapic->int_delivery_mode) | ||
9 | #define INT_DEST_MODE (genapic->int_dest_mode) | ||
10 | #undef APIC_DEST_LOGICAL | ||
11 | #define APIC_DEST_LOGICAL (genapic->apic_destination_logical) | ||
12 | #define TARGET_CPUS (genapic->target_cpus()) | ||
13 | #define apic_id_registered (genapic->apic_id_registered) | ||
14 | #define init_apic_ldr (genapic->init_apic_ldr) | ||
15 | #define ioapic_phys_id_map (genapic->ioapic_phys_id_map) | ||
16 | #define setup_apic_routing (genapic->setup_apic_routing) | ||
17 | #define multi_timer_check (genapic->multi_timer_check) | ||
18 | #define apicid_to_node (genapic->apicid_to_node) | ||
19 | #define cpu_to_logical_apicid (genapic->cpu_to_logical_apicid) | ||
20 | #define cpu_present_to_apicid (genapic->cpu_present_to_apicid) | ||
21 | #define apicid_to_cpu_present (genapic->apicid_to_cpu_present) | ||
22 | #define setup_portio_remap (genapic->setup_portio_remap) | ||
23 | #define check_apicid_present (genapic->check_apicid_present) | ||
24 | #define check_phys_apicid_present (genapic->check_phys_apicid_present) | ||
25 | #define check_apicid_used (genapic->check_apicid_used) | ||
26 | #define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid) | ||
27 | #define cpu_mask_to_apicid_and (genapic->cpu_mask_to_apicid_and) | ||
28 | #define vector_allocation_domain (genapic->vector_allocation_domain) | ||
29 | #define enable_apic_mode (genapic->enable_apic_mode) | ||
30 | #define phys_pkg_id (genapic->phys_pkg_id) | ||
31 | #define wakeup_secondary_cpu (genapic->wakeup_cpu) | ||
32 | |||
33 | extern void generic_bigsmp_probe(void); | ||
34 | |||
35 | #endif /* _ASM_X86_MACH_GENERIC_MACH_APIC_H */ | ||
diff --git a/arch/x86/include/asm/mach-generic/mach_apicdef.h b/arch/x86/include/asm/mach-generic/mach_apicdef.h deleted file mode 100644 index 68041f3802f4..000000000000 --- a/arch/x86/include/asm/mach-generic/mach_apicdef.h +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_GENERIC_MACH_APICDEF_H | ||
2 | #define _ASM_X86_MACH_GENERIC_MACH_APICDEF_H | ||
3 | |||
4 | #ifndef APIC_DEFINITION | ||
5 | #include <asm/genapic.h> | ||
6 | |||
7 | #define GET_APIC_ID (genapic->get_apic_id) | ||
8 | #define APIC_ID_MASK (genapic->apic_id_mask) | ||
9 | #endif | ||
10 | |||
11 | #endif /* _ASM_X86_MACH_GENERIC_MACH_APICDEF_H */ | ||
diff --git a/arch/x86/include/asm/mach-generic/mach_ipi.h b/arch/x86/include/asm/mach-generic/mach_ipi.h deleted file mode 100644 index ffd637e3c3d9..000000000000 --- a/arch/x86/include/asm/mach-generic/mach_ipi.h +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_GENERIC_MACH_IPI_H | ||
2 | #define _ASM_X86_MACH_GENERIC_MACH_IPI_H | ||
3 | |||
4 | #include <asm/genapic.h> | ||
5 | |||
6 | #define send_IPI_mask (genapic->send_IPI_mask) | ||
7 | #define send_IPI_allbutself (genapic->send_IPI_allbutself) | ||
8 | #define send_IPI_all (genapic->send_IPI_all) | ||
9 | |||
10 | #endif /* _ASM_X86_MACH_GENERIC_MACH_IPI_H */ | ||
diff --git a/arch/x86/include/asm/mach-generic/mach_mpparse.h b/arch/x86/include/asm/mach-generic/mach_mpparse.h deleted file mode 100644 index 9444ab8dca94..000000000000 --- a/arch/x86/include/asm/mach-generic/mach_mpparse.h +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_GENERIC_MACH_MPPARSE_H | ||
2 | #define _ASM_X86_MACH_GENERIC_MACH_MPPARSE_H | ||
3 | |||
4 | |||
5 | extern int mps_oem_check(struct mpc_table *, char *, char *); | ||
6 | |||
7 | extern int acpi_madt_oem_check(char *, char *); | ||
8 | |||
9 | #endif /* _ASM_X86_MACH_GENERIC_MACH_MPPARSE_H */ | ||
diff --git a/arch/x86/include/asm/mach-generic/mach_mpspec.h b/arch/x86/include/asm/mach-generic/mach_mpspec.h deleted file mode 100644 index 3bc407226578..000000000000 --- a/arch/x86/include/asm/mach-generic/mach_mpspec.h +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_GENERIC_MACH_MPSPEC_H | ||
2 | #define _ASM_X86_MACH_GENERIC_MACH_MPSPEC_H | ||
3 | |||
4 | #define MAX_IRQ_SOURCES 256 | ||
5 | |||
6 | /* Summit or generic (i.e. installer) kernels need lots of bus entries. */ | ||
7 | /* Maximum 256 PCI busses, plus 1 ISA bus in each of 4 cabinets. */ | ||
8 | #define MAX_MP_BUSSES 260 | ||
9 | |||
10 | extern void numaq_mps_oem_check(struct mpc_table *, char *, char *); | ||
11 | |||
12 | #endif /* _ASM_X86_MACH_GENERIC_MACH_MPSPEC_H */ | ||
diff --git a/arch/x86/include/asm/mach-generic/mach_wakecpu.h b/arch/x86/include/asm/mach-generic/mach_wakecpu.h deleted file mode 100644 index 1ab16b168c8a..000000000000 --- a/arch/x86/include/asm/mach-generic/mach_wakecpu.h +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H | ||
2 | #define _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H | ||
3 | |||
4 | #define TRAMPOLINE_PHYS_LOW (genapic->trampoline_phys_low) | ||
5 | #define TRAMPOLINE_PHYS_HIGH (genapic->trampoline_phys_high) | ||
6 | #define wait_for_init_deassert (genapic->wait_for_init_deassert) | ||
7 | #define smp_callin_clear_local_apic (genapic->smp_callin_clear_local_apic) | ||
8 | #define store_NMI_vector (genapic->store_NMI_vector) | ||
9 | #define restore_NMI_vector (genapic->restore_NMI_vector) | ||
10 | #define inquire_remote_apic (genapic->inquire_remote_apic) | ||
11 | |||
12 | #endif /* _ASM_X86_MACH_GENERIC_MACH_APIC_H */ | ||
diff --git a/arch/x86/include/asm/mach-rdc321x/gpio.h b/arch/x86/include/asm/mach-rdc321x/gpio.h deleted file mode 100644 index c210ab5788b0..000000000000 --- a/arch/x86/include/asm/mach-rdc321x/gpio.h +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_RDC321X_GPIO_H | ||
2 | #define _ASM_X86_MACH_RDC321X_GPIO_H | ||
3 | |||
4 | #include <linux/kernel.h> | ||
5 | |||
6 | extern int rdc_gpio_get_value(unsigned gpio); | ||
7 | extern void rdc_gpio_set_value(unsigned gpio, int value); | ||
8 | extern int rdc_gpio_direction_input(unsigned gpio); | ||
9 | extern int rdc_gpio_direction_output(unsigned gpio, int value); | ||
10 | extern int rdc_gpio_request(unsigned gpio, const char *label); | ||
11 | extern void rdc_gpio_free(unsigned gpio); | ||
12 | extern void __init rdc321x_gpio_setup(void); | ||
13 | |||
14 | /* Wrappers for the arch-neutral GPIO API */ | ||
15 | |||
16 | static inline int gpio_request(unsigned gpio, const char *label) | ||
17 | { | ||
18 | return rdc_gpio_request(gpio, label); | ||
19 | } | ||
20 | |||
21 | static inline void gpio_free(unsigned gpio) | ||
22 | { | ||
23 | might_sleep(); | ||
24 | rdc_gpio_free(gpio); | ||
25 | } | ||
26 | |||
27 | static inline int gpio_direction_input(unsigned gpio) | ||
28 | { | ||
29 | return rdc_gpio_direction_input(gpio); | ||
30 | } | ||
31 | |||
32 | static inline int gpio_direction_output(unsigned gpio, int value) | ||
33 | { | ||
34 | return rdc_gpio_direction_output(gpio, value); | ||
35 | } | ||
36 | |||
37 | static inline int gpio_get_value(unsigned gpio) | ||
38 | { | ||
39 | return rdc_gpio_get_value(gpio); | ||
40 | } | ||
41 | |||
42 | static inline void gpio_set_value(unsigned gpio, int value) | ||
43 | { | ||
44 | rdc_gpio_set_value(gpio, value); | ||
45 | } | ||
46 | |||
47 | static inline int gpio_to_irq(unsigned gpio) | ||
48 | { | ||
49 | return gpio; | ||
50 | } | ||
51 | |||
52 | static inline int irq_to_gpio(unsigned irq) | ||
53 | { | ||
54 | return irq; | ||
55 | } | ||
56 | |||
57 | /* For cansleep */ | ||
58 | #include <asm-generic/gpio.h> | ||
59 | |||
60 | #endif /* _ASM_X86_MACH_RDC321X_GPIO_H */ | ||
diff --git a/arch/x86/include/asm/mach-default/mach_timer.h b/arch/x86/include/asm/mach_timer.h index 853728519ae9..853728519ae9 100644 --- a/arch/x86/include/asm/mach-default/mach_timer.h +++ b/arch/x86/include/asm/mach_timer.h | |||
diff --git a/arch/x86/include/asm/mach-default/mach_traps.h b/arch/x86/include/asm/mach_traps.h index f7920601e472..f7920601e472 100644 --- a/arch/x86/include/asm/mach-default/mach_traps.h +++ b/arch/x86/include/asm/mach_traps.h | |||
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index 8aeeb3fd73db..52948df9cd1d 100644 --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h | |||
@@ -21,11 +21,54 @@ static inline void paravirt_activate_mm(struct mm_struct *prev, | |||
21 | int init_new_context(struct task_struct *tsk, struct mm_struct *mm); | 21 | int init_new_context(struct task_struct *tsk, struct mm_struct *mm); |
22 | void destroy_context(struct mm_struct *mm); | 22 | void destroy_context(struct mm_struct *mm); |
23 | 23 | ||
24 | #ifdef CONFIG_X86_32 | 24 | |
25 | # include "mmu_context_32.h" | 25 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) |
26 | #else | 26 | { |
27 | # include "mmu_context_64.h" | 27 | #ifdef CONFIG_SMP |
28 | if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK) | ||
29 | percpu_write(cpu_tlbstate.state, TLBSTATE_LAZY); | ||
30 | #endif | ||
31 | } | ||
32 | |||
33 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
34 | struct task_struct *tsk) | ||
35 | { | ||
36 | unsigned cpu = smp_processor_id(); | ||
37 | |||
38 | if (likely(prev != next)) { | ||
39 | /* stop flush ipis for the previous mm */ | ||
40 | cpu_clear(cpu, prev->cpu_vm_mask); | ||
41 | #ifdef CONFIG_SMP | ||
42 | percpu_write(cpu_tlbstate.state, TLBSTATE_OK); | ||
43 | percpu_write(cpu_tlbstate.active_mm, next); | ||
28 | #endif | 44 | #endif |
45 | cpu_set(cpu, next->cpu_vm_mask); | ||
46 | |||
47 | /* Re-load page tables */ | ||
48 | load_cr3(next->pgd); | ||
49 | |||
50 | /* | ||
51 | * load the LDT, if the LDT is different: | ||
52 | */ | ||
53 | if (unlikely(prev->context.ldt != next->context.ldt)) | ||
54 | load_LDT_nolock(&next->context); | ||
55 | } | ||
56 | #ifdef CONFIG_SMP | ||
57 | else { | ||
58 | percpu_write(cpu_tlbstate.state, TLBSTATE_OK); | ||
59 | BUG_ON(percpu_read(cpu_tlbstate.active_mm) != next); | ||
60 | |||
61 | if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) { | ||
62 | /* We were in lazy tlb mode and leave_mm disabled | ||
63 | * tlb flush IPI delivery. We must reload CR3 | ||
64 | * to make sure to use no freed page tables. | ||
65 | */ | ||
66 | load_cr3(next->pgd); | ||
67 | load_LDT_nolock(&next->context); | ||
68 | } | ||
69 | } | ||
70 | #endif | ||
71 | } | ||
29 | 72 | ||
30 | #define activate_mm(prev, next) \ | 73 | #define activate_mm(prev, next) \ |
31 | do { \ | 74 | do { \ |
@@ -33,5 +76,17 @@ do { \ | |||
33 | switch_mm((prev), (next), NULL); \ | 76 | switch_mm((prev), (next), NULL); \ |
34 | } while (0); | 77 | } while (0); |
35 | 78 | ||
79 | #ifdef CONFIG_X86_32 | ||
80 | #define deactivate_mm(tsk, mm) \ | ||
81 | do { \ | ||
82 | loadsegment(gs, 0); \ | ||
83 | } while (0) | ||
84 | #else | ||
85 | #define deactivate_mm(tsk, mm) \ | ||
86 | do { \ | ||
87 | load_gs_index(0); \ | ||
88 | loadsegment(fs, 0); \ | ||
89 | } while (0) | ||
90 | #endif | ||
36 | 91 | ||
37 | #endif /* _ASM_X86_MMU_CONTEXT_H */ | 92 | #endif /* _ASM_X86_MMU_CONTEXT_H */ |
diff --git a/arch/x86/include/asm/mmu_context_32.h b/arch/x86/include/asm/mmu_context_32.h deleted file mode 100644 index 7e98ce1d2c0e..000000000000 --- a/arch/x86/include/asm/mmu_context_32.h +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MMU_CONTEXT_32_H | ||
2 | #define _ASM_X86_MMU_CONTEXT_32_H | ||
3 | |||
4 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
5 | { | ||
6 | #ifdef CONFIG_SMP | ||
7 | if (x86_read_percpu(cpu_tlbstate.state) == TLBSTATE_OK) | ||
8 | x86_write_percpu(cpu_tlbstate.state, TLBSTATE_LAZY); | ||
9 | #endif | ||
10 | } | ||
11 | |||
12 | static inline void switch_mm(struct mm_struct *prev, | ||
13 | struct mm_struct *next, | ||
14 | struct task_struct *tsk) | ||
15 | { | ||
16 | int cpu = smp_processor_id(); | ||
17 | |||
18 | if (likely(prev != next)) { | ||
19 | /* stop flush ipis for the previous mm */ | ||
20 | cpu_clear(cpu, prev->cpu_vm_mask); | ||
21 | #ifdef CONFIG_SMP | ||
22 | x86_write_percpu(cpu_tlbstate.state, TLBSTATE_OK); | ||
23 | x86_write_percpu(cpu_tlbstate.active_mm, next); | ||
24 | #endif | ||
25 | cpu_set(cpu, next->cpu_vm_mask); | ||
26 | |||
27 | /* Re-load page tables */ | ||
28 | load_cr3(next->pgd); | ||
29 | |||
30 | /* | ||
31 | * load the LDT, if the LDT is different: | ||
32 | */ | ||
33 | if (unlikely(prev->context.ldt != next->context.ldt)) | ||
34 | load_LDT_nolock(&next->context); | ||
35 | } | ||
36 | #ifdef CONFIG_SMP | ||
37 | else { | ||
38 | x86_write_percpu(cpu_tlbstate.state, TLBSTATE_OK); | ||
39 | BUG_ON(x86_read_percpu(cpu_tlbstate.active_mm) != next); | ||
40 | |||
41 | if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) { | ||
42 | /* We were in lazy tlb mode and leave_mm disabled | ||
43 | * tlb flush IPI delivery. We must reload %cr3. | ||
44 | */ | ||
45 | load_cr3(next->pgd); | ||
46 | load_LDT_nolock(&next->context); | ||
47 | } | ||
48 | } | ||
49 | #endif | ||
50 | } | ||
51 | |||
52 | #define deactivate_mm(tsk, mm) \ | ||
53 | asm("movl %0,%%gs": :"r" (0)); | ||
54 | |||
55 | #endif /* _ASM_X86_MMU_CONTEXT_32_H */ | ||
diff --git a/arch/x86/include/asm/mmu_context_64.h b/arch/x86/include/asm/mmu_context_64.h deleted file mode 100644 index 677d36e9540a..000000000000 --- a/arch/x86/include/asm/mmu_context_64.h +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MMU_CONTEXT_64_H | ||
2 | #define _ASM_X86_MMU_CONTEXT_64_H | ||
3 | |||
4 | #include <asm/pda.h> | ||
5 | |||
6 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
7 | { | ||
8 | #ifdef CONFIG_SMP | ||
9 | if (read_pda(mmu_state) == TLBSTATE_OK) | ||
10 | write_pda(mmu_state, TLBSTATE_LAZY); | ||
11 | #endif | ||
12 | } | ||
13 | |||
14 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
15 | struct task_struct *tsk) | ||
16 | { | ||
17 | unsigned cpu = smp_processor_id(); | ||
18 | if (likely(prev != next)) { | ||
19 | /* stop flush ipis for the previous mm */ | ||
20 | cpu_clear(cpu, prev->cpu_vm_mask); | ||
21 | #ifdef CONFIG_SMP | ||
22 | write_pda(mmu_state, TLBSTATE_OK); | ||
23 | write_pda(active_mm, next); | ||
24 | #endif | ||
25 | cpu_set(cpu, next->cpu_vm_mask); | ||
26 | load_cr3(next->pgd); | ||
27 | |||
28 | if (unlikely(next->context.ldt != prev->context.ldt)) | ||
29 | load_LDT_nolock(&next->context); | ||
30 | } | ||
31 | #ifdef CONFIG_SMP | ||
32 | else { | ||
33 | write_pda(mmu_state, TLBSTATE_OK); | ||
34 | if (read_pda(active_mm) != next) | ||
35 | BUG(); | ||
36 | if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) { | ||
37 | /* We were in lazy tlb mode and leave_mm disabled | ||
38 | * tlb flush IPI delivery. We must reload CR3 | ||
39 | * to make sure to use no freed page tables. | ||
40 | */ | ||
41 | load_cr3(next->pgd); | ||
42 | load_LDT_nolock(&next->context); | ||
43 | } | ||
44 | } | ||
45 | #endif | ||
46 | } | ||
47 | |||
48 | #define deactivate_mm(tsk, mm) \ | ||
49 | do { \ | ||
50 | load_gs_index(0); \ | ||
51 | asm volatile("movl %0,%%fs"::"r"(0)); \ | ||
52 | } while (0) | ||
53 | |||
54 | #endif /* _ASM_X86_MMU_CONTEXT_64_H */ | ||
diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h index 62d14ce3cd00..d22f732eab8f 100644 --- a/arch/x86/include/asm/mpspec.h +++ b/arch/x86/include/asm/mpspec.h | |||
@@ -9,7 +9,18 @@ extern int apic_version[MAX_APICS]; | |||
9 | extern int pic_mode; | 9 | extern int pic_mode; |
10 | 10 | ||
11 | #ifdef CONFIG_X86_32 | 11 | #ifdef CONFIG_X86_32 |
12 | #include <mach_mpspec.h> | 12 | |
13 | /* | ||
14 | * Summit or generic (i.e. installer) kernels need lots of bus entries. | ||
15 | * Maximum 256 PCI busses, plus 1 ISA bus in each of 4 cabinets. | ||
16 | */ | ||
17 | #if CONFIG_BASE_SMALL == 0 | ||
18 | # define MAX_MP_BUSSES 260 | ||
19 | #else | ||
20 | # define MAX_MP_BUSSES 32 | ||
21 | #endif | ||
22 | |||
23 | #define MAX_IRQ_SOURCES 256 | ||
13 | 24 | ||
14 | extern unsigned int def_to_bigsmp; | 25 | extern unsigned int def_to_bigsmp; |
15 | extern u8 apicid_2_node[]; | 26 | extern u8 apicid_2_node[]; |
@@ -20,15 +31,15 @@ extern int mp_bus_id_to_local[MAX_MP_BUSSES]; | |||
20 | extern int quad_local_to_mp_bus_id [NR_CPUS/4][4]; | 31 | extern int quad_local_to_mp_bus_id [NR_CPUS/4][4]; |
21 | #endif | 32 | #endif |
22 | 33 | ||
23 | #define MAX_APICID 256 | 34 | #define MAX_APICID 256 |
24 | 35 | ||
25 | #else | 36 | #else /* CONFIG_X86_64: */ |
26 | 37 | ||
27 | #define MAX_MP_BUSSES 256 | 38 | #define MAX_MP_BUSSES 256 |
28 | /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */ | 39 | /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */ |
29 | #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4) | 40 | #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4) |
30 | 41 | ||
31 | #endif | 42 | #endif /* CONFIG_X86_64 */ |
32 | 43 | ||
33 | extern void early_find_smp_config(void); | 44 | extern void early_find_smp_config(void); |
34 | extern void early_get_smp_config(void); | 45 | extern void early_get_smp_config(void); |
@@ -45,11 +56,13 @@ extern int smp_found_config; | |||
45 | extern int mpc_default_type; | 56 | extern int mpc_default_type; |
46 | extern unsigned long mp_lapic_addr; | 57 | extern unsigned long mp_lapic_addr; |
47 | 58 | ||
48 | extern void find_smp_config(void); | ||
49 | extern void get_smp_config(void); | 59 | extern void get_smp_config(void); |
60 | |||
50 | #ifdef CONFIG_X86_MPPARSE | 61 | #ifdef CONFIG_X86_MPPARSE |
62 | extern void find_smp_config(void); | ||
51 | extern void early_reserve_e820_mpc_new(void); | 63 | extern void early_reserve_e820_mpc_new(void); |
52 | #else | 64 | #else |
65 | static inline void find_smp_config(void) { } | ||
53 | static inline void early_reserve_e820_mpc_new(void) { } | 66 | static inline void early_reserve_e820_mpc_new(void) { } |
54 | #endif | 67 | #endif |
55 | 68 | ||
@@ -142,4 +155,10 @@ static inline void physid_set_mask_of_physid(int physid, physid_mask_t *map) | |||
142 | 155 | ||
143 | extern physid_mask_t phys_cpu_present_map; | 156 | extern physid_mask_t phys_cpu_present_map; |
144 | 157 | ||
158 | extern int generic_mps_oem_check(struct mpc_table *, char *, char *); | ||
159 | |||
160 | extern int default_acpi_madt_oem_check(char *, char *); | ||
161 | |||
162 | extern void numaq_mps_oem_check(struct mpc_table *, char *, char *); | ||
163 | |||
145 | #endif /* _ASM_X86_MPSPEC_H */ | 164 | #endif /* _ASM_X86_MPSPEC_H */ |
diff --git a/arch/x86/include/asm/mpspec_def.h b/arch/x86/include/asm/mpspec_def.h index 59568bc4767f..4a7f96d7c188 100644 --- a/arch/x86/include/asm/mpspec_def.h +++ b/arch/x86/include/asm/mpspec_def.h | |||
@@ -24,17 +24,18 @@ | |||
24 | # endif | 24 | # endif |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | struct intel_mp_floating { | 27 | /* Intel MP Floating Pointer Structure */ |
28 | char mpf_signature[4]; /* "_MP_" */ | 28 | struct mpf_intel { |
29 | unsigned int mpf_physptr; /* Configuration table address */ | 29 | char signature[4]; /* "_MP_" */ |
30 | unsigned char mpf_length; /* Our length (paragraphs) */ | 30 | unsigned int physptr; /* Configuration table address */ |
31 | unsigned char mpf_specification;/* Specification version */ | 31 | unsigned char length; /* Our length (paragraphs) */ |
32 | unsigned char mpf_checksum; /* Checksum (makes sum 0) */ | 32 | unsigned char specification; /* Specification version */ |
33 | unsigned char mpf_feature1; /* Standard or configuration ? */ | 33 | unsigned char checksum; /* Checksum (makes sum 0) */ |
34 | unsigned char mpf_feature2; /* Bit7 set for IMCR|PIC */ | 34 | unsigned char feature1; /* Standard or configuration ? */ |
35 | unsigned char mpf_feature3; /* Unused (0) */ | 35 | unsigned char feature2; /* Bit7 set for IMCR|PIC */ |
36 | unsigned char mpf_feature4; /* Unused (0) */ | 36 | unsigned char feature3; /* Unused (0) */ |
37 | unsigned char mpf_feature5; /* Unused (0) */ | 37 | unsigned char feature4; /* Unused (0) */ |
38 | unsigned char feature5; /* Unused (0) */ | ||
38 | }; | 39 | }; |
39 | 40 | ||
40 | #define MPC_SIGNATURE "PCMP" | 41 | #define MPC_SIGNATURE "PCMP" |
diff --git a/arch/x86/include/asm/numaq/apic.h b/arch/x86/include/asm/numaq/apic.h deleted file mode 100644 index bf37bc49bd8e..000000000000 --- a/arch/x86/include/asm/numaq/apic.h +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | #ifndef __ASM_NUMAQ_APIC_H | ||
2 | #define __ASM_NUMAQ_APIC_H | ||
3 | |||
4 | #include <asm/io.h> | ||
5 | #include <linux/mmzone.h> | ||
6 | #include <linux/nodemask.h> | ||
7 | |||
8 | #define APIC_DFR_VALUE (APIC_DFR_CLUSTER) | ||
9 | |||
10 | static inline const cpumask_t *target_cpus(void) | ||
11 | { | ||
12 | return &CPU_MASK_ALL; | ||
13 | } | ||
14 | |||
15 | #define NO_BALANCE_IRQ (1) | ||
16 | #define esr_disable (1) | ||
17 | |||
18 | #define INT_DELIVERY_MODE dest_LowestPrio | ||
19 | #define INT_DEST_MODE 0 /* physical delivery on LOCAL quad */ | ||
20 | |||
21 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) | ||
22 | { | ||
23 | return physid_isset(apicid, bitmap); | ||
24 | } | ||
25 | static inline unsigned long check_apicid_present(int bit) | ||
26 | { | ||
27 | return physid_isset(bit, phys_cpu_present_map); | ||
28 | } | ||
29 | #define apicid_cluster(apicid) (apicid & 0xF0) | ||
30 | |||
31 | static inline int apic_id_registered(void) | ||
32 | { | ||
33 | return 1; | ||
34 | } | ||
35 | |||
36 | static inline void init_apic_ldr(void) | ||
37 | { | ||
38 | /* Already done in NUMA-Q firmware */ | ||
39 | } | ||
40 | |||
41 | static inline void setup_apic_routing(void) | ||
42 | { | ||
43 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | ||
44 | "NUMA-Q", nr_ioapics); | ||
45 | } | ||
46 | |||
47 | /* | ||
48 | * Skip adding the timer int on secondary nodes, which causes | ||
49 | * a small but painful rift in the time-space continuum. | ||
50 | */ | ||
51 | static inline int multi_timer_check(int apic, int irq) | ||
52 | { | ||
53 | return apic != 0 && irq == 0; | ||
54 | } | ||
55 | |||
56 | static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map) | ||
57 | { | ||
58 | /* We don't have a good way to do this yet - hack */ | ||
59 | return physids_promote(0xFUL); | ||
60 | } | ||
61 | |||
62 | /* Mapping from cpu number to logical apicid */ | ||
63 | extern u8 cpu_2_logical_apicid[]; | ||
64 | static inline int cpu_to_logical_apicid(int cpu) | ||
65 | { | ||
66 | if (cpu >= nr_cpu_ids) | ||
67 | return BAD_APICID; | ||
68 | return (int)cpu_2_logical_apicid[cpu]; | ||
69 | } | ||
70 | |||
71 | /* | ||
72 | * Supporting over 60 cpus on NUMA-Q requires a locality-dependent | ||
73 | * cpu to APIC ID relation to properly interact with the intelligent | ||
74 | * mode of the cluster controller. | ||
75 | */ | ||
76 | static inline int cpu_present_to_apicid(int mps_cpu) | ||
77 | { | ||
78 | if (mps_cpu < 60) | ||
79 | return ((mps_cpu >> 2) << 4) | (1 << (mps_cpu & 0x3)); | ||
80 | else | ||
81 | return BAD_APICID; | ||
82 | } | ||
83 | |||
84 | static inline int apicid_to_node(int logical_apicid) | ||
85 | { | ||
86 | return logical_apicid >> 4; | ||
87 | } | ||
88 | |||
89 | static inline physid_mask_t apicid_to_cpu_present(int logical_apicid) | ||
90 | { | ||
91 | int node = apicid_to_node(logical_apicid); | ||
92 | int cpu = __ffs(logical_apicid & 0xf); | ||
93 | |||
94 | return physid_mask_of_physid(cpu + 4*node); | ||
95 | } | ||
96 | |||
97 | extern void *xquad_portio; | ||
98 | |||
99 | static inline void setup_portio_remap(void) | ||
100 | { | ||
101 | int num_quads = num_online_nodes(); | ||
102 | |||
103 | if (num_quads <= 1) | ||
104 | return; | ||
105 | |||
106 | printk("Remapping cross-quad port I/O for %d quads\n", num_quads); | ||
107 | xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD); | ||
108 | printk("xquad_portio vaddr 0x%08lx, len %08lx\n", | ||
109 | (u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD); | ||
110 | } | ||
111 | |||
112 | static inline int check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
113 | { | ||
114 | return (1); | ||
115 | } | ||
116 | |||
117 | static inline void enable_apic_mode(void) | ||
118 | { | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * We use physical apicids here, not logical, so just return the default | ||
123 | * physical broadcast to stop people from breaking us | ||
124 | */ | ||
125 | static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | ||
126 | { | ||
127 | return (int) 0xF; | ||
128 | } | ||
129 | |||
130 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
131 | const struct cpumask *andmask) | ||
132 | { | ||
133 | return (int) 0xF; | ||
134 | } | ||
135 | |||
136 | /* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */ | ||
137 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | ||
138 | { | ||
139 | return cpuid_apic >> index_msb; | ||
140 | } | ||
141 | |||
142 | #endif /* __ASM_NUMAQ_APIC_H */ | ||
diff --git a/arch/x86/include/asm/numaq/apicdef.h b/arch/x86/include/asm/numaq/apicdef.h deleted file mode 100644 index e012a46cc22a..000000000000 --- a/arch/x86/include/asm/numaq/apicdef.h +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #ifndef __ASM_NUMAQ_APICDEF_H | ||
2 | #define __ASM_NUMAQ_APICDEF_H | ||
3 | |||
4 | |||
5 | #define APIC_ID_MASK (0xF<<24) | ||
6 | |||
7 | static inline unsigned get_apic_id(unsigned long x) | ||
8 | { | ||
9 | return (((x)>>24)&0x0F); | ||
10 | } | ||
11 | |||
12 | #define GET_APIC_ID(x) get_apic_id(x) | ||
13 | |||
14 | #endif | ||
diff --git a/arch/x86/include/asm/numaq/ipi.h b/arch/x86/include/asm/numaq/ipi.h deleted file mode 100644 index a8374c652778..000000000000 --- a/arch/x86/include/asm/numaq/ipi.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | #ifndef __ASM_NUMAQ_IPI_H | ||
2 | #define __ASM_NUMAQ_IPI_H | ||
3 | |||
4 | void send_IPI_mask_sequence(const struct cpumask *mask, int vector); | ||
5 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector); | ||
6 | |||
7 | static inline void send_IPI_mask(const struct cpumask *mask, int vector) | ||
8 | { | ||
9 | send_IPI_mask_sequence(mask, vector); | ||
10 | } | ||
11 | |||
12 | static inline void send_IPI_allbutself(int vector) | ||
13 | { | ||
14 | send_IPI_mask_allbutself(cpu_online_mask, vector); | ||
15 | } | ||
16 | |||
17 | static inline void send_IPI_all(int vector) | ||
18 | { | ||
19 | send_IPI_mask(cpu_online_mask, vector); | ||
20 | } | ||
21 | |||
22 | #endif /* __ASM_NUMAQ_IPI_H */ | ||
diff --git a/arch/x86/include/asm/numaq/mpparse.h b/arch/x86/include/asm/numaq/mpparse.h deleted file mode 100644 index a2eeefcd1cc7..000000000000 --- a/arch/x86/include/asm/numaq/mpparse.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ASM_NUMAQ_MPPARSE_H | ||
2 | #define __ASM_NUMAQ_MPPARSE_H | ||
3 | |||
4 | extern void numaq_mps_oem_check(struct mpc_table *, char *, char *); | ||
5 | |||
6 | #endif /* __ASM_NUMAQ_MPPARSE_H */ | ||
diff --git a/arch/x86/include/asm/numaq/wakecpu.h b/arch/x86/include/asm/numaq/wakecpu.h deleted file mode 100644 index 6f499df8eddb..000000000000 --- a/arch/x86/include/asm/numaq/wakecpu.h +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | #ifndef __ASM_NUMAQ_WAKECPU_H | ||
2 | #define __ASM_NUMAQ_WAKECPU_H | ||
3 | |||
4 | /* This file copes with machines that wakeup secondary CPUs by NMIs */ | ||
5 | |||
6 | #define TRAMPOLINE_PHYS_LOW (0x8) | ||
7 | #define TRAMPOLINE_PHYS_HIGH (0xa) | ||
8 | |||
9 | /* We don't do anything here because we use NMI's to boot instead */ | ||
10 | static inline void wait_for_init_deassert(atomic_t *deassert) | ||
11 | { | ||
12 | } | ||
13 | |||
14 | /* | ||
15 | * Because we use NMIs rather than the INIT-STARTUP sequence to | ||
16 | * bootstrap the CPUs, the APIC may be in a weird state. Kick it. | ||
17 | */ | ||
18 | static inline void smp_callin_clear_local_apic(void) | ||
19 | { | ||
20 | clear_local_APIC(); | ||
21 | } | ||
22 | |||
23 | static inline void store_NMI_vector(unsigned short *high, unsigned short *low) | ||
24 | { | ||
25 | printk("Storing NMI vector\n"); | ||
26 | *high = | ||
27 | *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_HIGH)); | ||
28 | *low = | ||
29 | *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_LOW)); | ||
30 | } | ||
31 | |||
32 | static inline void restore_NMI_vector(unsigned short *high, unsigned short *low) | ||
33 | { | ||
34 | printk("Restoring NMI vector\n"); | ||
35 | *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_HIGH)) = | ||
36 | *high; | ||
37 | *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = | ||
38 | *low; | ||
39 | } | ||
40 | |||
41 | static inline void inquire_remote_apic(int apicid) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | #endif /* __ASM_NUMAQ_WAKECPU_H */ | ||
diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h index e9873a2e8695..6b9810859daf 100644 --- a/arch/x86/include/asm/page.h +++ b/arch/x86/include/asm/page.h | |||
@@ -147,7 +147,7 @@ static inline pteval_t native_pte_val(pte_t pte) | |||
147 | return pte.pte; | 147 | return pte.pte; |
148 | } | 148 | } |
149 | 149 | ||
150 | static inline pteval_t native_pte_flags(pte_t pte) | 150 | static inline pteval_t pte_flags(pte_t pte) |
151 | { | 151 | { |
152 | return native_pte_val(pte) & PTE_FLAGS_MASK; | 152 | return native_pte_val(pte) & PTE_FLAGS_MASK; |
153 | } | 153 | } |
@@ -173,7 +173,6 @@ static inline pteval_t native_pte_flags(pte_t pte) | |||
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | #define pte_val(x) native_pte_val(x) | 175 | #define pte_val(x) native_pte_val(x) |
176 | #define pte_flags(x) native_pte_flags(x) | ||
177 | #define __pte(x) native_make_pte(x) | 176 | #define __pte(x) native_make_pte(x) |
178 | 177 | ||
179 | #endif /* CONFIG_PARAVIRT */ | 178 | #endif /* CONFIG_PARAVIRT */ |
diff --git a/arch/x86/include/asm/page_64.h b/arch/x86/include/asm/page_64.h index 5ebca29f44f0..e27fdbe5f9e4 100644 --- a/arch/x86/include/asm/page_64.h +++ b/arch/x86/include/asm/page_64.h | |||
@@ -13,8 +13,8 @@ | |||
13 | #define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1) | 13 | #define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1) |
14 | #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER) | 14 | #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER) |
15 | 15 | ||
16 | #define IRQSTACK_ORDER 2 | 16 | #define IRQ_STACK_ORDER 2 |
17 | #define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER) | 17 | #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER) |
18 | 18 | ||
19 | #define STACKFAULT_STACK 1 | 19 | #define STACKFAULT_STACK 1 |
20 | #define DOUBLEFAULT_STACK 2 | 20 | #define DOUBLEFAULT_STACK 2 |
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index ba3e2ff6aedc..7e674ea80f0d 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
@@ -244,7 +244,8 @@ struct pv_mmu_ops { | |||
244 | void (*flush_tlb_user)(void); | 244 | void (*flush_tlb_user)(void); |
245 | void (*flush_tlb_kernel)(void); | 245 | void (*flush_tlb_kernel)(void); |
246 | void (*flush_tlb_single)(unsigned long addr); | 246 | void (*flush_tlb_single)(unsigned long addr); |
247 | void (*flush_tlb_others)(const cpumask_t *cpus, struct mm_struct *mm, | 247 | void (*flush_tlb_others)(const struct cpumask *cpus, |
248 | struct mm_struct *mm, | ||
248 | unsigned long va); | 249 | unsigned long va); |
249 | 250 | ||
250 | /* Hooks for allocating and freeing a pagetable top-level */ | 251 | /* Hooks for allocating and freeing a pagetable top-level */ |
@@ -279,7 +280,6 @@ struct pv_mmu_ops { | |||
279 | pte_t *ptep, pte_t pte); | 280 | pte_t *ptep, pte_t pte); |
280 | 281 | ||
281 | pteval_t (*pte_val)(pte_t); | 282 | pteval_t (*pte_val)(pte_t); |
282 | pteval_t (*pte_flags)(pte_t); | ||
283 | pte_t (*make_pte)(pteval_t pte); | 283 | pte_t (*make_pte)(pteval_t pte); |
284 | 284 | ||
285 | pgdval_t (*pgd_val)(pgd_t); | 285 | pgdval_t (*pgd_val)(pgd_t); |
@@ -984,10 +984,11 @@ static inline void __flush_tlb_single(unsigned long addr) | |||
984 | PVOP_VCALL1(pv_mmu_ops.flush_tlb_single, addr); | 984 | PVOP_VCALL1(pv_mmu_ops.flush_tlb_single, addr); |
985 | } | 985 | } |
986 | 986 | ||
987 | static inline void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, | 987 | static inline void flush_tlb_others(const struct cpumask *cpumask, |
988 | struct mm_struct *mm, | ||
988 | unsigned long va) | 989 | unsigned long va) |
989 | { | 990 | { |
990 | PVOP_VCALL3(pv_mmu_ops.flush_tlb_others, &cpumask, mm, va); | 991 | PVOP_VCALL3(pv_mmu_ops.flush_tlb_others, cpumask, mm, va); |
991 | } | 992 | } |
992 | 993 | ||
993 | static inline int paravirt_pgd_alloc(struct mm_struct *mm) | 994 | static inline int paravirt_pgd_alloc(struct mm_struct *mm) |
@@ -1084,23 +1085,6 @@ static inline pteval_t pte_val(pte_t pte) | |||
1084 | return ret; | 1085 | return ret; |
1085 | } | 1086 | } |
1086 | 1087 | ||
1087 | static inline pteval_t pte_flags(pte_t pte) | ||
1088 | { | ||
1089 | pteval_t ret; | ||
1090 | |||
1091 | if (sizeof(pteval_t) > sizeof(long)) | ||
1092 | ret = PVOP_CALL2(pteval_t, pv_mmu_ops.pte_flags, | ||
1093 | pte.pte, (u64)pte.pte >> 32); | ||
1094 | else | ||
1095 | ret = PVOP_CALL1(pteval_t, pv_mmu_ops.pte_flags, | ||
1096 | pte.pte); | ||
1097 | |||
1098 | #ifdef CONFIG_PARAVIRT_DEBUG | ||
1099 | BUG_ON(ret & PTE_PFN_MASK); | ||
1100 | #endif | ||
1101 | return ret; | ||
1102 | } | ||
1103 | |||
1104 | static inline pgd_t __pgd(pgdval_t val) | 1088 | static inline pgd_t __pgd(pgdval_t val) |
1105 | { | 1089 | { |
1106 | pgdval_t ret; | 1090 | pgdval_t ret; |
@@ -1389,8 +1373,6 @@ static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx, | |||
1389 | void _paravirt_nop(void); | 1373 | void _paravirt_nop(void); |
1390 | #define paravirt_nop ((void *)_paravirt_nop) | 1374 | #define paravirt_nop ((void *)_paravirt_nop) |
1391 | 1375 | ||
1392 | void paravirt_use_bytelocks(void); | ||
1393 | |||
1394 | #ifdef CONFIG_SMP | 1376 | #ifdef CONFIG_SMP |
1395 | 1377 | ||
1396 | static inline int __raw_spin_is_locked(struct raw_spinlock *lock) | 1378 | static inline int __raw_spin_is_locked(struct raw_spinlock *lock) |
diff --git a/arch/x86/include/asm/pat.h b/arch/x86/include/asm/pat.h index b8493b3b9890..9709fdff6615 100644 --- a/arch/x86/include/asm/pat.h +++ b/arch/x86/include/asm/pat.h | |||
@@ -5,10 +5,8 @@ | |||
5 | 5 | ||
6 | #ifdef CONFIG_X86_PAT | 6 | #ifdef CONFIG_X86_PAT |
7 | extern int pat_enabled; | 7 | extern int pat_enabled; |
8 | extern void validate_pat_support(struct cpuinfo_x86 *c); | ||
9 | #else | 8 | #else |
10 | static const int pat_enabled; | 9 | static const int pat_enabled; |
11 | static inline void validate_pat_support(struct cpuinfo_x86 *c) { } | ||
12 | #endif | 10 | #endif |
13 | 11 | ||
14 | extern void pat_init(void); | 12 | extern void pat_init(void); |
@@ -17,6 +15,4 @@ extern int reserve_memtype(u64 start, u64 end, | |||
17 | unsigned long req_type, unsigned long *ret_type); | 15 | unsigned long req_type, unsigned long *ret_type); |
18 | extern int free_memtype(u64 start, u64 end); | 16 | extern int free_memtype(u64 start, u64 end); |
19 | 17 | ||
20 | extern void pat_disable(char *reason); | ||
21 | |||
22 | #endif /* _ASM_X86_PAT_H */ | 18 | #endif /* _ASM_X86_PAT_H */ |
diff --git a/arch/x86/include/asm/mach-default/pci-functions.h b/arch/x86/include/asm/pci-functions.h index ed0bab427354..ed0bab427354 100644 --- a/arch/x86/include/asm/mach-default/pci-functions.h +++ b/arch/x86/include/asm/pci-functions.h | |||
diff --git a/arch/x86/include/asm/pda.h b/arch/x86/include/asm/pda.h deleted file mode 100644 index 2fbfff88df37..000000000000 --- a/arch/x86/include/asm/pda.h +++ /dev/null | |||
@@ -1,137 +0,0 @@ | |||
1 | #ifndef _ASM_X86_PDA_H | ||
2 | #define _ASM_X86_PDA_H | ||
3 | |||
4 | #ifndef __ASSEMBLY__ | ||
5 | #include <linux/stddef.h> | ||
6 | #include <linux/types.h> | ||
7 | #include <linux/cache.h> | ||
8 | #include <asm/page.h> | ||
9 | |||
10 | /* Per processor datastructure. %gs points to it while the kernel runs */ | ||
11 | struct x8664_pda { | ||
12 | struct task_struct *pcurrent; /* 0 Current process */ | ||
13 | unsigned long data_offset; /* 8 Per cpu data offset from linker | ||
14 | address */ | ||
15 | unsigned long kernelstack; /* 16 top of kernel stack for current */ | ||
16 | unsigned long oldrsp; /* 24 user rsp for system call */ | ||
17 | int irqcount; /* 32 Irq nesting counter. Starts -1 */ | ||
18 | unsigned int cpunumber; /* 36 Logical CPU number */ | ||
19 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
20 | unsigned long stack_canary; /* 40 stack canary value */ | ||
21 | /* gcc-ABI: this canary MUST be at | ||
22 | offset 40!!! */ | ||
23 | #endif | ||
24 | char *irqstackptr; | ||
25 | short nodenumber; /* number of current node (32k max) */ | ||
26 | short in_bootmem; /* pda lives in bootmem */ | ||
27 | unsigned int __softirq_pending; | ||
28 | unsigned int __nmi_count; /* number of NMI on this CPUs */ | ||
29 | short mmu_state; | ||
30 | short isidle; | ||
31 | struct mm_struct *active_mm; | ||
32 | unsigned apic_timer_irqs; | ||
33 | unsigned irq0_irqs; | ||
34 | unsigned irq_resched_count; | ||
35 | unsigned irq_call_count; | ||
36 | unsigned irq_tlb_count; | ||
37 | unsigned irq_thermal_count; | ||
38 | unsigned irq_threshold_count; | ||
39 | unsigned irq_spurious_count; | ||
40 | } ____cacheline_aligned_in_smp; | ||
41 | |||
42 | extern struct x8664_pda **_cpu_pda; | ||
43 | extern void pda_init(int); | ||
44 | |||
45 | #define cpu_pda(i) (_cpu_pda[i]) | ||
46 | |||
47 | /* | ||
48 | * There is no fast way to get the base address of the PDA, all the accesses | ||
49 | * have to mention %fs/%gs. So it needs to be done this Torvaldian way. | ||
50 | */ | ||
51 | extern void __bad_pda_field(void) __attribute__((noreturn)); | ||
52 | |||
53 | /* | ||
54 | * proxy_pda doesn't actually exist, but tell gcc it is accessed for | ||
55 | * all PDA accesses so it gets read/write dependencies right. | ||
56 | */ | ||
57 | extern struct x8664_pda _proxy_pda; | ||
58 | |||
59 | #define pda_offset(field) offsetof(struct x8664_pda, field) | ||
60 | |||
61 | #define pda_to_op(op, field, val) \ | ||
62 | do { \ | ||
63 | typedef typeof(_proxy_pda.field) T__; \ | ||
64 | if (0) { T__ tmp__; tmp__ = (val); } /* type checking */ \ | ||
65 | switch (sizeof(_proxy_pda.field)) { \ | ||
66 | case 2: \ | ||
67 | asm(op "w %1,%%gs:%c2" : \ | ||
68 | "+m" (_proxy_pda.field) : \ | ||
69 | "ri" ((T__)val), \ | ||
70 | "i"(pda_offset(field))); \ | ||
71 | break; \ | ||
72 | case 4: \ | ||
73 | asm(op "l %1,%%gs:%c2" : \ | ||
74 | "+m" (_proxy_pda.field) : \ | ||
75 | "ri" ((T__)val), \ | ||
76 | "i" (pda_offset(field))); \ | ||
77 | break; \ | ||
78 | case 8: \ | ||
79 | asm(op "q %1,%%gs:%c2": \ | ||
80 | "+m" (_proxy_pda.field) : \ | ||
81 | "ri" ((T__)val), \ | ||
82 | "i"(pda_offset(field))); \ | ||
83 | break; \ | ||
84 | default: \ | ||
85 | __bad_pda_field(); \ | ||
86 | } \ | ||
87 | } while (0) | ||
88 | |||
89 | #define pda_from_op(op, field) \ | ||
90 | ({ \ | ||
91 | typeof(_proxy_pda.field) ret__; \ | ||
92 | switch (sizeof(_proxy_pda.field)) { \ | ||
93 | case 2: \ | ||
94 | asm(op "w %%gs:%c1,%0" : \ | ||
95 | "=r" (ret__) : \ | ||
96 | "i" (pda_offset(field)), \ | ||
97 | "m" (_proxy_pda.field)); \ | ||
98 | break; \ | ||
99 | case 4: \ | ||
100 | asm(op "l %%gs:%c1,%0": \ | ||
101 | "=r" (ret__): \ | ||
102 | "i" (pda_offset(field)), \ | ||
103 | "m" (_proxy_pda.field)); \ | ||
104 | break; \ | ||
105 | case 8: \ | ||
106 | asm(op "q %%gs:%c1,%0": \ | ||
107 | "=r" (ret__) : \ | ||
108 | "i" (pda_offset(field)), \ | ||
109 | "m" (_proxy_pda.field)); \ | ||
110 | break; \ | ||
111 | default: \ | ||
112 | __bad_pda_field(); \ | ||
113 | } \ | ||
114 | ret__; \ | ||
115 | }) | ||
116 | |||
117 | #define read_pda(field) pda_from_op("mov", field) | ||
118 | #define write_pda(field, val) pda_to_op("mov", field, val) | ||
119 | #define add_pda(field, val) pda_to_op("add", field, val) | ||
120 | #define sub_pda(field, val) pda_to_op("sub", field, val) | ||
121 | #define or_pda(field, val) pda_to_op("or", field, val) | ||
122 | |||
123 | /* This is not atomic against other CPUs -- CPU preemption needs to be off */ | ||
124 | #define test_and_clear_bit_pda(bit, field) \ | ||
125 | ({ \ | ||
126 | int old__; \ | ||
127 | asm volatile("btr %2,%%gs:%c3\n\tsbbl %0,%0" \ | ||
128 | : "=r" (old__), "+m" (_proxy_pda.field) \ | ||
129 | : "dIr" (bit), "i" (pda_offset(field)) : "memory");\ | ||
130 | old__; \ | ||
131 | }) | ||
132 | |||
133 | #endif | ||
134 | |||
135 | #define PDA_STACKOFFSET (5*8) | ||
136 | |||
137 | #endif /* _ASM_X86_PDA_H */ | ||
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index ece72053ba63..0b64af4f13ac 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h | |||
@@ -2,53 +2,12 @@ | |||
2 | #define _ASM_X86_PERCPU_H | 2 | #define _ASM_X86_PERCPU_H |
3 | 3 | ||
4 | #ifdef CONFIG_X86_64 | 4 | #ifdef CONFIG_X86_64 |
5 | #include <linux/compiler.h> | 5 | #define __percpu_seg gs |
6 | 6 | #define __percpu_mov_op movq | |
7 | /* Same as asm-generic/percpu.h, except that we store the per cpu offset | 7 | #else |
8 | in the PDA. Longer term the PDA and every per cpu variable | 8 | #define __percpu_seg fs |
9 | should be just put into a single section and referenced directly | 9 | #define __percpu_mov_op movl |
10 | from %gs */ | ||
11 | |||
12 | #ifdef CONFIG_SMP | ||
13 | #include <asm/pda.h> | ||
14 | |||
15 | #define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset) | ||
16 | #define __my_cpu_offset read_pda(data_offset) | ||
17 | |||
18 | #define per_cpu_offset(x) (__per_cpu_offset(x)) | ||
19 | |||
20 | #endif | 10 | #endif |
21 | #include <asm-generic/percpu.h> | ||
22 | |||
23 | DECLARE_PER_CPU(struct x8664_pda, pda); | ||
24 | |||
25 | /* | ||
26 | * These are supposed to be implemented as a single instruction which | ||
27 | * operates on the per-cpu data base segment. x86-64 doesn't have | ||
28 | * that yet, so this is a fairly inefficient workaround for the | ||
29 | * meantime. The single instruction is atomic with respect to | ||
30 | * preemption and interrupts, so we need to explicitly disable | ||
31 | * interrupts here to achieve the same effect. However, because it | ||
32 | * can be used from within interrupt-disable/enable, we can't actually | ||
33 | * disable interrupts; disabling preemption is enough. | ||
34 | */ | ||
35 | #define x86_read_percpu(var) \ | ||
36 | ({ \ | ||
37 | typeof(per_cpu_var(var)) __tmp; \ | ||
38 | preempt_disable(); \ | ||
39 | __tmp = __get_cpu_var(var); \ | ||
40 | preempt_enable(); \ | ||
41 | __tmp; \ | ||
42 | }) | ||
43 | |||
44 | #define x86_write_percpu(var, val) \ | ||
45 | do { \ | ||
46 | preempt_disable(); \ | ||
47 | __get_cpu_var(var) = (val); \ | ||
48 | preempt_enable(); \ | ||
49 | } while(0) | ||
50 | |||
51 | #else /* CONFIG_X86_64 */ | ||
52 | 11 | ||
53 | #ifdef __ASSEMBLY__ | 12 | #ifdef __ASSEMBLY__ |
54 | 13 | ||
@@ -65,47 +24,26 @@ DECLARE_PER_CPU(struct x8664_pda, pda); | |||
65 | * PER_CPU(cpu_gdt_descr, %ebx) | 24 | * PER_CPU(cpu_gdt_descr, %ebx) |
66 | */ | 25 | */ |
67 | #ifdef CONFIG_SMP | 26 | #ifdef CONFIG_SMP |
68 | #define PER_CPU(var, reg) \ | 27 | #define PER_CPU(var, reg) \ |
69 | movl %fs:per_cpu__##this_cpu_off, reg; \ | 28 | __percpu_mov_op %__percpu_seg:per_cpu__this_cpu_off, reg; \ |
70 | lea per_cpu__##var(reg), reg | 29 | lea per_cpu__##var(reg), reg |
71 | #define PER_CPU_VAR(var) %fs:per_cpu__##var | 30 | #define PER_CPU_VAR(var) %__percpu_seg:per_cpu__##var |
72 | #else /* ! SMP */ | 31 | #else /* ! SMP */ |
73 | #define PER_CPU(var, reg) \ | 32 | #define PER_CPU(var, reg) \ |
74 | movl $per_cpu__##var, reg | 33 | __percpu_mov_op $per_cpu__##var, reg |
75 | #define PER_CPU_VAR(var) per_cpu__##var | 34 | #define PER_CPU_VAR(var) per_cpu__##var |
76 | #endif /* SMP */ | 35 | #endif /* SMP */ |
77 | 36 | ||
78 | #else /* ...!ASSEMBLY */ | 37 | #else /* ...!ASSEMBLY */ |
79 | 38 | ||
80 | /* | 39 | #include <linux/stringify.h> |
81 | * PER_CPU finds an address of a per-cpu variable. | ||
82 | * | ||
83 | * Args: | ||
84 | * var - variable name | ||
85 | * cpu - 32bit register containing the current CPU number | ||
86 | * | ||
87 | * The resulting address is stored in the "cpu" argument. | ||
88 | * | ||
89 | * Example: | ||
90 | * PER_CPU(cpu_gdt_descr, %ebx) | ||
91 | */ | ||
92 | #ifdef CONFIG_SMP | ||
93 | |||
94 | #define __my_cpu_offset x86_read_percpu(this_cpu_off) | ||
95 | 40 | ||
96 | /* fs segment starts at (positive) offset == __per_cpu_offset[cpu] */ | 41 | #ifdef CONFIG_SMP |
97 | #define __percpu_seg "%%fs:" | 42 | #define __percpu_arg(x) "%%"__stringify(__percpu_seg)":%P" #x |
98 | 43 | #define __my_cpu_offset percpu_read(this_cpu_off) | |
99 | #else /* !SMP */ | 44 | #else |
100 | 45 | #define __percpu_arg(x) "%" #x | |
101 | #define __percpu_seg "" | 46 | #endif |
102 | |||
103 | #endif /* SMP */ | ||
104 | |||
105 | #include <asm-generic/percpu.h> | ||
106 | |||
107 | /* We can use this directly for local CPU (faster). */ | ||
108 | DECLARE_PER_CPU(unsigned long, this_cpu_off); | ||
109 | 47 | ||
110 | /* For arch-specific code, we can use direct single-insn ops (they | 48 | /* For arch-specific code, we can use direct single-insn ops (they |
111 | * don't give an lvalue though). */ | 49 | * don't give an lvalue though). */ |
@@ -120,20 +58,25 @@ do { \ | |||
120 | } \ | 58 | } \ |
121 | switch (sizeof(var)) { \ | 59 | switch (sizeof(var)) { \ |
122 | case 1: \ | 60 | case 1: \ |
123 | asm(op "b %1,"__percpu_seg"%0" \ | 61 | asm(op "b %1,"__percpu_arg(0) \ |
124 | : "+m" (var) \ | 62 | : "+m" (var) \ |
125 | : "ri" ((T__)val)); \ | 63 | : "ri" ((T__)val)); \ |
126 | break; \ | 64 | break; \ |
127 | case 2: \ | 65 | case 2: \ |
128 | asm(op "w %1,"__percpu_seg"%0" \ | 66 | asm(op "w %1,"__percpu_arg(0) \ |
129 | : "+m" (var) \ | 67 | : "+m" (var) \ |
130 | : "ri" ((T__)val)); \ | 68 | : "ri" ((T__)val)); \ |
131 | break; \ | 69 | break; \ |
132 | case 4: \ | 70 | case 4: \ |
133 | asm(op "l %1,"__percpu_seg"%0" \ | 71 | asm(op "l %1,"__percpu_arg(0) \ |
134 | : "+m" (var) \ | 72 | : "+m" (var) \ |
135 | : "ri" ((T__)val)); \ | 73 | : "ri" ((T__)val)); \ |
136 | break; \ | 74 | break; \ |
75 | case 8: \ | ||
76 | asm(op "q %1,"__percpu_arg(0) \ | ||
77 | : "+m" (var) \ | ||
78 | : "re" ((T__)val)); \ | ||
79 | break; \ | ||
137 | default: __bad_percpu_size(); \ | 80 | default: __bad_percpu_size(); \ |
138 | } \ | 81 | } \ |
139 | } while (0) | 82 | } while (0) |
@@ -143,17 +86,22 @@ do { \ | |||
143 | typeof(var) ret__; \ | 86 | typeof(var) ret__; \ |
144 | switch (sizeof(var)) { \ | 87 | switch (sizeof(var)) { \ |
145 | case 1: \ | 88 | case 1: \ |
146 | asm(op "b "__percpu_seg"%1,%0" \ | 89 | asm(op "b "__percpu_arg(1)",%0" \ |
147 | : "=r" (ret__) \ | 90 | : "=r" (ret__) \ |
148 | : "m" (var)); \ | 91 | : "m" (var)); \ |
149 | break; \ | 92 | break; \ |
150 | case 2: \ | 93 | case 2: \ |
151 | asm(op "w "__percpu_seg"%1,%0" \ | 94 | asm(op "w "__percpu_arg(1)",%0" \ |
152 | : "=r" (ret__) \ | 95 | : "=r" (ret__) \ |
153 | : "m" (var)); \ | 96 | : "m" (var)); \ |
154 | break; \ | 97 | break; \ |
155 | case 4: \ | 98 | case 4: \ |
156 | asm(op "l "__percpu_seg"%1,%0" \ | 99 | asm(op "l "__percpu_arg(1)",%0" \ |
100 | : "=r" (ret__) \ | ||
101 | : "m" (var)); \ | ||
102 | break; \ | ||
103 | case 8: \ | ||
104 | asm(op "q "__percpu_arg(1)",%0" \ | ||
157 | : "=r" (ret__) \ | 105 | : "=r" (ret__) \ |
158 | : "m" (var)); \ | 106 | : "m" (var)); \ |
159 | break; \ | 107 | break; \ |
@@ -162,13 +110,30 @@ do { \ | |||
162 | ret__; \ | 110 | ret__; \ |
163 | }) | 111 | }) |
164 | 112 | ||
165 | #define x86_read_percpu(var) percpu_from_op("mov", per_cpu__##var) | 113 | #define percpu_read(var) percpu_from_op("mov", per_cpu__##var) |
166 | #define x86_write_percpu(var, val) percpu_to_op("mov", per_cpu__##var, val) | 114 | #define percpu_write(var, val) percpu_to_op("mov", per_cpu__##var, val) |
167 | #define x86_add_percpu(var, val) percpu_to_op("add", per_cpu__##var, val) | 115 | #define percpu_add(var, val) percpu_to_op("add", per_cpu__##var, val) |
168 | #define x86_sub_percpu(var, val) percpu_to_op("sub", per_cpu__##var, val) | 116 | #define percpu_sub(var, val) percpu_to_op("sub", per_cpu__##var, val) |
169 | #define x86_or_percpu(var, val) percpu_to_op("or", per_cpu__##var, val) | 117 | #define percpu_and(var, val) percpu_to_op("and", per_cpu__##var, val) |
118 | #define percpu_or(var, val) percpu_to_op("or", per_cpu__##var, val) | ||
119 | #define percpu_xor(var, val) percpu_to_op("xor", per_cpu__##var, val) | ||
120 | |||
121 | /* This is not atomic against other CPUs -- CPU preemption needs to be off */ | ||
122 | #define x86_test_and_clear_bit_percpu(bit, var) \ | ||
123 | ({ \ | ||
124 | int old__; \ | ||
125 | asm volatile("btr %2,"__percpu_arg(1)"\n\tsbbl %0,%0" \ | ||
126 | : "=r" (old__), "+m" (per_cpu__##var) \ | ||
127 | : "dIr" (bit)); \ | ||
128 | old__; \ | ||
129 | }) | ||
130 | |||
131 | #include <asm-generic/percpu.h> | ||
132 | |||
133 | /* We can use this directly for local CPU (faster). */ | ||
134 | DECLARE_PER_CPU(unsigned long, this_cpu_off); | ||
135 | |||
170 | #endif /* !__ASSEMBLY__ */ | 136 | #endif /* !__ASSEMBLY__ */ |
171 | #endif /* !CONFIG_X86_64 */ | ||
172 | 137 | ||
173 | #ifdef CONFIG_SMP | 138 | #ifdef CONFIG_SMP |
174 | 139 | ||
@@ -195,9 +160,9 @@ do { \ | |||
195 | #define early_per_cpu_ptr(_name) (_name##_early_ptr) | 160 | #define early_per_cpu_ptr(_name) (_name##_early_ptr) |
196 | #define early_per_cpu_map(_name, _idx) (_name##_early_map[_idx]) | 161 | #define early_per_cpu_map(_name, _idx) (_name##_early_map[_idx]) |
197 | #define early_per_cpu(_name, _cpu) \ | 162 | #define early_per_cpu(_name, _cpu) \ |
198 | (early_per_cpu_ptr(_name) ? \ | 163 | *(early_per_cpu_ptr(_name) ? \ |
199 | early_per_cpu_ptr(_name)[_cpu] : \ | 164 | &early_per_cpu_ptr(_name)[_cpu] : \ |
200 | per_cpu(_name, _cpu)) | 165 | &per_cpu(_name, _cpu)) |
201 | 166 | ||
202 | #else /* !CONFIG_SMP */ | 167 | #else /* !CONFIG_SMP */ |
203 | #define DEFINE_EARLY_PER_CPU(_type, _name, _initvalue) \ | 168 | #define DEFINE_EARLY_PER_CPU(_type, _name, _initvalue) \ |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 4f5af8447d54..6f7c102018bf 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -240,64 +240,78 @@ static inline int pmd_large(pmd_t pte) | |||
240 | (_PAGE_PSE | _PAGE_PRESENT); | 240 | (_PAGE_PSE | _PAGE_PRESENT); |
241 | } | 241 | } |
242 | 242 | ||
243 | static inline pte_t pte_set_flags(pte_t pte, pteval_t set) | ||
244 | { | ||
245 | pteval_t v = native_pte_val(pte); | ||
246 | |||
247 | return native_make_pte(v | set); | ||
248 | } | ||
249 | |||
250 | static inline pte_t pte_clear_flags(pte_t pte, pteval_t clear) | ||
251 | { | ||
252 | pteval_t v = native_pte_val(pte); | ||
253 | |||
254 | return native_make_pte(v & ~clear); | ||
255 | } | ||
256 | |||
243 | static inline pte_t pte_mkclean(pte_t pte) | 257 | static inline pte_t pte_mkclean(pte_t pte) |
244 | { | 258 | { |
245 | return __pte(pte_val(pte) & ~_PAGE_DIRTY); | 259 | return pte_clear_flags(pte, _PAGE_DIRTY); |
246 | } | 260 | } |
247 | 261 | ||
248 | static inline pte_t pte_mkold(pte_t pte) | 262 | static inline pte_t pte_mkold(pte_t pte) |
249 | { | 263 | { |
250 | return __pte(pte_val(pte) & ~_PAGE_ACCESSED); | 264 | return pte_clear_flags(pte, _PAGE_ACCESSED); |
251 | } | 265 | } |
252 | 266 | ||
253 | static inline pte_t pte_wrprotect(pte_t pte) | 267 | static inline pte_t pte_wrprotect(pte_t pte) |
254 | { | 268 | { |
255 | return __pte(pte_val(pte) & ~_PAGE_RW); | 269 | return pte_clear_flags(pte, _PAGE_RW); |
256 | } | 270 | } |
257 | 271 | ||
258 | static inline pte_t pte_mkexec(pte_t pte) | 272 | static inline pte_t pte_mkexec(pte_t pte) |
259 | { | 273 | { |
260 | return __pte(pte_val(pte) & ~_PAGE_NX); | 274 | return pte_clear_flags(pte, _PAGE_NX); |
261 | } | 275 | } |
262 | 276 | ||
263 | static inline pte_t pte_mkdirty(pte_t pte) | 277 | static inline pte_t pte_mkdirty(pte_t pte) |
264 | { | 278 | { |
265 | return __pte(pte_val(pte) | _PAGE_DIRTY); | 279 | return pte_set_flags(pte, _PAGE_DIRTY); |
266 | } | 280 | } |
267 | 281 | ||
268 | static inline pte_t pte_mkyoung(pte_t pte) | 282 | static inline pte_t pte_mkyoung(pte_t pte) |
269 | { | 283 | { |
270 | return __pte(pte_val(pte) | _PAGE_ACCESSED); | 284 | return pte_set_flags(pte, _PAGE_ACCESSED); |
271 | } | 285 | } |
272 | 286 | ||
273 | static inline pte_t pte_mkwrite(pte_t pte) | 287 | static inline pte_t pte_mkwrite(pte_t pte) |
274 | { | 288 | { |
275 | return __pte(pte_val(pte) | _PAGE_RW); | 289 | return pte_set_flags(pte, _PAGE_RW); |
276 | } | 290 | } |
277 | 291 | ||
278 | static inline pte_t pte_mkhuge(pte_t pte) | 292 | static inline pte_t pte_mkhuge(pte_t pte) |
279 | { | 293 | { |
280 | return __pte(pte_val(pte) | _PAGE_PSE); | 294 | return pte_set_flags(pte, _PAGE_PSE); |
281 | } | 295 | } |
282 | 296 | ||
283 | static inline pte_t pte_clrhuge(pte_t pte) | 297 | static inline pte_t pte_clrhuge(pte_t pte) |
284 | { | 298 | { |
285 | return __pte(pte_val(pte) & ~_PAGE_PSE); | 299 | return pte_clear_flags(pte, _PAGE_PSE); |
286 | } | 300 | } |
287 | 301 | ||
288 | static inline pte_t pte_mkglobal(pte_t pte) | 302 | static inline pte_t pte_mkglobal(pte_t pte) |
289 | { | 303 | { |
290 | return __pte(pte_val(pte) | _PAGE_GLOBAL); | 304 | return pte_set_flags(pte, _PAGE_GLOBAL); |
291 | } | 305 | } |
292 | 306 | ||
293 | static inline pte_t pte_clrglobal(pte_t pte) | 307 | static inline pte_t pte_clrglobal(pte_t pte) |
294 | { | 308 | { |
295 | return __pte(pte_val(pte) & ~_PAGE_GLOBAL); | 309 | return pte_clear_flags(pte, _PAGE_GLOBAL); |
296 | } | 310 | } |
297 | 311 | ||
298 | static inline pte_t pte_mkspecial(pte_t pte) | 312 | static inline pte_t pte_mkspecial(pte_t pte) |
299 | { | 313 | { |
300 | return __pte(pte_val(pte) | _PAGE_SPECIAL); | 314 | return pte_set_flags(pte, _PAGE_SPECIAL); |
301 | } | 315 | } |
302 | 316 | ||
303 | extern pteval_t __supported_pte_mask; | 317 | extern pteval_t __supported_pte_mask; |
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h index ba09289accaa..1df9637dfda3 100644 --- a/arch/x86/include/asm/pgtable_64.h +++ b/arch/x86/include/asm/pgtable_64.h | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <asm/processor.h> | 11 | #include <asm/processor.h> |
12 | #include <linux/bitops.h> | 12 | #include <linux/bitops.h> |
13 | #include <linux/threads.h> | 13 | #include <linux/threads.h> |
14 | #include <asm/pda.h> | ||
15 | 14 | ||
16 | extern pud_t level3_kernel_pgt[512]; | 15 | extern pud_t level3_kernel_pgt[512]; |
17 | extern pud_t level3_ident_pgt[512]; | 16 | extern pud_t level3_ident_pgt[512]; |
diff --git a/arch/x86/include/asm/prctl.h b/arch/x86/include/asm/prctl.h index a8894647dd9a..3ac5032fae09 100644 --- a/arch/x86/include/asm/prctl.h +++ b/arch/x86/include/asm/prctl.h | |||
@@ -6,8 +6,4 @@ | |||
6 | #define ARCH_GET_FS 0x1003 | 6 | #define ARCH_GET_FS 0x1003 |
7 | #define ARCH_GET_GS 0x1004 | 7 | #define ARCH_GET_GS 0x1004 |
8 | 8 | ||
9 | #ifdef CONFIG_X86_64 | ||
10 | extern long sys_arch_prctl(int, unsigned long); | ||
11 | #endif /* CONFIG_X86_64 */ | ||
12 | |||
13 | #endif /* _ASM_X86_PRCTL_H */ | 9 | #endif /* _ASM_X86_PRCTL_H */ |
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 091cd8855f2e..84afa0d4d717 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -73,7 +73,7 @@ struct cpuinfo_x86 { | |||
73 | char pad0; | 73 | char pad0; |
74 | #else | 74 | #else |
75 | /* Number of 4K pages in DTLB/ITLB combined(in pages): */ | 75 | /* Number of 4K pages in DTLB/ITLB combined(in pages): */ |
76 | int x86_tlbsize; | 76 | int x86_tlbsize; |
77 | __u8 x86_virt_bits; | 77 | __u8 x86_virt_bits; |
78 | __u8 x86_phys_bits; | 78 | __u8 x86_phys_bits; |
79 | #endif | 79 | #endif |
@@ -378,6 +378,22 @@ union thread_xstate { | |||
378 | 378 | ||
379 | #ifdef CONFIG_X86_64 | 379 | #ifdef CONFIG_X86_64 |
380 | DECLARE_PER_CPU(struct orig_ist, orig_ist); | 380 | DECLARE_PER_CPU(struct orig_ist, orig_ist); |
381 | |||
382 | union irq_stack_union { | ||
383 | char irq_stack[IRQ_STACK_SIZE]; | ||
384 | /* | ||
385 | * GCC hardcodes the stack canary as %gs:40. Since the | ||
386 | * irq_stack is the object at %gs:0, we reserve the bottom | ||
387 | * 48 bytes of the irq stack for the canary. | ||
388 | */ | ||
389 | struct { | ||
390 | char gs_base[40]; | ||
391 | unsigned long stack_canary; | ||
392 | }; | ||
393 | }; | ||
394 | |||
395 | DECLARE_PER_CPU(union irq_stack_union, irq_stack_union); | ||
396 | DECLARE_PER_CPU(char *, irq_stack_ptr); | ||
381 | #endif | 397 | #endif |
382 | 398 | ||
383 | extern void print_cpu_info(struct cpuinfo_x86 *); | 399 | extern void print_cpu_info(struct cpuinfo_x86 *); |
@@ -754,7 +770,6 @@ extern struct desc_ptr early_gdt_descr; | |||
754 | extern void cpu_set_gdt(int); | 770 | extern void cpu_set_gdt(int); |
755 | extern void switch_to_new_gdt(void); | 771 | extern void switch_to_new_gdt(void); |
756 | extern void cpu_init(void); | 772 | extern void cpu_init(void); |
757 | extern void init_gdt(int cpu); | ||
758 | 773 | ||
759 | static inline unsigned long get_debugctlmsr(void) | 774 | static inline unsigned long get_debugctlmsr(void) |
760 | { | 775 | { |
diff --git a/arch/x86/include/asm/proto.h b/arch/x86/include/asm/proto.h index d6a22f92ba77..49fb3ecf3bb3 100644 --- a/arch/x86/include/asm/proto.h +++ b/arch/x86/include/asm/proto.h | |||
@@ -18,11 +18,7 @@ extern void syscall32_cpu_init(void); | |||
18 | 18 | ||
19 | extern void check_efer(void); | 19 | extern void check_efer(void); |
20 | 20 | ||
21 | #ifdef CONFIG_X86_BIOS_REBOOT | ||
22 | extern int reboot_force; | 21 | extern int reboot_force; |
23 | #else | ||
24 | static const int reboot_force = 0; | ||
25 | #endif | ||
26 | 22 | ||
27 | long do_arch_prctl(struct task_struct *task, int code, unsigned long addr); | 23 | long do_arch_prctl(struct task_struct *task, int code, unsigned long addr); |
28 | 24 | ||
diff --git a/arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h b/arch/x86/include/asm/rdc321x_defs.h index c8e9c8bed3d0..c8e9c8bed3d0 100644 --- a/arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h +++ b/arch/x86/include/asm/rdc321x_defs.h | |||
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h index ebe858cdc8a3..45b40278b582 100644 --- a/arch/x86/include/asm/setup.h +++ b/arch/x86/include/asm/setup.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _ASM_X86_SETUP_H | 1 | #ifndef _ASM_X86_SETUP_H |
2 | #define _ASM_X86_SETUP_H | 2 | #define _ASM_X86_SETUP_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
5 | |||
4 | #define COMMAND_LINE_SIZE 2048 | 6 | #define COMMAND_LINE_SIZE 2048 |
5 | 7 | ||
6 | #ifndef __ASSEMBLY__ | 8 | #ifndef __ASSEMBLY__ |
@@ -8,10 +10,8 @@ | |||
8 | /* Interrupt control for vSMPowered x86_64 systems */ | 10 | /* Interrupt control for vSMPowered x86_64 systems */ |
9 | void vsmp_init(void); | 11 | void vsmp_init(void); |
10 | 12 | ||
11 | |||
12 | void setup_bios_corruption_check(void); | 13 | void setup_bios_corruption_check(void); |
13 | 14 | ||
14 | |||
15 | #ifdef CONFIG_X86_VISWS | 15 | #ifdef CONFIG_X86_VISWS |
16 | extern void visws_early_detect(void); | 16 | extern void visws_early_detect(void); |
17 | extern int is_visws_box(void); | 17 | extern int is_visws_box(void); |
@@ -43,7 +43,7 @@ struct x86_quirks { | |||
43 | void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name); | 43 | void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name); |
44 | void (*mpc_oem_pci_bus)(struct mpc_bus *m); | 44 | void (*mpc_oem_pci_bus)(struct mpc_bus *m); |
45 | void (*smp_read_mpc_oem)(struct mpc_oemtable *oemtable, | 45 | void (*smp_read_mpc_oem)(struct mpc_oemtable *oemtable, |
46 | unsigned short oemsize); | 46 | unsigned short oemsize); |
47 | int (*setup_ioapic_ids)(void); | 47 | int (*setup_ioapic_ids)(void); |
48 | int (*update_genapic)(void); | 48 | int (*update_genapic)(void); |
49 | }; | 49 | }; |
@@ -56,8 +56,6 @@ extern unsigned long saved_video_mode; | |||
56 | #endif | 56 | #endif |
57 | #endif /* __ASSEMBLY__ */ | 57 | #endif /* __ASSEMBLY__ */ |
58 | 58 | ||
59 | #ifdef __KERNEL__ | ||
60 | |||
61 | #ifdef __i386__ | 59 | #ifdef __i386__ |
62 | 60 | ||
63 | #include <linux/pfn.h> | 61 | #include <linux/pfn.h> |
@@ -100,7 +98,6 @@ extern unsigned long init_pg_tables_start; | |||
100 | extern unsigned long init_pg_tables_end; | 98 | extern unsigned long init_pg_tables_end; |
101 | 99 | ||
102 | #else | 100 | #else |
103 | void __init x86_64_init_pda(void); | ||
104 | void __init x86_64_start_kernel(char *real_mode); | 101 | void __init x86_64_start_kernel(char *real_mode); |
105 | void __init x86_64_start_reservations(char *real_mode_data); | 102 | void __init x86_64_start_reservations(char *real_mode_data); |
106 | 103 | ||
diff --git a/arch/x86/include/asm/mach-default/setup_arch.h b/arch/x86/include/asm/setup_arch.h index 38846208b548..38846208b548 100644 --- a/arch/x86/include/asm/mach-default/setup_arch.h +++ b/arch/x86/include/asm/setup_arch.h | |||
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 19953df61c52..47d0e21f2b9e 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h | |||
@@ -15,34 +15,8 @@ | |||
15 | # include <asm/io_apic.h> | 15 | # include <asm/io_apic.h> |
16 | # endif | 16 | # endif |
17 | #endif | 17 | #endif |
18 | #include <asm/pda.h> | ||
19 | #include <asm/thread_info.h> | 18 | #include <asm/thread_info.h> |
20 | 19 | #include <asm/cpumask.h> | |
21 | #ifdef CONFIG_X86_64 | ||
22 | |||
23 | extern cpumask_var_t cpu_callin_mask; | ||
24 | extern cpumask_var_t cpu_callout_mask; | ||
25 | extern cpumask_var_t cpu_initialized_mask; | ||
26 | extern cpumask_var_t cpu_sibling_setup_mask; | ||
27 | |||
28 | #else /* CONFIG_X86_32 */ | ||
29 | |||
30 | extern cpumask_t cpu_callin_map; | ||
31 | extern cpumask_t cpu_callout_map; | ||
32 | extern cpumask_t cpu_initialized; | ||
33 | extern cpumask_t cpu_sibling_setup_map; | ||
34 | |||
35 | #define cpu_callin_mask ((struct cpumask *)&cpu_callin_map) | ||
36 | #define cpu_callout_mask ((struct cpumask *)&cpu_callout_map) | ||
37 | #define cpu_initialized_mask ((struct cpumask *)&cpu_initialized) | ||
38 | #define cpu_sibling_setup_mask ((struct cpumask *)&cpu_sibling_setup_map) | ||
39 | |||
40 | #endif /* CONFIG_X86_32 */ | ||
41 | |||
42 | extern void (*mtrr_hook)(void); | ||
43 | extern void zap_low_mappings(void); | ||
44 | |||
45 | extern int __cpuinit get_local_pda(int cpu); | ||
46 | 20 | ||
47 | extern int smp_num_siblings; | 21 | extern int smp_num_siblings; |
48 | extern unsigned int num_processors; | 22 | extern unsigned int num_processors; |
@@ -50,9 +24,7 @@ extern unsigned int num_processors; | |||
50 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); | 24 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); |
51 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); | 25 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); |
52 | DECLARE_PER_CPU(u16, cpu_llc_id); | 26 | DECLARE_PER_CPU(u16, cpu_llc_id); |
53 | #ifdef CONFIG_X86_32 | ||
54 | DECLARE_PER_CPU(int, cpu_number); | 27 | DECLARE_PER_CPU(int, cpu_number); |
55 | #endif | ||
56 | 28 | ||
57 | static inline struct cpumask *cpu_sibling_mask(int cpu) | 29 | static inline struct cpumask *cpu_sibling_mask(int cpu) |
58 | { | 30 | { |
@@ -167,8 +139,6 @@ void play_dead_common(void); | |||
167 | void native_send_call_func_ipi(const struct cpumask *mask); | 139 | void native_send_call_func_ipi(const struct cpumask *mask); |
168 | void native_send_call_func_single_ipi(int cpu); | 140 | void native_send_call_func_single_ipi(int cpu); |
169 | 141 | ||
170 | extern void prefill_possible_map(void); | ||
171 | |||
172 | void smp_store_cpu_info(int id); | 142 | void smp_store_cpu_info(int id); |
173 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) | 143 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) |
174 | 144 | ||
@@ -177,10 +147,6 @@ static inline int num_booting_cpus(void) | |||
177 | { | 147 | { |
178 | return cpumask_weight(cpu_callout_mask); | 148 | return cpumask_weight(cpu_callout_mask); |
179 | } | 149 | } |
180 | #else | ||
181 | static inline void prefill_possible_map(void) | ||
182 | { | ||
183 | } | ||
184 | #endif /* CONFIG_SMP */ | 150 | #endif /* CONFIG_SMP */ |
185 | 151 | ||
186 | extern unsigned disabled_cpus __cpuinitdata; | 152 | extern unsigned disabled_cpus __cpuinitdata; |
@@ -191,11 +157,11 @@ extern unsigned disabled_cpus __cpuinitdata; | |||
191 | * from the initial startup. We map APIC_BASE very early in page_setup(), | 157 | * from the initial startup. We map APIC_BASE very early in page_setup(), |
192 | * so this is correct in the x86 case. | 158 | * so this is correct in the x86 case. |
193 | */ | 159 | */ |
194 | #define raw_smp_processor_id() (x86_read_percpu(cpu_number)) | 160 | #define raw_smp_processor_id() (percpu_read(cpu_number)) |
195 | extern int safe_smp_processor_id(void); | 161 | extern int safe_smp_processor_id(void); |
196 | 162 | ||
197 | #elif defined(CONFIG_X86_64_SMP) | 163 | #elif defined(CONFIG_X86_64_SMP) |
198 | #define raw_smp_processor_id() read_pda(cpunumber) | 164 | #define raw_smp_processor_id() (percpu_read(cpu_number)) |
199 | 165 | ||
200 | #define stack_smp_processor_id() \ | 166 | #define stack_smp_processor_id() \ |
201 | ({ \ | 167 | ({ \ |
@@ -205,10 +171,6 @@ extern int safe_smp_processor_id(void); | |||
205 | }) | 171 | }) |
206 | #define safe_smp_processor_id() smp_processor_id() | 172 | #define safe_smp_processor_id() smp_processor_id() |
207 | 173 | ||
208 | #else /* !CONFIG_X86_32_SMP && !CONFIG_X86_64_SMP */ | ||
209 | #define cpu_physical_id(cpu) boot_cpu_physical_apicid | ||
210 | #define safe_smp_processor_id() 0 | ||
211 | #define stack_smp_processor_id() 0 | ||
212 | #endif | 174 | #endif |
213 | 175 | ||
214 | #ifdef CONFIG_X86_LOCAL_APIC | 176 | #ifdef CONFIG_X86_LOCAL_APIC |
@@ -220,28 +182,9 @@ static inline int logical_smp_processor_id(void) | |||
220 | return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR)); | 182 | return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR)); |
221 | } | 183 | } |
222 | 184 | ||
223 | #include <mach_apicdef.h> | ||
224 | static inline unsigned int read_apic_id(void) | ||
225 | { | ||
226 | unsigned int reg; | ||
227 | |||
228 | reg = *(u32 *)(APIC_BASE + APIC_ID); | ||
229 | |||
230 | return GET_APIC_ID(reg); | ||
231 | } | ||
232 | #endif | 185 | #endif |
233 | 186 | ||
234 | |||
235 | # if defined(APIC_DEFINITION) || defined(CONFIG_X86_64) | ||
236 | extern int hard_smp_processor_id(void); | 187 | extern int hard_smp_processor_id(void); |
237 | # else | ||
238 | #include <mach_apicdef.h> | ||
239 | static inline int hard_smp_processor_id(void) | ||
240 | { | ||
241 | /* we don't want to mark this access volatile - bad code generation */ | ||
242 | return read_apic_id(); | ||
243 | } | ||
244 | # endif /* APIC_DEFINITION */ | ||
245 | 188 | ||
246 | #else /* CONFIG_X86_LOCAL_APIC */ | 189 | #else /* CONFIG_X86_LOCAL_APIC */ |
247 | 190 | ||
@@ -251,11 +194,5 @@ static inline int hard_smp_processor_id(void) | |||
251 | 194 | ||
252 | #endif /* CONFIG_X86_LOCAL_APIC */ | 195 | #endif /* CONFIG_X86_LOCAL_APIC */ |
253 | 196 | ||
254 | #ifdef CONFIG_X86_HAS_BOOT_CPU_ID | ||
255 | extern unsigned char boot_cpu_id; | ||
256 | #else | ||
257 | #define boot_cpu_id 0 | ||
258 | #endif | ||
259 | |||
260 | #endif /* __ASSEMBLY__ */ | 197 | #endif /* __ASSEMBLY__ */ |
261 | #endif /* _ASM_X86_SMP_H */ | 198 | #endif /* _ASM_X86_SMP_H */ |
diff --git a/arch/x86/include/asm/mach-default/smpboot_hooks.h b/arch/x86/include/asm/smpboot_hooks.h index 23bf52103b89..1def60114906 100644 --- a/arch/x86/include/asm/mach-default/smpboot_hooks.h +++ b/arch/x86/include/asm/smpboot_hooks.h | |||
@@ -13,10 +13,10 @@ static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip) | |||
13 | CMOS_WRITE(0xa, 0xf); | 13 | CMOS_WRITE(0xa, 0xf); |
14 | local_flush_tlb(); | 14 | local_flush_tlb(); |
15 | pr_debug("1.\n"); | 15 | pr_debug("1.\n"); |
16 | *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_HIGH)) = | 16 | *((volatile unsigned short *)phys_to_virt(apic->trampoline_phys_high)) = |
17 | start_eip >> 4; | 17 | start_eip >> 4; |
18 | pr_debug("2.\n"); | 18 | pr_debug("2.\n"); |
19 | *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = | 19 | *((volatile unsigned short *)phys_to_virt(apic->trampoline_phys_low)) = |
20 | start_eip & 0xf; | 20 | start_eip & 0xf; |
21 | pr_debug("3.\n"); | 21 | pr_debug("3.\n"); |
22 | } | 22 | } |
@@ -34,7 +34,7 @@ static inline void smpboot_restore_warm_reset_vector(void) | |||
34 | */ | 34 | */ |
35 | CMOS_WRITE(0, 0xf); | 35 | CMOS_WRITE(0, 0xf); |
36 | 36 | ||
37 | *((volatile long *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = 0; | 37 | *((volatile long *)phys_to_virt(apic->trampoline_phys_low)) = 0; |
38 | } | 38 | } |
39 | 39 | ||
40 | static inline void __init smpboot_setup_io_apic(void) | 40 | static inline void __init smpboot_setup_io_apic(void) |
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h index d17c91981da2..139b4249a5ec 100644 --- a/arch/x86/include/asm/spinlock.h +++ b/arch/x86/include/asm/spinlock.h | |||
@@ -172,70 +172,8 @@ static inline int __ticket_spin_is_contended(raw_spinlock_t *lock) | |||
172 | return (((tmp >> TICKET_SHIFT) - tmp) & ((1 << TICKET_SHIFT) - 1)) > 1; | 172 | return (((tmp >> TICKET_SHIFT) - tmp) & ((1 << TICKET_SHIFT) - 1)) > 1; |
173 | } | 173 | } |
174 | 174 | ||
175 | #ifdef CONFIG_PARAVIRT | 175 | #ifndef CONFIG_PARAVIRT |
176 | /* | ||
177 | * Define virtualization-friendly old-style lock byte lock, for use in | ||
178 | * pv_lock_ops if desired. | ||
179 | * | ||
180 | * This differs from the pre-2.6.24 spinlock by always using xchgb | ||
181 | * rather than decb to take the lock; this allows it to use a | ||
182 | * zero-initialized lock structure. It also maintains a 1-byte | ||
183 | * contention counter, so that we can implement | ||
184 | * __byte_spin_is_contended. | ||
185 | */ | ||
186 | struct __byte_spinlock { | ||
187 | s8 lock; | ||
188 | s8 spinners; | ||
189 | }; | ||
190 | |||
191 | static inline int __byte_spin_is_locked(raw_spinlock_t *lock) | ||
192 | { | ||
193 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
194 | return bl->lock != 0; | ||
195 | } | ||
196 | |||
197 | static inline int __byte_spin_is_contended(raw_spinlock_t *lock) | ||
198 | { | ||
199 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
200 | return bl->spinners != 0; | ||
201 | } | ||
202 | |||
203 | static inline void __byte_spin_lock(raw_spinlock_t *lock) | ||
204 | { | ||
205 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
206 | s8 val = 1; | ||
207 | |||
208 | asm("1: xchgb %1, %0\n" | ||
209 | " test %1,%1\n" | ||
210 | " jz 3f\n" | ||
211 | " " LOCK_PREFIX "incb %2\n" | ||
212 | "2: rep;nop\n" | ||
213 | " cmpb $1, %0\n" | ||
214 | " je 2b\n" | ||
215 | " " LOCK_PREFIX "decb %2\n" | ||
216 | " jmp 1b\n" | ||
217 | "3:" | ||
218 | : "+m" (bl->lock), "+q" (val), "+m" (bl->spinners): : "memory"); | ||
219 | } | ||
220 | |||
221 | static inline int __byte_spin_trylock(raw_spinlock_t *lock) | ||
222 | { | ||
223 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
224 | u8 old = 1; | ||
225 | |||
226 | asm("xchgb %1,%0" | ||
227 | : "+m" (bl->lock), "+q" (old) : : "memory"); | ||
228 | 176 | ||
229 | return old == 0; | ||
230 | } | ||
231 | |||
232 | static inline void __byte_spin_unlock(raw_spinlock_t *lock) | ||
233 | { | ||
234 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
235 | smp_wmb(); | ||
236 | bl->lock = 0; | ||
237 | } | ||
238 | #else /* !CONFIG_PARAVIRT */ | ||
239 | static inline int __raw_spin_is_locked(raw_spinlock_t *lock) | 177 | static inline int __raw_spin_is_locked(raw_spinlock_t *lock) |
240 | { | 178 | { |
241 | return __ticket_spin_is_locked(lock); | 179 | return __ticket_spin_is_locked(lock); |
@@ -267,7 +205,7 @@ static __always_inline void __raw_spin_lock_flags(raw_spinlock_t *lock, | |||
267 | __raw_spin_lock(lock); | 205 | __raw_spin_lock(lock); |
268 | } | 206 | } |
269 | 207 | ||
270 | #endif /* CONFIG_PARAVIRT */ | 208 | #endif |
271 | 209 | ||
272 | static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock) | 210 | static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock) |
273 | { | 211 | { |
@@ -329,8 +267,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *lock) | |||
329 | { | 267 | { |
330 | atomic_t *count = (atomic_t *)lock; | 268 | atomic_t *count = (atomic_t *)lock; |
331 | 269 | ||
332 | atomic_dec(count); | 270 | if (atomic_dec_return(count) >= 0) |
333 | if (atomic_read(count) >= 0) | ||
334 | return 1; | 271 | return 1; |
335 | atomic_inc(count); | 272 | atomic_inc(count); |
336 | return 0; | 273 | return 0; |
diff --git a/arch/x86/include/asm/stackprotector.h b/arch/x86/include/asm/stackprotector.h new file mode 100644 index 000000000000..36a700acaf2b --- /dev/null +++ b/arch/x86/include/asm/stackprotector.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef _ASM_STACKPROTECTOR_H | ||
2 | #define _ASM_STACKPROTECTOR_H 1 | ||
3 | |||
4 | #include <asm/tsc.h> | ||
5 | #include <asm/processor.h> | ||
6 | |||
7 | /* | ||
8 | * Initialize the stackprotector canary value. | ||
9 | * | ||
10 | * NOTE: this must only be called from functions that never return, | ||
11 | * and it must always be inlined. | ||
12 | */ | ||
13 | static __always_inline void boot_init_stack_canary(void) | ||
14 | { | ||
15 | u64 canary; | ||
16 | u64 tsc; | ||
17 | |||
18 | /* | ||
19 | * Build time only check to make sure the stack_canary is at | ||
20 | * offset 40 in the pda; this is a gcc ABI requirement | ||
21 | */ | ||
22 | BUILD_BUG_ON(offsetof(union irq_stack_union, stack_canary) != 40); | ||
23 | |||
24 | /* | ||
25 | * We both use the random pool and the current TSC as a source | ||
26 | * of randomness. The TSC only matters for very early init, | ||
27 | * there it already has some randomness on most systems. Later | ||
28 | * on during the bootup the random pool has true entropy too. | ||
29 | */ | ||
30 | get_random_bytes(&canary, sizeof(canary)); | ||
31 | tsc = __native_read_tsc(); | ||
32 | canary += tsc + (tsc << 32UL); | ||
33 | |||
34 | current->stack_canary = canary; | ||
35 | percpu_write(irq_stack_union.stack_canary, canary); | ||
36 | } | ||
37 | |||
38 | #endif | ||
diff --git a/arch/x86/include/asm/summit/apic.h b/arch/x86/include/asm/summit/apic.h deleted file mode 100644 index 93d2c8667cfe..000000000000 --- a/arch/x86/include/asm/summit/apic.h +++ /dev/null | |||
@@ -1,202 +0,0 @@ | |||
1 | #ifndef __ASM_SUMMIT_APIC_H | ||
2 | #define __ASM_SUMMIT_APIC_H | ||
3 | |||
4 | #include <asm/smp.h> | ||
5 | #include <linux/gfp.h> | ||
6 | |||
7 | #define esr_disable (1) | ||
8 | #define NO_BALANCE_IRQ (0) | ||
9 | |||
10 | /* In clustered mode, the high nibble of APIC ID is a cluster number. | ||
11 | * The low nibble is a 4-bit bitmap. */ | ||
12 | #define XAPIC_DEST_CPUS_SHIFT 4 | ||
13 | #define XAPIC_DEST_CPUS_MASK ((1u << XAPIC_DEST_CPUS_SHIFT) - 1) | ||
14 | #define XAPIC_DEST_CLUSTER_MASK (XAPIC_DEST_CPUS_MASK << XAPIC_DEST_CPUS_SHIFT) | ||
15 | |||
16 | #define APIC_DFR_VALUE (APIC_DFR_CLUSTER) | ||
17 | |||
18 | static inline const cpumask_t *target_cpus(void) | ||
19 | { | ||
20 | /* CPU_MASK_ALL (0xff) has undefined behaviour with | ||
21 | * dest_LowestPrio mode logical clustered apic interrupt routing | ||
22 | * Just start on cpu 0. IRQ balancing will spread load | ||
23 | */ | ||
24 | return &cpumask_of_cpu(0); | ||
25 | } | ||
26 | |||
27 | #define INT_DELIVERY_MODE (dest_LowestPrio) | ||
28 | #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ | ||
29 | |||
30 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) | ||
31 | { | ||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | /* we don't use the phys_cpu_present_map to indicate apicid presence */ | ||
36 | static inline unsigned long check_apicid_present(int bit) | ||
37 | { | ||
38 | return 1; | ||
39 | } | ||
40 | |||
41 | #define apicid_cluster(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK) | ||
42 | |||
43 | extern u8 cpu_2_logical_apicid[]; | ||
44 | |||
45 | static inline void init_apic_ldr(void) | ||
46 | { | ||
47 | unsigned long val, id; | ||
48 | int count = 0; | ||
49 | u8 my_id = (u8)hard_smp_processor_id(); | ||
50 | u8 my_cluster = (u8)apicid_cluster(my_id); | ||
51 | #ifdef CONFIG_SMP | ||
52 | u8 lid; | ||
53 | int i; | ||
54 | |||
55 | /* Create logical APIC IDs by counting CPUs already in cluster. */ | ||
56 | for (count = 0, i = nr_cpu_ids; --i >= 0; ) { | ||
57 | lid = cpu_2_logical_apicid[i]; | ||
58 | if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster) | ||
59 | ++count; | ||
60 | } | ||
61 | #endif | ||
62 | /* We only have a 4 wide bitmap in cluster mode. If a deranged | ||
63 | * BIOS puts 5 CPUs in one APIC cluster, we're hosed. */ | ||
64 | BUG_ON(count >= XAPIC_DEST_CPUS_SHIFT); | ||
65 | id = my_cluster | (1UL << count); | ||
66 | apic_write(APIC_DFR, APIC_DFR_VALUE); | ||
67 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | ||
68 | val |= SET_APIC_LOGICAL_ID(id); | ||
69 | apic_write(APIC_LDR, val); | ||
70 | } | ||
71 | |||
72 | static inline int multi_timer_check(int apic, int irq) | ||
73 | { | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static inline int apic_id_registered(void) | ||
78 | { | ||
79 | return 1; | ||
80 | } | ||
81 | |||
82 | static inline void setup_apic_routing(void) | ||
83 | { | ||
84 | printk("Enabling APIC mode: Summit. Using %d I/O APICs\n", | ||
85 | nr_ioapics); | ||
86 | } | ||
87 | |||
88 | static inline int apicid_to_node(int logical_apicid) | ||
89 | { | ||
90 | #ifdef CONFIG_SMP | ||
91 | return apicid_2_node[hard_smp_processor_id()]; | ||
92 | #else | ||
93 | return 0; | ||
94 | #endif | ||
95 | } | ||
96 | |||
97 | /* Mapping from cpu number to logical apicid */ | ||
98 | static inline int cpu_to_logical_apicid(int cpu) | ||
99 | { | ||
100 | #ifdef CONFIG_SMP | ||
101 | if (cpu >= nr_cpu_ids) | ||
102 | return BAD_APICID; | ||
103 | return (int)cpu_2_logical_apicid[cpu]; | ||
104 | #else | ||
105 | return logical_smp_processor_id(); | ||
106 | #endif | ||
107 | } | ||
108 | |||
109 | static inline int cpu_present_to_apicid(int mps_cpu) | ||
110 | { | ||
111 | if (mps_cpu < nr_cpu_ids) | ||
112 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
113 | else | ||
114 | return BAD_APICID; | ||
115 | } | ||
116 | |||
117 | static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_id_map) | ||
118 | { | ||
119 | /* For clustered we don't have a good way to do this yet - hack */ | ||
120 | return physids_promote(0x0F); | ||
121 | } | ||
122 | |||
123 | static inline physid_mask_t apicid_to_cpu_present(int apicid) | ||
124 | { | ||
125 | return physid_mask_of_physid(0); | ||
126 | } | ||
127 | |||
128 | static inline void setup_portio_remap(void) | ||
129 | { | ||
130 | } | ||
131 | |||
132 | static inline int check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
133 | { | ||
134 | return 1; | ||
135 | } | ||
136 | |||
137 | static inline void enable_apic_mode(void) | ||
138 | { | ||
139 | } | ||
140 | |||
141 | static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) | ||
142 | { | ||
143 | int num_bits_set; | ||
144 | int cpus_found = 0; | ||
145 | int cpu; | ||
146 | int apicid; | ||
147 | |||
148 | num_bits_set = cpus_weight(*cpumask); | ||
149 | /* Return id to all */ | ||
150 | if (num_bits_set >= nr_cpu_ids) | ||
151 | return (int) 0xFF; | ||
152 | /* | ||
153 | * The cpus in the mask must all be on the apic cluster. If are not | ||
154 | * on the same apicid cluster return default value of TARGET_CPUS. | ||
155 | */ | ||
156 | cpu = first_cpu(*cpumask); | ||
157 | apicid = cpu_to_logical_apicid(cpu); | ||
158 | while (cpus_found < num_bits_set) { | ||
159 | if (cpu_isset(cpu, *cpumask)) { | ||
160 | int new_apicid = cpu_to_logical_apicid(cpu); | ||
161 | if (apicid_cluster(apicid) != | ||
162 | apicid_cluster(new_apicid)){ | ||
163 | printk ("%s: Not a valid mask!\n", __func__); | ||
164 | return 0xFF; | ||
165 | } | ||
166 | apicid = apicid | new_apicid; | ||
167 | cpus_found++; | ||
168 | } | ||
169 | cpu++; | ||
170 | } | ||
171 | return apicid; | ||
172 | } | ||
173 | |||
174 | static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, | ||
175 | const struct cpumask *andmask) | ||
176 | { | ||
177 | int apicid = cpu_to_logical_apicid(0); | ||
178 | cpumask_var_t cpumask; | ||
179 | |||
180 | if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC)) | ||
181 | return apicid; | ||
182 | |||
183 | cpumask_and(cpumask, inmask, andmask); | ||
184 | cpumask_and(cpumask, cpumask, cpu_online_mask); | ||
185 | apicid = cpu_mask_to_apicid(cpumask); | ||
186 | |||
187 | free_cpumask_var(cpumask); | ||
188 | return apicid; | ||
189 | } | ||
190 | |||
191 | /* cpuid returns the value latched in the HW at reset, not the APIC ID | ||
192 | * register's value. For any box whose BIOS changes APIC IDs, like | ||
193 | * clustered APIC systems, we must use hard_smp_processor_id. | ||
194 | * | ||
195 | * See Intel's IA-32 SW Dev's Manual Vol2 under CPUID. | ||
196 | */ | ||
197 | static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) | ||
198 | { | ||
199 | return hard_smp_processor_id() >> index_msb; | ||
200 | } | ||
201 | |||
202 | #endif /* __ASM_SUMMIT_APIC_H */ | ||
diff --git a/arch/x86/include/asm/summit/apicdef.h b/arch/x86/include/asm/summit/apicdef.h deleted file mode 100644 index f3fbca1f61c1..000000000000 --- a/arch/x86/include/asm/summit/apicdef.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #ifndef __ASM_SUMMIT_APICDEF_H | ||
2 | #define __ASM_SUMMIT_APICDEF_H | ||
3 | |||
4 | #define APIC_ID_MASK (0xFF<<24) | ||
5 | |||
6 | static inline unsigned get_apic_id(unsigned long x) | ||
7 | { | ||
8 | return (x>>24)&0xFF; | ||
9 | } | ||
10 | |||
11 | #define GET_APIC_ID(x) get_apic_id(x) | ||
12 | |||
13 | #endif | ||
diff --git a/arch/x86/include/asm/summit/ipi.h b/arch/x86/include/asm/summit/ipi.h deleted file mode 100644 index a8a2c24f50cc..000000000000 --- a/arch/x86/include/asm/summit/ipi.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | #ifndef __ASM_SUMMIT_IPI_H | ||
2 | #define __ASM_SUMMIT_IPI_H | ||
3 | |||
4 | void send_IPI_mask_sequence(const cpumask_t *mask, int vector); | ||
5 | void send_IPI_mask_allbutself(const cpumask_t *mask, int vector); | ||
6 | |||
7 | static inline void send_IPI_mask(const cpumask_t *mask, int vector) | ||
8 | { | ||
9 | send_IPI_mask_sequence(mask, vector); | ||
10 | } | ||
11 | |||
12 | static inline void send_IPI_allbutself(int vector) | ||
13 | { | ||
14 | cpumask_t mask = cpu_online_map; | ||
15 | cpu_clear(smp_processor_id(), mask); | ||
16 | |||
17 | if (!cpus_empty(mask)) | ||
18 | send_IPI_mask(&mask, vector); | ||
19 | } | ||
20 | |||
21 | static inline void send_IPI_all(int vector) | ||
22 | { | ||
23 | send_IPI_mask(&cpu_online_map, vector); | ||
24 | } | ||
25 | |||
26 | #endif /* __ASM_SUMMIT_IPI_H */ | ||
diff --git a/arch/x86/include/asm/summit/mpparse.h b/arch/x86/include/asm/summit/mpparse.h deleted file mode 100644 index 380e86c02363..000000000000 --- a/arch/x86/include/asm/summit/mpparse.h +++ /dev/null | |||
@@ -1,109 +0,0 @@ | |||
1 | #ifndef __ASM_SUMMIT_MPPARSE_H | ||
2 | #define __ASM_SUMMIT_MPPARSE_H | ||
3 | |||
4 | #include <asm/tsc.h> | ||
5 | |||
6 | extern int use_cyclone; | ||
7 | |||
8 | #ifdef CONFIG_X86_SUMMIT_NUMA | ||
9 | extern void setup_summit(void); | ||
10 | #else | ||
11 | #define setup_summit() {} | ||
12 | #endif | ||
13 | |||
14 | static inline int mps_oem_check(struct mpc_table *mpc, char *oem, | ||
15 | char *productid) | ||
16 | { | ||
17 | if (!strncmp(oem, "IBM ENSW", 8) && | ||
18 | (!strncmp(productid, "VIGIL SMP", 9) | ||
19 | || !strncmp(productid, "EXA", 3) | ||
20 | || !strncmp(productid, "RUTHLESS SMP", 12))){ | ||
21 | mark_tsc_unstable("Summit based system"); | ||
22 | use_cyclone = 1; /*enable cyclone-timer*/ | ||
23 | setup_summit(); | ||
24 | return 1; | ||
25 | } | ||
26 | return 0; | ||
27 | } | ||
28 | |||
29 | /* Hook from generic ACPI tables.c */ | ||
30 | static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
31 | { | ||
32 | if (!strncmp(oem_id, "IBM", 3) && | ||
33 | (!strncmp(oem_table_id, "SERVIGIL", 8) | ||
34 | || !strncmp(oem_table_id, "EXA", 3))){ | ||
35 | mark_tsc_unstable("Summit based system"); | ||
36 | use_cyclone = 1; /*enable cyclone-timer*/ | ||
37 | setup_summit(); | ||
38 | return 1; | ||
39 | } | ||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | struct rio_table_hdr { | ||
44 | unsigned char version; /* Version number of this data structure */ | ||
45 | /* Version 3 adds chassis_num & WP_index */ | ||
46 | unsigned char num_scal_dev; /* # of Scalability devices (Twisters for Vigil) */ | ||
47 | unsigned char num_rio_dev; /* # of RIO I/O devices (Cyclones and Winnipegs) */ | ||
48 | } __attribute__((packed)); | ||
49 | |||
50 | struct scal_detail { | ||
51 | unsigned char node_id; /* Scalability Node ID */ | ||
52 | unsigned long CBAR; /* Address of 1MB register space */ | ||
53 | unsigned char port0node; /* Node ID port connected to: 0xFF=None */ | ||
54 | unsigned char port0port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
55 | unsigned char port1node; /* Node ID port connected to: 0xFF = None */ | ||
56 | unsigned char port1port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
57 | unsigned char port2node; /* Node ID port connected to: 0xFF = None */ | ||
58 | unsigned char port2port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
59 | unsigned char chassis_num; /* 1 based Chassis number (1 = boot node) */ | ||
60 | } __attribute__((packed)); | ||
61 | |||
62 | struct rio_detail { | ||
63 | unsigned char node_id; /* RIO Node ID */ | ||
64 | unsigned long BBAR; /* Address of 1MB register space */ | ||
65 | unsigned char type; /* Type of device */ | ||
66 | unsigned char owner_id; /* For WPEG: Node ID of Cyclone that owns this WPEG*/ | ||
67 | /* For CYC: Node ID of Twister that owns this CYC */ | ||
68 | unsigned char port0node; /* Node ID port connected to: 0xFF=None */ | ||
69 | unsigned char port0port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
70 | unsigned char port1node; /* Node ID port connected to: 0xFF=None */ | ||
71 | unsigned char port1port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
72 | unsigned char first_slot; /* For WPEG: Lowest slot number below this WPEG */ | ||
73 | /* For CYC: 0 */ | ||
74 | unsigned char status; /* For WPEG: Bit 0 = 1 : the XAPIC is used */ | ||
75 | /* = 0 : the XAPIC is not used, ie:*/ | ||
76 | /* ints fwded to another XAPIC */ | ||
77 | /* Bits1:7 Reserved */ | ||
78 | /* For CYC: Bits0:7 Reserved */ | ||
79 | unsigned char WP_index; /* For WPEG: WPEG instance index - lower ones have */ | ||
80 | /* lower slot numbers/PCI bus numbers */ | ||
81 | /* For CYC: No meaning */ | ||
82 | unsigned char chassis_num; /* 1 based Chassis number */ | ||
83 | /* For LookOut WPEGs this field indicates the */ | ||
84 | /* Expansion Chassis #, enumerated from Boot */ | ||
85 | /* Node WPEG external port, then Boot Node CYC */ | ||
86 | /* external port, then Next Vigil chassis WPEG */ | ||
87 | /* external port, etc. */ | ||
88 | /* Shared Lookouts have only 1 chassis number (the */ | ||
89 | /* first one assigned) */ | ||
90 | } __attribute__((packed)); | ||
91 | |||
92 | |||
93 | typedef enum { | ||
94 | CompatTwister = 0, /* Compatibility Twister */ | ||
95 | AltTwister = 1, /* Alternate Twister of internal 8-way */ | ||
96 | CompatCyclone = 2, /* Compatibility Cyclone */ | ||
97 | AltCyclone = 3, /* Alternate Cyclone of internal 8-way */ | ||
98 | CompatWPEG = 4, /* Compatibility WPEG */ | ||
99 | AltWPEG = 5, /* Second Planar WPEG */ | ||
100 | LookOutAWPEG = 6, /* LookOut WPEG */ | ||
101 | LookOutBWPEG = 7, /* LookOut WPEG */ | ||
102 | } node_type; | ||
103 | |||
104 | static inline int is_WPEG(struct rio_detail *rio){ | ||
105 | return (rio->type == CompatWPEG || rio->type == AltWPEG || | ||
106 | rio->type == LookOutAWPEG || rio->type == LookOutBWPEG); | ||
107 | } | ||
108 | |||
109 | #endif /* __ASM_SUMMIT_MPPARSE_H */ | ||
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h index 8e626ea33a1a..c22383743f36 100644 --- a/arch/x86/include/asm/system.h +++ b/arch/x86/include/asm/system.h | |||
@@ -86,27 +86,44 @@ do { \ | |||
86 | , "rcx", "rbx", "rdx", "r8", "r9", "r10", "r11", \ | 86 | , "rcx", "rbx", "rdx", "r8", "r9", "r10", "r11", \ |
87 | "r12", "r13", "r14", "r15" | 87 | "r12", "r13", "r14", "r15" |
88 | 88 | ||
89 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
90 | #define __switch_canary \ | ||
91 | "movq %P[task_canary](%%rsi),%%r8\n\t" \ | ||
92 | "movq %%r8,"__percpu_arg([gs_canary])"\n\t" | ||
93 | #define __switch_canary_oparam \ | ||
94 | , [gs_canary] "=m" (per_cpu_var(irq_stack_union.stack_canary)) | ||
95 | #define __switch_canary_iparam \ | ||
96 | , [task_canary] "i" (offsetof(struct task_struct, stack_canary)) | ||
97 | #else /* CC_STACKPROTECTOR */ | ||
98 | #define __switch_canary | ||
99 | #define __switch_canary_oparam | ||
100 | #define __switch_canary_iparam | ||
101 | #endif /* CC_STACKPROTECTOR */ | ||
102 | |||
89 | /* Save restore flags to clear handle leaking NT */ | 103 | /* Save restore flags to clear handle leaking NT */ |
90 | #define switch_to(prev, next, last) \ | 104 | #define switch_to(prev, next, last) \ |
91 | asm volatile(SAVE_CONTEXT \ | 105 | asm volatile(SAVE_CONTEXT \ |
92 | "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ | 106 | "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ |
93 | "movq %P[threadrsp](%[next]),%%rsp\n\t" /* restore RSP */ \ | 107 | "movq %P[threadrsp](%[next]),%%rsp\n\t" /* restore RSP */ \ |
94 | "call __switch_to\n\t" \ | 108 | "call __switch_to\n\t" \ |
95 | ".globl thread_return\n" \ | 109 | ".globl thread_return\n" \ |
96 | "thread_return:\n\t" \ | 110 | "thread_return:\n\t" \ |
97 | "movq %%gs:%P[pda_pcurrent],%%rsi\n\t" \ | 111 | "movq "__percpu_arg([current_task])",%%rsi\n\t" \ |
112 | __switch_canary \ | ||
98 | "movq %P[thread_info](%%rsi),%%r8\n\t" \ | 113 | "movq %P[thread_info](%%rsi),%%r8\n\t" \ |
99 | LOCK_PREFIX "btr %[tif_fork],%P[ti_flags](%%r8)\n\t" \ | ||
100 | "movq %%rax,%%rdi\n\t" \ | 114 | "movq %%rax,%%rdi\n\t" \ |
101 | "jc ret_from_fork\n\t" \ | 115 | "testl %[_tif_fork],%P[ti_flags](%%r8)\n\t" \ |
116 | "jnz ret_from_fork\n\t" \ | ||
102 | RESTORE_CONTEXT \ | 117 | RESTORE_CONTEXT \ |
103 | : "=a" (last) \ | 118 | : "=a" (last) \ |
119 | __switch_canary_oparam \ | ||
104 | : [next] "S" (next), [prev] "D" (prev), \ | 120 | : [next] "S" (next), [prev] "D" (prev), \ |
105 | [threadrsp] "i" (offsetof(struct task_struct, thread.sp)), \ | 121 | [threadrsp] "i" (offsetof(struct task_struct, thread.sp)), \ |
106 | [ti_flags] "i" (offsetof(struct thread_info, flags)), \ | 122 | [ti_flags] "i" (offsetof(struct thread_info, flags)), \ |
107 | [tif_fork] "i" (TIF_FORK), \ | 123 | [_tif_fork] "i" (_TIF_FORK), \ |
108 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ | 124 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ |
109 | [pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent)) \ | 125 | [current_task] "m" (per_cpu_var(current_task)) \ |
126 | __switch_canary_iparam \ | ||
110 | : "memory", "cc" __EXTRA_CLOBBER) | 127 | : "memory", "cc" __EXTRA_CLOBBER) |
111 | #endif | 128 | #endif |
112 | 129 | ||
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index 98789647baa9..df9d5f78385e 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h | |||
@@ -40,6 +40,7 @@ struct thread_info { | |||
40 | */ | 40 | */ |
41 | __u8 supervisor_stack[0]; | 41 | __u8 supervisor_stack[0]; |
42 | #endif | 42 | #endif |
43 | int uaccess_err; | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | #define INIT_THREAD_INFO(tsk) \ | 46 | #define INIT_THREAD_INFO(tsk) \ |
@@ -194,25 +195,21 @@ static inline struct thread_info *current_thread_info(void) | |||
194 | 195 | ||
195 | #else /* X86_32 */ | 196 | #else /* X86_32 */ |
196 | 197 | ||
197 | #include <asm/pda.h> | 198 | #include <asm/percpu.h> |
199 | #define KERNEL_STACK_OFFSET (5*8) | ||
198 | 200 | ||
199 | /* | 201 | /* |
200 | * macros/functions for gaining access to the thread information structure | 202 | * macros/functions for gaining access to the thread information structure |
201 | * preempt_count needs to be 1 initially, until the scheduler is functional. | 203 | * preempt_count needs to be 1 initially, until the scheduler is functional. |
202 | */ | 204 | */ |
203 | #ifndef __ASSEMBLY__ | 205 | #ifndef __ASSEMBLY__ |
204 | static inline struct thread_info *current_thread_info(void) | 206 | DECLARE_PER_CPU(unsigned long, kernel_stack); |
205 | { | ||
206 | struct thread_info *ti; | ||
207 | ti = (void *)(read_pda(kernelstack) + PDA_STACKOFFSET - THREAD_SIZE); | ||
208 | return ti; | ||
209 | } | ||
210 | 207 | ||
211 | /* do not use in interrupt context */ | 208 | static inline struct thread_info *current_thread_info(void) |
212 | static inline struct thread_info *stack_thread_info(void) | ||
213 | { | 209 | { |
214 | struct thread_info *ti; | 210 | struct thread_info *ti; |
215 | asm("andq %%rsp,%0; " : "=r" (ti) : "0" (~(THREAD_SIZE - 1))); | 211 | ti = (void *)(percpu_read(kernel_stack) + |
212 | KERNEL_STACK_OFFSET - THREAD_SIZE); | ||
216 | return ti; | 213 | return ti; |
217 | } | 214 | } |
218 | 215 | ||
@@ -220,8 +217,8 @@ static inline struct thread_info *stack_thread_info(void) | |||
220 | 217 | ||
221 | /* how to get the thread information struct from ASM */ | 218 | /* how to get the thread information struct from ASM */ |
222 | #define GET_THREAD_INFO(reg) \ | 219 | #define GET_THREAD_INFO(reg) \ |
223 | movq %gs:pda_kernelstack,reg ; \ | 220 | movq PER_CPU_VAR(kernel_stack),reg ; \ |
224 | subq $(THREAD_SIZE-PDA_STACKOFFSET),reg | 221 | subq $(THREAD_SIZE-KERNEL_STACK_OFFSET),reg |
225 | 222 | ||
226 | #endif | 223 | #endif |
227 | 224 | ||
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 0e7bbb549116..d3539f998f88 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h | |||
@@ -113,7 +113,7 @@ static inline void flush_tlb_range(struct vm_area_struct *vma, | |||
113 | __flush_tlb(); | 113 | __flush_tlb(); |
114 | } | 114 | } |
115 | 115 | ||
116 | static inline void native_flush_tlb_others(const cpumask_t *cpumask, | 116 | static inline void native_flush_tlb_others(const struct cpumask *cpumask, |
117 | struct mm_struct *mm, | 117 | struct mm_struct *mm, |
118 | unsigned long va) | 118 | unsigned long va) |
119 | { | 119 | { |
@@ -142,31 +142,28 @@ static inline void flush_tlb_range(struct vm_area_struct *vma, | |||
142 | flush_tlb_mm(vma->vm_mm); | 142 | flush_tlb_mm(vma->vm_mm); |
143 | } | 143 | } |
144 | 144 | ||
145 | void native_flush_tlb_others(const cpumask_t *cpumask, struct mm_struct *mm, | 145 | void native_flush_tlb_others(const struct cpumask *cpumask, |
146 | unsigned long va); | 146 | struct mm_struct *mm, unsigned long va); |
147 | 147 | ||
148 | #define TLBSTATE_OK 1 | 148 | #define TLBSTATE_OK 1 |
149 | #define TLBSTATE_LAZY 2 | 149 | #define TLBSTATE_LAZY 2 |
150 | 150 | ||
151 | #ifdef CONFIG_X86_32 | ||
152 | struct tlb_state { | 151 | struct tlb_state { |
153 | struct mm_struct *active_mm; | 152 | struct mm_struct *active_mm; |
154 | int state; | 153 | int state; |
155 | char __cacheline_padding[L1_CACHE_BYTES-8]; | ||
156 | }; | 154 | }; |
157 | DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate); | 155 | DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate); |
158 | 156 | ||
159 | void reset_lazy_tlbstate(void); | ||
160 | #else | ||
161 | static inline void reset_lazy_tlbstate(void) | 157 | static inline void reset_lazy_tlbstate(void) |
162 | { | 158 | { |
159 | percpu_write(cpu_tlbstate.state, 0); | ||
160 | percpu_write(cpu_tlbstate.active_mm, &init_mm); | ||
163 | } | 161 | } |
164 | #endif | ||
165 | 162 | ||
166 | #endif /* SMP */ | 163 | #endif /* SMP */ |
167 | 164 | ||
168 | #ifndef CONFIG_PARAVIRT | 165 | #ifndef CONFIG_PARAVIRT |
169 | #define flush_tlb_others(mask, mm, va) native_flush_tlb_others(&mask, mm, va) | 166 | #define flush_tlb_others(mask, mm, va) native_flush_tlb_others(mask, mm, va) |
170 | #endif | 167 | #endif |
171 | 168 | ||
172 | static inline void flush_tlb_kernel_range(unsigned long start, | 169 | static inline void flush_tlb_kernel_range(unsigned long start, |
@@ -175,4 +172,6 @@ static inline void flush_tlb_kernel_range(unsigned long start, | |||
175 | flush_tlb_all(); | 172 | flush_tlb_all(); |
176 | } | 173 | } |
177 | 174 | ||
175 | extern void zap_low_mappings(void); | ||
176 | |||
178 | #endif /* _ASM_X86_TLBFLUSH_H */ | 177 | #endif /* _ASM_X86_TLBFLUSH_H */ |
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 4e2f2e0aab27..77cfb2cfb386 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h | |||
@@ -74,6 +74,8 @@ static inline const struct cpumask *cpumask_of_node(int node) | |||
74 | return &node_to_cpumask_map[node]; | 74 | return &node_to_cpumask_map[node]; |
75 | } | 75 | } |
76 | 76 | ||
77 | static inline void setup_node_to_cpumask_map(void) { } | ||
78 | |||
77 | #else /* CONFIG_X86_64 */ | 79 | #else /* CONFIG_X86_64 */ |
78 | 80 | ||
79 | /* Mappings between node number and cpus on that node. */ | 81 | /* Mappings between node number and cpus on that node. */ |
@@ -83,7 +85,8 @@ extern cpumask_t *node_to_cpumask_map; | |||
83 | DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); | 85 | DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); |
84 | 86 | ||
85 | /* Returns the number of the current Node. */ | 87 | /* Returns the number of the current Node. */ |
86 | #define numa_node_id() read_pda(nodenumber) | 88 | DECLARE_PER_CPU(int, node_number); |
89 | #define numa_node_id() percpu_read(node_number) | ||
87 | 90 | ||
88 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | 91 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
89 | extern int cpu_to_node(int cpu); | 92 | extern int cpu_to_node(int cpu); |
@@ -102,10 +105,7 @@ static inline int cpu_to_node(int cpu) | |||
102 | /* Same function but used if called before per_cpu areas are setup */ | 105 | /* Same function but used if called before per_cpu areas are setup */ |
103 | static inline int early_cpu_to_node(int cpu) | 106 | static inline int early_cpu_to_node(int cpu) |
104 | { | 107 | { |
105 | if (early_per_cpu_ptr(x86_cpu_to_node_map)) | 108 | return early_per_cpu(x86_cpu_to_node_map, cpu); |
106 | return early_per_cpu_ptr(x86_cpu_to_node_map)[cpu]; | ||
107 | |||
108 | return per_cpu(x86_cpu_to_node_map, cpu); | ||
109 | } | 109 | } |
110 | 110 | ||
111 | /* Returns a pointer to the cpumask of CPUs on Node 'node'. */ | 111 | /* Returns a pointer to the cpumask of CPUs on Node 'node'. */ |
@@ -122,6 +122,8 @@ static inline cpumask_t node_to_cpumask(int node) | |||
122 | 122 | ||
123 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 123 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
124 | 124 | ||
125 | extern void setup_node_to_cpumask_map(void); | ||
126 | |||
125 | /* | 127 | /* |
126 | * Replace default node_to_cpumask_ptr with optimized version | 128 | * Replace default node_to_cpumask_ptr with optimized version |
127 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" | 129 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" |
@@ -192,9 +194,20 @@ extern int __node_distance(int, int); | |||
192 | 194 | ||
193 | #else /* !CONFIG_NUMA */ | 195 | #else /* !CONFIG_NUMA */ |
194 | 196 | ||
195 | #define numa_node_id() 0 | 197 | static inline int numa_node_id(void) |
196 | #define cpu_to_node(cpu) 0 | 198 | { |
197 | #define early_cpu_to_node(cpu) 0 | 199 | return 0; |
200 | } | ||
201 | |||
202 | static inline int cpu_to_node(int cpu) | ||
203 | { | ||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | static inline int early_cpu_to_node(int cpu) | ||
208 | { | ||
209 | return 0; | ||
210 | } | ||
198 | 211 | ||
199 | static inline const cpumask_t *cpumask_of_node(int node) | 212 | static inline const cpumask_t *cpumask_of_node(int node) |
200 | { | 213 | { |
@@ -209,6 +222,8 @@ static inline int node_to_first_cpu(int node) | |||
209 | return first_cpu(cpu_online_map); | 222 | return first_cpu(cpu_online_map); |
210 | } | 223 | } |
211 | 224 | ||
225 | static inline void setup_node_to_cpumask_map(void) { } | ||
226 | |||
212 | /* | 227 | /* |
213 | * Replace default node_to_cpumask_ptr with optimized version | 228 | * Replace default node_to_cpumask_ptr with optimized version |
214 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" | 229 | * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)" |
diff --git a/arch/x86/include/asm/trampoline.h b/arch/x86/include/asm/trampoline.h index 780ba0ab94f9..90f06c25221d 100644 --- a/arch/x86/include/asm/trampoline.h +++ b/arch/x86/include/asm/trampoline.h | |||
@@ -13,6 +13,7 @@ extern unsigned char *trampoline_base; | |||
13 | 13 | ||
14 | extern unsigned long init_rsp; | 14 | extern unsigned long init_rsp; |
15 | extern unsigned long initial_code; | 15 | extern unsigned long initial_code; |
16 | extern unsigned long initial_gs; | ||
16 | 17 | ||
17 | #define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data, PAGE_SIZE) | 18 | #define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data, PAGE_SIZE) |
18 | #define TRAMPOLINE_BASE 0x6000 | 19 | #define TRAMPOLINE_BASE 0x6000 |
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 4340055b7559..0ec6de4bcb0b 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h | |||
@@ -121,7 +121,7 @@ extern int __get_user_bad(void); | |||
121 | 121 | ||
122 | #define __get_user_x(size, ret, x, ptr) \ | 122 | #define __get_user_x(size, ret, x, ptr) \ |
123 | asm volatile("call __get_user_" #size \ | 123 | asm volatile("call __get_user_" #size \ |
124 | : "=a" (ret),"=d" (x) \ | 124 | : "=a" (ret), "=d" (x) \ |
125 | : "0" (ptr)) \ | 125 | : "0" (ptr)) \ |
126 | 126 | ||
127 | /* Careful: we have to cast the result to the type of the pointer | 127 | /* Careful: we have to cast the result to the type of the pointer |
@@ -181,12 +181,12 @@ extern int __get_user_bad(void); | |||
181 | 181 | ||
182 | #define __put_user_x(size, x, ptr, __ret_pu) \ | 182 | #define __put_user_x(size, x, ptr, __ret_pu) \ |
183 | asm volatile("call __put_user_" #size : "=a" (__ret_pu) \ | 183 | asm volatile("call __put_user_" #size : "=a" (__ret_pu) \ |
184 | :"0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") | 184 | : "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") |
185 | 185 | ||
186 | 186 | ||
187 | 187 | ||
188 | #ifdef CONFIG_X86_32 | 188 | #ifdef CONFIG_X86_32 |
189 | #define __put_user_u64(x, addr, err) \ | 189 | #define __put_user_asm_u64(x, addr, err) \ |
190 | asm volatile("1: movl %%eax,0(%2)\n" \ | 190 | asm volatile("1: movl %%eax,0(%2)\n" \ |
191 | "2: movl %%edx,4(%2)\n" \ | 191 | "2: movl %%edx,4(%2)\n" \ |
192 | "3:\n" \ | 192 | "3:\n" \ |
@@ -199,12 +199,22 @@ extern int __get_user_bad(void); | |||
199 | : "=r" (err) \ | 199 | : "=r" (err) \ |
200 | : "A" (x), "r" (addr), "i" (-EFAULT), "0" (err)) | 200 | : "A" (x), "r" (addr), "i" (-EFAULT), "0" (err)) |
201 | 201 | ||
202 | #define __put_user_asm_ex_u64(x, addr) \ | ||
203 | asm volatile("1: movl %%eax,0(%1)\n" \ | ||
204 | "2: movl %%edx,4(%1)\n" \ | ||
205 | "3:\n" \ | ||
206 | _ASM_EXTABLE(1b, 2b - 1b) \ | ||
207 | _ASM_EXTABLE(2b, 3b - 2b) \ | ||
208 | : : "A" (x), "r" (addr)) | ||
209 | |||
202 | #define __put_user_x8(x, ptr, __ret_pu) \ | 210 | #define __put_user_x8(x, ptr, __ret_pu) \ |
203 | asm volatile("call __put_user_8" : "=a" (__ret_pu) \ | 211 | asm volatile("call __put_user_8" : "=a" (__ret_pu) \ |
204 | : "A" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") | 212 | : "A" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") |
205 | #else | 213 | #else |
206 | #define __put_user_u64(x, ptr, retval) \ | 214 | #define __put_user_asm_u64(x, ptr, retval) \ |
207 | __put_user_asm(x, ptr, retval, "q", "", "Zr", -EFAULT) | 215 | __put_user_asm(x, ptr, retval, "q", "", "Zr", -EFAULT) |
216 | #define __put_user_asm_ex_u64(x, addr) \ | ||
217 | __put_user_asm_ex(x, addr, "q", "", "Zr") | ||
208 | #define __put_user_x8(x, ptr, __ret_pu) __put_user_x(8, x, ptr, __ret_pu) | 218 | #define __put_user_x8(x, ptr, __ret_pu) __put_user_x(8, x, ptr, __ret_pu) |
209 | #endif | 219 | #endif |
210 | 220 | ||
@@ -276,10 +286,31 @@ do { \ | |||
276 | __put_user_asm(x, ptr, retval, "w", "w", "ir", errret); \ | 286 | __put_user_asm(x, ptr, retval, "w", "w", "ir", errret); \ |
277 | break; \ | 287 | break; \ |
278 | case 4: \ | 288 | case 4: \ |
279 | __put_user_asm(x, ptr, retval, "l", "k", "ir", errret);\ | 289 | __put_user_asm(x, ptr, retval, "l", "k", "ir", errret); \ |
280 | break; \ | 290 | break; \ |
281 | case 8: \ | 291 | case 8: \ |
282 | __put_user_u64((__typeof__(*ptr))(x), ptr, retval); \ | 292 | __put_user_asm_u64((__typeof__(*ptr))(x), ptr, retval); \ |
293 | break; \ | ||
294 | default: \ | ||
295 | __put_user_bad(); \ | ||
296 | } \ | ||
297 | } while (0) | ||
298 | |||
299 | #define __put_user_size_ex(x, ptr, size) \ | ||
300 | do { \ | ||
301 | __chk_user_ptr(ptr); \ | ||
302 | switch (size) { \ | ||
303 | case 1: \ | ||
304 | __put_user_asm_ex(x, ptr, "b", "b", "iq"); \ | ||
305 | break; \ | ||
306 | case 2: \ | ||
307 | __put_user_asm_ex(x, ptr, "w", "w", "ir"); \ | ||
308 | break; \ | ||
309 | case 4: \ | ||
310 | __put_user_asm_ex(x, ptr, "l", "k", "ir"); \ | ||
311 | break; \ | ||
312 | case 8: \ | ||
313 | __put_user_asm_ex_u64((__typeof__(*ptr))(x), ptr); \ | ||
283 | break; \ | 314 | break; \ |
284 | default: \ | 315 | default: \ |
285 | __put_user_bad(); \ | 316 | __put_user_bad(); \ |
@@ -311,9 +342,12 @@ do { \ | |||
311 | 342 | ||
312 | #ifdef CONFIG_X86_32 | 343 | #ifdef CONFIG_X86_32 |
313 | #define __get_user_asm_u64(x, ptr, retval, errret) (x) = __get_user_bad() | 344 | #define __get_user_asm_u64(x, ptr, retval, errret) (x) = __get_user_bad() |
345 | #define __get_user_asm_ex_u64(x, ptr) (x) = __get_user_bad() | ||
314 | #else | 346 | #else |
315 | #define __get_user_asm_u64(x, ptr, retval, errret) \ | 347 | #define __get_user_asm_u64(x, ptr, retval, errret) \ |
316 | __get_user_asm(x, ptr, retval, "q", "", "=r", errret) | 348 | __get_user_asm(x, ptr, retval, "q", "", "=r", errret) |
349 | #define __get_user_asm_ex_u64(x, ptr) \ | ||
350 | __get_user_asm_ex(x, ptr, "q", "", "=r") | ||
317 | #endif | 351 | #endif |
318 | 352 | ||
319 | #define __get_user_size(x, ptr, size, retval, errret) \ | 353 | #define __get_user_size(x, ptr, size, retval, errret) \ |
@@ -350,6 +384,33 @@ do { \ | |||
350 | : "=r" (err), ltype(x) \ | 384 | : "=r" (err), ltype(x) \ |
351 | : "m" (__m(addr)), "i" (errret), "0" (err)) | 385 | : "m" (__m(addr)), "i" (errret), "0" (err)) |
352 | 386 | ||
387 | #define __get_user_size_ex(x, ptr, size) \ | ||
388 | do { \ | ||
389 | __chk_user_ptr(ptr); \ | ||
390 | switch (size) { \ | ||
391 | case 1: \ | ||
392 | __get_user_asm_ex(x, ptr, "b", "b", "=q"); \ | ||
393 | break; \ | ||
394 | case 2: \ | ||
395 | __get_user_asm_ex(x, ptr, "w", "w", "=r"); \ | ||
396 | break; \ | ||
397 | case 4: \ | ||
398 | __get_user_asm_ex(x, ptr, "l", "k", "=r"); \ | ||
399 | break; \ | ||
400 | case 8: \ | ||
401 | __get_user_asm_ex_u64(x, ptr); \ | ||
402 | break; \ | ||
403 | default: \ | ||
404 | (x) = __get_user_bad(); \ | ||
405 | } \ | ||
406 | } while (0) | ||
407 | |||
408 | #define __get_user_asm_ex(x, addr, itype, rtype, ltype) \ | ||
409 | asm volatile("1: mov"itype" %1,%"rtype"0\n" \ | ||
410 | "2:\n" \ | ||
411 | _ASM_EXTABLE(1b, 2b - 1b) \ | ||
412 | : ltype(x) : "m" (__m(addr))) | ||
413 | |||
353 | #define __put_user_nocheck(x, ptr, size) \ | 414 | #define __put_user_nocheck(x, ptr, size) \ |
354 | ({ \ | 415 | ({ \ |
355 | int __pu_err; \ | 416 | int __pu_err; \ |
@@ -385,6 +446,26 @@ struct __large_struct { unsigned long buf[100]; }; | |||
385 | _ASM_EXTABLE(1b, 3b) \ | 446 | _ASM_EXTABLE(1b, 3b) \ |
386 | : "=r"(err) \ | 447 | : "=r"(err) \ |
387 | : ltype(x), "m" (__m(addr)), "i" (errret), "0" (err)) | 448 | : ltype(x), "m" (__m(addr)), "i" (errret), "0" (err)) |
449 | |||
450 | #define __put_user_asm_ex(x, addr, itype, rtype, ltype) \ | ||
451 | asm volatile("1: mov"itype" %"rtype"0,%1\n" \ | ||
452 | "2:\n" \ | ||
453 | _ASM_EXTABLE(1b, 2b - 1b) \ | ||
454 | : : ltype(x), "m" (__m(addr))) | ||
455 | |||
456 | /* | ||
457 | * uaccess_try and catch | ||
458 | */ | ||
459 | #define uaccess_try do { \ | ||
460 | int prev_err = current_thread_info()->uaccess_err; \ | ||
461 | current_thread_info()->uaccess_err = 0; \ | ||
462 | barrier(); | ||
463 | |||
464 | #define uaccess_catch(err) \ | ||
465 | (err) |= current_thread_info()->uaccess_err; \ | ||
466 | current_thread_info()->uaccess_err = prev_err; \ | ||
467 | } while (0) | ||
468 | |||
388 | /** | 469 | /** |
389 | * __get_user: - Get a simple variable from user space, with less checking. | 470 | * __get_user: - Get a simple variable from user space, with less checking. |
390 | * @x: Variable to store result. | 471 | * @x: Variable to store result. |
@@ -408,6 +489,7 @@ struct __large_struct { unsigned long buf[100]; }; | |||
408 | 489 | ||
409 | #define __get_user(x, ptr) \ | 490 | #define __get_user(x, ptr) \ |
410 | __get_user_nocheck((x), (ptr), sizeof(*(ptr))) | 491 | __get_user_nocheck((x), (ptr), sizeof(*(ptr))) |
492 | |||
411 | /** | 493 | /** |
412 | * __put_user: - Write a simple value into user space, with less checking. | 494 | * __put_user: - Write a simple value into user space, with less checking. |
413 | * @x: Value to copy to user space. | 495 | * @x: Value to copy to user space. |
@@ -435,6 +517,27 @@ struct __large_struct { unsigned long buf[100]; }; | |||
435 | #define __put_user_unaligned __put_user | 517 | #define __put_user_unaligned __put_user |
436 | 518 | ||
437 | /* | 519 | /* |
520 | * {get|put}_user_try and catch | ||
521 | * | ||
522 | * get_user_try { | ||
523 | * get_user_ex(...); | ||
524 | * } get_user_catch(err) | ||
525 | */ | ||
526 | #define get_user_try uaccess_try | ||
527 | #define get_user_catch(err) uaccess_catch(err) | ||
528 | #define put_user_try uaccess_try | ||
529 | #define put_user_catch(err) uaccess_catch(err) | ||
530 | |||
531 | #define get_user_ex(x, ptr) do { \ | ||
532 | unsigned long __gue_val; \ | ||
533 | __get_user_size_ex((__gue_val), (ptr), (sizeof(*(ptr)))); \ | ||
534 | (x) = (__force __typeof__(*(ptr)))__gue_val; \ | ||
535 | } while (0) | ||
536 | |||
537 | #define put_user_ex(x, ptr) \ | ||
538 | __put_user_size_ex((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) | ||
539 | |||
540 | /* | ||
438 | * movsl can be slow when source and dest are not both 8-byte aligned | 541 | * movsl can be slow when source and dest are not both 8-byte aligned |
439 | */ | 542 | */ |
440 | #ifdef CONFIG_X86_INTEL_USERCOPY | 543 | #ifdef CONFIG_X86_INTEL_USERCOPY |
diff --git a/arch/x86/include/asm/uv/uv.h b/arch/x86/include/asm/uv/uv.h new file mode 100644 index 000000000000..8ac1d7e312f3 --- /dev/null +++ b/arch/x86/include/asm/uv/uv.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef _ASM_X86_UV_UV_H | ||
2 | #define _ASM_X86_UV_UV_H | ||
3 | |||
4 | enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC}; | ||
5 | |||
6 | #ifdef CONFIG_X86_UV | ||
7 | |||
8 | extern enum uv_system_type get_uv_system_type(void); | ||
9 | extern int is_uv_system(void); | ||
10 | extern void uv_cpu_init(void); | ||
11 | extern void uv_system_init(void); | ||
12 | extern int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip); | ||
13 | extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, | ||
14 | struct mm_struct *mm, | ||
15 | unsigned long va, | ||
16 | unsigned int cpu); | ||
17 | |||
18 | #else /* X86_UV */ | ||
19 | |||
20 | static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; } | ||
21 | static inline int is_uv_system(void) { return 0; } | ||
22 | static inline void uv_cpu_init(void) { } | ||
23 | static inline void uv_system_init(void) { } | ||
24 | static inline int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip) | ||
25 | { return 1; } | ||
26 | static inline const struct cpumask * | ||
27 | uv_flush_tlb_others(const struct cpumask *cpumask, struct mm_struct *mm, | ||
28 | unsigned long va, unsigned int cpu) | ||
29 | { return cpumask; } | ||
30 | |||
31 | #endif /* X86_UV */ | ||
32 | |||
33 | #endif /* _ASM_X86_UV_UV_H */ | ||
diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h index 50423c7b56b2..9b0e61bf7a88 100644 --- a/arch/x86/include/asm/uv/uv_bau.h +++ b/arch/x86/include/asm/uv/uv_bau.h | |||
@@ -325,7 +325,6 @@ static inline void bau_cpubits_clear(struct bau_local_cpumask *dstp, int nbits) | |||
325 | #define cpubit_isset(cpu, bau_local_cpumask) \ | 325 | #define cpubit_isset(cpu, bau_local_cpumask) \ |
326 | test_bit((cpu), (bau_local_cpumask).bits) | 326 | test_bit((cpu), (bau_local_cpumask).bits) |
327 | 327 | ||
328 | extern int uv_flush_tlb_others(cpumask_t *, struct mm_struct *, unsigned long); | ||
329 | extern void uv_bau_message_intr1(void); | 328 | extern void uv_bau_message_intr1(void); |
330 | extern void uv_bau_timeout_intr1(void); | 329 | extern void uv_bau_timeout_intr1(void); |
331 | 330 | ||
diff --git a/arch/x86/include/asm/voyager.h b/arch/x86/include/asm/voyager.h index b3e647307625..c1635d43616f 100644 --- a/arch/x86/include/asm/voyager.h +++ b/arch/x86/include/asm/voyager.h | |||
@@ -527,3 +527,45 @@ extern void voyager_smp_intr_init(void); | |||
527 | #define VOYAGER_PSI_SUBREAD 2 | 527 | #define VOYAGER_PSI_SUBREAD 2 |
528 | #define VOYAGER_PSI_SUBWRITE 3 | 528 | #define VOYAGER_PSI_SUBWRITE 3 |
529 | extern void voyager_cat_psi(__u8, __u16, __u8 *); | 529 | extern void voyager_cat_psi(__u8, __u16, __u8 *); |
530 | |||
531 | /* These define the CPIs we use in linux */ | ||
532 | #define VIC_CPI_LEVEL0 0 | ||
533 | #define VIC_CPI_LEVEL1 1 | ||
534 | /* now the fake CPIs */ | ||
535 | #define VIC_TIMER_CPI 2 | ||
536 | #define VIC_INVALIDATE_CPI 3 | ||
537 | #define VIC_RESCHEDULE_CPI 4 | ||
538 | #define VIC_ENABLE_IRQ_CPI 5 | ||
539 | #define VIC_CALL_FUNCTION_CPI 6 | ||
540 | #define VIC_CALL_FUNCTION_SINGLE_CPI 7 | ||
541 | |||
542 | /* Now the QIC CPIs: Since we don't need the two initial levels, | ||
543 | * these are 2 less than the VIC CPIs */ | ||
544 | #define QIC_CPI_OFFSET 1 | ||
545 | #define QIC_TIMER_CPI (VIC_TIMER_CPI - QIC_CPI_OFFSET) | ||
546 | #define QIC_INVALIDATE_CPI (VIC_INVALIDATE_CPI - QIC_CPI_OFFSET) | ||
547 | #define QIC_RESCHEDULE_CPI (VIC_RESCHEDULE_CPI - QIC_CPI_OFFSET) | ||
548 | #define QIC_ENABLE_IRQ_CPI (VIC_ENABLE_IRQ_CPI - QIC_CPI_OFFSET) | ||
549 | #define QIC_CALL_FUNCTION_CPI (VIC_CALL_FUNCTION_CPI - QIC_CPI_OFFSET) | ||
550 | #define QIC_CALL_FUNCTION_SINGLE_CPI (VIC_CALL_FUNCTION_SINGLE_CPI - QIC_CPI_OFFSET) | ||
551 | |||
552 | #define VIC_START_FAKE_CPI VIC_TIMER_CPI | ||
553 | #define VIC_END_FAKE_CPI VIC_CALL_FUNCTION_SINGLE_CPI | ||
554 | |||
555 | /* this is the SYS_INT CPI. */ | ||
556 | #define VIC_SYS_INT 8 | ||
557 | #define VIC_CMN_INT 15 | ||
558 | |||
559 | /* This is the boot CPI for alternate processors. It gets overwritten | ||
560 | * by the above once the system has activated all available processors */ | ||
561 | #define VIC_CPU_BOOT_CPI VIC_CPI_LEVEL0 | ||
562 | #define VIC_CPU_BOOT_ERRATA_CPI (VIC_CPI_LEVEL0 + 8) | ||
563 | |||
564 | extern asmlinkage void vic_cpi_interrupt(void); | ||
565 | extern asmlinkage void vic_sys_interrupt(void); | ||
566 | extern asmlinkage void vic_cmn_interrupt(void); | ||
567 | extern asmlinkage void qic_timer_interrupt(void); | ||
568 | extern asmlinkage void qic_invalidate_interrupt(void); | ||
569 | extern asmlinkage void qic_reschedule_interrupt(void); | ||
570 | extern asmlinkage void qic_enable_irq_interrupt(void); | ||
571 | extern asmlinkage void qic_call_function_interrupt(void); | ||
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index d364df03c1d6..24f357e7557a 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -23,13 +23,14 @@ nostackp := $(call cc-option, -fno-stack-protector) | |||
23 | CFLAGS_vsyscall_64.o := $(PROFILING) -g0 $(nostackp) | 23 | CFLAGS_vsyscall_64.o := $(PROFILING) -g0 $(nostackp) |
24 | CFLAGS_hpet.o := $(nostackp) | 24 | CFLAGS_hpet.o := $(nostackp) |
25 | CFLAGS_tsc.o := $(nostackp) | 25 | CFLAGS_tsc.o := $(nostackp) |
26 | CFLAGS_paravirt.o := $(nostackp) | ||
26 | 27 | ||
27 | obj-y := process_$(BITS).o signal.o entry_$(BITS).o | 28 | obj-y := process_$(BITS).o signal.o entry_$(BITS).o |
28 | obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o | 29 | obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o |
29 | obj-y += time_$(BITS).o ioport.o ldt.o dumpstack.o | 30 | obj-y += time_$(BITS).o ioport.o ldt.o dumpstack.o |
30 | obj-y += setup.o i8259.o irqinit_$(BITS).o setup_percpu.o | 31 | obj-y += setup.o i8259.o irqinit_$(BITS).o |
31 | obj-$(CONFIG_X86_VISWS) += visws_quirks.o | 32 | obj-$(CONFIG_X86_VISWS) += visws_quirks.o |
32 | obj-$(CONFIG_X86_32) += probe_roms_32.o | 33 | obj-$(CONFIG_X86_32) += probe_32.o probe_roms_32.o |
33 | obj-$(CONFIG_X86_32) += sys_i386_32.o i386_ksyms_32.o | 34 | obj-$(CONFIG_X86_32) += sys_i386_32.o i386_ksyms_32.o |
34 | obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o | 35 | obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o |
35 | obj-$(CONFIG_X86_64) += syscall_64.o vsyscall_64.o | 36 | obj-$(CONFIG_X86_64) += syscall_64.o vsyscall_64.o |
@@ -49,20 +50,20 @@ obj-y += step.o | |||
49 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 50 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
50 | obj-y += cpu/ | 51 | obj-y += cpu/ |
51 | obj-y += acpi/ | 52 | obj-y += acpi/ |
52 | obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o | 53 | obj-y += reboot.o |
53 | obj-$(CONFIG_MCA) += mca_32.o | 54 | obj-$(CONFIG_MCA) += mca_32.o |
54 | obj-$(CONFIG_X86_MSR) += msr.o | 55 | obj-$(CONFIG_X86_MSR) += msr.o |
55 | obj-$(CONFIG_X86_CPUID) += cpuid.o | 56 | obj-$(CONFIG_X86_CPUID) += cpuid.o |
56 | obj-$(CONFIG_PCI) += early-quirks.o | 57 | obj-$(CONFIG_PCI) += early-quirks.o |
57 | apm-y := apm_32.o | 58 | apm-y := apm_32.o |
58 | obj-$(CONFIG_APM) += apm.o | 59 | obj-$(CONFIG_APM) += apm.o |
59 | obj-$(CONFIG_X86_SMP) += smp.o | 60 | obj-$(CONFIG_SMP) += smp.o |
60 | obj-$(CONFIG_X86_SMP) += smpboot.o tsc_sync.o ipi.o tlb_$(BITS).o | 61 | obj-$(CONFIG_SMP) += smpboot.o tsc_sync.o ipi.o |
61 | obj-$(CONFIG_X86_32_SMP) += smpcommon.o | 62 | obj-$(CONFIG_SMP) += setup_percpu.o |
62 | obj-$(CONFIG_X86_64_SMP) += tsc_sync.o smpcommon.o | 63 | obj-$(CONFIG_X86_64_SMP) += tsc_sync.o |
63 | obj-$(CONFIG_X86_TRAMPOLINE) += trampoline_$(BITS).o | 64 | obj-$(CONFIG_X86_TRAMPOLINE) += trampoline_$(BITS).o |
64 | obj-$(CONFIG_X86_MPPARSE) += mpparse.o | 65 | obj-$(CONFIG_X86_MPPARSE) += mpparse.o |
65 | obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o | 66 | obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o ipi.o |
66 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o | 67 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o |
67 | obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o | 68 | obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o |
68 | obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o | 69 | obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o |
@@ -70,9 +71,10 @@ obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o | |||
70 | obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o | 71 | obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o |
71 | obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o | 72 | obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o |
72 | obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o | 73 | obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o |
74 | obj-$(CONFIG_X86_BIGSMP) += bigsmp_32.o | ||
73 | obj-$(CONFIG_X86_NUMAQ) += numaq_32.o | 75 | obj-$(CONFIG_X86_NUMAQ) += numaq_32.o |
74 | obj-$(CONFIG_X86_ES7000) += es7000_32.o | 76 | obj-$(CONFIG_X86_ES7000) += es7000_32.o |
75 | obj-$(CONFIG_X86_SUMMIT_NUMA) += summit_32.o | 77 | obj-$(CONFIG_X86_SUMMIT) += summit_32.o |
76 | obj-y += vsmp_64.o | 78 | obj-y += vsmp_64.o |
77 | obj-$(CONFIG_KPROBES) += kprobes.o | 79 | obj-$(CONFIG_KPROBES) += kprobes.o |
78 | obj-$(CONFIG_MODULES) += module_$(BITS).o | 80 | obj-$(CONFIG_MODULES) += module_$(BITS).o |
@@ -114,10 +116,11 @@ obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o # NB rename without _64 | |||
114 | ### | 116 | ### |
115 | # 64 bit specific files | 117 | # 64 bit specific files |
116 | ifeq ($(CONFIG_X86_64),y) | 118 | ifeq ($(CONFIG_X86_64),y) |
117 | obj-y += genapic_64.o genapic_flat_64.o genx2apic_uv_x.o tlb_uv.o | 119 | obj-y += genapic_64.o genapic_flat_64.o |
118 | obj-y += bios_uv.o uv_irq.o uv_sysfs.o | ||
119 | obj-y += genx2apic_cluster.o | 120 | obj-y += genx2apic_cluster.o |
120 | obj-y += genx2apic_phys.o | 121 | obj-y += genx2apic_phys.o |
122 | obj-$(CONFIG_X86_UV) += genx2apic_uv_x.o tlb_uv.o | ||
123 | obj-$(CONFIG_X86_UV) += bios_uv.o uv_irq.o uv_sysfs.o | ||
121 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o | 124 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o |
122 | obj-$(CONFIG_AUDIT) += audit_64.o | 125 | obj-$(CONFIG_AUDIT) += audit_64.o |
123 | 126 | ||
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index d37593c2f438..3efa996b036c 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -42,10 +42,6 @@ | |||
42 | #include <asm/mpspec.h> | 42 | #include <asm/mpspec.h> |
43 | #include <asm/smp.h> | 43 | #include <asm/smp.h> |
44 | 44 | ||
45 | #ifdef CONFIG_X86_LOCAL_APIC | ||
46 | # include <mach_apic.h> | ||
47 | #endif | ||
48 | |||
49 | static int __initdata acpi_force = 0; | 45 | static int __initdata acpi_force = 0; |
50 | u32 acpi_rsdt_forced; | 46 | u32 acpi_rsdt_forced; |
51 | #ifdef CONFIG_ACPI | 47 | #ifdef CONFIG_ACPI |
@@ -56,16 +52,7 @@ int acpi_disabled = 1; | |||
56 | EXPORT_SYMBOL(acpi_disabled); | 52 | EXPORT_SYMBOL(acpi_disabled); |
57 | 53 | ||
58 | #ifdef CONFIG_X86_64 | 54 | #ifdef CONFIG_X86_64 |
59 | 55 | # include <asm/proto.h> | |
60 | #include <asm/proto.h> | ||
61 | |||
62 | #else /* X86 */ | ||
63 | |||
64 | #ifdef CONFIG_X86_LOCAL_APIC | ||
65 | #include <mach_apic.h> | ||
66 | #include <mach_mpparse.h> | ||
67 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
68 | |||
69 | #endif /* X86 */ | 56 | #endif /* X86 */ |
70 | 57 | ||
71 | #define BAD_MADT_ENTRY(entry, end) ( \ | 58 | #define BAD_MADT_ENTRY(entry, end) ( \ |
@@ -239,7 +226,8 @@ static int __init acpi_parse_madt(struct acpi_table_header *table) | |||
239 | madt->address); | 226 | madt->address); |
240 | } | 227 | } |
241 | 228 | ||
242 | acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id); | 229 | default_acpi_madt_oem_check(madt->header.oem_id, |
230 | madt->header.oem_table_id); | ||
243 | 231 | ||
244 | return 0; | 232 | return 0; |
245 | } | 233 | } |
@@ -912,8 +900,8 @@ static u8 __init uniq_ioapic_id(u8 id) | |||
912 | DECLARE_BITMAP(used, 256); | 900 | DECLARE_BITMAP(used, 256); |
913 | bitmap_zero(used, 256); | 901 | bitmap_zero(used, 256); |
914 | for (i = 0; i < nr_ioapics; i++) { | 902 | for (i = 0; i < nr_ioapics; i++) { |
915 | struct mp_config_ioapic *ia = &mp_ioapics[i]; | 903 | struct mpc_ioapic *ia = &mp_ioapics[i]; |
916 | __set_bit(ia->mp_apicid, used); | 904 | __set_bit(ia->apicid, used); |
917 | } | 905 | } |
918 | if (!test_bit(id, used)) | 906 | if (!test_bit(id, used)) |
919 | return id; | 907 | return id; |
@@ -945,47 +933,47 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) | |||
945 | 933 | ||
946 | idx = nr_ioapics; | 934 | idx = nr_ioapics; |
947 | 935 | ||
948 | mp_ioapics[idx].mp_type = MP_IOAPIC; | 936 | mp_ioapics[idx].type = MP_IOAPIC; |
949 | mp_ioapics[idx].mp_flags = MPC_APIC_USABLE; | 937 | mp_ioapics[idx].flags = MPC_APIC_USABLE; |
950 | mp_ioapics[idx].mp_apicaddr = address; | 938 | mp_ioapics[idx].apicaddr = address; |
951 | 939 | ||
952 | set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); | 940 | set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); |
953 | mp_ioapics[idx].mp_apicid = uniq_ioapic_id(id); | 941 | mp_ioapics[idx].apicid = uniq_ioapic_id(id); |
954 | #ifdef CONFIG_X86_32 | 942 | #ifdef CONFIG_X86_32 |
955 | mp_ioapics[idx].mp_apicver = io_apic_get_version(idx); | 943 | mp_ioapics[idx].apicver = io_apic_get_version(idx); |
956 | #else | 944 | #else |
957 | mp_ioapics[idx].mp_apicver = 0; | 945 | mp_ioapics[idx].apicver = 0; |
958 | #endif | 946 | #endif |
959 | /* | 947 | /* |
960 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups | 948 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups |
961 | * and to prevent reprogramming of IOAPIC pins (PCI GSIs). | 949 | * and to prevent reprogramming of IOAPIC pins (PCI GSIs). |
962 | */ | 950 | */ |
963 | mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].mp_apicid; | 951 | mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].apicid; |
964 | mp_ioapic_routing[idx].gsi_base = gsi_base; | 952 | mp_ioapic_routing[idx].gsi_base = gsi_base; |
965 | mp_ioapic_routing[idx].gsi_end = gsi_base + | 953 | mp_ioapic_routing[idx].gsi_end = gsi_base + |
966 | io_apic_get_redir_entries(idx); | 954 | io_apic_get_redir_entries(idx); |
967 | 955 | ||
968 | printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%lx, " | 956 | printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " |
969 | "GSI %d-%d\n", idx, mp_ioapics[idx].mp_apicid, | 957 | "GSI %d-%d\n", idx, mp_ioapics[idx].apicid, |
970 | mp_ioapics[idx].mp_apicver, mp_ioapics[idx].mp_apicaddr, | 958 | mp_ioapics[idx].apicver, mp_ioapics[idx].apicaddr, |
971 | mp_ioapic_routing[idx].gsi_base, mp_ioapic_routing[idx].gsi_end); | 959 | mp_ioapic_routing[idx].gsi_base, mp_ioapic_routing[idx].gsi_end); |
972 | 960 | ||
973 | nr_ioapics++; | 961 | nr_ioapics++; |
974 | } | 962 | } |
975 | 963 | ||
976 | static void assign_to_mp_irq(struct mp_config_intsrc *m, | 964 | static void assign_to_mp_irq(struct mpc_intsrc *m, |
977 | struct mp_config_intsrc *mp_irq) | 965 | struct mpc_intsrc *mp_irq) |
978 | { | 966 | { |
979 | memcpy(mp_irq, m, sizeof(struct mp_config_intsrc)); | 967 | memcpy(mp_irq, m, sizeof(struct mpc_intsrc)); |
980 | } | 968 | } |
981 | 969 | ||
982 | static int mp_irq_cmp(struct mp_config_intsrc *mp_irq, | 970 | static int mp_irq_cmp(struct mpc_intsrc *mp_irq, |
983 | struct mp_config_intsrc *m) | 971 | struct mpc_intsrc *m) |
984 | { | 972 | { |
985 | return memcmp(mp_irq, m, sizeof(struct mp_config_intsrc)); | 973 | return memcmp(mp_irq, m, sizeof(struct mpc_intsrc)); |
986 | } | 974 | } |
987 | 975 | ||
988 | static void save_mp_irq(struct mp_config_intsrc *m) | 976 | static void save_mp_irq(struct mpc_intsrc *m) |
989 | { | 977 | { |
990 | int i; | 978 | int i; |
991 | 979 | ||
@@ -1003,7 +991,7 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) | |||
1003 | { | 991 | { |
1004 | int ioapic; | 992 | int ioapic; |
1005 | int pin; | 993 | int pin; |
1006 | struct mp_config_intsrc mp_irq; | 994 | struct mpc_intsrc mp_irq; |
1007 | 995 | ||
1008 | /* | 996 | /* |
1009 | * Convert 'gsi' to 'ioapic.pin'. | 997 | * Convert 'gsi' to 'ioapic.pin'. |
@@ -1021,13 +1009,13 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) | |||
1021 | if ((bus_irq == 0) && (trigger == 3)) | 1009 | if ((bus_irq == 0) && (trigger == 3)) |
1022 | trigger = 1; | 1010 | trigger = 1; |
1023 | 1011 | ||
1024 | mp_irq.mp_type = MP_INTSRC; | 1012 | mp_irq.type = MP_INTSRC; |
1025 | mp_irq.mp_irqtype = mp_INT; | 1013 | mp_irq.irqtype = mp_INT; |
1026 | mp_irq.mp_irqflag = (trigger << 2) | polarity; | 1014 | mp_irq.irqflag = (trigger << 2) | polarity; |
1027 | mp_irq.mp_srcbus = MP_ISA_BUS; | 1015 | mp_irq.srcbus = MP_ISA_BUS; |
1028 | mp_irq.mp_srcbusirq = bus_irq; /* IRQ */ | 1016 | mp_irq.srcbusirq = bus_irq; /* IRQ */ |
1029 | mp_irq.mp_dstapic = mp_ioapics[ioapic].mp_apicid; /* APIC ID */ | 1017 | mp_irq.dstapic = mp_ioapics[ioapic].apicid; /* APIC ID */ |
1030 | mp_irq.mp_dstirq = pin; /* INTIN# */ | 1018 | mp_irq.dstirq = pin; /* INTIN# */ |
1031 | 1019 | ||
1032 | save_mp_irq(&mp_irq); | 1020 | save_mp_irq(&mp_irq); |
1033 | } | 1021 | } |
@@ -1037,7 +1025,7 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
1037 | int i; | 1025 | int i; |
1038 | int ioapic; | 1026 | int ioapic; |
1039 | unsigned int dstapic; | 1027 | unsigned int dstapic; |
1040 | struct mp_config_intsrc mp_irq; | 1028 | struct mpc_intsrc mp_irq; |
1041 | 1029 | ||
1042 | #if defined (CONFIG_MCA) || defined (CONFIG_EISA) | 1030 | #if defined (CONFIG_MCA) || defined (CONFIG_EISA) |
1043 | /* | 1031 | /* |
@@ -1062,7 +1050,7 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
1062 | ioapic = mp_find_ioapic(0); | 1050 | ioapic = mp_find_ioapic(0); |
1063 | if (ioapic < 0) | 1051 | if (ioapic < 0) |
1064 | return; | 1052 | return; |
1065 | dstapic = mp_ioapics[ioapic].mp_apicid; | 1053 | dstapic = mp_ioapics[ioapic].apicid; |
1066 | 1054 | ||
1067 | /* | 1055 | /* |
1068 | * Use the default configuration for the IRQs 0-15. Unless | 1056 | * Use the default configuration for the IRQs 0-15. Unless |
@@ -1072,16 +1060,14 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
1072 | int idx; | 1060 | int idx; |
1073 | 1061 | ||
1074 | for (idx = 0; idx < mp_irq_entries; idx++) { | 1062 | for (idx = 0; idx < mp_irq_entries; idx++) { |
1075 | struct mp_config_intsrc *irq = mp_irqs + idx; | 1063 | struct mpc_intsrc *irq = mp_irqs + idx; |
1076 | 1064 | ||
1077 | /* Do we already have a mapping for this ISA IRQ? */ | 1065 | /* Do we already have a mapping for this ISA IRQ? */ |
1078 | if (irq->mp_srcbus == MP_ISA_BUS | 1066 | if (irq->srcbus == MP_ISA_BUS && irq->srcbusirq == i) |
1079 | && irq->mp_srcbusirq == i) | ||
1080 | break; | 1067 | break; |
1081 | 1068 | ||
1082 | /* Do we already have a mapping for this IOAPIC pin */ | 1069 | /* Do we already have a mapping for this IOAPIC pin */ |
1083 | if (irq->mp_dstapic == dstapic && | 1070 | if (irq->dstapic == dstapic && irq->dstirq == i) |
1084 | irq->mp_dstirq == i) | ||
1085 | break; | 1071 | break; |
1086 | } | 1072 | } |
1087 | 1073 | ||
@@ -1090,13 +1076,13 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
1090 | continue; /* IRQ already used */ | 1076 | continue; /* IRQ already used */ |
1091 | } | 1077 | } |
1092 | 1078 | ||
1093 | mp_irq.mp_type = MP_INTSRC; | 1079 | mp_irq.type = MP_INTSRC; |
1094 | mp_irq.mp_irqflag = 0; /* Conforming */ | 1080 | mp_irq.irqflag = 0; /* Conforming */ |
1095 | mp_irq.mp_srcbus = MP_ISA_BUS; | 1081 | mp_irq.srcbus = MP_ISA_BUS; |
1096 | mp_irq.mp_dstapic = dstapic; | 1082 | mp_irq.dstapic = dstapic; |
1097 | mp_irq.mp_irqtype = mp_INT; | 1083 | mp_irq.irqtype = mp_INT; |
1098 | mp_irq.mp_srcbusirq = i; /* Identity mapped */ | 1084 | mp_irq.srcbusirq = i; /* Identity mapped */ |
1099 | mp_irq.mp_dstirq = i; | 1085 | mp_irq.dstirq = i; |
1100 | 1086 | ||
1101 | save_mp_irq(&mp_irq); | 1087 | save_mp_irq(&mp_irq); |
1102 | } | 1088 | } |
@@ -1207,22 +1193,22 @@ int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin, | |||
1207 | u32 gsi, int triggering, int polarity) | 1193 | u32 gsi, int triggering, int polarity) |
1208 | { | 1194 | { |
1209 | #ifdef CONFIG_X86_MPPARSE | 1195 | #ifdef CONFIG_X86_MPPARSE |
1210 | struct mp_config_intsrc mp_irq; | 1196 | struct mpc_intsrc mp_irq; |
1211 | int ioapic; | 1197 | int ioapic; |
1212 | 1198 | ||
1213 | if (!acpi_ioapic) | 1199 | if (!acpi_ioapic) |
1214 | return 0; | 1200 | return 0; |
1215 | 1201 | ||
1216 | /* print the entry should happen on mptable identically */ | 1202 | /* print the entry should happen on mptable identically */ |
1217 | mp_irq.mp_type = MP_INTSRC; | 1203 | mp_irq.type = MP_INTSRC; |
1218 | mp_irq.mp_irqtype = mp_INT; | 1204 | mp_irq.irqtype = mp_INT; |
1219 | mp_irq.mp_irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) | | 1205 | mp_irq.irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) | |
1220 | (polarity == ACPI_ACTIVE_HIGH ? 1 : 3); | 1206 | (polarity == ACPI_ACTIVE_HIGH ? 1 : 3); |
1221 | mp_irq.mp_srcbus = number; | 1207 | mp_irq.srcbus = number; |
1222 | mp_irq.mp_srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3); | 1208 | mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3); |
1223 | ioapic = mp_find_ioapic(gsi); | 1209 | ioapic = mp_find_ioapic(gsi); |
1224 | mp_irq.mp_dstapic = mp_ioapic_routing[ioapic].apic_id; | 1210 | mp_irq.dstapic = mp_ioapic_routing[ioapic].apic_id; |
1225 | mp_irq.mp_dstirq = gsi - mp_ioapic_routing[ioapic].gsi_base; | 1211 | mp_irq.dstirq = gsi - mp_ioapic_routing[ioapic].gsi_base; |
1226 | 1212 | ||
1227 | save_mp_irq(&mp_irq); | 1213 | save_mp_irq(&mp_irq); |
1228 | #endif | 1214 | #endif |
@@ -1349,7 +1335,7 @@ static void __init acpi_process_madt(void) | |||
1349 | if (!error) { | 1335 | if (!error) { |
1350 | acpi_lapic = 1; | 1336 | acpi_lapic = 1; |
1351 | 1337 | ||
1352 | #ifdef CONFIG_X86_GENERICARCH | 1338 | #ifdef CONFIG_X86_BIGSMP |
1353 | generic_bigsmp_probe(); | 1339 | generic_bigsmp_probe(); |
1354 | #endif | 1340 | #endif |
1355 | /* | 1341 | /* |
@@ -1361,9 +1347,8 @@ static void __init acpi_process_madt(void) | |||
1361 | acpi_ioapic = 1; | 1347 | acpi_ioapic = 1; |
1362 | 1348 | ||
1363 | smp_found_config = 1; | 1349 | smp_found_config = 1; |
1364 | #ifdef CONFIG_X86_32 | 1350 | if (apic->setup_apic_routing) |
1365 | setup_apic_routing(); | 1351 | apic->setup_apic_routing(); |
1366 | #endif | ||
1367 | } | 1352 | } |
1368 | } | 1353 | } |
1369 | if (error == -EINVAL) { | 1354 | if (error == -EINVAL) { |
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c index 707c1f6f95fa..4abff454c55b 100644 --- a/arch/x86/kernel/acpi/sleep.c +++ b/arch/x86/kernel/acpi/sleep.c | |||
@@ -101,6 +101,7 @@ int acpi_save_state_mem(void) | |||
101 | stack_start.sp = temp_stack + sizeof(temp_stack); | 101 | stack_start.sp = temp_stack + sizeof(temp_stack); |
102 | early_gdt_descr.address = | 102 | early_gdt_descr.address = |
103 | (unsigned long)get_cpu_gdt_table(smp_processor_id()); | 103 | (unsigned long)get_cpu_gdt_table(smp_processor_id()); |
104 | initial_gs = per_cpu_offset(smp_processor_id()); | ||
104 | #endif | 105 | #endif |
105 | initial_code = (unsigned long)wakeup_long64; | 106 | initial_code = (unsigned long)wakeup_long64; |
106 | saved_magic = 0x123456789abcdef0; | 107 | saved_magic = 0x123456789abcdef0; |
diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c index 115449f869ee..8bd801db24d9 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Local APIC handling, local APIC timers | 2 | * Local APIC handling, local APIC timers |
3 | * | 3 | * |
4 | * (c) 1999, 2000 Ingo Molnar <mingo@redhat.com> | 4 | * (c) 1999, 2000, 2009 Ingo Molnar <mingo@redhat.com> |
5 | * | 5 | * |
6 | * Fixes | 6 | * Fixes |
7 | * Maciej W. Rozycki : Bits for genuine 82489DX APICs; | 7 | * Maciej W. Rozycki : Bits for genuine 82489DX APICs; |
@@ -14,51 +14,71 @@ | |||
14 | * Mikael Pettersson : PM converted to driver model. | 14 | * Mikael Pettersson : PM converted to driver model. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/init.h> | ||
18 | |||
19 | #include <linux/mm.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/bootmem.h> | ||
22 | #include <linux/interrupt.h> | ||
23 | #include <linux/mc146818rtc.h> | ||
24 | #include <linux/kernel_stat.h> | 17 | #include <linux/kernel_stat.h> |
25 | #include <linux/sysdev.h> | 18 | #include <linux/mc146818rtc.h> |
26 | #include <linux/ioport.h> | ||
27 | #include <linux/cpu.h> | ||
28 | #include <linux/clockchips.h> | ||
29 | #include <linux/acpi_pmtmr.h> | 19 | #include <linux/acpi_pmtmr.h> |
20 | #include <linux/clockchips.h> | ||
21 | #include <linux/interrupt.h> | ||
22 | #include <linux/bootmem.h> | ||
23 | #include <linux/ftrace.h> | ||
24 | #include <linux/ioport.h> | ||
30 | #include <linux/module.h> | 25 | #include <linux/module.h> |
31 | #include <linux/dmi.h> | 26 | #include <linux/sysdev.h> |
27 | #include <linux/delay.h> | ||
28 | #include <linux/timex.h> | ||
32 | #include <linux/dmar.h> | 29 | #include <linux/dmar.h> |
33 | #include <linux/ftrace.h> | 30 | #include <linux/init.h> |
34 | #include <linux/smp.h> | 31 | #include <linux/cpu.h> |
32 | #include <linux/dmi.h> | ||
35 | #include <linux/nmi.h> | 33 | #include <linux/nmi.h> |
36 | #include <linux/timex.h> | 34 | #include <linux/smp.h> |
35 | #include <linux/mm.h> | ||
37 | 36 | ||
38 | #include <asm/atomic.h> | ||
39 | #include <asm/mtrr.h> | ||
40 | #include <asm/mpspec.h> | ||
41 | #include <asm/desc.h> | ||
42 | #include <asm/arch_hooks.h> | 37 | #include <asm/arch_hooks.h> |
43 | #include <asm/hpet.h> | ||
44 | #include <asm/pgalloc.h> | 38 | #include <asm/pgalloc.h> |
39 | #include <asm/genapic.h> | ||
40 | #include <asm/atomic.h> | ||
41 | #include <asm/mpspec.h> | ||
45 | #include <asm/i8253.h> | 42 | #include <asm/i8253.h> |
46 | #include <asm/idle.h> | 43 | #include <asm/i8259.h> |
47 | #include <asm/proto.h> | 44 | #include <asm/proto.h> |
48 | #include <asm/apic.h> | 45 | #include <asm/apic.h> |
49 | #include <asm/i8259.h> | 46 | #include <asm/desc.h> |
47 | #include <asm/hpet.h> | ||
48 | #include <asm/idle.h> | ||
49 | #include <asm/mtrr.h> | ||
50 | #include <asm/smp.h> | 50 | #include <asm/smp.h> |
51 | 51 | ||
52 | #include <mach_apic.h> | 52 | unsigned int num_processors; |
53 | #include <mach_apicdef.h> | 53 | |
54 | #include <mach_ipi.h> | 54 | unsigned disabled_cpus __cpuinitdata; |
55 | |||
56 | /* Processor that is doing the boot up */ | ||
57 | unsigned int boot_cpu_physical_apicid = -1U; | ||
55 | 58 | ||
56 | /* | 59 | /* |
57 | * Sanity check | 60 | * The highest APIC ID seen during enumeration. |
61 | * | ||
62 | * This determines the messaging protocol we can use: if all APIC IDs | ||
63 | * are in the 0 ... 7 range, then we can use logical addressing which | ||
64 | * has some performance advantages (better broadcasting). | ||
65 | * | ||
66 | * If there's an APIC ID above 8, we use physical addressing. | ||
58 | */ | 67 | */ |
59 | #if ((SPURIOUS_APIC_VECTOR & 0x0F) != 0x0F) | 68 | unsigned int max_physical_apicid; |
60 | # error SPURIOUS_APIC_VECTOR definition error | 69 | |
61 | #endif | 70 | /* |
71 | * Bitmask of physically existing CPUs: | ||
72 | */ | ||
73 | physid_mask_t phys_cpu_present_map; | ||
74 | |||
75 | /* | ||
76 | * Map cpu index to physical APIC ID | ||
77 | */ | ||
78 | DEFINE_EARLY_PER_CPU(u16, x86_cpu_to_apicid, BAD_APICID); | ||
79 | DEFINE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid, BAD_APICID); | ||
80 | EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_apicid); | ||
81 | EXPORT_EARLY_PER_CPU_SYMBOL(x86_bios_cpu_apicid); | ||
62 | 82 | ||
63 | #ifdef CONFIG_X86_32 | 83 | #ifdef CONFIG_X86_32 |
64 | /* | 84 | /* |
@@ -457,7 +477,7 @@ static void lapic_timer_setup(enum clock_event_mode mode, | |||
457 | static void lapic_timer_broadcast(const struct cpumask *mask) | 477 | static void lapic_timer_broadcast(const struct cpumask *mask) |
458 | { | 478 | { |
459 | #ifdef CONFIG_SMP | 479 | #ifdef CONFIG_SMP |
460 | send_IPI_mask(mask, LOCAL_TIMER_VECTOR); | 480 | apic->send_IPI_mask(mask, LOCAL_TIMER_VECTOR); |
461 | #endif | 481 | #endif |
462 | } | 482 | } |
463 | 483 | ||
@@ -991,11 +1011,11 @@ int __init verify_local_APIC(void) | |||
991 | */ | 1011 | */ |
992 | reg0 = apic_read(APIC_ID); | 1012 | reg0 = apic_read(APIC_ID); |
993 | apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0); | 1013 | apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0); |
994 | apic_write(APIC_ID, reg0 ^ APIC_ID_MASK); | 1014 | apic_write(APIC_ID, reg0 ^ apic->apic_id_mask); |
995 | reg1 = apic_read(APIC_ID); | 1015 | reg1 = apic_read(APIC_ID); |
996 | apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1); | 1016 | apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1); |
997 | apic_write(APIC_ID, reg0); | 1017 | apic_write(APIC_ID, reg0); |
998 | if (reg1 != (reg0 ^ APIC_ID_MASK)) | 1018 | if (reg1 != (reg0 ^ apic->apic_id_mask)) |
999 | return 0; | 1019 | return 0; |
1000 | 1020 | ||
1001 | /* | 1021 | /* |
@@ -1089,7 +1109,7 @@ static void __cpuinit lapic_setup_esr(void) | |||
1089 | return; | 1109 | return; |
1090 | } | 1110 | } |
1091 | 1111 | ||
1092 | if (esr_disable) { | 1112 | if (apic->disable_esr) { |
1093 | /* | 1113 | /* |
1094 | * Something untraceable is creating bad interrupts on | 1114 | * Something untraceable is creating bad interrupts on |
1095 | * secondary quads ... for the moment, just leave the | 1115 | * secondary quads ... for the moment, just leave the |
@@ -1130,9 +1150,14 @@ void __cpuinit setup_local_APIC(void) | |||
1130 | unsigned int value; | 1150 | unsigned int value; |
1131 | int i, j; | 1151 | int i, j; |
1132 | 1152 | ||
1153 | if (disable_apic) { | ||
1154 | arch_disable_smp_support(); | ||
1155 | return; | ||
1156 | } | ||
1157 | |||
1133 | #ifdef CONFIG_X86_32 | 1158 | #ifdef CONFIG_X86_32 |
1134 | /* Pound the ESR really hard over the head with a big hammer - mbligh */ | 1159 | /* Pound the ESR really hard over the head with a big hammer - mbligh */ |
1135 | if (lapic_is_integrated() && esr_disable) { | 1160 | if (lapic_is_integrated() && apic->disable_esr) { |
1136 | apic_write(APIC_ESR, 0); | 1161 | apic_write(APIC_ESR, 0); |
1137 | apic_write(APIC_ESR, 0); | 1162 | apic_write(APIC_ESR, 0); |
1138 | apic_write(APIC_ESR, 0); | 1163 | apic_write(APIC_ESR, 0); |
@@ -1146,7 +1171,7 @@ void __cpuinit setup_local_APIC(void) | |||
1146 | * Double-check whether this APIC is really registered. | 1171 | * Double-check whether this APIC is really registered. |
1147 | * This is meaningless in clustered apic mode, so we skip it. | 1172 | * This is meaningless in clustered apic mode, so we skip it. |
1148 | */ | 1173 | */ |
1149 | if (!apic_id_registered()) | 1174 | if (!apic->apic_id_registered()) |
1150 | BUG(); | 1175 | BUG(); |
1151 | 1176 | ||
1152 | /* | 1177 | /* |
@@ -1154,7 +1179,7 @@ void __cpuinit setup_local_APIC(void) | |||
1154 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | 1179 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel |
1155 | * document number 292116). So here it goes... | 1180 | * document number 292116). So here it goes... |
1156 | */ | 1181 | */ |
1157 | init_apic_ldr(); | 1182 | apic->init_apic_ldr(); |
1158 | 1183 | ||
1159 | /* | 1184 | /* |
1160 | * Set Task Priority to 'accept all'. We never change this | 1185 | * Set Task Priority to 'accept all'. We never change this |
@@ -1570,11 +1595,11 @@ int apic_version[MAX_APICS]; | |||
1570 | 1595 | ||
1571 | int __init APIC_init_uniprocessor(void) | 1596 | int __init APIC_init_uniprocessor(void) |
1572 | { | 1597 | { |
1573 | #ifdef CONFIG_X86_64 | ||
1574 | if (disable_apic) { | 1598 | if (disable_apic) { |
1575 | pr_info("Apic disabled\n"); | 1599 | pr_info("Apic disabled\n"); |
1576 | return -1; | 1600 | return -1; |
1577 | } | 1601 | } |
1602 | #ifdef CONFIG_X86_64 | ||
1578 | if (!cpu_has_apic) { | 1603 | if (!cpu_has_apic) { |
1579 | disable_apic = 1; | 1604 | disable_apic = 1; |
1580 | pr_info("Apic disabled by BIOS\n"); | 1605 | pr_info("Apic disabled by BIOS\n"); |
@@ -1600,7 +1625,7 @@ int __init APIC_init_uniprocessor(void) | |||
1600 | enable_IR_x2apic(); | 1625 | enable_IR_x2apic(); |
1601 | #endif | 1626 | #endif |
1602 | #ifdef CONFIG_X86_64 | 1627 | #ifdef CONFIG_X86_64 |
1603 | setup_apic_routing(); | 1628 | default_setup_apic_routing(); |
1604 | #endif | 1629 | #endif |
1605 | 1630 | ||
1606 | verify_local_APIC(); | 1631 | verify_local_APIC(); |
@@ -1738,7 +1763,8 @@ void __init connect_bsp_APIC(void) | |||
1738 | outb(0x01, 0x23); | 1763 | outb(0x01, 0x23); |
1739 | } | 1764 | } |
1740 | #endif | 1765 | #endif |
1741 | enable_apic_mode(); | 1766 | if (apic->enable_apic_mode) |
1767 | apic->enable_apic_mode(); | ||
1742 | } | 1768 | } |
1743 | 1769 | ||
1744 | /** | 1770 | /** |
@@ -1876,29 +1902,39 @@ void __cpuinit generic_processor_info(int apicid, int version) | |||
1876 | } | 1902 | } |
1877 | #endif | 1903 | #endif |
1878 | 1904 | ||
1879 | #if defined(CONFIG_X86_SMP) || defined(CONFIG_X86_64) | 1905 | #if defined(CONFIG_SMP) || defined(CONFIG_X86_64) |
1880 | /* are we being called early in kernel startup? */ | 1906 | early_per_cpu(x86_cpu_to_apicid, cpu) = apicid; |
1881 | if (early_per_cpu_ptr(x86_cpu_to_apicid)) { | 1907 | early_per_cpu(x86_bios_cpu_apicid, cpu) = apicid; |
1882 | u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid); | ||
1883 | u16 *bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid); | ||
1884 | |||
1885 | cpu_to_apicid[cpu] = apicid; | ||
1886 | bios_cpu_apicid[cpu] = apicid; | ||
1887 | } else { | ||
1888 | per_cpu(x86_cpu_to_apicid, cpu) = apicid; | ||
1889 | per_cpu(x86_bios_cpu_apicid, cpu) = apicid; | ||
1890 | } | ||
1891 | #endif | 1908 | #endif |
1892 | 1909 | ||
1893 | set_cpu_possible(cpu, true); | 1910 | set_cpu_possible(cpu, true); |
1894 | set_cpu_present(cpu, true); | 1911 | set_cpu_present(cpu, true); |
1895 | } | 1912 | } |
1896 | 1913 | ||
1897 | #ifdef CONFIG_X86_64 | ||
1898 | int hard_smp_processor_id(void) | 1914 | int hard_smp_processor_id(void) |
1899 | { | 1915 | { |
1900 | return read_apic_id(); | 1916 | return read_apic_id(); |
1901 | } | 1917 | } |
1918 | |||
1919 | void default_init_apic_ldr(void) | ||
1920 | { | ||
1921 | unsigned long val; | ||
1922 | |||
1923 | apic_write(APIC_DFR, APIC_DFR_VALUE); | ||
1924 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | ||
1925 | val |= SET_APIC_LOGICAL_ID(1UL << smp_processor_id()); | ||
1926 | apic_write(APIC_LDR, val); | ||
1927 | } | ||
1928 | |||
1929 | #ifdef CONFIG_X86_32 | ||
1930 | int default_apicid_to_node(int logical_apicid) | ||
1931 | { | ||
1932 | #ifdef CONFIG_SMP | ||
1933 | return apicid_2_node[hard_smp_processor_id()]; | ||
1934 | #else | ||
1935 | return 0; | ||
1936 | #endif | ||
1937 | } | ||
1902 | #endif | 1938 | #endif |
1903 | 1939 | ||
1904 | /* | 1940 | /* |
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index 98807bb095ad..37ba5f85b718 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c | |||
@@ -301,7 +301,7 @@ extern int (*console_blank_hook)(int); | |||
301 | */ | 301 | */ |
302 | #define APM_ZERO_SEGS | 302 | #define APM_ZERO_SEGS |
303 | 303 | ||
304 | #include "apm.h" | 304 | #include <asm/apm.h> |
305 | 305 | ||
306 | /* | 306 | /* |
307 | * Define to re-initialize the interrupt 0 timer to 100 Hz after a suspend. | 307 | * Define to re-initialize the interrupt 0 timer to 100 Hz after a suspend. |
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c index 1d41d3f1edbc..8793ab33e2c1 100644 --- a/arch/x86/kernel/asm-offsets_64.c +++ b/arch/x86/kernel/asm-offsets_64.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/hardirq.h> | 11 | #include <linux/hardirq.h> |
12 | #include <linux/suspend.h> | 12 | #include <linux/suspend.h> |
13 | #include <linux/kbuild.h> | 13 | #include <linux/kbuild.h> |
14 | #include <asm/pda.h> | ||
15 | #include <asm/processor.h> | 14 | #include <asm/processor.h> |
16 | #include <asm/segment.h> | 15 | #include <asm/segment.h> |
17 | #include <asm/thread_info.h> | 16 | #include <asm/thread_info.h> |
@@ -48,16 +47,6 @@ int main(void) | |||
48 | #endif | 47 | #endif |
49 | BLANK(); | 48 | BLANK(); |
50 | #undef ENTRY | 49 | #undef ENTRY |
51 | #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry)) | ||
52 | ENTRY(kernelstack); | ||
53 | ENTRY(oldrsp); | ||
54 | ENTRY(pcurrent); | ||
55 | ENTRY(irqcount); | ||
56 | ENTRY(cpunumber); | ||
57 | ENTRY(irqstackptr); | ||
58 | ENTRY(data_offset); | ||
59 | BLANK(); | ||
60 | #undef ENTRY | ||
61 | #ifdef CONFIG_PARAVIRT | 50 | #ifdef CONFIG_PARAVIRT |
62 | BLANK(); | 51 | BLANK(); |
63 | OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled); | 52 | OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled); |
diff --git a/arch/x86/kernel/bigsmp_32.c b/arch/x86/kernel/bigsmp_32.c new file mode 100644 index 000000000000..47a62f46afdb --- /dev/null +++ b/arch/x86/kernel/bigsmp_32.c | |||
@@ -0,0 +1,266 @@ | |||
1 | /* | ||
2 | * APIC driver for "bigsmp" XAPIC machines with more than 8 virtual CPUs. | ||
3 | * Drives the local APIC in "clustered mode". | ||
4 | */ | ||
5 | #define APIC_DEFINITION 1 | ||
6 | #include <linux/threads.h> | ||
7 | #include <linux/cpumask.h> | ||
8 | #include <asm/mpspec.h> | ||
9 | #include <asm/genapic.h> | ||
10 | #include <asm/fixmap.h> | ||
11 | #include <asm/apicdef.h> | ||
12 | #include <asm/ipi.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/dmi.h> | ||
16 | #include <linux/smp.h> | ||
17 | |||
18 | |||
19 | static inline unsigned bigsmp_get_apic_id(unsigned long x) | ||
20 | { | ||
21 | return (x >> 24) & 0xFF; | ||
22 | } | ||
23 | |||
24 | #define xapic_phys_to_log_apicid(cpu) (per_cpu(x86_bios_cpu_apicid, cpu)) | ||
25 | |||
26 | static inline int bigsmp_apic_id_registered(void) | ||
27 | { | ||
28 | return 1; | ||
29 | } | ||
30 | |||
31 | static inline const cpumask_t *bigsmp_target_cpus(void) | ||
32 | { | ||
33 | #ifdef CONFIG_SMP | ||
34 | return &cpu_online_map; | ||
35 | #else | ||
36 | return &cpumask_of_cpu(0); | ||
37 | #endif | ||
38 | } | ||
39 | |||
40 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
41 | |||
42 | static inline unsigned long | ||
43 | bigsmp_check_apicid_used(physid_mask_t bitmap, int apicid) | ||
44 | { | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | static inline unsigned long bigsmp_check_apicid_present(int bit) | ||
49 | { | ||
50 | return 1; | ||
51 | } | ||
52 | |||
53 | static inline unsigned long calculate_ldr(int cpu) | ||
54 | { | ||
55 | unsigned long val, id; | ||
56 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | ||
57 | id = xapic_phys_to_log_apicid(cpu); | ||
58 | val |= SET_APIC_LOGICAL_ID(id); | ||
59 | return val; | ||
60 | } | ||
61 | |||
62 | /* | ||
63 | * Set up the logical destination ID. | ||
64 | * | ||
65 | * Intel recommends to set DFR, LDR and TPR before enabling | ||
66 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
67 | * document number 292116). So here it goes... | ||
68 | */ | ||
69 | static inline void bigsmp_init_apic_ldr(void) | ||
70 | { | ||
71 | unsigned long val; | ||
72 | int cpu = smp_processor_id(); | ||
73 | |||
74 | apic_write(APIC_DFR, APIC_DFR_VALUE); | ||
75 | val = calculate_ldr(cpu); | ||
76 | apic_write(APIC_LDR, val); | ||
77 | } | ||
78 | |||
79 | static inline void bigsmp_setup_apic_routing(void) | ||
80 | { | ||
81 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | ||
82 | "Physflat", nr_ioapics); | ||
83 | } | ||
84 | |||
85 | static inline int bigsmp_apicid_to_node(int logical_apicid) | ||
86 | { | ||
87 | return apicid_2_node[hard_smp_processor_id()]; | ||
88 | } | ||
89 | |||
90 | static inline int bigsmp_cpu_present_to_apicid(int mps_cpu) | ||
91 | { | ||
92 | if (mps_cpu < nr_cpu_ids) | ||
93 | return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
94 | |||
95 | return BAD_APICID; | ||
96 | } | ||
97 | |||
98 | static inline physid_mask_t bigsmp_apicid_to_cpu_present(int phys_apicid) | ||
99 | { | ||
100 | return physid_mask_of_physid(phys_apicid); | ||
101 | } | ||
102 | |||
103 | extern u8 cpu_2_logical_apicid[]; | ||
104 | /* Mapping from cpu number to logical apicid */ | ||
105 | static inline int bigsmp_cpu_to_logical_apicid(int cpu) | ||
106 | { | ||
107 | if (cpu >= nr_cpu_ids) | ||
108 | return BAD_APICID; | ||
109 | return cpu_physical_id(cpu); | ||
110 | } | ||
111 | |||
112 | static inline physid_mask_t bigsmp_ioapic_phys_id_map(physid_mask_t phys_map) | ||
113 | { | ||
114 | /* For clustered we don't have a good way to do this yet - hack */ | ||
115 | return physids_promote(0xFFL); | ||
116 | } | ||
117 | |||
118 | static inline void bigsmp_setup_portio_remap(void) | ||
119 | { | ||
120 | } | ||
121 | |||
122 | static inline int bigsmp_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
123 | { | ||
124 | return 1; | ||
125 | } | ||
126 | |||
127 | /* As we are using single CPU as destination, pick only one CPU here */ | ||
128 | static inline unsigned int bigsmp_cpu_mask_to_apicid(const cpumask_t *cpumask) | ||
129 | { | ||
130 | return bigsmp_cpu_to_logical_apicid(first_cpu(*cpumask)); | ||
131 | } | ||
132 | |||
133 | static inline unsigned int | ||
134 | bigsmp_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
135 | const struct cpumask *andmask) | ||
136 | { | ||
137 | int cpu; | ||
138 | |||
139 | /* | ||
140 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | ||
141 | * May as well be the first. | ||
142 | */ | ||
143 | for_each_cpu_and(cpu, cpumask, andmask) { | ||
144 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | ||
145 | break; | ||
146 | } | ||
147 | if (cpu < nr_cpu_ids) | ||
148 | return bigsmp_cpu_to_logical_apicid(cpu); | ||
149 | |||
150 | return BAD_APICID; | ||
151 | } | ||
152 | |||
153 | static inline int bigsmp_phys_pkg_id(int cpuid_apic, int index_msb) | ||
154 | { | ||
155 | return cpuid_apic >> index_msb; | ||
156 | } | ||
157 | |||
158 | static inline void bigsmp_send_IPI_mask(const struct cpumask *mask, int vector) | ||
159 | { | ||
160 | default_send_IPI_mask_sequence_phys(mask, vector); | ||
161 | } | ||
162 | |||
163 | static inline void bigsmp_send_IPI_allbutself(int vector) | ||
164 | { | ||
165 | default_send_IPI_mask_allbutself_phys(cpu_online_mask, vector); | ||
166 | } | ||
167 | |||
168 | static inline void bigsmp_send_IPI_all(int vector) | ||
169 | { | ||
170 | bigsmp_send_IPI_mask(cpu_online_mask, vector); | ||
171 | } | ||
172 | |||
173 | static int dmi_bigsmp; /* can be set by dmi scanners */ | ||
174 | |||
175 | static int hp_ht_bigsmp(const struct dmi_system_id *d) | ||
176 | { | ||
177 | printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident); | ||
178 | dmi_bigsmp = 1; | ||
179 | return 0; | ||
180 | } | ||
181 | |||
182 | |||
183 | static const struct dmi_system_id bigsmp_dmi_table[] = { | ||
184 | { hp_ht_bigsmp, "HP ProLiant DL760 G2", | ||
185 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), | ||
186 | DMI_MATCH(DMI_BIOS_VERSION, "P44-"),} | ||
187 | }, | ||
188 | |||
189 | { hp_ht_bigsmp, "HP ProLiant DL740", | ||
190 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), | ||
191 | DMI_MATCH(DMI_BIOS_VERSION, "P47-"),} | ||
192 | }, | ||
193 | { } | ||
194 | }; | ||
195 | |||
196 | static void bigsmp_vector_allocation_domain(int cpu, cpumask_t *retmask) | ||
197 | { | ||
198 | cpus_clear(*retmask); | ||
199 | cpu_set(cpu, *retmask); | ||
200 | } | ||
201 | |||
202 | static int probe_bigsmp(void) | ||
203 | { | ||
204 | if (def_to_bigsmp) | ||
205 | dmi_bigsmp = 1; | ||
206 | else | ||
207 | dmi_check_system(bigsmp_dmi_table); | ||
208 | return dmi_bigsmp; | ||
209 | } | ||
210 | |||
211 | struct genapic apic_bigsmp = { | ||
212 | |||
213 | .name = "bigsmp", | ||
214 | .probe = probe_bigsmp, | ||
215 | .acpi_madt_oem_check = NULL, | ||
216 | .apic_id_registered = bigsmp_apic_id_registered, | ||
217 | |||
218 | .irq_delivery_mode = dest_Fixed, | ||
219 | /* phys delivery to target CPU: */ | ||
220 | .irq_dest_mode = 0, | ||
221 | |||
222 | .target_cpus = bigsmp_target_cpus, | ||
223 | .disable_esr = 1, | ||
224 | .dest_logical = 0, | ||
225 | .check_apicid_used = bigsmp_check_apicid_used, | ||
226 | .check_apicid_present = bigsmp_check_apicid_present, | ||
227 | |||
228 | .vector_allocation_domain = bigsmp_vector_allocation_domain, | ||
229 | .init_apic_ldr = bigsmp_init_apic_ldr, | ||
230 | |||
231 | .ioapic_phys_id_map = bigsmp_ioapic_phys_id_map, | ||
232 | .setup_apic_routing = bigsmp_setup_apic_routing, | ||
233 | .multi_timer_check = NULL, | ||
234 | .apicid_to_node = bigsmp_apicid_to_node, | ||
235 | .cpu_to_logical_apicid = bigsmp_cpu_to_logical_apicid, | ||
236 | .cpu_present_to_apicid = bigsmp_cpu_present_to_apicid, | ||
237 | .apicid_to_cpu_present = bigsmp_apicid_to_cpu_present, | ||
238 | .setup_portio_remap = NULL, | ||
239 | .check_phys_apicid_present = bigsmp_check_phys_apicid_present, | ||
240 | .enable_apic_mode = NULL, | ||
241 | .phys_pkg_id = bigsmp_phys_pkg_id, | ||
242 | .mps_oem_check = NULL, | ||
243 | |||
244 | .get_apic_id = bigsmp_get_apic_id, | ||
245 | .set_apic_id = NULL, | ||
246 | .apic_id_mask = 0xFF << 24, | ||
247 | |||
248 | .cpu_mask_to_apicid = bigsmp_cpu_mask_to_apicid, | ||
249 | .cpu_mask_to_apicid_and = bigsmp_cpu_mask_to_apicid_and, | ||
250 | |||
251 | .send_IPI_mask = bigsmp_send_IPI_mask, | ||
252 | .send_IPI_mask_allbutself = NULL, | ||
253 | .send_IPI_allbutself = bigsmp_send_IPI_allbutself, | ||
254 | .send_IPI_all = bigsmp_send_IPI_all, | ||
255 | .send_IPI_self = default_send_IPI_self, | ||
256 | |||
257 | .wakeup_cpu = NULL, | ||
258 | .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, | ||
259 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | ||
260 | |||
261 | .wait_for_init_deassert = default_wait_for_init_deassert, | ||
262 | |||
263 | .smp_callin_clear_local_apic = NULL, | ||
264 | .store_NMI_vector = NULL, | ||
265 | .inquire_remote_apic = default_inquire_remote_apic, | ||
266 | }; | ||
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c index 2cf23634b6d9..e48640cfac0c 100644 --- a/arch/x86/kernel/cpu/addon_cpuid_features.c +++ b/arch/x86/kernel/cpu/addon_cpuid_features.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <asm/pat.h> | 7 | #include <asm/pat.h> |
8 | #include <asm/processor.h> | 8 | #include <asm/processor.h> |
9 | 9 | ||
10 | #include <mach_apic.h> | 10 | #include <asm/genapic.h> |
11 | 11 | ||
12 | struct cpuid_bit { | 12 | struct cpuid_bit { |
13 | u16 feature; | 13 | u16 feature; |
@@ -69,7 +69,7 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c) | |||
69 | */ | 69 | */ |
70 | void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c) | 70 | void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c) |
71 | { | 71 | { |
72 | #ifdef CONFIG_X86_SMP | 72 | #ifdef CONFIG_SMP |
73 | unsigned int eax, ebx, ecx, edx, sub_index; | 73 | unsigned int eax, ebx, ecx, edx, sub_index; |
74 | unsigned int ht_mask_width, core_plus_mask_width; | 74 | unsigned int ht_mask_width, core_plus_mask_width; |
75 | unsigned int core_select_mask, core_level_siblings; | 75 | unsigned int core_select_mask, core_level_siblings; |
@@ -116,22 +116,14 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c) | |||
116 | 116 | ||
117 | core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width; | 117 | core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width; |
118 | 118 | ||
119 | #ifdef CONFIG_X86_32 | 119 | c->cpu_core_id = apic->phys_pkg_id(c->initial_apicid, ht_mask_width) |
120 | c->cpu_core_id = phys_pkg_id(c->initial_apicid, ht_mask_width) | ||
121 | & core_select_mask; | 120 | & core_select_mask; |
122 | c->phys_proc_id = phys_pkg_id(c->initial_apicid, core_plus_mask_width); | 121 | c->phys_proc_id = apic->phys_pkg_id(c->initial_apicid, core_plus_mask_width); |
123 | /* | 122 | /* |
124 | * Reinit the apicid, now that we have extended initial_apicid. | 123 | * Reinit the apicid, now that we have extended initial_apicid. |
125 | */ | 124 | */ |
126 | c->apicid = phys_pkg_id(c->initial_apicid, 0); | 125 | c->apicid = apic->phys_pkg_id(c->initial_apicid, 0); |
127 | #else | 126 | |
128 | c->cpu_core_id = phys_pkg_id(ht_mask_width) & core_select_mask; | ||
129 | c->phys_proc_id = phys_pkg_id(core_plus_mask_width); | ||
130 | /* | ||
131 | * Reinit the apicid, now that we have extended initial_apicid. | ||
132 | */ | ||
133 | c->apicid = phys_pkg_id(0); | ||
134 | #endif | ||
135 | c->x86_max_cores = (core_level_siblings / smp_num_siblings); | 127 | c->x86_max_cores = (core_level_siblings / smp_num_siblings); |
136 | 128 | ||
137 | 129 | ||
@@ -143,37 +135,3 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c) | |||
143 | return; | 135 | return; |
144 | #endif | 136 | #endif |
145 | } | 137 | } |
146 | |||
147 | #ifdef CONFIG_X86_PAT | ||
148 | void __cpuinit validate_pat_support(struct cpuinfo_x86 *c) | ||
149 | { | ||
150 | if (!cpu_has_pat) | ||
151 | pat_disable("PAT not supported by CPU."); | ||
152 | |||
153 | switch (c->x86_vendor) { | ||
154 | case X86_VENDOR_INTEL: | ||
155 | /* | ||
156 | * There is a known erratum on Pentium III and Core Solo | ||
157 | * and Core Duo CPUs. | ||
158 | * " Page with PAT set to WC while associated MTRR is UC | ||
159 | * may consolidate to UC " | ||
160 | * Because of this erratum, it is better to stick with | ||
161 | * setting WC in MTRR rather than using PAT on these CPUs. | ||
162 | * | ||
163 | * Enable PAT WC only on P4, Core 2 or later CPUs. | ||
164 | */ | ||
165 | if (c->x86 > 0x6 || (c->x86 == 6 && c->x86_model >= 15)) | ||
166 | return; | ||
167 | |||
168 | pat_disable("PAT WC disabled due to known CPU erratum."); | ||
169 | return; | ||
170 | |||
171 | case X86_VENDOR_AMD: | ||
172 | case X86_VENDOR_CENTAUR: | ||
173 | case X86_VENDOR_TRANSMETA: | ||
174 | return; | ||
175 | } | ||
176 | |||
177 | pat_disable("PAT disabled. Not yet verified on this CPU type."); | ||
178 | } | ||
179 | #endif | ||
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 7c878f6aa919..ff4d7b9e32e4 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -12,7 +12,7 @@ | |||
12 | # include <asm/cacheflush.h> | 12 | # include <asm/cacheflush.h> |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | #include <mach_apic.h> | 15 | #include <asm/genapic.h> |
16 | 16 | ||
17 | #include "cpu.h" | 17 | #include "cpu.h" |
18 | 18 | ||
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 83492b1f93b1..c4bdc7f00207 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -21,14 +21,16 @@ | |||
21 | #include <asm/asm.h> | 21 | #include <asm/asm.h> |
22 | #include <asm/numa.h> | 22 | #include <asm/numa.h> |
23 | #include <asm/smp.h> | 23 | #include <asm/smp.h> |
24 | #include <asm/cpu.h> | ||
25 | #include <asm/cpumask.h> | ||
24 | #ifdef CONFIG_X86_LOCAL_APIC | 26 | #ifdef CONFIG_X86_LOCAL_APIC |
25 | #include <asm/mpspec.h> | 27 | #include <asm/mpspec.h> |
26 | #include <asm/apic.h> | 28 | #include <asm/apic.h> |
27 | #include <mach_apic.h> | ||
28 | #include <asm/genapic.h> | 29 | #include <asm/genapic.h> |
30 | #include <asm/genapic.h> | ||
31 | #include <asm/uv/uv.h> | ||
29 | #endif | 32 | #endif |
30 | 33 | ||
31 | #include <asm/pda.h> | ||
32 | #include <asm/pgtable.h> | 34 | #include <asm/pgtable.h> |
33 | #include <asm/processor.h> | 35 | #include <asm/processor.h> |
34 | #include <asm/desc.h> | 36 | #include <asm/desc.h> |
@@ -50,6 +52,15 @@ cpumask_var_t cpu_initialized_mask; | |||
50 | /* representing cpus for which sibling maps can be computed */ | 52 | /* representing cpus for which sibling maps can be computed */ |
51 | cpumask_var_t cpu_sibling_setup_mask; | 53 | cpumask_var_t cpu_sibling_setup_mask; |
52 | 54 | ||
55 | /* correctly size the local cpu masks */ | ||
56 | void __init setup_cpu_local_masks(void) | ||
57 | { | ||
58 | alloc_bootmem_cpumask_var(&cpu_initialized_mask); | ||
59 | alloc_bootmem_cpumask_var(&cpu_callin_mask); | ||
60 | alloc_bootmem_cpumask_var(&cpu_callout_mask); | ||
61 | alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask); | ||
62 | } | ||
63 | |||
53 | #else /* CONFIG_X86_32 */ | 64 | #else /* CONFIG_X86_32 */ |
54 | 65 | ||
55 | cpumask_t cpu_callin_map; | 66 | cpumask_t cpu_callin_map; |
@@ -62,23 +73,23 @@ cpumask_t cpu_sibling_setup_map; | |||
62 | 73 | ||
63 | static struct cpu_dev *this_cpu __cpuinitdata; | 74 | static struct cpu_dev *this_cpu __cpuinitdata; |
64 | 75 | ||
76 | DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { | ||
65 | #ifdef CONFIG_X86_64 | 77 | #ifdef CONFIG_X86_64 |
66 | /* We need valid kernel segments for data and code in long mode too | 78 | /* |
67 | * IRET will check the segment types kkeil 2000/10/28 | 79 | * We need valid kernel segments for data and code in long mode too |
68 | * Also sysret mandates a special GDT layout | 80 | * IRET will check the segment types kkeil 2000/10/28 |
69 | */ | 81 | * Also sysret mandates a special GDT layout |
70 | /* The TLS descriptors are currently at a different place compared to i386. | 82 | * |
71 | Hopefully nobody expects them at a fixed place (Wine?) */ | 83 | * The TLS descriptors are currently at a different place compared to i386. |
72 | DEFINE_PER_CPU(struct gdt_page, gdt_page) = { .gdt = { | 84 | * Hopefully nobody expects them at a fixed place (Wine?) |
85 | */ | ||
73 | [GDT_ENTRY_KERNEL32_CS] = { { { 0x0000ffff, 0x00cf9b00 } } }, | 86 | [GDT_ENTRY_KERNEL32_CS] = { { { 0x0000ffff, 0x00cf9b00 } } }, |
74 | [GDT_ENTRY_KERNEL_CS] = { { { 0x0000ffff, 0x00af9b00 } } }, | 87 | [GDT_ENTRY_KERNEL_CS] = { { { 0x0000ffff, 0x00af9b00 } } }, |
75 | [GDT_ENTRY_KERNEL_DS] = { { { 0x0000ffff, 0x00cf9300 } } }, | 88 | [GDT_ENTRY_KERNEL_DS] = { { { 0x0000ffff, 0x00cf9300 } } }, |
76 | [GDT_ENTRY_DEFAULT_USER32_CS] = { { { 0x0000ffff, 0x00cffb00 } } }, | 89 | [GDT_ENTRY_DEFAULT_USER32_CS] = { { { 0x0000ffff, 0x00cffb00 } } }, |
77 | [GDT_ENTRY_DEFAULT_USER_DS] = { { { 0x0000ffff, 0x00cff300 } } }, | 90 | [GDT_ENTRY_DEFAULT_USER_DS] = { { { 0x0000ffff, 0x00cff300 } } }, |
78 | [GDT_ENTRY_DEFAULT_USER_CS] = { { { 0x0000ffff, 0x00affb00 } } }, | 91 | [GDT_ENTRY_DEFAULT_USER_CS] = { { { 0x0000ffff, 0x00affb00 } } }, |
79 | } }; | ||
80 | #else | 92 | #else |
81 | DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { | ||
82 | [GDT_ENTRY_KERNEL_CS] = { { { 0x0000ffff, 0x00cf9a00 } } }, | 93 | [GDT_ENTRY_KERNEL_CS] = { { { 0x0000ffff, 0x00cf9a00 } } }, |
83 | [GDT_ENTRY_KERNEL_DS] = { { { 0x0000ffff, 0x00cf9200 } } }, | 94 | [GDT_ENTRY_KERNEL_DS] = { { { 0x0000ffff, 0x00cf9200 } } }, |
84 | [GDT_ENTRY_DEFAULT_USER_CS] = { { { 0x0000ffff, 0x00cffa00 } } }, | 95 | [GDT_ENTRY_DEFAULT_USER_CS] = { { { 0x0000ffff, 0x00cffa00 } } }, |
@@ -110,9 +121,9 @@ DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { | |||
110 | [GDT_ENTRY_APMBIOS_BASE+2] = { { { 0x0000ffff, 0x00409200 } } }, | 121 | [GDT_ENTRY_APMBIOS_BASE+2] = { { { 0x0000ffff, 0x00409200 } } }, |
111 | 122 | ||
112 | [GDT_ENTRY_ESPFIX_SS] = { { { 0x00000000, 0x00c09200 } } }, | 123 | [GDT_ENTRY_ESPFIX_SS] = { { { 0x00000000, 0x00c09200 } } }, |
113 | [GDT_ENTRY_PERCPU] = { { { 0x00000000, 0x00000000 } } }, | 124 | [GDT_ENTRY_PERCPU] = { { { 0x0000ffff, 0x00cf9200 } } }, |
114 | } }; | ||
115 | #endif | 125 | #endif |
126 | } }; | ||
116 | EXPORT_PER_CPU_SYMBOL_GPL(gdt_page); | 127 | EXPORT_PER_CPU_SYMBOL_GPL(gdt_page); |
117 | 128 | ||
118 | #ifdef CONFIG_X86_32 | 129 | #ifdef CONFIG_X86_32 |
@@ -213,6 +224,49 @@ static inline void squash_the_stupid_serial_number(struct cpuinfo_x86 *c) | |||
213 | #endif | 224 | #endif |
214 | 225 | ||
215 | /* | 226 | /* |
227 | * Some CPU features depend on higher CPUID levels, which may not always | ||
228 | * be available due to CPUID level capping or broken virtualization | ||
229 | * software. Add those features to this table to auto-disable them. | ||
230 | */ | ||
231 | struct cpuid_dependent_feature { | ||
232 | u32 feature; | ||
233 | u32 level; | ||
234 | }; | ||
235 | static const struct cpuid_dependent_feature __cpuinitconst | ||
236 | cpuid_dependent_features[] = { | ||
237 | { X86_FEATURE_MWAIT, 0x00000005 }, | ||
238 | { X86_FEATURE_DCA, 0x00000009 }, | ||
239 | { X86_FEATURE_XSAVE, 0x0000000d }, | ||
240 | { 0, 0 } | ||
241 | }; | ||
242 | |||
243 | static void __cpuinit filter_cpuid_features(struct cpuinfo_x86 *c, bool warn) | ||
244 | { | ||
245 | const struct cpuid_dependent_feature *df; | ||
246 | for (df = cpuid_dependent_features; df->feature; df++) { | ||
247 | /* | ||
248 | * Note: cpuid_level is set to -1 if unavailable, but | ||
249 | * extended_extended_level is set to 0 if unavailable | ||
250 | * and the legitimate extended levels are all negative | ||
251 | * when signed; hence the weird messing around with | ||
252 | * signs here... | ||
253 | */ | ||
254 | if (cpu_has(c, df->feature) && | ||
255 | ((s32)df->feature < 0 ? | ||
256 | (u32)df->feature > (u32)c->extended_cpuid_level : | ||
257 | (s32)df->feature > (s32)c->cpuid_level)) { | ||
258 | clear_cpu_cap(c, df->feature); | ||
259 | if (warn) | ||
260 | printk(KERN_WARNING | ||
261 | "CPU: CPU feature %s disabled " | ||
262 | "due to lack of CPUID level 0x%x\n", | ||
263 | x86_cap_flags[df->feature], | ||
264 | df->level); | ||
265 | } | ||
266 | } | ||
267 | } | ||
268 | |||
269 | /* | ||
216 | * Naming convention should be: <Name> [(<Codename>)] | 270 | * Naming convention should be: <Name> [(<Codename>)] |
217 | * This table only is used unless init_<vendor>() below doesn't set it; | 271 | * This table only is used unless init_<vendor>() below doesn't set it; |
218 | * in particular, if CPUID levels 0x80000002..4 are supported, this isn't used | 272 | * in particular, if CPUID levels 0x80000002..4 are supported, this isn't used |
@@ -247,12 +301,17 @@ __u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata; | |||
247 | void switch_to_new_gdt(void) | 301 | void switch_to_new_gdt(void) |
248 | { | 302 | { |
249 | struct desc_ptr gdt_descr; | 303 | struct desc_ptr gdt_descr; |
304 | int cpu = smp_processor_id(); | ||
250 | 305 | ||
251 | gdt_descr.address = (long)get_cpu_gdt_table(smp_processor_id()); | 306 | gdt_descr.address = (long)get_cpu_gdt_table(cpu); |
252 | gdt_descr.size = GDT_SIZE - 1; | 307 | gdt_descr.size = GDT_SIZE - 1; |
253 | load_gdt(&gdt_descr); | 308 | load_gdt(&gdt_descr); |
309 | /* Reload the per-cpu base */ | ||
254 | #ifdef CONFIG_X86_32 | 310 | #ifdef CONFIG_X86_32 |
255 | asm("mov %0, %%fs" : : "r" (__KERNEL_PERCPU) : "memory"); | 311 | loadsegment(fs, __KERNEL_PERCPU); |
312 | #else | ||
313 | loadsegment(gs, 0); | ||
314 | wrmsrl(MSR_GS_BASE, (unsigned long)per_cpu(irq_stack_union.gs_base, cpu)); | ||
256 | #endif | 315 | #endif |
257 | } | 316 | } |
258 | 317 | ||
@@ -383,11 +442,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
383 | } | 442 | } |
384 | 443 | ||
385 | index_msb = get_count_order(smp_num_siblings); | 444 | index_msb = get_count_order(smp_num_siblings); |
386 | #ifdef CONFIG_X86_64 | 445 | c->phys_proc_id = apic->phys_pkg_id(c->initial_apicid, index_msb); |
387 | c->phys_proc_id = phys_pkg_id(index_msb); | ||
388 | #else | ||
389 | c->phys_proc_id = phys_pkg_id(c->initial_apicid, index_msb); | ||
390 | #endif | ||
391 | 446 | ||
392 | smp_num_siblings = smp_num_siblings / c->x86_max_cores; | 447 | smp_num_siblings = smp_num_siblings / c->x86_max_cores; |
393 | 448 | ||
@@ -395,13 +450,8 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
395 | 450 | ||
396 | core_bits = get_count_order(c->x86_max_cores); | 451 | core_bits = get_count_order(c->x86_max_cores); |
397 | 452 | ||
398 | #ifdef CONFIG_X86_64 | 453 | c->cpu_core_id = apic->phys_pkg_id(c->initial_apicid, index_msb) & |
399 | c->cpu_core_id = phys_pkg_id(index_msb) & | ||
400 | ((1 << core_bits) - 1); | ||
401 | #else | ||
402 | c->cpu_core_id = phys_pkg_id(c->initial_apicid, index_msb) & | ||
403 | ((1 << core_bits) - 1); | 454 | ((1 << core_bits) - 1); |
404 | #endif | ||
405 | } | 455 | } |
406 | 456 | ||
407 | out: | 457 | out: |
@@ -570,11 +620,10 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c) | |||
570 | if (this_cpu->c_early_init) | 620 | if (this_cpu->c_early_init) |
571 | this_cpu->c_early_init(c); | 621 | this_cpu->c_early_init(c); |
572 | 622 | ||
573 | validate_pat_support(c); | ||
574 | |||
575 | #ifdef CONFIG_SMP | 623 | #ifdef CONFIG_SMP |
576 | c->cpu_index = boot_cpu_id; | 624 | c->cpu_index = boot_cpu_id; |
577 | #endif | 625 | #endif |
626 | filter_cpuid_features(c, false); | ||
578 | } | 627 | } |
579 | 628 | ||
580 | void __init early_cpu_init(void) | 629 | void __init early_cpu_init(void) |
@@ -637,7 +686,7 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c) | |||
637 | c->initial_apicid = (cpuid_ebx(1) >> 24) & 0xFF; | 686 | c->initial_apicid = (cpuid_ebx(1) >> 24) & 0xFF; |
638 | #ifdef CONFIG_X86_32 | 687 | #ifdef CONFIG_X86_32 |
639 | # ifdef CONFIG_X86_HT | 688 | # ifdef CONFIG_X86_HT |
640 | c->apicid = phys_pkg_id(c->initial_apicid, 0); | 689 | c->apicid = apic->phys_pkg_id(c->initial_apicid, 0); |
641 | # else | 690 | # else |
642 | c->apicid = c->initial_apicid; | 691 | c->apicid = c->initial_apicid; |
643 | # endif | 692 | # endif |
@@ -684,7 +733,7 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
684 | this_cpu->c_identify(c); | 733 | this_cpu->c_identify(c); |
685 | 734 | ||
686 | #ifdef CONFIG_X86_64 | 735 | #ifdef CONFIG_X86_64 |
687 | c->apicid = phys_pkg_id(0); | 736 | c->apicid = apic->phys_pkg_id(c->initial_apicid, 0); |
688 | #endif | 737 | #endif |
689 | 738 | ||
690 | /* | 739 | /* |
@@ -708,6 +757,9 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
708 | * we do "generic changes." | 757 | * we do "generic changes." |
709 | */ | 758 | */ |
710 | 759 | ||
760 | /* Filter out anything that depends on CPUID levels we don't have */ | ||
761 | filter_cpuid_features(c, true); | ||
762 | |||
711 | /* If the model name is still unset, do table lookup. */ | 763 | /* If the model name is still unset, do table lookup. */ |
712 | if (!c->x86_model_id[0]) { | 764 | if (!c->x86_model_id[0]) { |
713 | char *p; | 765 | char *p; |
@@ -877,54 +929,26 @@ static __init int setup_disablecpuid(char *arg) | |||
877 | __setup("clearcpuid=", setup_disablecpuid); | 929 | __setup("clearcpuid=", setup_disablecpuid); |
878 | 930 | ||
879 | #ifdef CONFIG_X86_64 | 931 | #ifdef CONFIG_X86_64 |
880 | struct x8664_pda **_cpu_pda __read_mostly; | ||
881 | EXPORT_SYMBOL(_cpu_pda); | ||
882 | |||
883 | struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table }; | 932 | struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table }; |
884 | 933 | ||
885 | static char boot_cpu_stack[IRQSTACKSIZE] __page_aligned_bss; | 934 | DEFINE_PER_CPU_FIRST(union irq_stack_union, |
886 | 935 | irq_stack_union) __aligned(PAGE_SIZE); | |
887 | void __cpuinit pda_init(int cpu) | 936 | #ifdef CONFIG_SMP |
888 | { | 937 | DEFINE_PER_CPU(char *, irq_stack_ptr); /* will be set during per cpu init */ |
889 | struct x8664_pda *pda = cpu_pda(cpu); | 938 | #else |
939 | DEFINE_PER_CPU(char *, irq_stack_ptr) = | ||
940 | per_cpu_var(irq_stack_union.irq_stack) + IRQ_STACK_SIZE - 64; | ||
941 | #endif | ||
890 | 942 | ||
891 | /* Setup up data that may be needed in __get_free_pages early */ | 943 | DEFINE_PER_CPU(unsigned long, kernel_stack) = |
892 | loadsegment(fs, 0); | 944 | (unsigned long)&init_thread_union - KERNEL_STACK_OFFSET + THREAD_SIZE; |
893 | loadsegment(gs, 0); | 945 | EXPORT_PER_CPU_SYMBOL(kernel_stack); |
894 | /* Memory clobbers used to order PDA accessed */ | ||
895 | mb(); | ||
896 | wrmsrl(MSR_GS_BASE, pda); | ||
897 | mb(); | ||
898 | |||
899 | pda->cpunumber = cpu; | ||
900 | pda->irqcount = -1; | ||
901 | pda->kernelstack = (unsigned long)stack_thread_info() - | ||
902 | PDA_STACKOFFSET + THREAD_SIZE; | ||
903 | pda->active_mm = &init_mm; | ||
904 | pda->mmu_state = 0; | ||
905 | |||
906 | if (cpu == 0) { | ||
907 | /* others are initialized in smpboot.c */ | ||
908 | pda->pcurrent = &init_task; | ||
909 | pda->irqstackptr = boot_cpu_stack; | ||
910 | pda->irqstackptr += IRQSTACKSIZE - 64; | ||
911 | } else { | ||
912 | if (!pda->irqstackptr) { | ||
913 | pda->irqstackptr = (char *) | ||
914 | __get_free_pages(GFP_ATOMIC, IRQSTACK_ORDER); | ||
915 | if (!pda->irqstackptr) | ||
916 | panic("cannot allocate irqstack for cpu %d", | ||
917 | cpu); | ||
918 | pda->irqstackptr += IRQSTACKSIZE - 64; | ||
919 | } | ||
920 | 946 | ||
921 | if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE) | 947 | DEFINE_PER_CPU(unsigned int, irq_count) = -1; |
922 | pda->nodenumber = cpu_to_node(cpu); | ||
923 | } | ||
924 | } | ||
925 | 948 | ||
926 | static char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + | 949 | static DEFINE_PER_CPU_PAGE_ALIGNED(char, exception_stacks |
927 | DEBUG_STKSZ] __page_aligned_bss; | 950 | [(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ]) |
951 | __aligned(PAGE_SIZE); | ||
928 | 952 | ||
929 | extern asmlinkage void ignore_sysret(void); | 953 | extern asmlinkage void ignore_sysret(void); |
930 | 954 | ||
@@ -982,15 +1006,14 @@ void __cpuinit cpu_init(void) | |||
982 | struct tss_struct *t = &per_cpu(init_tss, cpu); | 1006 | struct tss_struct *t = &per_cpu(init_tss, cpu); |
983 | struct orig_ist *orig_ist = &per_cpu(orig_ist, cpu); | 1007 | struct orig_ist *orig_ist = &per_cpu(orig_ist, cpu); |
984 | unsigned long v; | 1008 | unsigned long v; |
985 | char *estacks = NULL; | ||
986 | struct task_struct *me; | 1009 | struct task_struct *me; |
987 | int i; | 1010 | int i; |
988 | 1011 | ||
989 | /* CPU 0 is initialised in head64.c */ | 1012 | #ifdef CONFIG_NUMA |
990 | if (cpu != 0) | 1013 | if (cpu != 0 && percpu_read(node_number) == 0 && |
991 | pda_init(cpu); | 1014 | cpu_to_node(cpu) != NUMA_NO_NODE) |
992 | else | 1015 | percpu_write(node_number, cpu_to_node(cpu)); |
993 | estacks = boot_exception_stacks; | 1016 | #endif |
994 | 1017 | ||
995 | me = current; | 1018 | me = current; |
996 | 1019 | ||
@@ -1007,6 +1030,8 @@ void __cpuinit cpu_init(void) | |||
1007 | */ | 1030 | */ |
1008 | 1031 | ||
1009 | switch_to_new_gdt(); | 1032 | switch_to_new_gdt(); |
1033 | loadsegment(fs, 0); | ||
1034 | |||
1010 | load_idt((const struct desc_ptr *)&idt_descr); | 1035 | load_idt((const struct desc_ptr *)&idt_descr); |
1011 | 1036 | ||
1012 | memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8); | 1037 | memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8); |
@@ -1024,18 +1049,13 @@ void __cpuinit cpu_init(void) | |||
1024 | * set up and load the per-CPU TSS | 1049 | * set up and load the per-CPU TSS |
1025 | */ | 1050 | */ |
1026 | if (!orig_ist->ist[0]) { | 1051 | if (!orig_ist->ist[0]) { |
1027 | static const unsigned int order[N_EXCEPTION_STACKS] = { | 1052 | static const unsigned int sizes[N_EXCEPTION_STACKS] = { |
1028 | [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, | 1053 | [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STKSZ, |
1029 | [DEBUG_STACK - 1] = DEBUG_STACK_ORDER | 1054 | [DEBUG_STACK - 1] = DEBUG_STKSZ |
1030 | }; | 1055 | }; |
1056 | char *estacks = per_cpu(exception_stacks, cpu); | ||
1031 | for (v = 0; v < N_EXCEPTION_STACKS; v++) { | 1057 | for (v = 0; v < N_EXCEPTION_STACKS; v++) { |
1032 | if (cpu) { | 1058 | estacks += sizes[v]; |
1033 | estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]); | ||
1034 | if (!estacks) | ||
1035 | panic("Cannot allocate exception " | ||
1036 | "stack %ld %d\n", v, cpu); | ||
1037 | } | ||
1038 | estacks += PAGE_SIZE << order[v]; | ||
1039 | orig_ist->ist[v] = t->x86_tss.ist[v] = | 1059 | orig_ist->ist[v] = t->x86_tss.ist[v] = |
1040 | (unsigned long)estacks; | 1060 | (unsigned long)estacks; |
1041 | } | 1061 | } |
@@ -1069,22 +1089,19 @@ void __cpuinit cpu_init(void) | |||
1069 | */ | 1089 | */ |
1070 | if (kgdb_connected && arch_kgdb_ops.correct_hw_break) | 1090 | if (kgdb_connected && arch_kgdb_ops.correct_hw_break) |
1071 | arch_kgdb_ops.correct_hw_break(); | 1091 | arch_kgdb_ops.correct_hw_break(); |
1072 | else { | 1092 | else |
1073 | #endif | 1093 | #endif |
1074 | /* | 1094 | { |
1075 | * Clear all 6 debug registers: | 1095 | /* |
1076 | */ | 1096 | * Clear all 6 debug registers: |
1077 | 1097 | */ | |
1078 | set_debugreg(0UL, 0); | 1098 | set_debugreg(0UL, 0); |
1079 | set_debugreg(0UL, 1); | 1099 | set_debugreg(0UL, 1); |
1080 | set_debugreg(0UL, 2); | 1100 | set_debugreg(0UL, 2); |
1081 | set_debugreg(0UL, 3); | 1101 | set_debugreg(0UL, 3); |
1082 | set_debugreg(0UL, 6); | 1102 | set_debugreg(0UL, 6); |
1083 | set_debugreg(0UL, 7); | 1103 | set_debugreg(0UL, 7); |
1084 | #ifdef CONFIG_KGDB | ||
1085 | /* If the kgdb is connected no debug regs should be altered. */ | ||
1086 | } | 1104 | } |
1087 | #endif | ||
1088 | 1105 | ||
1089 | fpu_init(); | 1106 | fpu_init(); |
1090 | 1107 | ||
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 430e5c38a544..1cef0aa5e5dc 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #ifdef CONFIG_X86_LOCAL_APIC | 24 | #ifdef CONFIG_X86_LOCAL_APIC |
25 | #include <asm/mpspec.h> | 25 | #include <asm/mpspec.h> |
26 | #include <asm/apic.h> | 26 | #include <asm/apic.h> |
27 | #include <mach_apic.h> | 27 | #include <asm/genapic.h> |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) | 30 | static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) |
@@ -63,6 +63,18 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) | |||
63 | set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC); | 63 | set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC); |
64 | } | 64 | } |
65 | 65 | ||
66 | /* | ||
67 | * There is a known erratum on Pentium III and Core Solo | ||
68 | * and Core Duo CPUs. | ||
69 | * " Page with PAT set to WC while associated MTRR is UC | ||
70 | * may consolidate to UC " | ||
71 | * Because of this erratum, it is better to stick with | ||
72 | * setting WC in MTRR rather than using PAT on these CPUs. | ||
73 | * | ||
74 | * Enable PAT WC only on P4, Core 2 or later CPUs. | ||
75 | */ | ||
76 | if (c->x86 == 6 && c->x86_model < 15) | ||
77 | clear_cpu_cap(c, X86_FEATURE_PAT); | ||
66 | } | 78 | } |
67 | 79 | ||
68 | #ifdef CONFIG_X86_32 | 80 | #ifdef CONFIG_X86_32 |
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index da299eb85fc0..7293508d8f5c 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
@@ -147,7 +147,16 @@ struct _cpuid4_info { | |||
147 | union _cpuid4_leaf_ecx ecx; | 147 | union _cpuid4_leaf_ecx ecx; |
148 | unsigned long size; | 148 | unsigned long size; |
149 | unsigned long can_disable; | 149 | unsigned long can_disable; |
150 | cpumask_t shared_cpu_map; /* future?: only cpus/node is needed */ | 150 | DECLARE_BITMAP(shared_cpu_map, NR_CPUS); |
151 | }; | ||
152 | |||
153 | /* subset of above _cpuid4_info w/o shared_cpu_map */ | ||
154 | struct _cpuid4_info_regs { | ||
155 | union _cpuid4_leaf_eax eax; | ||
156 | union _cpuid4_leaf_ebx ebx; | ||
157 | union _cpuid4_leaf_ecx ecx; | ||
158 | unsigned long size; | ||
159 | unsigned long can_disable; | ||
151 | }; | 160 | }; |
152 | 161 | ||
153 | #ifdef CONFIG_PCI | 162 | #ifdef CONFIG_PCI |
@@ -278,7 +287,7 @@ amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, | |||
278 | } | 287 | } |
279 | 288 | ||
280 | static void __cpuinit | 289 | static void __cpuinit |
281 | amd_check_l3_disable(int index, struct _cpuid4_info *this_leaf) | 290 | amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf) |
282 | { | 291 | { |
283 | if (index < 3) | 292 | if (index < 3) |
284 | return; | 293 | return; |
@@ -286,7 +295,8 @@ amd_check_l3_disable(int index, struct _cpuid4_info *this_leaf) | |||
286 | } | 295 | } |
287 | 296 | ||
288 | static int | 297 | static int |
289 | __cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf) | 298 | __cpuinit cpuid4_cache_lookup_regs(int index, |
299 | struct _cpuid4_info_regs *this_leaf) | ||
290 | { | 300 | { |
291 | union _cpuid4_leaf_eax eax; | 301 | union _cpuid4_leaf_eax eax; |
292 | union _cpuid4_leaf_ebx ebx; | 302 | union _cpuid4_leaf_ebx ebx; |
@@ -314,6 +324,15 @@ __cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf) | |||
314 | return 0; | 324 | return 0; |
315 | } | 325 | } |
316 | 326 | ||
327 | static int | ||
328 | __cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf) | ||
329 | { | ||
330 | struct _cpuid4_info_regs *leaf_regs = | ||
331 | (struct _cpuid4_info_regs *)this_leaf; | ||
332 | |||
333 | return cpuid4_cache_lookup_regs(index, leaf_regs); | ||
334 | } | ||
335 | |||
317 | static int __cpuinit find_num_cache_leaves(void) | 336 | static int __cpuinit find_num_cache_leaves(void) |
318 | { | 337 | { |
319 | unsigned int eax, ebx, ecx, edx; | 338 | unsigned int eax, ebx, ecx, edx; |
@@ -353,11 +372,10 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) | |||
353 | * parameters cpuid leaf to find the cache details | 372 | * parameters cpuid leaf to find the cache details |
354 | */ | 373 | */ |
355 | for (i = 0; i < num_cache_leaves; i++) { | 374 | for (i = 0; i < num_cache_leaves; i++) { |
356 | struct _cpuid4_info this_leaf; | 375 | struct _cpuid4_info_regs this_leaf; |
357 | |||
358 | int retval; | 376 | int retval; |
359 | 377 | ||
360 | retval = cpuid4_cache_lookup(i, &this_leaf); | 378 | retval = cpuid4_cache_lookup_regs(i, &this_leaf); |
361 | if (retval >= 0) { | 379 | if (retval >= 0) { |
362 | switch(this_leaf.eax.split.level) { | 380 | switch(this_leaf.eax.split.level) { |
363 | case 1: | 381 | case 1: |
@@ -506,17 +524,20 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) | |||
506 | num_threads_sharing = 1 + this_leaf->eax.split.num_threads_sharing; | 524 | num_threads_sharing = 1 + this_leaf->eax.split.num_threads_sharing; |
507 | 525 | ||
508 | if (num_threads_sharing == 1) | 526 | if (num_threads_sharing == 1) |
509 | cpu_set(cpu, this_leaf->shared_cpu_map); | 527 | cpumask_set_cpu(cpu, to_cpumask(this_leaf->shared_cpu_map)); |
510 | else { | 528 | else { |
511 | index_msb = get_count_order(num_threads_sharing); | 529 | index_msb = get_count_order(num_threads_sharing); |
512 | 530 | ||
513 | for_each_online_cpu(i) { | 531 | for_each_online_cpu(i) { |
514 | if (cpu_data(i).apicid >> index_msb == | 532 | if (cpu_data(i).apicid >> index_msb == |
515 | c->apicid >> index_msb) { | 533 | c->apicid >> index_msb) { |
516 | cpu_set(i, this_leaf->shared_cpu_map); | 534 | cpumask_set_cpu(i, |
535 | to_cpumask(this_leaf->shared_cpu_map)); | ||
517 | if (i != cpu && per_cpu(cpuid4_info, i)) { | 536 | if (i != cpu && per_cpu(cpuid4_info, i)) { |
518 | sibling_leaf = CPUID4_INFO_IDX(i, index); | 537 | sibling_leaf = |
519 | cpu_set(cpu, sibling_leaf->shared_cpu_map); | 538 | CPUID4_INFO_IDX(i, index); |
539 | cpumask_set_cpu(cpu, to_cpumask( | ||
540 | sibling_leaf->shared_cpu_map)); | ||
520 | } | 541 | } |
521 | } | 542 | } |
522 | } | 543 | } |
@@ -528,9 +549,10 @@ static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index) | |||
528 | int sibling; | 549 | int sibling; |
529 | 550 | ||
530 | this_leaf = CPUID4_INFO_IDX(cpu, index); | 551 | this_leaf = CPUID4_INFO_IDX(cpu, index); |
531 | for_each_cpu_mask_nr(sibling, this_leaf->shared_cpu_map) { | 552 | for_each_cpu(sibling, to_cpumask(this_leaf->shared_cpu_map)) { |
532 | sibling_leaf = CPUID4_INFO_IDX(sibling, index); | 553 | sibling_leaf = CPUID4_INFO_IDX(sibling, index); |
533 | cpu_clear(cpu, sibling_leaf->shared_cpu_map); | 554 | cpumask_clear_cpu(cpu, |
555 | to_cpumask(sibling_leaf->shared_cpu_map)); | ||
534 | } | 556 | } |
535 | } | 557 | } |
536 | #else | 558 | #else |
@@ -635,8 +657,9 @@ static ssize_t show_shared_cpu_map_func(struct _cpuid4_info *this_leaf, | |||
635 | int n = 0; | 657 | int n = 0; |
636 | 658 | ||
637 | if (len > 1) { | 659 | if (len > 1) { |
638 | cpumask_t *mask = &this_leaf->shared_cpu_map; | 660 | const struct cpumask *mask; |
639 | 661 | ||
662 | mask = to_cpumask(this_leaf->shared_cpu_map); | ||
640 | n = type? | 663 | n = type? |
641 | cpulist_scnprintf(buf, len-2, mask) : | 664 | cpulist_scnprintf(buf, len-2, mask) : |
642 | cpumask_scnprintf(buf, len-2, mask); | 665 | cpumask_scnprintf(buf, len-2, mask); |
@@ -699,7 +722,8 @@ static struct pci_dev *get_k8_northbridge(int node) | |||
699 | 722 | ||
700 | static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf) | 723 | static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf) |
701 | { | 724 | { |
702 | int node = cpu_to_node(first_cpu(this_leaf->shared_cpu_map)); | 725 | const struct cpumask *mask = to_cpumask(this_leaf->shared_cpu_map); |
726 | int node = cpu_to_node(cpumask_first(mask)); | ||
703 | struct pci_dev *dev = NULL; | 727 | struct pci_dev *dev = NULL; |
704 | ssize_t ret = 0; | 728 | ssize_t ret = 0; |
705 | int i; | 729 | int i; |
@@ -733,7 +757,8 @@ static ssize_t | |||
733 | store_cache_disable(struct _cpuid4_info *this_leaf, const char *buf, | 757 | store_cache_disable(struct _cpuid4_info *this_leaf, const char *buf, |
734 | size_t count) | 758 | size_t count) |
735 | { | 759 | { |
736 | int node = cpu_to_node(first_cpu(this_leaf->shared_cpu_map)); | 760 | const struct cpumask *mask = to_cpumask(this_leaf->shared_cpu_map); |
761 | int node = cpu_to_node(cpumask_first(mask)); | ||
737 | struct pci_dev *dev = NULL; | 762 | struct pci_dev *dev = NULL; |
738 | unsigned int ret, index, val; | 763 | unsigned int ret, index, val; |
739 | 764 | ||
@@ -878,7 +903,7 @@ err_out: | |||
878 | return -ENOMEM; | 903 | return -ENOMEM; |
879 | } | 904 | } |
880 | 905 | ||
881 | static cpumask_t cache_dev_map = CPU_MASK_NONE; | 906 | static DECLARE_BITMAP(cache_dev_map, NR_CPUS); |
882 | 907 | ||
883 | /* Add/Remove cache interface for CPU device */ | 908 | /* Add/Remove cache interface for CPU device */ |
884 | static int __cpuinit cache_add_dev(struct sys_device * sys_dev) | 909 | static int __cpuinit cache_add_dev(struct sys_device * sys_dev) |
@@ -918,7 +943,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) | |||
918 | } | 943 | } |
919 | kobject_uevent(&(this_object->kobj), KOBJ_ADD); | 944 | kobject_uevent(&(this_object->kobj), KOBJ_ADD); |
920 | } | 945 | } |
921 | cpu_set(cpu, cache_dev_map); | 946 | cpumask_set_cpu(cpu, to_cpumask(cache_dev_map)); |
922 | 947 | ||
923 | kobject_uevent(per_cpu(cache_kobject, cpu), KOBJ_ADD); | 948 | kobject_uevent(per_cpu(cache_kobject, cpu), KOBJ_ADD); |
924 | return 0; | 949 | return 0; |
@@ -931,9 +956,9 @@ static void __cpuinit cache_remove_dev(struct sys_device * sys_dev) | |||
931 | 956 | ||
932 | if (per_cpu(cpuid4_info, cpu) == NULL) | 957 | if (per_cpu(cpuid4_info, cpu) == NULL) |
933 | return; | 958 | return; |
934 | if (!cpu_isset(cpu, cache_dev_map)) | 959 | if (!cpumask_test_cpu(cpu, to_cpumask(cache_dev_map))) |
935 | return; | 960 | return; |
936 | cpu_clear(cpu, cache_dev_map); | 961 | cpumask_clear_cpu(cpu, to_cpumask(cache_dev_map)); |
937 | 962 | ||
938 | for (i = 0; i < num_cache_leaves; i++) | 963 | for (i = 0; i < num_cache_leaves; i++) |
939 | kobject_put(&(INDEX_KOBJECT_PTR(cpu,i)->kobj)); | 964 | kobject_put(&(INDEX_KOBJECT_PTR(cpu,i)->kobj)); |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c index 8ae8c4ff094d..4772e91e8246 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c | |||
@@ -67,7 +67,7 @@ static struct threshold_block threshold_defaults = { | |||
67 | struct threshold_bank { | 67 | struct threshold_bank { |
68 | struct kobject *kobj; | 68 | struct kobject *kobj; |
69 | struct threshold_block *blocks; | 69 | struct threshold_block *blocks; |
70 | cpumask_t cpus; | 70 | cpumask_var_t cpus; |
71 | }; | 71 | }; |
72 | static DEFINE_PER_CPU(struct threshold_bank *, threshold_banks[NR_BANKS]); | 72 | static DEFINE_PER_CPU(struct threshold_bank *, threshold_banks[NR_BANKS]); |
73 | 73 | ||
@@ -481,7 +481,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
481 | 481 | ||
482 | #ifdef CONFIG_SMP | 482 | #ifdef CONFIG_SMP |
483 | if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */ | 483 | if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */ |
484 | i = first_cpu(per_cpu(cpu_core_map, cpu)); | 484 | i = cpumask_first(&per_cpu(cpu_core_map, cpu)); |
485 | 485 | ||
486 | /* first core not up yet */ | 486 | /* first core not up yet */ |
487 | if (cpu_data(i).cpu_core_id) | 487 | if (cpu_data(i).cpu_core_id) |
@@ -501,7 +501,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
501 | if (err) | 501 | if (err) |
502 | goto out; | 502 | goto out; |
503 | 503 | ||
504 | b->cpus = per_cpu(cpu_core_map, cpu); | 504 | cpumask_copy(b->cpus, &per_cpu(cpu_core_map, cpu)); |
505 | per_cpu(threshold_banks, cpu)[bank] = b; | 505 | per_cpu(threshold_banks, cpu)[bank] = b; |
506 | goto out; | 506 | goto out; |
507 | } | 507 | } |
@@ -512,15 +512,20 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
512 | err = -ENOMEM; | 512 | err = -ENOMEM; |
513 | goto out; | 513 | goto out; |
514 | } | 514 | } |
515 | if (!alloc_cpumask_var(&b->cpus, GFP_KERNEL)) { | ||
516 | kfree(b); | ||
517 | err = -ENOMEM; | ||
518 | goto out; | ||
519 | } | ||
515 | 520 | ||
516 | b->kobj = kobject_create_and_add(name, &per_cpu(device_mce, cpu).kobj); | 521 | b->kobj = kobject_create_and_add(name, &per_cpu(device_mce, cpu).kobj); |
517 | if (!b->kobj) | 522 | if (!b->kobj) |
518 | goto out_free; | 523 | goto out_free; |
519 | 524 | ||
520 | #ifndef CONFIG_SMP | 525 | #ifndef CONFIG_SMP |
521 | b->cpus = CPU_MASK_ALL; | 526 | cpumask_setall(b->cpus); |
522 | #else | 527 | #else |
523 | b->cpus = per_cpu(cpu_core_map, cpu); | 528 | cpumask_copy(b->cpus, &per_cpu(cpu_core_map, cpu)); |
524 | #endif | 529 | #endif |
525 | 530 | ||
526 | per_cpu(threshold_banks, cpu)[bank] = b; | 531 | per_cpu(threshold_banks, cpu)[bank] = b; |
@@ -529,7 +534,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
529 | if (err) | 534 | if (err) |
530 | goto out_free; | 535 | goto out_free; |
531 | 536 | ||
532 | for_each_cpu_mask_nr(i, b->cpus) { | 537 | for_each_cpu(i, b->cpus) { |
533 | if (i == cpu) | 538 | if (i == cpu) |
534 | continue; | 539 | continue; |
535 | 540 | ||
@@ -545,6 +550,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
545 | 550 | ||
546 | out_free: | 551 | out_free: |
547 | per_cpu(threshold_banks, cpu)[bank] = NULL; | 552 | per_cpu(threshold_banks, cpu)[bank] = NULL; |
553 | free_cpumask_var(b->cpus); | ||
548 | kfree(b); | 554 | kfree(b); |
549 | out: | 555 | out: |
550 | return err; | 556 | return err; |
@@ -619,7 +625,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank) | |||
619 | #endif | 625 | #endif |
620 | 626 | ||
621 | /* remove all sibling symlinks before unregistering */ | 627 | /* remove all sibling symlinks before unregistering */ |
622 | for_each_cpu_mask_nr(i, b->cpus) { | 628 | for_each_cpu(i, b->cpus) { |
623 | if (i == cpu) | 629 | if (i == cpu) |
624 | continue; | 630 | continue; |
625 | 631 | ||
@@ -632,6 +638,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank) | |||
632 | free_out: | 638 | free_out: |
633 | kobject_del(b->kobj); | 639 | kobject_del(b->kobj); |
634 | kobject_put(b->kobj); | 640 | kobject_put(b->kobj); |
641 | free_cpumask_var(b->cpus); | ||
635 | kfree(b); | 642 | kfree(b); |
636 | per_cpu(threshold_banks, cpu)[bank] = NULL; | 643 | per_cpu(threshold_banks, cpu)[bank] = NULL; |
637 | } | 644 | } |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c index 4b48f251fd39..5e8c79e748a6 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/interrupt.h> | 7 | #include <linux/interrupt.h> |
8 | #include <linux/percpu.h> | 8 | #include <linux/percpu.h> |
9 | #include <asm/processor.h> | 9 | #include <asm/processor.h> |
10 | #include <asm/apic.h> | ||
10 | #include <asm/msr.h> | 11 | #include <asm/msr.h> |
11 | #include <asm/mce.h> | 12 | #include <asm/mce.h> |
12 | #include <asm/hw_irq.h> | 13 | #include <asm/hw_irq.h> |
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index c689d19e35ab..ad7f2a696f4a 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c | |||
@@ -24,11 +24,11 @@ | |||
24 | #include <asm/apic.h> | 24 | #include <asm/apic.h> |
25 | #include <asm/hpet.h> | 25 | #include <asm/hpet.h> |
26 | #include <linux/kdebug.h> | 26 | #include <linux/kdebug.h> |
27 | #include <asm/smp.h> | 27 | #include <asm/cpu.h> |
28 | #include <asm/reboot.h> | 28 | #include <asm/reboot.h> |
29 | #include <asm/virtext.h> | 29 | #include <asm/virtext.h> |
30 | 30 | ||
31 | #include <mach_ipi.h> | 31 | #include <asm/genapic.h> |
32 | 32 | ||
33 | 33 | ||
34 | #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) | 34 | #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) |
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c index c302d0707048..d35db5993fd6 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c | |||
@@ -106,7 +106,8 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, | |||
106 | const struct stacktrace_ops *ops, void *data) | 106 | const struct stacktrace_ops *ops, void *data) |
107 | { | 107 | { |
108 | const unsigned cpu = get_cpu(); | 108 | const unsigned cpu = get_cpu(); |
109 | unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr; | 109 | unsigned long *irq_stack_end = |
110 | (unsigned long *)per_cpu(irq_stack_ptr, cpu); | ||
110 | unsigned used = 0; | 111 | unsigned used = 0; |
111 | struct thread_info *tinfo; | 112 | struct thread_info *tinfo; |
112 | int graph = 0; | 113 | int graph = 0; |
@@ -160,23 +161,23 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, | |||
160 | stack = (unsigned long *) estack_end[-2]; | 161 | stack = (unsigned long *) estack_end[-2]; |
161 | continue; | 162 | continue; |
162 | } | 163 | } |
163 | if (irqstack_end) { | 164 | if (irq_stack_end) { |
164 | unsigned long *irqstack; | 165 | unsigned long *irq_stack; |
165 | irqstack = irqstack_end - | 166 | irq_stack = irq_stack_end - |
166 | (IRQSTACKSIZE - 64) / sizeof(*irqstack); | 167 | (IRQ_STACK_SIZE - 64) / sizeof(*irq_stack); |
167 | 168 | ||
168 | if (stack >= irqstack && stack < irqstack_end) { | 169 | if (stack >= irq_stack && stack < irq_stack_end) { |
169 | if (ops->stack(data, "IRQ") < 0) | 170 | if (ops->stack(data, "IRQ") < 0) |
170 | break; | 171 | break; |
171 | bp = print_context_stack(tinfo, stack, bp, | 172 | bp = print_context_stack(tinfo, stack, bp, |
172 | ops, data, irqstack_end, &graph); | 173 | ops, data, irq_stack_end, &graph); |
173 | /* | 174 | /* |
174 | * We link to the next stack (which would be | 175 | * We link to the next stack (which would be |
175 | * the process stack normally) the last | 176 | * the process stack normally) the last |
176 | * pointer (index -1 to end) in the IRQ stack: | 177 | * pointer (index -1 to end) in the IRQ stack: |
177 | */ | 178 | */ |
178 | stack = (unsigned long *) (irqstack_end[-1]); | 179 | stack = (unsigned long *) (irq_stack_end[-1]); |
179 | irqstack_end = NULL; | 180 | irq_stack_end = NULL; |
180 | ops->stack(data, "EOI"); | 181 | ops->stack(data, "EOI"); |
181 | continue; | 182 | continue; |
182 | } | 183 | } |
@@ -199,10 +200,10 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs, | |||
199 | unsigned long *stack; | 200 | unsigned long *stack; |
200 | int i; | 201 | int i; |
201 | const int cpu = smp_processor_id(); | 202 | const int cpu = smp_processor_id(); |
202 | unsigned long *irqstack_end = | 203 | unsigned long *irq_stack_end = |
203 | (unsigned long *) (cpu_pda(cpu)->irqstackptr); | 204 | (unsigned long *)(per_cpu(irq_stack_ptr, cpu)); |
204 | unsigned long *irqstack = | 205 | unsigned long *irq_stack = |
205 | (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE); | 206 | (unsigned long *)(per_cpu(irq_stack_ptr, cpu) - IRQ_STACK_SIZE); |
206 | 207 | ||
207 | /* | 208 | /* |
208 | * debugging aid: "show_stack(NULL, NULL);" prints the | 209 | * debugging aid: "show_stack(NULL, NULL);" prints the |
@@ -218,9 +219,9 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs, | |||
218 | 219 | ||
219 | stack = sp; | 220 | stack = sp; |
220 | for (i = 0; i < kstack_depth_to_print; i++) { | 221 | for (i = 0; i < kstack_depth_to_print; i++) { |
221 | if (stack >= irqstack && stack <= irqstack_end) { | 222 | if (stack >= irq_stack && stack <= irq_stack_end) { |
222 | if (stack == irqstack_end) { | 223 | if (stack == irq_stack_end) { |
223 | stack = (unsigned long *) (irqstack_end[-1]); | 224 | stack = (unsigned long *) (irq_stack_end[-1]); |
224 | printk(" <EOI> "); | 225 | printk(" <EOI> "); |
225 | } | 226 | } |
226 | } else { | 227 | } else { |
@@ -241,7 +242,7 @@ void show_registers(struct pt_regs *regs) | |||
241 | int i; | 242 | int i; |
242 | unsigned long sp; | 243 | unsigned long sp; |
243 | const int cpu = smp_processor_id(); | 244 | const int cpu = smp_processor_id(); |
244 | struct task_struct *cur = cpu_pda(cpu)->pcurrent; | 245 | struct task_struct *cur = current; |
245 | 246 | ||
246 | sp = regs->sp; | 247 | sp = regs->sp; |
247 | printk("CPU %d ", cpu); | 248 | printk("CPU %d ", cpu); |
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c index 1119d247fe11..b205272ad394 100644 --- a/arch/x86/kernel/efi.c +++ b/arch/x86/kernel/efi.c | |||
@@ -366,10 +366,12 @@ void __init efi_init(void) | |||
366 | SMBIOS_TABLE_GUID)) { | 366 | SMBIOS_TABLE_GUID)) { |
367 | efi.smbios = config_tables[i].table; | 367 | efi.smbios = config_tables[i].table; |
368 | printk(" SMBIOS=0x%lx ", config_tables[i].table); | 368 | printk(" SMBIOS=0x%lx ", config_tables[i].table); |
369 | #ifdef CONFIG_X86_UV | ||
369 | } else if (!efi_guidcmp(config_tables[i].guid, | 370 | } else if (!efi_guidcmp(config_tables[i].guid, |
370 | UV_SYSTEM_TABLE_GUID)) { | 371 | UV_SYSTEM_TABLE_GUID)) { |
371 | efi.uv_systab = config_tables[i].table; | 372 | efi.uv_systab = config_tables[i].table; |
372 | printk(" UVsystab=0x%lx ", config_tables[i].table); | 373 | printk(" UVsystab=0x%lx ", config_tables[i].table); |
374 | #endif | ||
373 | } else if (!efi_guidcmp(config_tables[i].guid, | 375 | } else if (!efi_guidcmp(config_tables[i].guid, |
374 | HCDP_TABLE_GUID)) { | 376 | HCDP_TABLE_GUID)) { |
375 | efi.hcdp = config_tables[i].table; | 377 | efi.hcdp = config_tables[i].table; |
diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/kernel/efi_64.c index 652c5287215f..a4ee29127fdf 100644 --- a/arch/x86/kernel/efi_64.c +++ b/arch/x86/kernel/efi_64.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <asm/proto.h> | 36 | #include <asm/proto.h> |
37 | #include <asm/efi.h> | 37 | #include <asm/efi.h> |
38 | #include <asm/cacheflush.h> | 38 | #include <asm/cacheflush.h> |
39 | #include <asm/fixmap.h> | ||
39 | 40 | ||
40 | static pgd_t save_pgd __initdata; | 41 | static pgd_t save_pgd __initdata; |
41 | static unsigned long efi_flags __initdata; | 42 | static unsigned long efi_flags __initdata; |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index 46469029e9d3..65efd42454be 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -672,7 +672,7 @@ common_interrupt: | |||
672 | ENDPROC(common_interrupt) | 672 | ENDPROC(common_interrupt) |
673 | CFI_ENDPROC | 673 | CFI_ENDPROC |
674 | 674 | ||
675 | #define BUILD_INTERRUPT(name, nr) \ | 675 | #define BUILD_INTERRUPT3(name, nr, fn) \ |
676 | ENTRY(name) \ | 676 | ENTRY(name) \ |
677 | RING0_INT_FRAME; \ | 677 | RING0_INT_FRAME; \ |
678 | pushl $~(nr); \ | 678 | pushl $~(nr); \ |
@@ -680,13 +680,15 @@ ENTRY(name) \ | |||
680 | SAVE_ALL; \ | 680 | SAVE_ALL; \ |
681 | TRACE_IRQS_OFF \ | 681 | TRACE_IRQS_OFF \ |
682 | movl %esp,%eax; \ | 682 | movl %esp,%eax; \ |
683 | call smp_##name; \ | 683 | call fn; \ |
684 | jmp ret_from_intr; \ | 684 | jmp ret_from_intr; \ |
685 | CFI_ENDPROC; \ | 685 | CFI_ENDPROC; \ |
686 | ENDPROC(name) | 686 | ENDPROC(name) |
687 | 687 | ||
688 | #define BUILD_INTERRUPT(name, nr) BUILD_INTERRUPT3(name, nr, smp_##name) | ||
689 | |||
688 | /* The include is where all of the SMP etc. interrupts come from */ | 690 | /* The include is where all of the SMP etc. interrupts come from */ |
689 | #include "entry_arch.h" | 691 | #include <asm/entry_arch.h> |
690 | 692 | ||
691 | ENTRY(coprocessor_error) | 693 | ENTRY(coprocessor_error) |
692 | RING0_INT_FRAME | 694 | RING0_INT_FRAME |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index a1346217e43c..1f7d697b5c00 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <asm/irqflags.h> | 52 | #include <asm/irqflags.h> |
53 | #include <asm/paravirt.h> | 53 | #include <asm/paravirt.h> |
54 | #include <asm/ftrace.h> | 54 | #include <asm/ftrace.h> |
55 | #include <asm/percpu.h> | ||
55 | 56 | ||
56 | /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ | 57 | /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ |
57 | #include <linux/elf-em.h> | 58 | #include <linux/elf-em.h> |
@@ -209,7 +210,7 @@ ENTRY(native_usergs_sysret64) | |||
209 | 210 | ||
210 | /* %rsp:at FRAMEEND */ | 211 | /* %rsp:at FRAMEEND */ |
211 | .macro FIXUP_TOP_OF_STACK tmp offset=0 | 212 | .macro FIXUP_TOP_OF_STACK tmp offset=0 |
212 | movq %gs:pda_oldrsp,\tmp | 213 | movq PER_CPU_VAR(old_rsp),\tmp |
213 | movq \tmp,RSP+\offset(%rsp) | 214 | movq \tmp,RSP+\offset(%rsp) |
214 | movq $__USER_DS,SS+\offset(%rsp) | 215 | movq $__USER_DS,SS+\offset(%rsp) |
215 | movq $__USER_CS,CS+\offset(%rsp) | 216 | movq $__USER_CS,CS+\offset(%rsp) |
@@ -220,7 +221,7 @@ ENTRY(native_usergs_sysret64) | |||
220 | 221 | ||
221 | .macro RESTORE_TOP_OF_STACK tmp offset=0 | 222 | .macro RESTORE_TOP_OF_STACK tmp offset=0 |
222 | movq RSP+\offset(%rsp),\tmp | 223 | movq RSP+\offset(%rsp),\tmp |
223 | movq \tmp,%gs:pda_oldrsp | 224 | movq \tmp,PER_CPU_VAR(old_rsp) |
224 | movq EFLAGS+\offset(%rsp),\tmp | 225 | movq EFLAGS+\offset(%rsp),\tmp |
225 | movq \tmp,R11+\offset(%rsp) | 226 | movq \tmp,R11+\offset(%rsp) |
226 | .endm | 227 | .endm |
@@ -336,15 +337,15 @@ ENTRY(save_args) | |||
336 | je 1f | 337 | je 1f |
337 | SWAPGS | 338 | SWAPGS |
338 | /* | 339 | /* |
339 | * irqcount is used to check if a CPU is already on an interrupt stack | 340 | * irq_count is used to check if a CPU is already on an interrupt stack |
340 | * or not. While this is essentially redundant with preempt_count it is | 341 | * or not. While this is essentially redundant with preempt_count it is |
341 | * a little cheaper to use a separate counter in the PDA (short of | 342 | * a little cheaper to use a separate counter in the PDA (short of |
342 | * moving irq_enter into assembly, which would be too much work) | 343 | * moving irq_enter into assembly, which would be too much work) |
343 | */ | 344 | */ |
344 | 1: incl %gs:pda_irqcount | 345 | 1: incl PER_CPU_VAR(irq_count) |
345 | jne 2f | 346 | jne 2f |
346 | popq_cfi %rax /* move return address... */ | 347 | popq_cfi %rax /* move return address... */ |
347 | mov %gs:pda_irqstackptr,%rsp | 348 | mov PER_CPU_VAR(irq_stack_ptr),%rsp |
348 | EMPTY_FRAME 0 | 349 | EMPTY_FRAME 0 |
349 | pushq_cfi %rbp /* backlink for unwinder */ | 350 | pushq_cfi %rbp /* backlink for unwinder */ |
350 | pushq_cfi %rax /* ... to the new stack */ | 351 | pushq_cfi %rax /* ... to the new stack */ |
@@ -409,6 +410,8 @@ END(save_paranoid) | |||
409 | ENTRY(ret_from_fork) | 410 | ENTRY(ret_from_fork) |
410 | DEFAULT_FRAME | 411 | DEFAULT_FRAME |
411 | 412 | ||
413 | LOCK ; btr $TIF_FORK,TI_flags(%r8) | ||
414 | |||
412 | push kernel_eflags(%rip) | 415 | push kernel_eflags(%rip) |
413 | CFI_ADJUST_CFA_OFFSET 8 | 416 | CFI_ADJUST_CFA_OFFSET 8 |
414 | popf # reset kernel eflags | 417 | popf # reset kernel eflags |
@@ -468,7 +471,7 @@ END(ret_from_fork) | |||
468 | ENTRY(system_call) | 471 | ENTRY(system_call) |
469 | CFI_STARTPROC simple | 472 | CFI_STARTPROC simple |
470 | CFI_SIGNAL_FRAME | 473 | CFI_SIGNAL_FRAME |
471 | CFI_DEF_CFA rsp,PDA_STACKOFFSET | 474 | CFI_DEF_CFA rsp,KERNEL_STACK_OFFSET |
472 | CFI_REGISTER rip,rcx | 475 | CFI_REGISTER rip,rcx |
473 | /*CFI_REGISTER rflags,r11*/ | 476 | /*CFI_REGISTER rflags,r11*/ |
474 | SWAPGS_UNSAFE_STACK | 477 | SWAPGS_UNSAFE_STACK |
@@ -479,8 +482,8 @@ ENTRY(system_call) | |||
479 | */ | 482 | */ |
480 | ENTRY(system_call_after_swapgs) | 483 | ENTRY(system_call_after_swapgs) |
481 | 484 | ||
482 | movq %rsp,%gs:pda_oldrsp | 485 | movq %rsp,PER_CPU_VAR(old_rsp) |
483 | movq %gs:pda_kernelstack,%rsp | 486 | movq PER_CPU_VAR(kernel_stack),%rsp |
484 | /* | 487 | /* |
485 | * No need to follow this irqs off/on section - it's straight | 488 | * No need to follow this irqs off/on section - it's straight |
486 | * and short: | 489 | * and short: |
@@ -523,7 +526,7 @@ sysret_check: | |||
523 | CFI_REGISTER rip,rcx | 526 | CFI_REGISTER rip,rcx |
524 | RESTORE_ARGS 0,-ARG_SKIP,1 | 527 | RESTORE_ARGS 0,-ARG_SKIP,1 |
525 | /*CFI_REGISTER rflags,r11*/ | 528 | /*CFI_REGISTER rflags,r11*/ |
526 | movq %gs:pda_oldrsp, %rsp | 529 | movq PER_CPU_VAR(old_rsp), %rsp |
527 | USERGS_SYSRET64 | 530 | USERGS_SYSRET64 |
528 | 531 | ||
529 | CFI_RESTORE_STATE | 532 | CFI_RESTORE_STATE |
@@ -833,11 +836,11 @@ common_interrupt: | |||
833 | XCPT_FRAME | 836 | XCPT_FRAME |
834 | addq $-0x80,(%rsp) /* Adjust vector to [-256,-1] range */ | 837 | addq $-0x80,(%rsp) /* Adjust vector to [-256,-1] range */ |
835 | interrupt do_IRQ | 838 | interrupt do_IRQ |
836 | /* 0(%rsp): oldrsp-ARGOFFSET */ | 839 | /* 0(%rsp): old_rsp-ARGOFFSET */ |
837 | ret_from_intr: | 840 | ret_from_intr: |
838 | DISABLE_INTERRUPTS(CLBR_NONE) | 841 | DISABLE_INTERRUPTS(CLBR_NONE) |
839 | TRACE_IRQS_OFF | 842 | TRACE_IRQS_OFF |
840 | decl %gs:pda_irqcount | 843 | decl PER_CPU_VAR(irq_count) |
841 | leaveq | 844 | leaveq |
842 | CFI_DEF_CFA_REGISTER rsp | 845 | CFI_DEF_CFA_REGISTER rsp |
843 | CFI_ADJUST_CFA_OFFSET -8 | 846 | CFI_ADJUST_CFA_OFFSET -8 |
@@ -982,8 +985,10 @@ apicinterrupt IRQ_MOVE_CLEANUP_VECTOR \ | |||
982 | irq_move_cleanup_interrupt smp_irq_move_cleanup_interrupt | 985 | irq_move_cleanup_interrupt smp_irq_move_cleanup_interrupt |
983 | #endif | 986 | #endif |
984 | 987 | ||
988 | #ifdef CONFIG_X86_UV | ||
985 | apicinterrupt UV_BAU_MESSAGE \ | 989 | apicinterrupt UV_BAU_MESSAGE \ |
986 | uv_bau_message_intr1 uv_bau_message_interrupt | 990 | uv_bau_message_intr1 uv_bau_message_interrupt |
991 | #endif | ||
987 | apicinterrupt LOCAL_TIMER_VECTOR \ | 992 | apicinterrupt LOCAL_TIMER_VECTOR \ |
988 | apic_timer_interrupt smp_apic_timer_interrupt | 993 | apic_timer_interrupt smp_apic_timer_interrupt |
989 | 994 | ||
@@ -1073,10 +1078,10 @@ ENTRY(\sym) | |||
1073 | TRACE_IRQS_OFF | 1078 | TRACE_IRQS_OFF |
1074 | movq %rsp,%rdi /* pt_regs pointer */ | 1079 | movq %rsp,%rdi /* pt_regs pointer */ |
1075 | xorl %esi,%esi /* no error code */ | 1080 | xorl %esi,%esi /* no error code */ |
1076 | movq %gs:pda_data_offset, %rbp | 1081 | PER_CPU(init_tss, %rbp) |
1077 | subq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp) | 1082 | subq $EXCEPTION_STKSZ, TSS_ist + (\ist - 1) * 8(%rbp) |
1078 | call \do_sym | 1083 | call \do_sym |
1079 | addq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp) | 1084 | addq $EXCEPTION_STKSZ, TSS_ist + (\ist - 1) * 8(%rbp) |
1080 | jmp paranoid_exit /* %ebx: no swapgs flag */ | 1085 | jmp paranoid_exit /* %ebx: no swapgs flag */ |
1081 | CFI_ENDPROC | 1086 | CFI_ENDPROC |
1082 | END(\sym) | 1087 | END(\sym) |
@@ -1260,14 +1265,14 @@ ENTRY(call_softirq) | |||
1260 | CFI_REL_OFFSET rbp,0 | 1265 | CFI_REL_OFFSET rbp,0 |
1261 | mov %rsp,%rbp | 1266 | mov %rsp,%rbp |
1262 | CFI_DEF_CFA_REGISTER rbp | 1267 | CFI_DEF_CFA_REGISTER rbp |
1263 | incl %gs:pda_irqcount | 1268 | incl PER_CPU_VAR(irq_count) |
1264 | cmove %gs:pda_irqstackptr,%rsp | 1269 | cmove PER_CPU_VAR(irq_stack_ptr),%rsp |
1265 | push %rbp # backlink for old unwinder | 1270 | push %rbp # backlink for old unwinder |
1266 | call __do_softirq | 1271 | call __do_softirq |
1267 | leaveq | 1272 | leaveq |
1268 | CFI_DEF_CFA_REGISTER rsp | 1273 | CFI_DEF_CFA_REGISTER rsp |
1269 | CFI_ADJUST_CFA_OFFSET -8 | 1274 | CFI_ADJUST_CFA_OFFSET -8 |
1270 | decl %gs:pda_irqcount | 1275 | decl PER_CPU_VAR(irq_count) |
1271 | ret | 1276 | ret |
1272 | CFI_ENDPROC | 1277 | CFI_ENDPROC |
1273 | END(call_softirq) | 1278 | END(call_softirq) |
@@ -1297,15 +1302,15 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs) | |||
1297 | movq %rdi, %rsp # we don't return, adjust the stack frame | 1302 | movq %rdi, %rsp # we don't return, adjust the stack frame |
1298 | CFI_ENDPROC | 1303 | CFI_ENDPROC |
1299 | DEFAULT_FRAME | 1304 | DEFAULT_FRAME |
1300 | 11: incl %gs:pda_irqcount | 1305 | 11: incl PER_CPU_VAR(irq_count) |
1301 | movq %rsp,%rbp | 1306 | movq %rsp,%rbp |
1302 | CFI_DEF_CFA_REGISTER rbp | 1307 | CFI_DEF_CFA_REGISTER rbp |
1303 | cmovzq %gs:pda_irqstackptr,%rsp | 1308 | cmovzq PER_CPU_VAR(irq_stack_ptr),%rsp |
1304 | pushq %rbp # backlink for old unwinder | 1309 | pushq %rbp # backlink for old unwinder |
1305 | call xen_evtchn_do_upcall | 1310 | call xen_evtchn_do_upcall |
1306 | popq %rsp | 1311 | popq %rsp |
1307 | CFI_DEF_CFA_REGISTER rsp | 1312 | CFI_DEF_CFA_REGISTER rsp |
1308 | decl %gs:pda_irqcount | 1313 | decl PER_CPU_VAR(irq_count) |
1309 | jmp error_exit | 1314 | jmp error_exit |
1310 | CFI_ENDPROC | 1315 | CFI_ENDPROC |
1311 | END(do_hypervisor_callback) | 1316 | END(do_hypervisor_callback) |
diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c index 53699c931ad4..d6184c12a182 100644 --- a/arch/x86/kernel/es7000_32.c +++ b/arch/x86/kernel/es7000_32.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <asm/smp.h> | 40 | #include <asm/smp.h> |
41 | #include <asm/atomic.h> | 41 | #include <asm/atomic.h> |
42 | #include <asm/apicdef.h> | 42 | #include <asm/apicdef.h> |
43 | #include <mach_mpparse.h> | ||
44 | #include <asm/genapic.h> | 43 | #include <asm/genapic.h> |
45 | #include <asm/setup.h> | 44 | #include <asm/setup.h> |
46 | 45 | ||
@@ -182,20 +181,16 @@ static int wakeup_secondary_cpu_via_mip(int cpu, unsigned long eip) | |||
182 | return 0; | 181 | return 0; |
183 | } | 182 | } |
184 | 183 | ||
185 | static void noop_wait_for_deassert(atomic_t *deassert_not_used) | ||
186 | { | ||
187 | } | ||
188 | |||
189 | static int __init es7000_update_genapic(void) | 184 | static int __init es7000_update_genapic(void) |
190 | { | 185 | { |
191 | genapic->wakeup_cpu = wakeup_secondary_cpu_via_mip; | 186 | apic->wakeup_cpu = wakeup_secondary_cpu_via_mip; |
192 | 187 | ||
193 | /* MPENTIUMIII */ | 188 | /* MPENTIUMIII */ |
194 | if (boot_cpu_data.x86 == 6 && | 189 | if (boot_cpu_data.x86 == 6 && |
195 | (boot_cpu_data.x86_model >= 7 || boot_cpu_data.x86_model <= 11)) { | 190 | (boot_cpu_data.x86_model >= 7 || boot_cpu_data.x86_model <= 11)) { |
196 | es7000_update_genapic_to_cluster(); | 191 | es7000_update_genapic_to_cluster(); |
197 | genapic->wait_for_init_deassert = noop_wait_for_deassert; | 192 | apic->wait_for_init_deassert = NULL; |
198 | genapic->wakeup_cpu = wakeup_secondary_cpu_via_mip; | 193 | apic->wakeup_cpu = wakeup_secondary_cpu_via_mip; |
199 | } | 194 | } |
200 | 195 | ||
201 | return 0; | 196 | return 0; |
@@ -359,20 +354,449 @@ es7000_mip_write(struct mip_reg *mip_reg) | |||
359 | return status; | 354 | return status; |
360 | } | 355 | } |
361 | 356 | ||
362 | void __init | 357 | void __init es7000_enable_apic_mode(void) |
363 | es7000_sw_apic(void) | 358 | { |
364 | { | 359 | struct mip_reg es7000_mip_reg; |
365 | if (es7000_plat) { | 360 | int mip_status; |
366 | int mip_status; | 361 | |
367 | struct mip_reg es7000_mip_reg; | 362 | if (!es7000_plat) |
368 | |||
369 | printk("ES7000: Enabling APIC mode.\n"); | ||
370 | memset(&es7000_mip_reg, 0, sizeof(struct mip_reg)); | ||
371 | es7000_mip_reg.off_0 = MIP_SW_APIC; | ||
372 | es7000_mip_reg.off_38 = (MIP_VALID); | ||
373 | while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) | ||
374 | printk("es7000_sw_apic: command failed, status = %x\n", | ||
375 | mip_status); | ||
376 | return; | 363 | return; |
364 | |||
365 | printk("ES7000: Enabling APIC mode.\n"); | ||
366 | memset(&es7000_mip_reg, 0, sizeof(struct mip_reg)); | ||
367 | es7000_mip_reg.off_0 = MIP_SW_APIC; | ||
368 | es7000_mip_reg.off_38 = MIP_VALID; | ||
369 | |||
370 | while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) { | ||
371 | printk("es7000_enable_apic_mode: command failed, status = %x\n", | ||
372 | mip_status); | ||
373 | } | ||
374 | } | ||
375 | |||
376 | /* | ||
377 | * APIC driver for the Unisys ES7000 chipset. | ||
378 | */ | ||
379 | #define APIC_DEFINITION 1 | ||
380 | #include <linux/threads.h> | ||
381 | #include <linux/cpumask.h> | ||
382 | #include <asm/mpspec.h> | ||
383 | #include <asm/genapic.h> | ||
384 | #include <asm/fixmap.h> | ||
385 | #include <asm/apicdef.h> | ||
386 | #include <linux/kernel.h> | ||
387 | #include <linux/string.h> | ||
388 | #include <linux/init.h> | ||
389 | #include <linux/acpi.h> | ||
390 | #include <linux/smp.h> | ||
391 | #include <asm/ipi.h> | ||
392 | |||
393 | #define APIC_DFR_VALUE_CLUSTER (APIC_DFR_CLUSTER) | ||
394 | #define INT_DELIVERY_MODE_CLUSTER (dest_LowestPrio) | ||
395 | #define INT_DEST_MODE_CLUSTER (1) /* logical delivery broadcast to all procs */ | ||
396 | |||
397 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
398 | |||
399 | extern void es7000_enable_apic_mode(void); | ||
400 | extern int apic_version [MAX_APICS]; | ||
401 | extern u8 cpu_2_logical_apicid[]; | ||
402 | extern unsigned int boot_cpu_physical_apicid; | ||
403 | |||
404 | extern int parse_unisys_oem (char *oemptr); | ||
405 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); | ||
406 | extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr); | ||
407 | extern void setup_unisys(void); | ||
408 | |||
409 | #define apicid_cluster(apicid) (apicid & 0xF0) | ||
410 | #define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu) | ||
411 | |||
412 | static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask) | ||
413 | { | ||
414 | /* Careful. Some cpus do not strictly honor the set of cpus | ||
415 | * specified in the interrupt destination when using lowest | ||
416 | * priority interrupt delivery mode. | ||
417 | * | ||
418 | * In particular there was a hyperthreading cpu observed to | ||
419 | * deliver interrupts to the wrong hyperthread when only one | ||
420 | * hyperthread was specified in the interrupt desitination. | ||
421 | */ | ||
422 | *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } }; | ||
423 | } | ||
424 | |||
425 | |||
426 | static void es7000_wait_for_init_deassert(atomic_t *deassert) | ||
427 | { | ||
428 | #ifndef CONFIG_ES7000_CLUSTERED_APIC | ||
429 | while (!atomic_read(deassert)) | ||
430 | cpu_relax(); | ||
431 | #endif | ||
432 | return; | ||
433 | } | ||
434 | |||
435 | static unsigned int es7000_get_apic_id(unsigned long x) | ||
436 | { | ||
437 | return (x >> 24) & 0xFF; | ||
438 | } | ||
439 | |||
440 | #ifdef CONFIG_ACPI | ||
441 | static int es7000_check_dsdt(void) | ||
442 | { | ||
443 | struct acpi_table_header header; | ||
444 | |||
445 | if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) && | ||
446 | !strncmp(header.oem_id, "UNISYS", 6)) | ||
447 | return 1; | ||
448 | return 0; | ||
449 | } | ||
450 | #endif | ||
451 | |||
452 | static void es7000_send_IPI_mask(const struct cpumask *mask, int vector) | ||
453 | { | ||
454 | default_send_IPI_mask_sequence_phys(mask, vector); | ||
455 | } | ||
456 | |||
457 | static void es7000_send_IPI_allbutself(int vector) | ||
458 | { | ||
459 | default_send_IPI_mask_allbutself_phys(cpu_online_mask, vector); | ||
460 | } | ||
461 | |||
462 | static void es7000_send_IPI_all(int vector) | ||
463 | { | ||
464 | es7000_send_IPI_mask(cpu_online_mask, vector); | ||
465 | } | ||
466 | |||
467 | static int es7000_apic_id_registered(void) | ||
468 | { | ||
469 | return 1; | ||
470 | } | ||
471 | |||
472 | static const cpumask_t *target_cpus_cluster(void) | ||
473 | { | ||
474 | return &CPU_MASK_ALL; | ||
475 | } | ||
476 | |||
477 | static const cpumask_t *es7000_target_cpus(void) | ||
478 | { | ||
479 | return &cpumask_of_cpu(smp_processor_id()); | ||
480 | } | ||
481 | |||
482 | static unsigned long | ||
483 | es7000_check_apicid_used(physid_mask_t bitmap, int apicid) | ||
484 | { | ||
485 | return 0; | ||
486 | } | ||
487 | static unsigned long es7000_check_apicid_present(int bit) | ||
488 | { | ||
489 | return physid_isset(bit, phys_cpu_present_map); | ||
490 | } | ||
491 | |||
492 | static unsigned long calculate_ldr(int cpu) | ||
493 | { | ||
494 | unsigned long id = xapic_phys_to_log_apicid(cpu); | ||
495 | |||
496 | return (SET_APIC_LOGICAL_ID(id)); | ||
497 | } | ||
498 | |||
499 | /* | ||
500 | * Set up the logical destination ID. | ||
501 | * | ||
502 | * Intel recommends to set DFR, LdR and TPR before enabling | ||
503 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
504 | * document number 292116). So here it goes... | ||
505 | */ | ||
506 | static void es7000_init_apic_ldr_cluster(void) | ||
507 | { | ||
508 | unsigned long val; | ||
509 | int cpu = smp_processor_id(); | ||
510 | |||
511 | apic_write(APIC_DFR, APIC_DFR_VALUE_CLUSTER); | ||
512 | val = calculate_ldr(cpu); | ||
513 | apic_write(APIC_LDR, val); | ||
514 | } | ||
515 | |||
516 | static void es7000_init_apic_ldr(void) | ||
517 | { | ||
518 | unsigned long val; | ||
519 | int cpu = smp_processor_id(); | ||
520 | |||
521 | apic_write(APIC_DFR, APIC_DFR_VALUE); | ||
522 | val = calculate_ldr(cpu); | ||
523 | apic_write(APIC_LDR, val); | ||
524 | } | ||
525 | |||
526 | static void es7000_setup_apic_routing(void) | ||
527 | { | ||
528 | int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id()); | ||
529 | printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n", | ||
530 | (apic_version[apic] == 0x14) ? | ||
531 | "Physical Cluster" : "Logical Cluster", | ||
532 | nr_ioapics, cpus_addr(*es7000_target_cpus())[0]); | ||
533 | } | ||
534 | |||
535 | static int es7000_apicid_to_node(int logical_apicid) | ||
536 | { | ||
537 | return 0; | ||
538 | } | ||
539 | |||
540 | |||
541 | static int es7000_cpu_present_to_apicid(int mps_cpu) | ||
542 | { | ||
543 | if (!mps_cpu) | ||
544 | return boot_cpu_physical_apicid; | ||
545 | else if (mps_cpu < nr_cpu_ids) | ||
546 | return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
547 | else | ||
548 | return BAD_APICID; | ||
549 | } | ||
550 | |||
551 | static physid_mask_t es7000_apicid_to_cpu_present(int phys_apicid) | ||
552 | { | ||
553 | static int id = 0; | ||
554 | physid_mask_t mask; | ||
555 | |||
556 | mask = physid_mask_of_physid(id); | ||
557 | ++id; | ||
558 | |||
559 | return mask; | ||
560 | } | ||
561 | |||
562 | /* Mapping from cpu number to logical apicid */ | ||
563 | static int es7000_cpu_to_logical_apicid(int cpu) | ||
564 | { | ||
565 | #ifdef CONFIG_SMP | ||
566 | if (cpu >= nr_cpu_ids) | ||
567 | return BAD_APICID; | ||
568 | return (int)cpu_2_logical_apicid[cpu]; | ||
569 | #else | ||
570 | return logical_smp_processor_id(); | ||
571 | #endif | ||
572 | } | ||
573 | |||
574 | static physid_mask_t es7000_ioapic_phys_id_map(physid_mask_t phys_map) | ||
575 | { | ||
576 | /* For clustered we don't have a good way to do this yet - hack */ | ||
577 | return physids_promote(0xff); | ||
578 | } | ||
579 | |||
580 | static int es7000_check_phys_apicid_present(int cpu_physical_apicid) | ||
581 | { | ||
582 | boot_cpu_physical_apicid = read_apic_id(); | ||
583 | return (1); | ||
584 | } | ||
585 | |||
586 | static unsigned int | ||
587 | es7000_cpu_mask_to_apicid_cluster(const struct cpumask *cpumask) | ||
588 | { | ||
589 | int cpus_found = 0; | ||
590 | int num_bits_set; | ||
591 | int apicid; | ||
592 | int cpu; | ||
593 | |||
594 | num_bits_set = cpumask_weight(cpumask); | ||
595 | /* Return id to all */ | ||
596 | if (num_bits_set == nr_cpu_ids) | ||
597 | return 0xFF; | ||
598 | /* | ||
599 | * The cpus in the mask must all be on the apic cluster. If are not | ||
600 | * on the same apicid cluster return default value of target_cpus(): | ||
601 | */ | ||
602 | cpu = cpumask_first(cpumask); | ||
603 | apicid = es7000_cpu_to_logical_apicid(cpu); | ||
604 | |||
605 | while (cpus_found < num_bits_set) { | ||
606 | if (cpumask_test_cpu(cpu, cpumask)) { | ||
607 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); | ||
608 | |||
609 | if (apicid_cluster(apicid) != | ||
610 | apicid_cluster(new_apicid)) { | ||
611 | printk ("%s: Not a valid mask!\n", __func__); | ||
612 | |||
613 | return 0xFF; | ||
614 | } | ||
615 | apicid = new_apicid; | ||
616 | cpus_found++; | ||
617 | } | ||
618 | cpu++; | ||
377 | } | 619 | } |
620 | return apicid; | ||
378 | } | 621 | } |
622 | |||
623 | static unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask) | ||
624 | { | ||
625 | int cpus_found = 0; | ||
626 | int num_bits_set; | ||
627 | int apicid; | ||
628 | int cpu; | ||
629 | |||
630 | num_bits_set = cpus_weight(*cpumask); | ||
631 | /* Return id to all */ | ||
632 | if (num_bits_set == nr_cpu_ids) | ||
633 | return es7000_cpu_to_logical_apicid(0); | ||
634 | /* | ||
635 | * The cpus in the mask must all be on the apic cluster. If are not | ||
636 | * on the same apicid cluster return default value of target_cpus(): | ||
637 | */ | ||
638 | cpu = first_cpu(*cpumask); | ||
639 | apicid = es7000_cpu_to_logical_apicid(cpu); | ||
640 | while (cpus_found < num_bits_set) { | ||
641 | if (cpu_isset(cpu, *cpumask)) { | ||
642 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); | ||
643 | |||
644 | if (apicid_cluster(apicid) != | ||
645 | apicid_cluster(new_apicid)) { | ||
646 | printk ("%s: Not a valid mask!\n", __func__); | ||
647 | |||
648 | return es7000_cpu_to_logical_apicid(0); | ||
649 | } | ||
650 | apicid = new_apicid; | ||
651 | cpus_found++; | ||
652 | } | ||
653 | cpu++; | ||
654 | } | ||
655 | return apicid; | ||
656 | } | ||
657 | |||
658 | static unsigned int | ||
659 | es7000_cpu_mask_to_apicid_and(const struct cpumask *inmask, | ||
660 | const struct cpumask *andmask) | ||
661 | { | ||
662 | int apicid = es7000_cpu_to_logical_apicid(0); | ||
663 | cpumask_var_t cpumask; | ||
664 | |||
665 | if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC)) | ||
666 | return apicid; | ||
667 | |||
668 | cpumask_and(cpumask, inmask, andmask); | ||
669 | cpumask_and(cpumask, cpumask, cpu_online_mask); | ||
670 | apicid = es7000_cpu_mask_to_apicid(cpumask); | ||
671 | |||
672 | free_cpumask_var(cpumask); | ||
673 | |||
674 | return apicid; | ||
675 | } | ||
676 | |||
677 | static int es7000_phys_pkg_id(int cpuid_apic, int index_msb) | ||
678 | { | ||
679 | return cpuid_apic >> index_msb; | ||
680 | } | ||
681 | |||
682 | void __init es7000_update_genapic_to_cluster(void) | ||
683 | { | ||
684 | apic->target_cpus = target_cpus_cluster; | ||
685 | apic->irq_delivery_mode = INT_DELIVERY_MODE_CLUSTER; | ||
686 | apic->irq_dest_mode = INT_DEST_MODE_CLUSTER; | ||
687 | |||
688 | apic->init_apic_ldr = es7000_init_apic_ldr_cluster; | ||
689 | |||
690 | apic->cpu_mask_to_apicid = es7000_cpu_mask_to_apicid_cluster; | ||
691 | } | ||
692 | |||
693 | static int probe_es7000(void) | ||
694 | { | ||
695 | /* probed later in mptable/ACPI hooks */ | ||
696 | return 0; | ||
697 | } | ||
698 | |||
699 | static __init int | ||
700 | es7000_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | ||
701 | { | ||
702 | if (mpc->oemptr) { | ||
703 | struct mpc_oemtable *oem_table = | ||
704 | (struct mpc_oemtable *)mpc->oemptr; | ||
705 | |||
706 | if (!strncmp(oem, "UNISYS", 6)) | ||
707 | return parse_unisys_oem((char *)oem_table); | ||
708 | } | ||
709 | return 0; | ||
710 | } | ||
711 | |||
712 | #ifdef CONFIG_ACPI | ||
713 | /* Hook from generic ACPI tables.c */ | ||
714 | static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
715 | { | ||
716 | unsigned long oem_addr = 0; | ||
717 | int check_dsdt; | ||
718 | int ret = 0; | ||
719 | |||
720 | /* check dsdt at first to avoid clear fix_map for oem_addr */ | ||
721 | check_dsdt = es7000_check_dsdt(); | ||
722 | |||
723 | if (!find_unisys_acpi_oem_table(&oem_addr)) { | ||
724 | if (check_dsdt) | ||
725 | ret = parse_unisys_oem((char *)oem_addr); | ||
726 | else { | ||
727 | setup_unisys(); | ||
728 | ret = 1; | ||
729 | } | ||
730 | /* | ||
731 | * we need to unmap it | ||
732 | */ | ||
733 | unmap_unisys_acpi_oem_table(oem_addr); | ||
734 | } | ||
735 | return ret; | ||
736 | } | ||
737 | #else | ||
738 | static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
739 | { | ||
740 | return 0; | ||
741 | } | ||
742 | #endif | ||
743 | |||
744 | |||
745 | struct genapic apic_es7000 = { | ||
746 | |||
747 | .name = "es7000", | ||
748 | .probe = probe_es7000, | ||
749 | .acpi_madt_oem_check = es7000_acpi_madt_oem_check, | ||
750 | .apic_id_registered = es7000_apic_id_registered, | ||
751 | |||
752 | .irq_delivery_mode = dest_Fixed, | ||
753 | /* phys delivery to target CPUs: */ | ||
754 | .irq_dest_mode = 0, | ||
755 | |||
756 | .target_cpus = es7000_target_cpus, | ||
757 | .disable_esr = 1, | ||
758 | .dest_logical = 0, | ||
759 | .check_apicid_used = es7000_check_apicid_used, | ||
760 | .check_apicid_present = es7000_check_apicid_present, | ||
761 | |||
762 | .vector_allocation_domain = es7000_vector_allocation_domain, | ||
763 | .init_apic_ldr = es7000_init_apic_ldr, | ||
764 | |||
765 | .ioapic_phys_id_map = es7000_ioapic_phys_id_map, | ||
766 | .setup_apic_routing = es7000_setup_apic_routing, | ||
767 | .multi_timer_check = NULL, | ||
768 | .apicid_to_node = es7000_apicid_to_node, | ||
769 | .cpu_to_logical_apicid = es7000_cpu_to_logical_apicid, | ||
770 | .cpu_present_to_apicid = es7000_cpu_present_to_apicid, | ||
771 | .apicid_to_cpu_present = es7000_apicid_to_cpu_present, | ||
772 | .setup_portio_remap = NULL, | ||
773 | .check_phys_apicid_present = es7000_check_phys_apicid_present, | ||
774 | .enable_apic_mode = es7000_enable_apic_mode, | ||
775 | .phys_pkg_id = es7000_phys_pkg_id, | ||
776 | .mps_oem_check = es7000_mps_oem_check, | ||
777 | |||
778 | .get_apic_id = es7000_get_apic_id, | ||
779 | .set_apic_id = NULL, | ||
780 | .apic_id_mask = 0xFF << 24, | ||
781 | |||
782 | .cpu_mask_to_apicid = es7000_cpu_mask_to_apicid, | ||
783 | .cpu_mask_to_apicid_and = es7000_cpu_mask_to_apicid_and, | ||
784 | |||
785 | .send_IPI_mask = es7000_send_IPI_mask, | ||
786 | .send_IPI_mask_allbutself = NULL, | ||
787 | .send_IPI_allbutself = es7000_send_IPI_allbutself, | ||
788 | .send_IPI_all = es7000_send_IPI_all, | ||
789 | .send_IPI_self = default_send_IPI_self, | ||
790 | |||
791 | .wakeup_cpu = NULL, | ||
792 | |||
793 | .trampoline_phys_low = 0x467, | ||
794 | .trampoline_phys_high = 0x469, | ||
795 | |||
796 | .wait_for_init_deassert = es7000_wait_for_init_deassert, | ||
797 | |||
798 | /* Nothing to do for most platforms, since cleared by the INIT cycle: */ | ||
799 | .smp_callin_clear_local_apic = NULL, | ||
800 | .store_NMI_vector = NULL, | ||
801 | .inquire_remote_apic = default_inquire_remote_apic, | ||
802 | }; | ||
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/genapic_64.c index 2bced78b0b8e..820dea5d0ebe 100644 --- a/arch/x86/kernel/genapic_64.c +++ b/arch/x86/kernel/genapic_64.c | |||
@@ -29,10 +29,12 @@ extern struct genapic apic_x2xpic_uv_x; | |||
29 | extern struct genapic apic_x2apic_phys; | 29 | extern struct genapic apic_x2apic_phys; |
30 | extern struct genapic apic_x2apic_cluster; | 30 | extern struct genapic apic_x2apic_cluster; |
31 | 31 | ||
32 | struct genapic __read_mostly *genapic = &apic_flat; | 32 | struct genapic __read_mostly *apic = &apic_flat; |
33 | 33 | ||
34 | static struct genapic *apic_probe[] __initdata = { | 34 | static struct genapic *apic_probe[] __initdata = { |
35 | #ifdef CONFIG_X86_UV | ||
35 | &apic_x2apic_uv_x, | 36 | &apic_x2apic_uv_x, |
37 | #endif | ||
36 | &apic_x2apic_phys, | 38 | &apic_x2apic_phys, |
37 | &apic_x2apic_cluster, | 39 | &apic_x2apic_cluster, |
38 | &apic_physflat, | 40 | &apic_physflat, |
@@ -42,17 +44,17 @@ static struct genapic *apic_probe[] __initdata = { | |||
42 | /* | 44 | /* |
43 | * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode. | 45 | * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode. |
44 | */ | 46 | */ |
45 | void __init setup_apic_routing(void) | 47 | void __init default_setup_apic_routing(void) |
46 | { | 48 | { |
47 | if (genapic == &apic_x2apic_phys || genapic == &apic_x2apic_cluster) { | 49 | if (apic == &apic_x2apic_phys || apic == &apic_x2apic_cluster) { |
48 | if (!intr_remapping_enabled) | 50 | if (!intr_remapping_enabled) |
49 | genapic = &apic_flat; | 51 | apic = &apic_flat; |
50 | } | 52 | } |
51 | 53 | ||
52 | if (genapic == &apic_flat) { | 54 | if (apic == &apic_flat) { |
53 | if (max_physical_apicid >= 8) | 55 | if (max_physical_apicid >= 8) |
54 | genapic = &apic_physflat; | 56 | apic = &apic_physflat; |
55 | printk(KERN_INFO "Setting APIC routing to %s\n", genapic->name); | 57 | printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); |
56 | } | 58 | } |
57 | 59 | ||
58 | if (x86_quirks->update_genapic) | 60 | if (x86_quirks->update_genapic) |
@@ -63,18 +65,18 @@ void __init setup_apic_routing(void) | |||
63 | 65 | ||
64 | void apic_send_IPI_self(int vector) | 66 | void apic_send_IPI_self(int vector) |
65 | { | 67 | { |
66 | __send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL); | 68 | __default_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL); |
67 | } | 69 | } |
68 | 70 | ||
69 | int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) | 71 | int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
70 | { | 72 | { |
71 | int i; | 73 | int i; |
72 | 74 | ||
73 | for (i = 0; apic_probe[i]; ++i) { | 75 | for (i = 0; apic_probe[i]; ++i) { |
74 | if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) { | 76 | if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) { |
75 | genapic = apic_probe[i]; | 77 | apic = apic_probe[i]; |
76 | printk(KERN_INFO "Setting APIC routing to %s.\n", | 78 | printk(KERN_INFO "Setting APIC routing to %s.\n", |
77 | genapic->name); | 79 | apic->name); |
78 | return 1; | 80 | return 1; |
79 | } | 81 | } |
80 | } | 82 | } |
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c index 34185488e4fb..249d2d3c034c 100644 --- a/arch/x86/kernel/genapic_flat_64.c +++ b/arch/x86/kernel/genapic_flat_64.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <asm/smp.h> | 19 | #include <asm/smp.h> |
20 | #include <asm/ipi.h> | 20 | #include <asm/ipi.h> |
21 | #include <asm/genapic.h> | 21 | #include <asm/genapic.h> |
22 | #include <mach_apicdef.h> | ||
23 | 22 | ||
24 | #ifdef CONFIG_ACPI | 23 | #ifdef CONFIG_ACPI |
25 | #include <acpi/acpi_bus.h> | 24 | #include <acpi/acpi_bus.h> |
@@ -74,7 +73,7 @@ static inline void _flat_send_IPI_mask(unsigned long mask, int vector) | |||
74 | unsigned long flags; | 73 | unsigned long flags; |
75 | 74 | ||
76 | local_irq_save(flags); | 75 | local_irq_save(flags); |
77 | __send_IPI_dest_field(mask, vector, APIC_DEST_LOGICAL); | 76 | __default_send_IPI_dest_field(mask, vector, apic->dest_logical); |
78 | local_irq_restore(flags); | 77 | local_irq_restore(flags); |
79 | } | 78 | } |
80 | 79 | ||
@@ -85,14 +84,15 @@ static void flat_send_IPI_mask(const struct cpumask *cpumask, int vector) | |||
85 | _flat_send_IPI_mask(mask, vector); | 84 | _flat_send_IPI_mask(mask, vector); |
86 | } | 85 | } |
87 | 86 | ||
88 | static void flat_send_IPI_mask_allbutself(const struct cpumask *cpumask, | 87 | static void |
89 | int vector) | 88 | flat_send_IPI_mask_allbutself(const struct cpumask *cpumask, int vector) |
90 | { | 89 | { |
91 | unsigned long mask = cpumask_bits(cpumask)[0]; | 90 | unsigned long mask = cpumask_bits(cpumask)[0]; |
92 | int cpu = smp_processor_id(); | 91 | int cpu = smp_processor_id(); |
93 | 92 | ||
94 | if (cpu < BITS_PER_LONG) | 93 | if (cpu < BITS_PER_LONG) |
95 | clear_bit(cpu, &mask); | 94 | clear_bit(cpu, &mask); |
95 | |||
96 | _flat_send_IPI_mask(mask, vector); | 96 | _flat_send_IPI_mask(mask, vector); |
97 | } | 97 | } |
98 | 98 | ||
@@ -114,23 +114,27 @@ static void flat_send_IPI_allbutself(int vector) | |||
114 | _flat_send_IPI_mask(mask, vector); | 114 | _flat_send_IPI_mask(mask, vector); |
115 | } | 115 | } |
116 | } else if (num_online_cpus() > 1) { | 116 | } else if (num_online_cpus() > 1) { |
117 | __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL); | 117 | __default_send_IPI_shortcut(APIC_DEST_ALLBUT, |
118 | vector, apic->dest_logical); | ||
118 | } | 119 | } |
119 | } | 120 | } |
120 | 121 | ||
121 | static void flat_send_IPI_all(int vector) | 122 | static void flat_send_IPI_all(int vector) |
122 | { | 123 | { |
123 | if (vector == NMI_VECTOR) | 124 | if (vector == NMI_VECTOR) { |
124 | flat_send_IPI_mask(cpu_online_mask, vector); | 125 | flat_send_IPI_mask(cpu_online_mask, vector); |
125 | else | 126 | } else { |
126 | __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL); | 127 | __default_send_IPI_shortcut(APIC_DEST_ALLINC, |
128 | vector, apic->dest_logical); | ||
129 | } | ||
127 | } | 130 | } |
128 | 131 | ||
129 | static unsigned int get_apic_id(unsigned long x) | 132 | static unsigned int flat_get_apic_id(unsigned long x) |
130 | { | 133 | { |
131 | unsigned int id; | 134 | unsigned int id; |
132 | 135 | ||
133 | id = (((x)>>24) & 0xFFu); | 136 | id = (((x)>>24) & 0xFFu); |
137 | |||
134 | return id; | 138 | return id; |
135 | } | 139 | } |
136 | 140 | ||
@@ -146,7 +150,7 @@ static unsigned int read_xapic_id(void) | |||
146 | { | 150 | { |
147 | unsigned int id; | 151 | unsigned int id; |
148 | 152 | ||
149 | id = get_apic_id(apic_read(APIC_ID)); | 153 | id = flat_get_apic_id(apic_read(APIC_ID)); |
150 | return id; | 154 | return id; |
151 | } | 155 | } |
152 | 156 | ||
@@ -169,31 +173,62 @@ static unsigned int flat_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
169 | return mask1 & mask2; | 173 | return mask1 & mask2; |
170 | } | 174 | } |
171 | 175 | ||
172 | static unsigned int phys_pkg_id(int index_msb) | 176 | static int flat_phys_pkg_id(int initial_apic_id, int index_msb) |
173 | { | 177 | { |
174 | return hard_smp_processor_id() >> index_msb; | 178 | return hard_smp_processor_id() >> index_msb; |
175 | } | 179 | } |
176 | 180 | ||
177 | struct genapic apic_flat = { | 181 | struct genapic apic_flat = { |
178 | .name = "flat", | 182 | .name = "flat", |
179 | .acpi_madt_oem_check = flat_acpi_madt_oem_check, | 183 | .probe = NULL, |
180 | .int_delivery_mode = dest_LowestPrio, | 184 | .acpi_madt_oem_check = flat_acpi_madt_oem_check, |
181 | .int_dest_mode = (APIC_DEST_LOGICAL != 0), | 185 | .apic_id_registered = flat_apic_id_registered, |
182 | .target_cpus = flat_target_cpus, | 186 | |
183 | .vector_allocation_domain = flat_vector_allocation_domain, | 187 | .irq_delivery_mode = dest_LowestPrio, |
184 | .apic_id_registered = flat_apic_id_registered, | 188 | .irq_dest_mode = 1, /* logical */ |
185 | .init_apic_ldr = flat_init_apic_ldr, | 189 | |
186 | .send_IPI_all = flat_send_IPI_all, | 190 | .target_cpus = flat_target_cpus, |
187 | .send_IPI_allbutself = flat_send_IPI_allbutself, | 191 | .disable_esr = 0, |
188 | .send_IPI_mask = flat_send_IPI_mask, | 192 | .dest_logical = APIC_DEST_LOGICAL, |
189 | .send_IPI_mask_allbutself = flat_send_IPI_mask_allbutself, | 193 | .check_apicid_used = NULL, |
190 | .send_IPI_self = apic_send_IPI_self, | 194 | .check_apicid_present = NULL, |
191 | .cpu_mask_to_apicid = flat_cpu_mask_to_apicid, | 195 | |
192 | .cpu_mask_to_apicid_and = flat_cpu_mask_to_apicid_and, | 196 | .vector_allocation_domain = flat_vector_allocation_domain, |
193 | .phys_pkg_id = phys_pkg_id, | 197 | .init_apic_ldr = flat_init_apic_ldr, |
194 | .get_apic_id = get_apic_id, | 198 | |
195 | .set_apic_id = set_apic_id, | 199 | .ioapic_phys_id_map = NULL, |
196 | .apic_id_mask = (0xFFu<<24), | 200 | .setup_apic_routing = NULL, |
201 | .multi_timer_check = NULL, | ||
202 | .apicid_to_node = NULL, | ||
203 | .cpu_to_logical_apicid = NULL, | ||
204 | .cpu_present_to_apicid = default_cpu_present_to_apicid, | ||
205 | .apicid_to_cpu_present = NULL, | ||
206 | .setup_portio_remap = NULL, | ||
207 | .check_phys_apicid_present = default_check_phys_apicid_present, | ||
208 | .enable_apic_mode = NULL, | ||
209 | .phys_pkg_id = flat_phys_pkg_id, | ||
210 | .mps_oem_check = NULL, | ||
211 | |||
212 | .get_apic_id = flat_get_apic_id, | ||
213 | .set_apic_id = set_apic_id, | ||
214 | .apic_id_mask = 0xFFu << 24, | ||
215 | |||
216 | .cpu_mask_to_apicid = flat_cpu_mask_to_apicid, | ||
217 | .cpu_mask_to_apicid_and = flat_cpu_mask_to_apicid_and, | ||
218 | |||
219 | .send_IPI_mask = flat_send_IPI_mask, | ||
220 | .send_IPI_mask_allbutself = flat_send_IPI_mask_allbutself, | ||
221 | .send_IPI_allbutself = flat_send_IPI_allbutself, | ||
222 | .send_IPI_all = flat_send_IPI_all, | ||
223 | .send_IPI_self = apic_send_IPI_self, | ||
224 | |||
225 | .wakeup_cpu = NULL, | ||
226 | .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, | ||
227 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | ||
228 | .wait_for_init_deassert = NULL, | ||
229 | .smp_callin_clear_local_apic = NULL, | ||
230 | .store_NMI_vector = NULL, | ||
231 | .inquire_remote_apic = NULL, | ||
197 | }; | 232 | }; |
198 | 233 | ||
199 | /* | 234 | /* |
@@ -232,18 +267,18 @@ static void physflat_vector_allocation_domain(int cpu, struct cpumask *retmask) | |||
232 | 267 | ||
233 | static void physflat_send_IPI_mask(const struct cpumask *cpumask, int vector) | 268 | static void physflat_send_IPI_mask(const struct cpumask *cpumask, int vector) |
234 | { | 269 | { |
235 | send_IPI_mask_sequence(cpumask, vector); | 270 | default_send_IPI_mask_sequence_phys(cpumask, vector); |
236 | } | 271 | } |
237 | 272 | ||
238 | static void physflat_send_IPI_mask_allbutself(const struct cpumask *cpumask, | 273 | static void physflat_send_IPI_mask_allbutself(const struct cpumask *cpumask, |
239 | int vector) | 274 | int vector) |
240 | { | 275 | { |
241 | send_IPI_mask_allbutself(cpumask, vector); | 276 | default_send_IPI_mask_allbutself_phys(cpumask, vector); |
242 | } | 277 | } |
243 | 278 | ||
244 | static void physflat_send_IPI_allbutself(int vector) | 279 | static void physflat_send_IPI_allbutself(int vector) |
245 | { | 280 | { |
246 | send_IPI_mask_allbutself(cpu_online_mask, vector); | 281 | default_send_IPI_mask_allbutself_phys(cpu_online_mask, vector); |
247 | } | 282 | } |
248 | 283 | ||
249 | static void physflat_send_IPI_all(int vector) | 284 | static void physflat_send_IPI_all(int vector) |
@@ -276,32 +311,67 @@ physflat_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
276 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | 311 | * We're using fixed IRQ delivery, can only return one phys APIC ID. |
277 | * May as well be the first. | 312 | * May as well be the first. |
278 | */ | 313 | */ |
279 | for_each_cpu_and(cpu, cpumask, andmask) | 314 | for_each_cpu_and(cpu, cpumask, andmask) { |
280 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | 315 | if (cpumask_test_cpu(cpu, cpu_online_mask)) |
281 | break; | 316 | break; |
317 | } | ||
282 | if (cpu < nr_cpu_ids) | 318 | if (cpu < nr_cpu_ids) |
283 | return per_cpu(x86_cpu_to_apicid, cpu); | 319 | return per_cpu(x86_cpu_to_apicid, cpu); |
320 | |||
284 | return BAD_APICID; | 321 | return BAD_APICID; |
285 | } | 322 | } |
286 | 323 | ||
287 | struct genapic apic_physflat = { | 324 | struct genapic apic_physflat = { |
288 | .name = "physical flat", | 325 | |
289 | .acpi_madt_oem_check = physflat_acpi_madt_oem_check, | 326 | .name = "physical flat", |
290 | .int_delivery_mode = dest_Fixed, | 327 | .probe = NULL, |
291 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), | 328 | .acpi_madt_oem_check = physflat_acpi_madt_oem_check, |
292 | .target_cpus = physflat_target_cpus, | 329 | .apic_id_registered = flat_apic_id_registered, |
293 | .vector_allocation_domain = physflat_vector_allocation_domain, | 330 | |
294 | .apic_id_registered = flat_apic_id_registered, | 331 | .irq_delivery_mode = dest_Fixed, |
295 | .init_apic_ldr = flat_init_apic_ldr,/*not needed, but shouldn't hurt*/ | 332 | .irq_dest_mode = 0, /* physical */ |
296 | .send_IPI_all = physflat_send_IPI_all, | 333 | |
297 | .send_IPI_allbutself = physflat_send_IPI_allbutself, | 334 | .target_cpus = physflat_target_cpus, |
298 | .send_IPI_mask = physflat_send_IPI_mask, | 335 | .disable_esr = 0, |
299 | .send_IPI_mask_allbutself = physflat_send_IPI_mask_allbutself, | 336 | .dest_logical = 0, |
300 | .send_IPI_self = apic_send_IPI_self, | 337 | .check_apicid_used = NULL, |
301 | .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid, | 338 | .check_apicid_present = NULL, |
302 | .cpu_mask_to_apicid_and = physflat_cpu_mask_to_apicid_and, | 339 | |
303 | .phys_pkg_id = phys_pkg_id, | 340 | .vector_allocation_domain = physflat_vector_allocation_domain, |
304 | .get_apic_id = get_apic_id, | 341 | /* not needed, but shouldn't hurt: */ |
305 | .set_apic_id = set_apic_id, | 342 | .init_apic_ldr = flat_init_apic_ldr, |
306 | .apic_id_mask = (0xFFu<<24), | 343 | |
344 | .ioapic_phys_id_map = NULL, | ||
345 | .setup_apic_routing = NULL, | ||
346 | .multi_timer_check = NULL, | ||
347 | .apicid_to_node = NULL, | ||
348 | .cpu_to_logical_apicid = NULL, | ||
349 | .cpu_present_to_apicid = default_cpu_present_to_apicid, | ||
350 | .apicid_to_cpu_present = NULL, | ||
351 | .setup_portio_remap = NULL, | ||
352 | .check_phys_apicid_present = default_check_phys_apicid_present, | ||
353 | .enable_apic_mode = NULL, | ||
354 | .phys_pkg_id = flat_phys_pkg_id, | ||
355 | .mps_oem_check = NULL, | ||
356 | |||
357 | .get_apic_id = flat_get_apic_id, | ||
358 | .set_apic_id = set_apic_id, | ||
359 | .apic_id_mask = 0xFFu << 24, | ||
360 | |||
361 | .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid, | ||
362 | .cpu_mask_to_apicid_and = physflat_cpu_mask_to_apicid_and, | ||
363 | |||
364 | .send_IPI_mask = physflat_send_IPI_mask, | ||
365 | .send_IPI_mask_allbutself = physflat_send_IPI_mask_allbutself, | ||
366 | .send_IPI_allbutself = physflat_send_IPI_allbutself, | ||
367 | .send_IPI_all = physflat_send_IPI_all, | ||
368 | .send_IPI_self = apic_send_IPI_self, | ||
369 | |||
370 | .wakeup_cpu = NULL, | ||
371 | .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, | ||
372 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | ||
373 | .wait_for_init_deassert = NULL, | ||
374 | .smp_callin_clear_local_apic = NULL, | ||
375 | .store_NMI_vector = NULL, | ||
376 | .inquire_remote_apic = NULL, | ||
307 | }; | 377 | }; |
diff --git a/arch/x86/kernel/genx2apic_cluster.c b/arch/x86/kernel/genx2apic_cluster.c index 6ce497cc372d..7c87156b6411 100644 --- a/arch/x86/kernel/genx2apic_cluster.c +++ b/arch/x86/kernel/genx2apic_cluster.c | |||
@@ -36,8 +36,8 @@ static void x2apic_vector_allocation_domain(int cpu, struct cpumask *retmask) | |||
36 | cpumask_set_cpu(cpu, retmask); | 36 | cpumask_set_cpu(cpu, retmask); |
37 | } | 37 | } |
38 | 38 | ||
39 | static void __x2apic_send_IPI_dest(unsigned int apicid, int vector, | 39 | static void |
40 | unsigned int dest) | 40 | __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest) |
41 | { | 41 | { |
42 | unsigned long cfg; | 42 | unsigned long cfg; |
43 | 43 | ||
@@ -57,45 +57,50 @@ static void __x2apic_send_IPI_dest(unsigned int apicid, int vector, | |||
57 | */ | 57 | */ |
58 | static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) | 58 | static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) |
59 | { | 59 | { |
60 | unsigned long flags; | ||
61 | unsigned long query_cpu; | 60 | unsigned long query_cpu; |
61 | unsigned long flags; | ||
62 | 62 | ||
63 | local_irq_save(flags); | 63 | local_irq_save(flags); |
64 | for_each_cpu(query_cpu, mask) | 64 | for_each_cpu(query_cpu, mask) { |
65 | __x2apic_send_IPI_dest( | 65 | __x2apic_send_IPI_dest( |
66 | per_cpu(x86_cpu_to_logical_apicid, query_cpu), | 66 | per_cpu(x86_cpu_to_logical_apicid, query_cpu), |
67 | vector, APIC_DEST_LOGICAL); | 67 | vector, apic->dest_logical); |
68 | } | ||
68 | local_irq_restore(flags); | 69 | local_irq_restore(flags); |
69 | } | 70 | } |
70 | 71 | ||
71 | static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, | 72 | static void |
72 | int vector) | 73 | x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector) |
73 | { | 74 | { |
74 | unsigned long flags; | ||
75 | unsigned long query_cpu; | ||
76 | unsigned long this_cpu = smp_processor_id(); | 75 | unsigned long this_cpu = smp_processor_id(); |
76 | unsigned long query_cpu; | ||
77 | unsigned long flags; | ||
77 | 78 | ||
78 | local_irq_save(flags); | 79 | local_irq_save(flags); |
79 | for_each_cpu(query_cpu, mask) | 80 | for_each_cpu(query_cpu, mask) { |
80 | if (query_cpu != this_cpu) | 81 | if (query_cpu == this_cpu) |
81 | __x2apic_send_IPI_dest( | 82 | continue; |
83 | __x2apic_send_IPI_dest( | ||
82 | per_cpu(x86_cpu_to_logical_apicid, query_cpu), | 84 | per_cpu(x86_cpu_to_logical_apicid, query_cpu), |
83 | vector, APIC_DEST_LOGICAL); | 85 | vector, apic->dest_logical); |
86 | } | ||
84 | local_irq_restore(flags); | 87 | local_irq_restore(flags); |
85 | } | 88 | } |
86 | 89 | ||
87 | static void x2apic_send_IPI_allbutself(int vector) | 90 | static void x2apic_send_IPI_allbutself(int vector) |
88 | { | 91 | { |
89 | unsigned long flags; | ||
90 | unsigned long query_cpu; | ||
91 | unsigned long this_cpu = smp_processor_id(); | 92 | unsigned long this_cpu = smp_processor_id(); |
93 | unsigned long query_cpu; | ||
94 | unsigned long flags; | ||
92 | 95 | ||
93 | local_irq_save(flags); | 96 | local_irq_save(flags); |
94 | for_each_online_cpu(query_cpu) | 97 | for_each_online_cpu(query_cpu) { |
95 | if (query_cpu != this_cpu) | 98 | if (query_cpu == this_cpu) |
96 | __x2apic_send_IPI_dest( | 99 | continue; |
100 | __x2apic_send_IPI_dest( | ||
97 | per_cpu(x86_cpu_to_logical_apicid, query_cpu), | 101 | per_cpu(x86_cpu_to_logical_apicid, query_cpu), |
98 | vector, APIC_DEST_LOGICAL); | 102 | vector, apic->dest_logical); |
103 | } | ||
99 | local_irq_restore(flags); | 104 | local_irq_restore(flags); |
100 | } | 105 | } |
101 | 106 | ||
@@ -111,21 +116,21 @@ static int x2apic_apic_id_registered(void) | |||
111 | 116 | ||
112 | static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask) | 117 | static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask) |
113 | { | 118 | { |
114 | int cpu; | ||
115 | |||
116 | /* | 119 | /* |
117 | * We're using fixed IRQ delivery, can only return one logical APIC ID. | 120 | * We're using fixed IRQ delivery, can only return one logical APIC ID. |
118 | * May as well be the first. | 121 | * May as well be the first. |
119 | */ | 122 | */ |
120 | cpu = cpumask_first(cpumask); | 123 | int cpu = cpumask_first(cpumask); |
124 | |||
121 | if ((unsigned)cpu < nr_cpu_ids) | 125 | if ((unsigned)cpu < nr_cpu_ids) |
122 | return per_cpu(x86_cpu_to_logical_apicid, cpu); | 126 | return per_cpu(x86_cpu_to_logical_apicid, cpu); |
123 | else | 127 | else |
124 | return BAD_APICID; | 128 | return BAD_APICID; |
125 | } | 129 | } |
126 | 130 | ||
127 | static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | 131 | static unsigned int |
128 | const struct cpumask *andmask) | 132 | x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, |
133 | const struct cpumask *andmask) | ||
129 | { | 134 | { |
130 | int cpu; | 135 | int cpu; |
131 | 136 | ||
@@ -133,15 +138,18 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
133 | * We're using fixed IRQ delivery, can only return one logical APIC ID. | 138 | * We're using fixed IRQ delivery, can only return one logical APIC ID. |
134 | * May as well be the first. | 139 | * May as well be the first. |
135 | */ | 140 | */ |
136 | for_each_cpu_and(cpu, cpumask, andmask) | 141 | for_each_cpu_and(cpu, cpumask, andmask) { |
137 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | 142 | if (cpumask_test_cpu(cpu, cpu_online_mask)) |
138 | break; | 143 | break; |
144 | } | ||
145 | |||
139 | if (cpu < nr_cpu_ids) | 146 | if (cpu < nr_cpu_ids) |
140 | return per_cpu(x86_cpu_to_logical_apicid, cpu); | 147 | return per_cpu(x86_cpu_to_logical_apicid, cpu); |
148 | |||
141 | return BAD_APICID; | 149 | return BAD_APICID; |
142 | } | 150 | } |
143 | 151 | ||
144 | static unsigned int get_apic_id(unsigned long x) | 152 | static unsigned int x2apic_cluster_phys_get_apic_id(unsigned long x) |
145 | { | 153 | { |
146 | unsigned int id; | 154 | unsigned int id; |
147 | 155 | ||
@@ -157,7 +165,7 @@ static unsigned long set_apic_id(unsigned int id) | |||
157 | return x; | 165 | return x; |
158 | } | 166 | } |
159 | 167 | ||
160 | static unsigned int phys_pkg_id(int index_msb) | 168 | static int x2apic_cluster_phys_pkg_id(int initial_apicid, int index_msb) |
161 | { | 169 | { |
162 | return current_cpu_data.initial_apicid >> index_msb; | 170 | return current_cpu_data.initial_apicid >> index_msb; |
163 | } | 171 | } |
@@ -172,27 +180,58 @@ static void init_x2apic_ldr(void) | |||
172 | int cpu = smp_processor_id(); | 180 | int cpu = smp_processor_id(); |
173 | 181 | ||
174 | per_cpu(x86_cpu_to_logical_apicid, cpu) = apic_read(APIC_LDR); | 182 | per_cpu(x86_cpu_to_logical_apicid, cpu) = apic_read(APIC_LDR); |
175 | return; | ||
176 | } | 183 | } |
177 | 184 | ||
178 | struct genapic apic_x2apic_cluster = { | 185 | struct genapic apic_x2apic_cluster = { |
179 | .name = "cluster x2apic", | 186 | |
180 | .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, | 187 | .name = "cluster x2apic", |
181 | .int_delivery_mode = dest_LowestPrio, | 188 | .probe = NULL, |
182 | .int_dest_mode = (APIC_DEST_LOGICAL != 0), | 189 | .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, |
183 | .target_cpus = x2apic_target_cpus, | 190 | .apic_id_registered = x2apic_apic_id_registered, |
184 | .vector_allocation_domain = x2apic_vector_allocation_domain, | 191 | |
185 | .apic_id_registered = x2apic_apic_id_registered, | 192 | .irq_delivery_mode = dest_LowestPrio, |
186 | .init_apic_ldr = init_x2apic_ldr, | 193 | .irq_dest_mode = 1, /* logical */ |
187 | .send_IPI_all = x2apic_send_IPI_all, | 194 | |
188 | .send_IPI_allbutself = x2apic_send_IPI_allbutself, | 195 | .target_cpus = x2apic_target_cpus, |
189 | .send_IPI_mask = x2apic_send_IPI_mask, | 196 | .disable_esr = 0, |
190 | .send_IPI_mask_allbutself = x2apic_send_IPI_mask_allbutself, | 197 | .dest_logical = APIC_DEST_LOGICAL, |
191 | .send_IPI_self = x2apic_send_IPI_self, | 198 | .check_apicid_used = NULL, |
192 | .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid, | 199 | .check_apicid_present = NULL, |
193 | .cpu_mask_to_apicid_and = x2apic_cpu_mask_to_apicid_and, | 200 | |
194 | .phys_pkg_id = phys_pkg_id, | 201 | .vector_allocation_domain = x2apic_vector_allocation_domain, |
195 | .get_apic_id = get_apic_id, | 202 | .init_apic_ldr = init_x2apic_ldr, |
196 | .set_apic_id = set_apic_id, | 203 | |
197 | .apic_id_mask = (0xFFFFFFFFu), | 204 | .ioapic_phys_id_map = NULL, |
205 | .setup_apic_routing = NULL, | ||
206 | .multi_timer_check = NULL, | ||
207 | .apicid_to_node = NULL, | ||
208 | .cpu_to_logical_apicid = NULL, | ||
209 | .cpu_present_to_apicid = default_cpu_present_to_apicid, | ||
210 | .apicid_to_cpu_present = NULL, | ||
211 | .setup_portio_remap = NULL, | ||
212 | .check_phys_apicid_present = default_check_phys_apicid_present, | ||
213 | .enable_apic_mode = NULL, | ||
214 | .phys_pkg_id = x2apic_cluster_phys_pkg_id, | ||
215 | .mps_oem_check = NULL, | ||
216 | |||
217 | .get_apic_id = x2apic_cluster_phys_get_apic_id, | ||
218 | .set_apic_id = set_apic_id, | ||
219 | .apic_id_mask = 0xFFFFFFFFu, | ||
220 | |||
221 | .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid, | ||
222 | .cpu_mask_to_apicid_and = x2apic_cpu_mask_to_apicid_and, | ||
223 | |||
224 | .send_IPI_mask = x2apic_send_IPI_mask, | ||
225 | .send_IPI_mask_allbutself = x2apic_send_IPI_mask_allbutself, | ||
226 | .send_IPI_allbutself = x2apic_send_IPI_allbutself, | ||
227 | .send_IPI_all = x2apic_send_IPI_all, | ||
228 | .send_IPI_self = x2apic_send_IPI_self, | ||
229 | |||
230 | .wakeup_cpu = NULL, | ||
231 | .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, | ||
232 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | ||
233 | .wait_for_init_deassert = NULL, | ||
234 | .smp_callin_clear_local_apic = NULL, | ||
235 | .store_NMI_vector = NULL, | ||
236 | .inquire_remote_apic = NULL, | ||
198 | }; | 237 | }; |
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/genx2apic_phys.c index 21bcc0e098ba..5cbae8aa0408 100644 --- a/arch/x86/kernel/genx2apic_phys.c +++ b/arch/x86/kernel/genx2apic_phys.c | |||
@@ -55,8 +55,8 @@ static void __x2apic_send_IPI_dest(unsigned int apicid, int vector, | |||
55 | 55 | ||
56 | static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) | 56 | static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) |
57 | { | 57 | { |
58 | unsigned long flags; | ||
59 | unsigned long query_cpu; | 58 | unsigned long query_cpu; |
59 | unsigned long flags; | ||
60 | 60 | ||
61 | local_irq_save(flags); | 61 | local_irq_save(flags); |
62 | for_each_cpu(query_cpu, mask) { | 62 | for_each_cpu(query_cpu, mask) { |
@@ -66,12 +66,12 @@ static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) | |||
66 | local_irq_restore(flags); | 66 | local_irq_restore(flags); |
67 | } | 67 | } |
68 | 68 | ||
69 | static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, | 69 | static void |
70 | int vector) | 70 | x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector) |
71 | { | 71 | { |
72 | unsigned long flags; | ||
73 | unsigned long query_cpu; | ||
74 | unsigned long this_cpu = smp_processor_id(); | 72 | unsigned long this_cpu = smp_processor_id(); |
73 | unsigned long query_cpu; | ||
74 | unsigned long flags; | ||
75 | 75 | ||
76 | local_irq_save(flags); | 76 | local_irq_save(flags); |
77 | for_each_cpu(query_cpu, mask) { | 77 | for_each_cpu(query_cpu, mask) { |
@@ -85,16 +85,17 @@ static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, | |||
85 | 85 | ||
86 | static void x2apic_send_IPI_allbutself(int vector) | 86 | static void x2apic_send_IPI_allbutself(int vector) |
87 | { | 87 | { |
88 | unsigned long flags; | ||
89 | unsigned long query_cpu; | ||
90 | unsigned long this_cpu = smp_processor_id(); | 88 | unsigned long this_cpu = smp_processor_id(); |
89 | unsigned long query_cpu; | ||
90 | unsigned long flags; | ||
91 | 91 | ||
92 | local_irq_save(flags); | 92 | local_irq_save(flags); |
93 | for_each_online_cpu(query_cpu) | 93 | for_each_online_cpu(query_cpu) { |
94 | if (query_cpu != this_cpu) | 94 | if (query_cpu == this_cpu) |
95 | __x2apic_send_IPI_dest( | 95 | continue; |
96 | per_cpu(x86_cpu_to_apicid, query_cpu), | 96 | __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu), |
97 | vector, APIC_DEST_PHYSICAL); | 97 | vector, APIC_DEST_PHYSICAL); |
98 | } | ||
98 | local_irq_restore(flags); | 99 | local_irq_restore(flags); |
99 | } | 100 | } |
100 | 101 | ||
@@ -110,21 +111,21 @@ static int x2apic_apic_id_registered(void) | |||
110 | 111 | ||
111 | static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask) | 112 | static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask) |
112 | { | 113 | { |
113 | int cpu; | ||
114 | |||
115 | /* | 114 | /* |
116 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | 115 | * We're using fixed IRQ delivery, can only return one phys APIC ID. |
117 | * May as well be the first. | 116 | * May as well be the first. |
118 | */ | 117 | */ |
119 | cpu = cpumask_first(cpumask); | 118 | int cpu = cpumask_first(cpumask); |
119 | |||
120 | if ((unsigned)cpu < nr_cpu_ids) | 120 | if ((unsigned)cpu < nr_cpu_ids) |
121 | return per_cpu(x86_cpu_to_apicid, cpu); | 121 | return per_cpu(x86_cpu_to_apicid, cpu); |
122 | else | 122 | else |
123 | return BAD_APICID; | 123 | return BAD_APICID; |
124 | } | 124 | } |
125 | 125 | ||
126 | static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | 126 | static unsigned int |
127 | const struct cpumask *andmask) | 127 | x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, |
128 | const struct cpumask *andmask) | ||
128 | { | 129 | { |
129 | int cpu; | 130 | int cpu; |
130 | 131 | ||
@@ -132,31 +133,28 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
132 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | 133 | * We're using fixed IRQ delivery, can only return one phys APIC ID. |
133 | * May as well be the first. | 134 | * May as well be the first. |
134 | */ | 135 | */ |
135 | for_each_cpu_and(cpu, cpumask, andmask) | 136 | for_each_cpu_and(cpu, cpumask, andmask) { |
136 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | 137 | if (cpumask_test_cpu(cpu, cpu_online_mask)) |
137 | break; | 138 | break; |
139 | } | ||
140 | |||
138 | if (cpu < nr_cpu_ids) | 141 | if (cpu < nr_cpu_ids) |
139 | return per_cpu(x86_cpu_to_apicid, cpu); | 142 | return per_cpu(x86_cpu_to_apicid, cpu); |
143 | |||
140 | return BAD_APICID; | 144 | return BAD_APICID; |
141 | } | 145 | } |
142 | 146 | ||
143 | static unsigned int get_apic_id(unsigned long x) | 147 | static unsigned int x2apic_phys_get_apic_id(unsigned long x) |
144 | { | 148 | { |
145 | unsigned int id; | 149 | return x; |
146 | |||
147 | id = x; | ||
148 | return id; | ||
149 | } | 150 | } |
150 | 151 | ||
151 | static unsigned long set_apic_id(unsigned int id) | 152 | static unsigned long set_apic_id(unsigned int id) |
152 | { | 153 | { |
153 | unsigned long x; | 154 | return id; |
154 | |||
155 | x = id; | ||
156 | return x; | ||
157 | } | 155 | } |
158 | 156 | ||
159 | static unsigned int phys_pkg_id(int index_msb) | 157 | static int x2apic_phys_pkg_id(int initial_apicid, int index_msb) |
160 | { | 158 | { |
161 | return current_cpu_data.initial_apicid >> index_msb; | 159 | return current_cpu_data.initial_apicid >> index_msb; |
162 | } | 160 | } |
@@ -168,27 +166,58 @@ static void x2apic_send_IPI_self(int vector) | |||
168 | 166 | ||
169 | static void init_x2apic_ldr(void) | 167 | static void init_x2apic_ldr(void) |
170 | { | 168 | { |
171 | return; | ||
172 | } | 169 | } |
173 | 170 | ||
174 | struct genapic apic_x2apic_phys = { | 171 | struct genapic apic_x2apic_phys = { |
175 | .name = "physical x2apic", | 172 | |
176 | .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, | 173 | .name = "physical x2apic", |
177 | .int_delivery_mode = dest_Fixed, | 174 | .probe = NULL, |
178 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), | 175 | .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, |
179 | .target_cpus = x2apic_target_cpus, | 176 | .apic_id_registered = x2apic_apic_id_registered, |
180 | .vector_allocation_domain = x2apic_vector_allocation_domain, | 177 | |
181 | .apic_id_registered = x2apic_apic_id_registered, | 178 | .irq_delivery_mode = dest_Fixed, |
182 | .init_apic_ldr = init_x2apic_ldr, | 179 | .irq_dest_mode = 0, /* physical */ |
183 | .send_IPI_all = x2apic_send_IPI_all, | 180 | |
184 | .send_IPI_allbutself = x2apic_send_IPI_allbutself, | 181 | .target_cpus = x2apic_target_cpus, |
185 | .send_IPI_mask = x2apic_send_IPI_mask, | 182 | .disable_esr = 0, |
186 | .send_IPI_mask_allbutself = x2apic_send_IPI_mask_allbutself, | 183 | .dest_logical = 0, |
187 | .send_IPI_self = x2apic_send_IPI_self, | 184 | .check_apicid_used = NULL, |
188 | .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid, | 185 | .check_apicid_present = NULL, |
189 | .cpu_mask_to_apicid_and = x2apic_cpu_mask_to_apicid_and, | 186 | |
190 | .phys_pkg_id = phys_pkg_id, | 187 | .vector_allocation_domain = x2apic_vector_allocation_domain, |
191 | .get_apic_id = get_apic_id, | 188 | .init_apic_ldr = init_x2apic_ldr, |
192 | .set_apic_id = set_apic_id, | 189 | |
193 | .apic_id_mask = (0xFFFFFFFFu), | 190 | .ioapic_phys_id_map = NULL, |
191 | .setup_apic_routing = NULL, | ||
192 | .multi_timer_check = NULL, | ||
193 | .apicid_to_node = NULL, | ||
194 | .cpu_to_logical_apicid = NULL, | ||
195 | .cpu_present_to_apicid = default_cpu_present_to_apicid, | ||
196 | .apicid_to_cpu_present = NULL, | ||
197 | .setup_portio_remap = NULL, | ||
198 | .check_phys_apicid_present = default_check_phys_apicid_present, | ||
199 | .enable_apic_mode = NULL, | ||
200 | .phys_pkg_id = x2apic_phys_pkg_id, | ||
201 | .mps_oem_check = NULL, | ||
202 | |||
203 | .get_apic_id = x2apic_phys_get_apic_id, | ||
204 | .set_apic_id = set_apic_id, | ||
205 | .apic_id_mask = 0xFFFFFFFFu, | ||
206 | |||
207 | .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid, | ||
208 | .cpu_mask_to_apicid_and = x2apic_cpu_mask_to_apicid_and, | ||
209 | |||
210 | .send_IPI_mask = x2apic_send_IPI_mask, | ||
211 | .send_IPI_mask_allbutself = x2apic_send_IPI_mask_allbutself, | ||
212 | .send_IPI_allbutself = x2apic_send_IPI_allbutself, | ||
213 | .send_IPI_all = x2apic_send_IPI_all, | ||
214 | .send_IPI_self = x2apic_send_IPI_self, | ||
215 | |||
216 | .wakeup_cpu = NULL, | ||
217 | .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, | ||
218 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | ||
219 | .wait_for_init_deassert = NULL, | ||
220 | .smp_callin_clear_local_apic = NULL, | ||
221 | .store_NMI_vector = NULL, | ||
222 | .inquire_remote_apic = NULL, | ||
194 | }; | 223 | }; |
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/genx2apic_uv_x.c index b193e082f6ce..6adb5e6f4d92 100644 --- a/arch/x86/kernel/genx2apic_uv_x.c +++ b/arch/x86/kernel/genx2apic_uv_x.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <asm/ipi.h> | 25 | #include <asm/ipi.h> |
26 | #include <asm/genapic.h> | 26 | #include <asm/genapic.h> |
27 | #include <asm/pgtable.h> | 27 | #include <asm/pgtable.h> |
28 | #include <asm/uv/uv.h> | ||
28 | #include <asm/uv/uv_mmrs.h> | 29 | #include <asm/uv/uv_mmrs.h> |
29 | #include <asm/uv/uv_hub.h> | 30 | #include <asm/uv/uv_hub.h> |
30 | #include <asm/uv/bios.h> | 31 | #include <asm/uv/bios.h> |
@@ -117,12 +118,13 @@ static void uv_send_IPI_one(int cpu, int vector) | |||
117 | int pnode; | 118 | int pnode; |
118 | 119 | ||
119 | apicid = per_cpu(x86_cpu_to_apicid, cpu); | 120 | apicid = per_cpu(x86_cpu_to_apicid, cpu); |
120 | lapicid = apicid & 0x3f; /* ZZZ macro needed */ | 121 | lapicid = apicid & 0x3f; /* ZZZ macro needed */ |
121 | pnode = uv_apicid_to_pnode(apicid); | 122 | pnode = uv_apicid_to_pnode(apicid); |
122 | val = | 123 | |
123 | (1UL << UVH_IPI_INT_SEND_SHFT) | (lapicid << | 124 | val = ( 1UL << UVH_IPI_INT_SEND_SHFT ) | |
124 | UVH_IPI_INT_APIC_ID_SHFT) | | 125 | ( lapicid << UVH_IPI_INT_APIC_ID_SHFT ) | |
125 | (vector << UVH_IPI_INT_VECTOR_SHFT); | 126 | ( vector << UVH_IPI_INT_VECTOR_SHFT ); |
127 | |||
126 | uv_write_global_mmr64(pnode, UVH_IPI_INT, val); | 128 | uv_write_global_mmr64(pnode, UVH_IPI_INT, val); |
127 | } | 129 | } |
128 | 130 | ||
@@ -136,22 +138,24 @@ static void uv_send_IPI_mask(const struct cpumask *mask, int vector) | |||
136 | 138 | ||
137 | static void uv_send_IPI_mask_allbutself(const struct cpumask *mask, int vector) | 139 | static void uv_send_IPI_mask_allbutself(const struct cpumask *mask, int vector) |
138 | { | 140 | { |
139 | unsigned int cpu; | ||
140 | unsigned int this_cpu = smp_processor_id(); | 141 | unsigned int this_cpu = smp_processor_id(); |
142 | unsigned int cpu; | ||
141 | 143 | ||
142 | for_each_cpu(cpu, mask) | 144 | for_each_cpu(cpu, mask) { |
143 | if (cpu != this_cpu) | 145 | if (cpu != this_cpu) |
144 | uv_send_IPI_one(cpu, vector); | 146 | uv_send_IPI_one(cpu, vector); |
147 | } | ||
145 | } | 148 | } |
146 | 149 | ||
147 | static void uv_send_IPI_allbutself(int vector) | 150 | static void uv_send_IPI_allbutself(int vector) |
148 | { | 151 | { |
149 | unsigned int cpu; | ||
150 | unsigned int this_cpu = smp_processor_id(); | 152 | unsigned int this_cpu = smp_processor_id(); |
153 | unsigned int cpu; | ||
151 | 154 | ||
152 | for_each_online_cpu(cpu) | 155 | for_each_online_cpu(cpu) { |
153 | if (cpu != this_cpu) | 156 | if (cpu != this_cpu) |
154 | uv_send_IPI_one(cpu, vector); | 157 | uv_send_IPI_one(cpu, vector); |
158 | } | ||
155 | } | 159 | } |
156 | 160 | ||
157 | static void uv_send_IPI_all(int vector) | 161 | static void uv_send_IPI_all(int vector) |
@@ -170,21 +174,21 @@ static void uv_init_apic_ldr(void) | |||
170 | 174 | ||
171 | static unsigned int uv_cpu_mask_to_apicid(const struct cpumask *cpumask) | 175 | static unsigned int uv_cpu_mask_to_apicid(const struct cpumask *cpumask) |
172 | { | 176 | { |
173 | int cpu; | ||
174 | |||
175 | /* | 177 | /* |
176 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | 178 | * We're using fixed IRQ delivery, can only return one phys APIC ID. |
177 | * May as well be the first. | 179 | * May as well be the first. |
178 | */ | 180 | */ |
179 | cpu = cpumask_first(cpumask); | 181 | int cpu = cpumask_first(cpumask); |
182 | |||
180 | if ((unsigned)cpu < nr_cpu_ids) | 183 | if ((unsigned)cpu < nr_cpu_ids) |
181 | return per_cpu(x86_cpu_to_apicid, cpu); | 184 | return per_cpu(x86_cpu_to_apicid, cpu); |
182 | else | 185 | else |
183 | return BAD_APICID; | 186 | return BAD_APICID; |
184 | } | 187 | } |
185 | 188 | ||
186 | static unsigned int uv_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | 189 | static unsigned int |
187 | const struct cpumask *andmask) | 190 | uv_cpu_mask_to_apicid_and(const struct cpumask *cpumask, |
191 | const struct cpumask *andmask) | ||
188 | { | 192 | { |
189 | int cpu; | 193 | int cpu; |
190 | 194 | ||
@@ -192,15 +196,17 @@ static unsigned int uv_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
192 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | 196 | * We're using fixed IRQ delivery, can only return one phys APIC ID. |
193 | * May as well be the first. | 197 | * May as well be the first. |
194 | */ | 198 | */ |
195 | for_each_cpu_and(cpu, cpumask, andmask) | 199 | for_each_cpu_and(cpu, cpumask, andmask) { |
196 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | 200 | if (cpumask_test_cpu(cpu, cpu_online_mask)) |
197 | break; | 201 | break; |
202 | } | ||
198 | if (cpu < nr_cpu_ids) | 203 | if (cpu < nr_cpu_ids) |
199 | return per_cpu(x86_cpu_to_apicid, cpu); | 204 | return per_cpu(x86_cpu_to_apicid, cpu); |
205 | |||
200 | return BAD_APICID; | 206 | return BAD_APICID; |
201 | } | 207 | } |
202 | 208 | ||
203 | static unsigned int get_apic_id(unsigned long x) | 209 | static unsigned int x2apic_get_apic_id(unsigned long x) |
204 | { | 210 | { |
205 | unsigned int id; | 211 | unsigned int id; |
206 | 212 | ||
@@ -222,10 +228,10 @@ static unsigned long set_apic_id(unsigned int id) | |||
222 | static unsigned int uv_read_apic_id(void) | 228 | static unsigned int uv_read_apic_id(void) |
223 | { | 229 | { |
224 | 230 | ||
225 | return get_apic_id(apic_read(APIC_ID)); | 231 | return x2apic_get_apic_id(apic_read(APIC_ID)); |
226 | } | 232 | } |
227 | 233 | ||
228 | static unsigned int phys_pkg_id(int index_msb) | 234 | static int uv_phys_pkg_id(int initial_apicid, int index_msb) |
229 | { | 235 | { |
230 | return uv_read_apic_id() >> index_msb; | 236 | return uv_read_apic_id() >> index_msb; |
231 | } | 237 | } |
@@ -236,25 +242,57 @@ static void uv_send_IPI_self(int vector) | |||
236 | } | 242 | } |
237 | 243 | ||
238 | struct genapic apic_x2apic_uv_x = { | 244 | struct genapic apic_x2apic_uv_x = { |
239 | .name = "UV large system", | 245 | |
240 | .acpi_madt_oem_check = uv_acpi_madt_oem_check, | 246 | .name = "UV large system", |
241 | .int_delivery_mode = dest_Fixed, | 247 | .probe = NULL, |
242 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), | 248 | .acpi_madt_oem_check = uv_acpi_madt_oem_check, |
243 | .target_cpus = uv_target_cpus, | 249 | .apic_id_registered = uv_apic_id_registered, |
244 | .vector_allocation_domain = uv_vector_allocation_domain, | 250 | |
245 | .apic_id_registered = uv_apic_id_registered, | 251 | .irq_delivery_mode = dest_Fixed, |
246 | .init_apic_ldr = uv_init_apic_ldr, | 252 | .irq_dest_mode = 1, /* logical */ |
247 | .send_IPI_all = uv_send_IPI_all, | 253 | |
248 | .send_IPI_allbutself = uv_send_IPI_allbutself, | 254 | .target_cpus = uv_target_cpus, |
249 | .send_IPI_mask = uv_send_IPI_mask, | 255 | .disable_esr = 0, |
250 | .send_IPI_mask_allbutself = uv_send_IPI_mask_allbutself, | 256 | .dest_logical = APIC_DEST_LOGICAL, |
251 | .send_IPI_self = uv_send_IPI_self, | 257 | .check_apicid_used = NULL, |
252 | .cpu_mask_to_apicid = uv_cpu_mask_to_apicid, | 258 | .check_apicid_present = NULL, |
253 | .cpu_mask_to_apicid_and = uv_cpu_mask_to_apicid_and, | 259 | |
254 | .phys_pkg_id = phys_pkg_id, | 260 | .vector_allocation_domain = uv_vector_allocation_domain, |
255 | .get_apic_id = get_apic_id, | 261 | .init_apic_ldr = uv_init_apic_ldr, |
256 | .set_apic_id = set_apic_id, | 262 | |
257 | .apic_id_mask = (0xFFFFFFFFu), | 263 | .ioapic_phys_id_map = NULL, |
264 | .setup_apic_routing = NULL, | ||
265 | .multi_timer_check = NULL, | ||
266 | .apicid_to_node = NULL, | ||
267 | .cpu_to_logical_apicid = NULL, | ||
268 | .cpu_present_to_apicid = default_cpu_present_to_apicid, | ||
269 | .apicid_to_cpu_present = NULL, | ||
270 | .setup_portio_remap = NULL, | ||
271 | .check_phys_apicid_present = default_check_phys_apicid_present, | ||
272 | .enable_apic_mode = NULL, | ||
273 | .phys_pkg_id = uv_phys_pkg_id, | ||
274 | .mps_oem_check = NULL, | ||
275 | |||
276 | .get_apic_id = x2apic_get_apic_id, | ||
277 | .set_apic_id = set_apic_id, | ||
278 | .apic_id_mask = 0xFFFFFFFFu, | ||
279 | |||
280 | .cpu_mask_to_apicid = uv_cpu_mask_to_apicid, | ||
281 | .cpu_mask_to_apicid_and = uv_cpu_mask_to_apicid_and, | ||
282 | |||
283 | .send_IPI_mask = uv_send_IPI_mask, | ||
284 | .send_IPI_mask_allbutself = uv_send_IPI_mask_allbutself, | ||
285 | .send_IPI_allbutself = uv_send_IPI_allbutself, | ||
286 | .send_IPI_all = uv_send_IPI_all, | ||
287 | .send_IPI_self = uv_send_IPI_self, | ||
288 | |||
289 | .wakeup_cpu = NULL, | ||
290 | .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, | ||
291 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | ||
292 | .wait_for_init_deassert = NULL, | ||
293 | .smp_callin_clear_local_apic = NULL, | ||
294 | .store_NMI_vector = NULL, | ||
295 | .inquire_remote_apic = NULL, | ||
258 | }; | 296 | }; |
259 | 297 | ||
260 | static __cpuinit void set_x2apic_extra_bits(int pnode) | 298 | static __cpuinit void set_x2apic_extra_bits(int pnode) |
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index b9a4d8c4b935..f5b272247690 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c | |||
@@ -26,27 +26,6 @@ | |||
26 | #include <asm/bios_ebda.h> | 26 | #include <asm/bios_ebda.h> |
27 | #include <asm/trampoline.h> | 27 | #include <asm/trampoline.h> |
28 | 28 | ||
29 | /* boot cpu pda */ | ||
30 | static struct x8664_pda _boot_cpu_pda; | ||
31 | |||
32 | #ifdef CONFIG_SMP | ||
33 | /* | ||
34 | * We install an empty cpu_pda pointer table to indicate to early users | ||
35 | * (numa_set_node) that the cpu_pda pointer table for cpus other than | ||
36 | * the boot cpu is not yet setup. | ||
37 | */ | ||
38 | static struct x8664_pda *__cpu_pda[NR_CPUS] __initdata; | ||
39 | #else | ||
40 | static struct x8664_pda *__cpu_pda[NR_CPUS] __read_mostly; | ||
41 | #endif | ||
42 | |||
43 | void __init x86_64_init_pda(void) | ||
44 | { | ||
45 | _cpu_pda = __cpu_pda; | ||
46 | cpu_pda(0) = &_boot_cpu_pda; | ||
47 | pda_init(0); | ||
48 | } | ||
49 | |||
50 | static void __init zap_identity_mappings(void) | 29 | static void __init zap_identity_mappings(void) |
51 | { | 30 | { |
52 | pgd_t *pgd = pgd_offset_k(0UL); | 31 | pgd_t *pgd = pgd_offset_k(0UL); |
@@ -112,8 +91,6 @@ void __init x86_64_start_kernel(char * real_mode_data) | |||
112 | if (console_loglevel == 10) | 91 | if (console_loglevel == 10) |
113 | early_printk("Kernel alive\n"); | 92 | early_printk("Kernel alive\n"); |
114 | 93 | ||
115 | x86_64_init_pda(); | ||
116 | |||
117 | x86_64_start_reservations(real_mode_data); | 94 | x86_64_start_reservations(real_mode_data); |
118 | } | 95 | } |
119 | 96 | ||
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index e835b4eea70b..722464c520cf 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
@@ -429,12 +429,14 @@ is386: movl $2,%ecx # set MP | |||
429 | ljmp $(__KERNEL_CS),$1f | 429 | ljmp $(__KERNEL_CS),$1f |
430 | 1: movl $(__KERNEL_DS),%eax # reload all the segment registers | 430 | 1: movl $(__KERNEL_DS),%eax # reload all the segment registers |
431 | movl %eax,%ss # after changing gdt. | 431 | movl %eax,%ss # after changing gdt. |
432 | movl %eax,%fs # gets reset once there's real percpu | ||
433 | 432 | ||
434 | movl $(__USER_DS),%eax # DS/ES contains default USER segment | 433 | movl $(__USER_DS),%eax # DS/ES contains default USER segment |
435 | movl %eax,%ds | 434 | movl %eax,%ds |
436 | movl %eax,%es | 435 | movl %eax,%es |
437 | 436 | ||
437 | movl $(__KERNEL_PERCPU), %eax | ||
438 | movl %eax,%fs # set this cpu's percpu | ||
439 | |||
438 | xorl %eax,%eax # Clear GS and LDT | 440 | xorl %eax,%eax # Clear GS and LDT |
439 | movl %eax,%gs | 441 | movl %eax,%gs |
440 | lldt %ax | 442 | lldt %ax |
@@ -446,8 +448,6 @@ is386: movl $2,%ecx # set MP | |||
446 | movb $1, ready | 448 | movb $1, ready |
447 | cmpb $0,%cl # the first CPU calls start_kernel | 449 | cmpb $0,%cl # the first CPU calls start_kernel |
448 | je 1f | 450 | je 1f |
449 | movl $(__KERNEL_PERCPU), %eax | ||
450 | movl %eax,%fs # set this cpu's percpu | ||
451 | movl (stack_start), %esp | 451 | movl (stack_start), %esp |
452 | 1: | 452 | 1: |
453 | #endif /* CONFIG_SMP */ | 453 | #endif /* CONFIG_SMP */ |
@@ -548,12 +548,8 @@ early_fault: | |||
548 | pushl %eax | 548 | pushl %eax |
549 | pushl %edx /* trapno */ | 549 | pushl %edx /* trapno */ |
550 | pushl $fault_msg | 550 | pushl $fault_msg |
551 | #ifdef CONFIG_EARLY_PRINTK | ||
552 | call early_printk | ||
553 | #else | ||
554 | call printk | 551 | call printk |
555 | #endif | 552 | #endif |
556 | #endif | ||
557 | call dump_stack | 553 | call dump_stack |
558 | hlt_loop: | 554 | hlt_loop: |
559 | hlt | 555 | hlt |
@@ -580,11 +576,10 @@ ignore_int: | |||
580 | pushl 32(%esp) | 576 | pushl 32(%esp) |
581 | pushl 40(%esp) | 577 | pushl 40(%esp) |
582 | pushl $int_msg | 578 | pushl $int_msg |
583 | #ifdef CONFIG_EARLY_PRINTK | ||
584 | call early_printk | ||
585 | #else | ||
586 | call printk | 579 | call printk |
587 | #endif | 580 | |
581 | call dump_stack | ||
582 | |||
588 | addl $(5*4),%esp | 583 | addl $(5*4),%esp |
589 | popl %ds | 584 | popl %ds |
590 | popl %es | 585 | popl %es |
@@ -660,7 +655,7 @@ early_recursion_flag: | |||
660 | .long 0 | 655 | .long 0 |
661 | 656 | ||
662 | int_msg: | 657 | int_msg: |
663 | .asciz "Unknown interrupt or fault at EIP %p %p %p\n" | 658 | .asciz "Unknown interrupt or fault at: %p %p %p\n" |
664 | 659 | ||
665 | fault_msg: | 660 | fault_msg: |
666 | /* fault info: */ | 661 | /* fault info: */ |
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index 0e275d495563..a0a2b5ca9b7d 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <asm/msr.h> | 19 | #include <asm/msr.h> |
20 | #include <asm/cache.h> | 20 | #include <asm/cache.h> |
21 | #include <asm/processor-flags.h> | 21 | #include <asm/processor-flags.h> |
22 | #include <asm/percpu.h> | ||
22 | 23 | ||
23 | #ifdef CONFIG_PARAVIRT | 24 | #ifdef CONFIG_PARAVIRT |
24 | #include <asm/asm-offsets.h> | 25 | #include <asm/asm-offsets.h> |
@@ -204,6 +205,19 @@ ENTRY(secondary_startup_64) | |||
204 | pushq $0 | 205 | pushq $0 |
205 | popfq | 206 | popfq |
206 | 207 | ||
208 | #ifdef CONFIG_SMP | ||
209 | /* | ||
210 | * Fix up static pointers that need __per_cpu_load added. The assembler | ||
211 | * is unable to do this directly. This is only needed for the boot cpu. | ||
212 | * These values are set up with the correct base addresses by C code for | ||
213 | * secondary cpus. | ||
214 | */ | ||
215 | movq initial_gs(%rip), %rax | ||
216 | cmpl $0, per_cpu__cpu_number(%rax) | ||
217 | jne 1f | ||
218 | addq %rax, early_gdt_descr_base(%rip) | ||
219 | 1: | ||
220 | #endif | ||
207 | /* | 221 | /* |
208 | * We must switch to a new descriptor in kernel space for the GDT | 222 | * We must switch to a new descriptor in kernel space for the GDT |
209 | * because soon the kernel won't have access anymore to the userspace | 223 | * because soon the kernel won't have access anymore to the userspace |
@@ -226,12 +240,15 @@ ENTRY(secondary_startup_64) | |||
226 | movl %eax,%fs | 240 | movl %eax,%fs |
227 | movl %eax,%gs | 241 | movl %eax,%gs |
228 | 242 | ||
229 | /* | 243 | /* Set up %gs. |
230 | * Setup up a dummy PDA. this is just for some early bootup code | 244 | * |
231 | * that does in_interrupt() | 245 | * The base of %gs always points to the bottom of the irqstack |
232 | */ | 246 | * union. If the stack protector canary is enabled, it is |
247 | * located at %gs:40. Note that, on SMP, the boot cpu uses | ||
248 | * init data section till per cpu areas are set up. | ||
249 | */ | ||
233 | movl $MSR_GS_BASE,%ecx | 250 | movl $MSR_GS_BASE,%ecx |
234 | movq $empty_zero_page,%rax | 251 | movq initial_gs(%rip),%rax |
235 | movq %rax,%rdx | 252 | movq %rax,%rdx |
236 | shrq $32,%rdx | 253 | shrq $32,%rdx |
237 | wrmsr | 254 | wrmsr |
@@ -257,6 +274,12 @@ ENTRY(secondary_startup_64) | |||
257 | .align 8 | 274 | .align 8 |
258 | ENTRY(initial_code) | 275 | ENTRY(initial_code) |
259 | .quad x86_64_start_kernel | 276 | .quad x86_64_start_kernel |
277 | ENTRY(initial_gs) | ||
278 | #ifdef CONFIG_SMP | ||
279 | .quad __per_cpu_load | ||
280 | #else | ||
281 | .quad PER_CPU_VAR(irq_stack_union) | ||
282 | #endif | ||
260 | __FINITDATA | 283 | __FINITDATA |
261 | 284 | ||
262 | ENTRY(stack_start) | 285 | ENTRY(stack_start) |
@@ -401,7 +424,8 @@ NEXT_PAGE(level2_spare_pgt) | |||
401 | .globl early_gdt_descr | 424 | .globl early_gdt_descr |
402 | early_gdt_descr: | 425 | early_gdt_descr: |
403 | .word GDT_ENTRIES*8-1 | 426 | .word GDT_ENTRIES*8-1 |
404 | .quad per_cpu__gdt_page | 427 | early_gdt_descr_base: |
428 | .quad per_cpu__gdt_page | ||
405 | 429 | ||
406 | ENTRY(phys_base) | 430 | ENTRY(phys_base) |
407 | /* This must match the first entry in level2_kernel_pgt */ | 431 | /* This must match the first entry in level2_kernel_pgt */ |
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c index 9b0c480c383b..9578d33f20a0 100644 --- a/arch/x86/kernel/io_apic.c +++ b/arch/x86/kernel/io_apic.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Intel IO-APIC support for multi-Pentium hosts. | 2 | * Intel IO-APIC support for multi-Pentium hosts. |
3 | * | 3 | * |
4 | * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar, Hajnalka Szabo | 4 | * Copyright (C) 1997, 1998, 1999, 2000, 2009 Ingo Molnar, Hajnalka Szabo |
5 | * | 5 | * |
6 | * Many thanks to Stig Venaas for trying out countless experimental | 6 | * Many thanks to Stig Venaas for trying out countless experimental |
7 | * patches and reporting/debugging problems patiently! | 7 | * patches and reporting/debugging problems patiently! |
@@ -46,6 +46,7 @@ | |||
46 | #include <asm/idle.h> | 46 | #include <asm/idle.h> |
47 | #include <asm/io.h> | 47 | #include <asm/io.h> |
48 | #include <asm/smp.h> | 48 | #include <asm/smp.h> |
49 | #include <asm/cpu.h> | ||
49 | #include <asm/desc.h> | 50 | #include <asm/desc.h> |
50 | #include <asm/proto.h> | 51 | #include <asm/proto.h> |
51 | #include <asm/acpi.h> | 52 | #include <asm/acpi.h> |
@@ -61,9 +62,7 @@ | |||
61 | #include <asm/uv/uv_hub.h> | 62 | #include <asm/uv/uv_hub.h> |
62 | #include <asm/uv/uv_irq.h> | 63 | #include <asm/uv/uv_irq.h> |
63 | 64 | ||
64 | #include <mach_ipi.h> | 65 | #include <asm/genapic.h> |
65 | #include <mach_apic.h> | ||
66 | #include <mach_apicdef.h> | ||
67 | 66 | ||
68 | #define __apicdebuginit(type) static type __init | 67 | #define __apicdebuginit(type) static type __init |
69 | 68 | ||
@@ -82,11 +81,11 @@ static DEFINE_SPINLOCK(vector_lock); | |||
82 | int nr_ioapic_registers[MAX_IO_APICS]; | 81 | int nr_ioapic_registers[MAX_IO_APICS]; |
83 | 82 | ||
84 | /* I/O APIC entries */ | 83 | /* I/O APIC entries */ |
85 | struct mp_config_ioapic mp_ioapics[MAX_IO_APICS]; | 84 | struct mpc_ioapic mp_ioapics[MAX_IO_APICS]; |
86 | int nr_ioapics; | 85 | int nr_ioapics; |
87 | 86 | ||
88 | /* MP IRQ source entries */ | 87 | /* MP IRQ source entries */ |
89 | struct mp_config_intsrc mp_irqs[MAX_IRQ_SOURCES]; | 88 | struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES]; |
90 | 89 | ||
91 | /* # of MP IRQ source entries */ | 90 | /* # of MP IRQ source entries */ |
92 | int mp_irq_entries; | 91 | int mp_irq_entries; |
@@ -99,10 +98,19 @@ DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); | |||
99 | 98 | ||
100 | int skip_ioapic_setup; | 99 | int skip_ioapic_setup; |
101 | 100 | ||
101 | void arch_disable_smp_support(void) | ||
102 | { | ||
103 | #ifdef CONFIG_PCI | ||
104 | noioapicquirk = 1; | ||
105 | noioapicreroute = -1; | ||
106 | #endif | ||
107 | skip_ioapic_setup = 1; | ||
108 | } | ||
109 | |||
102 | static int __init parse_noapic(char *str) | 110 | static int __init parse_noapic(char *str) |
103 | { | 111 | { |
104 | /* disable IO-APIC */ | 112 | /* disable IO-APIC */ |
105 | disable_ioapic_setup(); | 113 | arch_disable_smp_support(); |
106 | return 0; | 114 | return 0; |
107 | } | 115 | } |
108 | early_param("noapic", parse_noapic); | 116 | early_param("noapic", parse_noapic); |
@@ -356,7 +364,7 @@ set_extra_move_desc(struct irq_desc *desc, const struct cpumask *mask) | |||
356 | 364 | ||
357 | if (!cfg->move_in_progress) { | 365 | if (!cfg->move_in_progress) { |
358 | /* it means that domain is not changed */ | 366 | /* it means that domain is not changed */ |
359 | if (!cpumask_intersects(&desc->affinity, mask)) | 367 | if (!cpumask_intersects(desc->affinity, mask)) |
360 | cfg->move_desc_pending = 1; | 368 | cfg->move_desc_pending = 1; |
361 | } | 369 | } |
362 | } | 370 | } |
@@ -386,7 +394,7 @@ struct io_apic { | |||
386 | static __attribute_const__ struct io_apic __iomem *io_apic_base(int idx) | 394 | static __attribute_const__ struct io_apic __iomem *io_apic_base(int idx) |
387 | { | 395 | { |
388 | return (void __iomem *) __fix_to_virt(FIX_IO_APIC_BASE_0 + idx) | 396 | return (void __iomem *) __fix_to_virt(FIX_IO_APIC_BASE_0 + idx) |
389 | + (mp_ioapics[idx].mp_apicaddr & ~PAGE_MASK); | 397 | + (mp_ioapics[idx].apicaddr & ~PAGE_MASK); |
390 | } | 398 | } |
391 | 399 | ||
392 | static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg) | 400 | static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg) |
@@ -513,11 +521,11 @@ static void send_cleanup_vector(struct irq_cfg *cfg) | |||
513 | for_each_cpu_and(i, cfg->old_domain, cpu_online_mask) | 521 | for_each_cpu_and(i, cfg->old_domain, cpu_online_mask) |
514 | cfg->move_cleanup_count++; | 522 | cfg->move_cleanup_count++; |
515 | for_each_cpu_and(i, cfg->old_domain, cpu_online_mask) | 523 | for_each_cpu_and(i, cfg->old_domain, cpu_online_mask) |
516 | send_IPI_mask(cpumask_of(i), IRQ_MOVE_CLEANUP_VECTOR); | 524 | apic->send_IPI_mask(cpumask_of(i), IRQ_MOVE_CLEANUP_VECTOR); |
517 | } else { | 525 | } else { |
518 | cpumask_and(cleanup_mask, cfg->old_domain, cpu_online_mask); | 526 | cpumask_and(cleanup_mask, cfg->old_domain, cpu_online_mask); |
519 | cfg->move_cleanup_count = cpumask_weight(cleanup_mask); | 527 | cfg->move_cleanup_count = cpumask_weight(cleanup_mask); |
520 | send_IPI_mask(cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR); | 528 | apic->send_IPI_mask(cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR); |
521 | free_cpumask_var(cleanup_mask); | 529 | free_cpumask_var(cleanup_mask); |
522 | } | 530 | } |
523 | cfg->move_in_progress = 0; | 531 | cfg->move_in_progress = 0; |
@@ -562,8 +570,9 @@ static int | |||
562 | assign_irq_vector(int irq, struct irq_cfg *cfg, const struct cpumask *mask); | 570 | assign_irq_vector(int irq, struct irq_cfg *cfg, const struct cpumask *mask); |
563 | 571 | ||
564 | /* | 572 | /* |
565 | * Either sets desc->affinity to a valid value, and returns cpu_mask_to_apicid | 573 | * Either sets desc->affinity to a valid value, and returns |
566 | * of that, or returns BAD_APICID and leaves desc->affinity untouched. | 574 | * ->cpu_mask_to_apicid of that, or returns BAD_APICID and |
575 | * leaves desc->affinity untouched. | ||
567 | */ | 576 | */ |
568 | static unsigned int | 577 | static unsigned int |
569 | set_desc_affinity(struct irq_desc *desc, const struct cpumask *mask) | 578 | set_desc_affinity(struct irq_desc *desc, const struct cpumask *mask) |
@@ -579,9 +588,10 @@ set_desc_affinity(struct irq_desc *desc, const struct cpumask *mask) | |||
579 | if (assign_irq_vector(irq, cfg, mask)) | 588 | if (assign_irq_vector(irq, cfg, mask)) |
580 | return BAD_APICID; | 589 | return BAD_APICID; |
581 | 590 | ||
582 | cpumask_and(&desc->affinity, cfg->domain, mask); | 591 | cpumask_and(desc->affinity, cfg->domain, mask); |
583 | set_extra_move_desc(desc, mask); | 592 | set_extra_move_desc(desc, mask); |
584 | return cpu_mask_to_apicid_and(&desc->affinity, cpu_online_mask); | 593 | |
594 | return apic->cpu_mask_to_apicid_and(desc->affinity, cpu_online_mask); | ||
585 | } | 595 | } |
586 | 596 | ||
587 | static void | 597 | static void |
@@ -796,23 +806,6 @@ static void clear_IO_APIC (void) | |||
796 | clear_IO_APIC_pin(apic, pin); | 806 | clear_IO_APIC_pin(apic, pin); |
797 | } | 807 | } |
798 | 808 | ||
799 | #if !defined(CONFIG_SMP) && defined(CONFIG_X86_32) | ||
800 | void send_IPI_self(int vector) | ||
801 | { | ||
802 | unsigned int cfg; | ||
803 | |||
804 | /* | ||
805 | * Wait for idle. | ||
806 | */ | ||
807 | apic_wait_icr_idle(); | ||
808 | cfg = APIC_DM_FIXED | APIC_DEST_SELF | vector | APIC_DEST_LOGICAL; | ||
809 | /* | ||
810 | * Send the IPI. The write to APIC_ICR fires this off. | ||
811 | */ | ||
812 | apic_write(APIC_ICR, cfg); | ||
813 | } | ||
814 | #endif /* !CONFIG_SMP && CONFIG_X86_32*/ | ||
815 | |||
816 | #ifdef CONFIG_X86_32 | 809 | #ifdef CONFIG_X86_32 |
817 | /* | 810 | /* |
818 | * support for broken MP BIOSs, enables hand-redirection of PIRQ0-7 to | 811 | * support for broken MP BIOSs, enables hand-redirection of PIRQ0-7 to |
@@ -944,10 +937,10 @@ static int find_irq_entry(int apic, int pin, int type) | |||
944 | int i; | 937 | int i; |
945 | 938 | ||
946 | for (i = 0; i < mp_irq_entries; i++) | 939 | for (i = 0; i < mp_irq_entries; i++) |
947 | if (mp_irqs[i].mp_irqtype == type && | 940 | if (mp_irqs[i].irqtype == type && |
948 | (mp_irqs[i].mp_dstapic == mp_ioapics[apic].mp_apicid || | 941 | (mp_irqs[i].dstapic == mp_ioapics[apic].apicid || |
949 | mp_irqs[i].mp_dstapic == MP_APIC_ALL) && | 942 | mp_irqs[i].dstapic == MP_APIC_ALL) && |
950 | mp_irqs[i].mp_dstirq == pin) | 943 | mp_irqs[i].dstirq == pin) |
951 | return i; | 944 | return i; |
952 | 945 | ||
953 | return -1; | 946 | return -1; |
@@ -961,13 +954,13 @@ static int __init find_isa_irq_pin(int irq, int type) | |||
961 | int i; | 954 | int i; |
962 | 955 | ||
963 | for (i = 0; i < mp_irq_entries; i++) { | 956 | for (i = 0; i < mp_irq_entries; i++) { |
964 | int lbus = mp_irqs[i].mp_srcbus; | 957 | int lbus = mp_irqs[i].srcbus; |
965 | 958 | ||
966 | if (test_bit(lbus, mp_bus_not_pci) && | 959 | if (test_bit(lbus, mp_bus_not_pci) && |
967 | (mp_irqs[i].mp_irqtype == type) && | 960 | (mp_irqs[i].irqtype == type) && |
968 | (mp_irqs[i].mp_srcbusirq == irq)) | 961 | (mp_irqs[i].srcbusirq == irq)) |
969 | 962 | ||
970 | return mp_irqs[i].mp_dstirq; | 963 | return mp_irqs[i].dstirq; |
971 | } | 964 | } |
972 | return -1; | 965 | return -1; |
973 | } | 966 | } |
@@ -977,17 +970,17 @@ static int __init find_isa_irq_apic(int irq, int type) | |||
977 | int i; | 970 | int i; |
978 | 971 | ||
979 | for (i = 0; i < mp_irq_entries; i++) { | 972 | for (i = 0; i < mp_irq_entries; i++) { |
980 | int lbus = mp_irqs[i].mp_srcbus; | 973 | int lbus = mp_irqs[i].srcbus; |
981 | 974 | ||
982 | if (test_bit(lbus, mp_bus_not_pci) && | 975 | if (test_bit(lbus, mp_bus_not_pci) && |
983 | (mp_irqs[i].mp_irqtype == type) && | 976 | (mp_irqs[i].irqtype == type) && |
984 | (mp_irqs[i].mp_srcbusirq == irq)) | 977 | (mp_irqs[i].srcbusirq == irq)) |
985 | break; | 978 | break; |
986 | } | 979 | } |
987 | if (i < mp_irq_entries) { | 980 | if (i < mp_irq_entries) { |
988 | int apic; | 981 | int apic; |
989 | for(apic = 0; apic < nr_ioapics; apic++) { | 982 | for(apic = 0; apic < nr_ioapics; apic++) { |
990 | if (mp_ioapics[apic].mp_apicid == mp_irqs[i].mp_dstapic) | 983 | if (mp_ioapics[apic].apicid == mp_irqs[i].dstapic) |
991 | return apic; | 984 | return apic; |
992 | } | 985 | } |
993 | } | 986 | } |
@@ -1012,23 +1005,23 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin) | |||
1012 | return -1; | 1005 | return -1; |
1013 | } | 1006 | } |
1014 | for (i = 0; i < mp_irq_entries; i++) { | 1007 | for (i = 0; i < mp_irq_entries; i++) { |
1015 | int lbus = mp_irqs[i].mp_srcbus; | 1008 | int lbus = mp_irqs[i].srcbus; |
1016 | 1009 | ||
1017 | for (apic = 0; apic < nr_ioapics; apic++) | 1010 | for (apic = 0; apic < nr_ioapics; apic++) |
1018 | if (mp_ioapics[apic].mp_apicid == mp_irqs[i].mp_dstapic || | 1011 | if (mp_ioapics[apic].apicid == mp_irqs[i].dstapic || |
1019 | mp_irqs[i].mp_dstapic == MP_APIC_ALL) | 1012 | mp_irqs[i].dstapic == MP_APIC_ALL) |
1020 | break; | 1013 | break; |
1021 | 1014 | ||
1022 | if (!test_bit(lbus, mp_bus_not_pci) && | 1015 | if (!test_bit(lbus, mp_bus_not_pci) && |
1023 | !mp_irqs[i].mp_irqtype && | 1016 | !mp_irqs[i].irqtype && |
1024 | (bus == lbus) && | 1017 | (bus == lbus) && |
1025 | (slot == ((mp_irqs[i].mp_srcbusirq >> 2) & 0x1f))) { | 1018 | (slot == ((mp_irqs[i].srcbusirq >> 2) & 0x1f))) { |
1026 | int irq = pin_2_irq(i,apic,mp_irqs[i].mp_dstirq); | 1019 | int irq = pin_2_irq(i, apic, mp_irqs[i].dstirq); |
1027 | 1020 | ||
1028 | if (!(apic || IO_APIC_IRQ(irq))) | 1021 | if (!(apic || IO_APIC_IRQ(irq))) |
1029 | continue; | 1022 | continue; |
1030 | 1023 | ||
1031 | if (pin == (mp_irqs[i].mp_srcbusirq & 3)) | 1024 | if (pin == (mp_irqs[i].srcbusirq & 3)) |
1032 | return irq; | 1025 | return irq; |
1033 | /* | 1026 | /* |
1034 | * Use the first all-but-pin matching entry as a | 1027 | * Use the first all-but-pin matching entry as a |
@@ -1071,7 +1064,7 @@ static int EISA_ELCR(unsigned int irq) | |||
1071 | * EISA conforming in the MP table, that means its trigger type must | 1064 | * EISA conforming in the MP table, that means its trigger type must |
1072 | * be read in from the ELCR */ | 1065 | * be read in from the ELCR */ |
1073 | 1066 | ||
1074 | #define default_EISA_trigger(idx) (EISA_ELCR(mp_irqs[idx].mp_srcbusirq)) | 1067 | #define default_EISA_trigger(idx) (EISA_ELCR(mp_irqs[idx].srcbusirq)) |
1075 | #define default_EISA_polarity(idx) default_ISA_polarity(idx) | 1068 | #define default_EISA_polarity(idx) default_ISA_polarity(idx) |
1076 | 1069 | ||
1077 | /* PCI interrupts are always polarity one level triggered, | 1070 | /* PCI interrupts are always polarity one level triggered, |
@@ -1088,13 +1081,13 @@ static int EISA_ELCR(unsigned int irq) | |||
1088 | 1081 | ||
1089 | static int MPBIOS_polarity(int idx) | 1082 | static int MPBIOS_polarity(int idx) |
1090 | { | 1083 | { |
1091 | int bus = mp_irqs[idx].mp_srcbus; | 1084 | int bus = mp_irqs[idx].srcbus; |
1092 | int polarity; | 1085 | int polarity; |
1093 | 1086 | ||
1094 | /* | 1087 | /* |
1095 | * Determine IRQ line polarity (high active or low active): | 1088 | * Determine IRQ line polarity (high active or low active): |
1096 | */ | 1089 | */ |
1097 | switch (mp_irqs[idx].mp_irqflag & 3) | 1090 | switch (mp_irqs[idx].irqflag & 3) |
1098 | { | 1091 | { |
1099 | case 0: /* conforms, ie. bus-type dependent polarity */ | 1092 | case 0: /* conforms, ie. bus-type dependent polarity */ |
1100 | if (test_bit(bus, mp_bus_not_pci)) | 1093 | if (test_bit(bus, mp_bus_not_pci)) |
@@ -1130,13 +1123,13 @@ static int MPBIOS_polarity(int idx) | |||
1130 | 1123 | ||
1131 | static int MPBIOS_trigger(int idx) | 1124 | static int MPBIOS_trigger(int idx) |
1132 | { | 1125 | { |
1133 | int bus = mp_irqs[idx].mp_srcbus; | 1126 | int bus = mp_irqs[idx].srcbus; |
1134 | int trigger; | 1127 | int trigger; |
1135 | 1128 | ||
1136 | /* | 1129 | /* |
1137 | * Determine IRQ trigger mode (edge or level sensitive): | 1130 | * Determine IRQ trigger mode (edge or level sensitive): |
1138 | */ | 1131 | */ |
1139 | switch ((mp_irqs[idx].mp_irqflag>>2) & 3) | 1132 | switch ((mp_irqs[idx].irqflag>>2) & 3) |
1140 | { | 1133 | { |
1141 | case 0: /* conforms, ie. bus-type dependent */ | 1134 | case 0: /* conforms, ie. bus-type dependent */ |
1142 | if (test_bit(bus, mp_bus_not_pci)) | 1135 | if (test_bit(bus, mp_bus_not_pci)) |
@@ -1214,16 +1207,16 @@ int (*ioapic_renumber_irq)(int ioapic, int irq); | |||
1214 | static int pin_2_irq(int idx, int apic, int pin) | 1207 | static int pin_2_irq(int idx, int apic, int pin) |
1215 | { | 1208 | { |
1216 | int irq, i; | 1209 | int irq, i; |
1217 | int bus = mp_irqs[idx].mp_srcbus; | 1210 | int bus = mp_irqs[idx].srcbus; |
1218 | 1211 | ||
1219 | /* | 1212 | /* |
1220 | * Debugging check, we are in big trouble if this message pops up! | 1213 | * Debugging check, we are in big trouble if this message pops up! |
1221 | */ | 1214 | */ |
1222 | if (mp_irqs[idx].mp_dstirq != pin) | 1215 | if (mp_irqs[idx].dstirq != pin) |
1223 | printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n"); | 1216 | printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n"); |
1224 | 1217 | ||
1225 | if (test_bit(bus, mp_bus_not_pci)) { | 1218 | if (test_bit(bus, mp_bus_not_pci)) { |
1226 | irq = mp_irqs[idx].mp_srcbusirq; | 1219 | irq = mp_irqs[idx].srcbusirq; |
1227 | } else { | 1220 | } else { |
1228 | /* | 1221 | /* |
1229 | * PCI IRQs are mapped in order | 1222 | * PCI IRQs are mapped in order |
@@ -1315,7 +1308,7 @@ __assign_irq_vector(int irq, struct irq_cfg *cfg, const struct cpumask *mask) | |||
1315 | int new_cpu; | 1308 | int new_cpu; |
1316 | int vector, offset; | 1309 | int vector, offset; |
1317 | 1310 | ||
1318 | vector_allocation_domain(cpu, tmp_mask); | 1311 | apic->vector_allocation_domain(cpu, tmp_mask); |
1319 | 1312 | ||
1320 | vector = current_vector; | 1313 | vector = current_vector; |
1321 | offset = current_offset; | 1314 | offset = current_offset; |
@@ -1485,7 +1478,7 @@ static void ioapic_register_intr(int irq, struct irq_desc *desc, unsigned long t | |||
1485 | handle_edge_irq, "edge"); | 1478 | handle_edge_irq, "edge"); |
1486 | } | 1479 | } |
1487 | 1480 | ||
1488 | static int setup_ioapic_entry(int apic, int irq, | 1481 | static int setup_ioapic_entry(int apic_id, int irq, |
1489 | struct IO_APIC_route_entry *entry, | 1482 | struct IO_APIC_route_entry *entry, |
1490 | unsigned int destination, int trigger, | 1483 | unsigned int destination, int trigger, |
1491 | int polarity, int vector) | 1484 | int polarity, int vector) |
@@ -1497,25 +1490,25 @@ static int setup_ioapic_entry(int apic, int irq, | |||
1497 | 1490 | ||
1498 | #ifdef CONFIG_INTR_REMAP | 1491 | #ifdef CONFIG_INTR_REMAP |
1499 | if (intr_remapping_enabled) { | 1492 | if (intr_remapping_enabled) { |
1500 | struct intel_iommu *iommu = map_ioapic_to_ir(apic); | 1493 | struct intel_iommu *iommu = map_ioapic_to_ir(apic_id); |
1501 | struct irte irte; | 1494 | struct irte irte; |
1502 | struct IR_IO_APIC_route_entry *ir_entry = | 1495 | struct IR_IO_APIC_route_entry *ir_entry = |
1503 | (struct IR_IO_APIC_route_entry *) entry; | 1496 | (struct IR_IO_APIC_route_entry *) entry; |
1504 | int index; | 1497 | int index; |
1505 | 1498 | ||
1506 | if (!iommu) | 1499 | if (!iommu) |
1507 | panic("No mapping iommu for ioapic %d\n", apic); | 1500 | panic("No mapping iommu for ioapic %d\n", apic_id); |
1508 | 1501 | ||
1509 | index = alloc_irte(iommu, irq, 1); | 1502 | index = alloc_irte(iommu, irq, 1); |
1510 | if (index < 0) | 1503 | if (index < 0) |
1511 | panic("Failed to allocate IRTE for ioapic %d\n", apic); | 1504 | panic("Failed to allocate IRTE for ioapic %d\n", apic_id); |
1512 | 1505 | ||
1513 | memset(&irte, 0, sizeof(irte)); | 1506 | memset(&irte, 0, sizeof(irte)); |
1514 | 1507 | ||
1515 | irte.present = 1; | 1508 | irte.present = 1; |
1516 | irte.dst_mode = INT_DEST_MODE; | 1509 | irte.dst_mode = apic->irq_dest_mode; |
1517 | irte.trigger_mode = trigger; | 1510 | irte.trigger_mode = trigger; |
1518 | irte.dlvry_mode = INT_DELIVERY_MODE; | 1511 | irte.dlvry_mode = apic->irq_delivery_mode; |
1519 | irte.vector = vector; | 1512 | irte.vector = vector; |
1520 | irte.dest_id = IRTE_DEST(destination); | 1513 | irte.dest_id = IRTE_DEST(destination); |
1521 | 1514 | ||
@@ -1528,8 +1521,8 @@ static int setup_ioapic_entry(int apic, int irq, | |||
1528 | } else | 1521 | } else |
1529 | #endif | 1522 | #endif |
1530 | { | 1523 | { |
1531 | entry->delivery_mode = INT_DELIVERY_MODE; | 1524 | entry->delivery_mode = apic->irq_delivery_mode; |
1532 | entry->dest_mode = INT_DEST_MODE; | 1525 | entry->dest_mode = apic->irq_dest_mode; |
1533 | entry->dest = destination; | 1526 | entry->dest = destination; |
1534 | } | 1527 | } |
1535 | 1528 | ||
@@ -1546,7 +1539,7 @@ static int setup_ioapic_entry(int apic, int irq, | |||
1546 | return 0; | 1539 | return 0; |
1547 | } | 1540 | } |
1548 | 1541 | ||
1549 | static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq, struct irq_desc *desc, | 1542 | static void setup_IO_APIC_irq(int apic_id, int pin, unsigned int irq, struct irq_desc *desc, |
1550 | int trigger, int polarity) | 1543 | int trigger, int polarity) |
1551 | { | 1544 | { |
1552 | struct irq_cfg *cfg; | 1545 | struct irq_cfg *cfg; |
@@ -1558,22 +1551,22 @@ static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq, struct irq_de | |||
1558 | 1551 | ||
1559 | cfg = desc->chip_data; | 1552 | cfg = desc->chip_data; |
1560 | 1553 | ||
1561 | if (assign_irq_vector(irq, cfg, TARGET_CPUS)) | 1554 | if (assign_irq_vector(irq, cfg, apic->target_cpus())) |
1562 | return; | 1555 | return; |
1563 | 1556 | ||
1564 | dest = cpu_mask_to_apicid_and(cfg->domain, TARGET_CPUS); | 1557 | dest = apic->cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus()); |
1565 | 1558 | ||
1566 | apic_printk(APIC_VERBOSE,KERN_DEBUG | 1559 | apic_printk(APIC_VERBOSE,KERN_DEBUG |
1567 | "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> " | 1560 | "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> " |
1568 | "IRQ %d Mode:%i Active:%i)\n", | 1561 | "IRQ %d Mode:%i Active:%i)\n", |
1569 | apic, mp_ioapics[apic].mp_apicid, pin, cfg->vector, | 1562 | apic_id, mp_ioapics[apic_id].apicid, pin, cfg->vector, |
1570 | irq, trigger, polarity); | 1563 | irq, trigger, polarity); |
1571 | 1564 | ||
1572 | 1565 | ||
1573 | if (setup_ioapic_entry(mp_ioapics[apic].mp_apicid, irq, &entry, | 1566 | if (setup_ioapic_entry(mp_ioapics[apic_id].apicid, irq, &entry, |
1574 | dest, trigger, polarity, cfg->vector)) { | 1567 | dest, trigger, polarity, cfg->vector)) { |
1575 | printk("Failed to setup ioapic entry for ioapic %d, pin %d\n", | 1568 | printk("Failed to setup ioapic entry for ioapic %d, pin %d\n", |
1576 | mp_ioapics[apic].mp_apicid, pin); | 1569 | mp_ioapics[apic_id].apicid, pin); |
1577 | __clear_irq_vector(irq, cfg); | 1570 | __clear_irq_vector(irq, cfg); |
1578 | return; | 1571 | return; |
1579 | } | 1572 | } |
@@ -1582,12 +1575,12 @@ static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq, struct irq_de | |||
1582 | if (irq < NR_IRQS_LEGACY) | 1575 | if (irq < NR_IRQS_LEGACY) |
1583 | disable_8259A_irq(irq); | 1576 | disable_8259A_irq(irq); |
1584 | 1577 | ||
1585 | ioapic_write_entry(apic, pin, entry); | 1578 | ioapic_write_entry(apic_id, pin, entry); |
1586 | } | 1579 | } |
1587 | 1580 | ||
1588 | static void __init setup_IO_APIC_irqs(void) | 1581 | static void __init setup_IO_APIC_irqs(void) |
1589 | { | 1582 | { |
1590 | int apic, pin, idx, irq; | 1583 | int apic_id, pin, idx, irq; |
1591 | int notcon = 0; | 1584 | int notcon = 0; |
1592 | struct irq_desc *desc; | 1585 | struct irq_desc *desc; |
1593 | struct irq_cfg *cfg; | 1586 | struct irq_cfg *cfg; |
@@ -1595,21 +1588,19 @@ static void __init setup_IO_APIC_irqs(void) | |||
1595 | 1588 | ||
1596 | apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n"); | 1589 | apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n"); |
1597 | 1590 | ||
1598 | for (apic = 0; apic < nr_ioapics; apic++) { | 1591 | for (apic_id = 0; apic_id < nr_ioapics; apic_id++) { |
1599 | for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) { | 1592 | for (pin = 0; pin < nr_ioapic_registers[apic_id]; pin++) { |
1600 | 1593 | ||
1601 | idx = find_irq_entry(apic, pin, mp_INT); | 1594 | idx = find_irq_entry(apic_id, pin, mp_INT); |
1602 | if (idx == -1) { | 1595 | if (idx == -1) { |
1603 | if (!notcon) { | 1596 | if (!notcon) { |
1604 | notcon = 1; | 1597 | notcon = 1; |
1605 | apic_printk(APIC_VERBOSE, | 1598 | apic_printk(APIC_VERBOSE, |
1606 | KERN_DEBUG " %d-%d", | 1599 | KERN_DEBUG " %d-%d", |
1607 | mp_ioapics[apic].mp_apicid, | 1600 | mp_ioapics[apic_id].apicid, pin); |
1608 | pin); | ||
1609 | } else | 1601 | } else |
1610 | apic_printk(APIC_VERBOSE, " %d-%d", | 1602 | apic_printk(APIC_VERBOSE, " %d-%d", |
1611 | mp_ioapics[apic].mp_apicid, | 1603 | mp_ioapics[apic_id].apicid, pin); |
1612 | pin); | ||
1613 | continue; | 1604 | continue; |
1614 | } | 1605 | } |
1615 | if (notcon) { | 1606 | if (notcon) { |
@@ -1618,20 +1609,25 @@ static void __init setup_IO_APIC_irqs(void) | |||
1618 | notcon = 0; | 1609 | notcon = 0; |
1619 | } | 1610 | } |
1620 | 1611 | ||
1621 | irq = pin_2_irq(idx, apic, pin); | 1612 | irq = pin_2_irq(idx, apic_id, pin); |
1622 | #ifdef CONFIG_X86_32 | 1613 | |
1623 | if (multi_timer_check(apic, irq)) | 1614 | /* |
1615 | * Skip the timer IRQ if there's a quirk handler | ||
1616 | * installed and if it returns 1: | ||
1617 | */ | ||
1618 | if (apic->multi_timer_check && | ||
1619 | apic->multi_timer_check(apic_id, irq)) | ||
1624 | continue; | 1620 | continue; |
1625 | #endif | 1621 | |
1626 | desc = irq_to_desc_alloc_cpu(irq, cpu); | 1622 | desc = irq_to_desc_alloc_cpu(irq, cpu); |
1627 | if (!desc) { | 1623 | if (!desc) { |
1628 | printk(KERN_INFO "can not get irq_desc for %d\n", irq); | 1624 | printk(KERN_INFO "can not get irq_desc for %d\n", irq); |
1629 | continue; | 1625 | continue; |
1630 | } | 1626 | } |
1631 | cfg = desc->chip_data; | 1627 | cfg = desc->chip_data; |
1632 | add_pin_to_irq_cpu(cfg, cpu, apic, pin); | 1628 | add_pin_to_irq_cpu(cfg, cpu, apic_id, pin); |
1633 | 1629 | ||
1634 | setup_IO_APIC_irq(apic, pin, irq, desc, | 1630 | setup_IO_APIC_irq(apic_id, pin, irq, desc, |
1635 | irq_trigger(idx), irq_polarity(idx)); | 1631 | irq_trigger(idx), irq_polarity(idx)); |
1636 | } | 1632 | } |
1637 | } | 1633 | } |
@@ -1644,7 +1640,7 @@ static void __init setup_IO_APIC_irqs(void) | |||
1644 | /* | 1640 | /* |
1645 | * Set up the timer pin, possibly with the 8259A-master behind. | 1641 | * Set up the timer pin, possibly with the 8259A-master behind. |
1646 | */ | 1642 | */ |
1647 | static void __init setup_timer_IRQ0_pin(unsigned int apic, unsigned int pin, | 1643 | static void __init setup_timer_IRQ0_pin(unsigned int apic_id, unsigned int pin, |
1648 | int vector) | 1644 | int vector) |
1649 | { | 1645 | { |
1650 | struct IO_APIC_route_entry entry; | 1646 | struct IO_APIC_route_entry entry; |
@@ -1660,10 +1656,10 @@ static void __init setup_timer_IRQ0_pin(unsigned int apic, unsigned int pin, | |||
1660 | * We use logical delivery to get the timer IRQ | 1656 | * We use logical delivery to get the timer IRQ |
1661 | * to the first CPU. | 1657 | * to the first CPU. |
1662 | */ | 1658 | */ |
1663 | entry.dest_mode = INT_DEST_MODE; | 1659 | entry.dest_mode = apic->irq_dest_mode; |
1664 | entry.mask = 1; /* mask IRQ now */ | 1660 | entry.mask = 1; /* mask IRQ now */ |
1665 | entry.dest = cpu_mask_to_apicid(TARGET_CPUS); | 1661 | entry.dest = apic->cpu_mask_to_apicid(apic->target_cpus()); |
1666 | entry.delivery_mode = INT_DELIVERY_MODE; | 1662 | entry.delivery_mode = apic->irq_delivery_mode; |
1667 | entry.polarity = 0; | 1663 | entry.polarity = 0; |
1668 | entry.trigger = 0; | 1664 | entry.trigger = 0; |
1669 | entry.vector = vector; | 1665 | entry.vector = vector; |
@@ -1677,7 +1673,7 @@ static void __init setup_timer_IRQ0_pin(unsigned int apic, unsigned int pin, | |||
1677 | /* | 1673 | /* |
1678 | * Add it to the IO-APIC irq-routing table: | 1674 | * Add it to the IO-APIC irq-routing table: |
1679 | */ | 1675 | */ |
1680 | ioapic_write_entry(apic, pin, entry); | 1676 | ioapic_write_entry(apic_id, pin, entry); |
1681 | } | 1677 | } |
1682 | 1678 | ||
1683 | 1679 | ||
@@ -1699,7 +1695,7 @@ __apicdebuginit(void) print_IO_APIC(void) | |||
1699 | printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); | 1695 | printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); |
1700 | for (i = 0; i < nr_ioapics; i++) | 1696 | for (i = 0; i < nr_ioapics; i++) |
1701 | printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n", | 1697 | printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n", |
1702 | mp_ioapics[i].mp_apicid, nr_ioapic_registers[i]); | 1698 | mp_ioapics[i].apicid, nr_ioapic_registers[i]); |
1703 | 1699 | ||
1704 | /* | 1700 | /* |
1705 | * We are a bit conservative about what we expect. We have to | 1701 | * We are a bit conservative about what we expect. We have to |
@@ -1719,7 +1715,7 @@ __apicdebuginit(void) print_IO_APIC(void) | |||
1719 | spin_unlock_irqrestore(&ioapic_lock, flags); | 1715 | spin_unlock_irqrestore(&ioapic_lock, flags); |
1720 | 1716 | ||
1721 | printk("\n"); | 1717 | printk("\n"); |
1722 | printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].mp_apicid); | 1718 | printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].apicid); |
1723 | printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw); | 1719 | printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw); |
1724 | printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID); | 1720 | printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID); |
1725 | printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.delivery_type); | 1721 | printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.delivery_type); |
@@ -2090,7 +2086,7 @@ static void __init setup_ioapic_ids_from_mpc(void) | |||
2090 | { | 2086 | { |
2091 | union IO_APIC_reg_00 reg_00; | 2087 | union IO_APIC_reg_00 reg_00; |
2092 | physid_mask_t phys_id_present_map; | 2088 | physid_mask_t phys_id_present_map; |
2093 | int apic; | 2089 | int apic_id; |
2094 | int i; | 2090 | int i; |
2095 | unsigned char old_id; | 2091 | unsigned char old_id; |
2096 | unsigned long flags; | 2092 | unsigned long flags; |
@@ -2109,26 +2105,26 @@ static void __init setup_ioapic_ids_from_mpc(void) | |||
2109 | * This is broken; anything with a real cpu count has to | 2105 | * This is broken; anything with a real cpu count has to |
2110 | * circumvent this idiocy regardless. | 2106 | * circumvent this idiocy regardless. |
2111 | */ | 2107 | */ |
2112 | phys_id_present_map = ioapic_phys_id_map(phys_cpu_present_map); | 2108 | phys_id_present_map = apic->ioapic_phys_id_map(phys_cpu_present_map); |
2113 | 2109 | ||
2114 | /* | 2110 | /* |
2115 | * Set the IOAPIC ID to the value stored in the MPC table. | 2111 | * Set the IOAPIC ID to the value stored in the MPC table. |
2116 | */ | 2112 | */ |
2117 | for (apic = 0; apic < nr_ioapics; apic++) { | 2113 | for (apic_id = 0; apic_id < nr_ioapics; apic_id++) { |
2118 | 2114 | ||
2119 | /* Read the register 0 value */ | 2115 | /* Read the register 0 value */ |
2120 | spin_lock_irqsave(&ioapic_lock, flags); | 2116 | spin_lock_irqsave(&ioapic_lock, flags); |
2121 | reg_00.raw = io_apic_read(apic, 0); | 2117 | reg_00.raw = io_apic_read(apic_id, 0); |
2122 | spin_unlock_irqrestore(&ioapic_lock, flags); | 2118 | spin_unlock_irqrestore(&ioapic_lock, flags); |
2123 | 2119 | ||
2124 | old_id = mp_ioapics[apic].mp_apicid; | 2120 | old_id = mp_ioapics[apic_id].apicid; |
2125 | 2121 | ||
2126 | if (mp_ioapics[apic].mp_apicid >= get_physical_broadcast()) { | 2122 | if (mp_ioapics[apic_id].apicid >= get_physical_broadcast()) { |
2127 | printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", | 2123 | printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", |
2128 | apic, mp_ioapics[apic].mp_apicid); | 2124 | apic_id, mp_ioapics[apic_id].apicid); |
2129 | printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", | 2125 | printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", |
2130 | reg_00.bits.ID); | 2126 | reg_00.bits.ID); |
2131 | mp_ioapics[apic].mp_apicid = reg_00.bits.ID; | 2127 | mp_ioapics[apic_id].apicid = reg_00.bits.ID; |
2132 | } | 2128 | } |
2133 | 2129 | ||
2134 | /* | 2130 | /* |
@@ -2136,10 +2132,10 @@ static void __init setup_ioapic_ids_from_mpc(void) | |||
2136 | * system must have a unique ID or we get lots of nice | 2132 | * system must have a unique ID or we get lots of nice |
2137 | * 'stuck on smp_invalidate_needed IPI wait' messages. | 2133 | * 'stuck on smp_invalidate_needed IPI wait' messages. |
2138 | */ | 2134 | */ |
2139 | if (check_apicid_used(phys_id_present_map, | 2135 | if (apic->check_apicid_used(phys_id_present_map, |
2140 | mp_ioapics[apic].mp_apicid)) { | 2136 | mp_ioapics[apic_id].apicid)) { |
2141 | printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n", | 2137 | printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n", |
2142 | apic, mp_ioapics[apic].mp_apicid); | 2138 | apic_id, mp_ioapics[apic_id].apicid); |
2143 | for (i = 0; i < get_physical_broadcast(); i++) | 2139 | for (i = 0; i < get_physical_broadcast(); i++) |
2144 | if (!physid_isset(i, phys_id_present_map)) | 2140 | if (!physid_isset(i, phys_id_present_map)) |
2145 | break; | 2141 | break; |
@@ -2148,13 +2144,13 @@ static void __init setup_ioapic_ids_from_mpc(void) | |||
2148 | printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", | 2144 | printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", |
2149 | i); | 2145 | i); |
2150 | physid_set(i, phys_id_present_map); | 2146 | physid_set(i, phys_id_present_map); |
2151 | mp_ioapics[apic].mp_apicid = i; | 2147 | mp_ioapics[apic_id].apicid = i; |
2152 | } else { | 2148 | } else { |
2153 | physid_mask_t tmp; | 2149 | physid_mask_t tmp; |
2154 | tmp = apicid_to_cpu_present(mp_ioapics[apic].mp_apicid); | 2150 | tmp = apic->apicid_to_cpu_present(mp_ioapics[apic_id].apicid); |
2155 | apic_printk(APIC_VERBOSE, "Setting %d in the " | 2151 | apic_printk(APIC_VERBOSE, "Setting %d in the " |
2156 | "phys_id_present_map\n", | 2152 | "phys_id_present_map\n", |
2157 | mp_ioapics[apic].mp_apicid); | 2153 | mp_ioapics[apic_id].apicid); |
2158 | physids_or(phys_id_present_map, phys_id_present_map, tmp); | 2154 | physids_or(phys_id_present_map, phys_id_present_map, tmp); |
2159 | } | 2155 | } |
2160 | 2156 | ||
@@ -2163,11 +2159,11 @@ static void __init setup_ioapic_ids_from_mpc(void) | |||
2163 | * We need to adjust the IRQ routing table | 2159 | * We need to adjust the IRQ routing table |
2164 | * if the ID changed. | 2160 | * if the ID changed. |
2165 | */ | 2161 | */ |
2166 | if (old_id != mp_ioapics[apic].mp_apicid) | 2162 | if (old_id != mp_ioapics[apic_id].apicid) |
2167 | for (i = 0; i < mp_irq_entries; i++) | 2163 | for (i = 0; i < mp_irq_entries; i++) |
2168 | if (mp_irqs[i].mp_dstapic == old_id) | 2164 | if (mp_irqs[i].dstapic == old_id) |
2169 | mp_irqs[i].mp_dstapic | 2165 | mp_irqs[i].dstapic |
2170 | = mp_ioapics[apic].mp_apicid; | 2166 | = mp_ioapics[apic_id].apicid; |
2171 | 2167 | ||
2172 | /* | 2168 | /* |
2173 | * Read the right value from the MPC table and | 2169 | * Read the right value from the MPC table and |
@@ -2175,20 +2171,20 @@ static void __init setup_ioapic_ids_from_mpc(void) | |||
2175 | */ | 2171 | */ |
2176 | apic_printk(APIC_VERBOSE, KERN_INFO | 2172 | apic_printk(APIC_VERBOSE, KERN_INFO |
2177 | "...changing IO-APIC physical APIC ID to %d ...", | 2173 | "...changing IO-APIC physical APIC ID to %d ...", |
2178 | mp_ioapics[apic].mp_apicid); | 2174 | mp_ioapics[apic_id].apicid); |
2179 | 2175 | ||
2180 | reg_00.bits.ID = mp_ioapics[apic].mp_apicid; | 2176 | reg_00.bits.ID = mp_ioapics[apic_id].apicid; |
2181 | spin_lock_irqsave(&ioapic_lock, flags); | 2177 | spin_lock_irqsave(&ioapic_lock, flags); |
2182 | io_apic_write(apic, 0, reg_00.raw); | 2178 | io_apic_write(apic_id, 0, reg_00.raw); |
2183 | spin_unlock_irqrestore(&ioapic_lock, flags); | 2179 | spin_unlock_irqrestore(&ioapic_lock, flags); |
2184 | 2180 | ||
2185 | /* | 2181 | /* |
2186 | * Sanity check | 2182 | * Sanity check |
2187 | */ | 2183 | */ |
2188 | spin_lock_irqsave(&ioapic_lock, flags); | 2184 | spin_lock_irqsave(&ioapic_lock, flags); |
2189 | reg_00.raw = io_apic_read(apic, 0); | 2185 | reg_00.raw = io_apic_read(apic_id, 0); |
2190 | spin_unlock_irqrestore(&ioapic_lock, flags); | 2186 | spin_unlock_irqrestore(&ioapic_lock, flags); |
2191 | if (reg_00.bits.ID != mp_ioapics[apic].mp_apicid) | 2187 | if (reg_00.bits.ID != mp_ioapics[apic_id].apicid) |
2192 | printk("could not set ID!\n"); | 2188 | printk("could not set ID!\n"); |
2193 | else | 2189 | else |
2194 | apic_printk(APIC_VERBOSE, " ok.\n"); | 2190 | apic_printk(APIC_VERBOSE, " ok.\n"); |
@@ -2291,7 +2287,7 @@ static int ioapic_retrigger_irq(unsigned int irq) | |||
2291 | unsigned long flags; | 2287 | unsigned long flags; |
2292 | 2288 | ||
2293 | spin_lock_irqsave(&vector_lock, flags); | 2289 | spin_lock_irqsave(&vector_lock, flags); |
2294 | send_IPI_mask(cpumask_of(cpumask_first(cfg->domain)), cfg->vector); | 2290 | apic->send_IPI_mask(cpumask_of(cpumask_first(cfg->domain)), cfg->vector); |
2295 | spin_unlock_irqrestore(&vector_lock, flags); | 2291 | spin_unlock_irqrestore(&vector_lock, flags); |
2296 | 2292 | ||
2297 | return 1; | 2293 | return 1; |
@@ -2299,7 +2295,7 @@ static int ioapic_retrigger_irq(unsigned int irq) | |||
2299 | #else | 2295 | #else |
2300 | static int ioapic_retrigger_irq(unsigned int irq) | 2296 | static int ioapic_retrigger_irq(unsigned int irq) |
2301 | { | 2297 | { |
2302 | send_IPI_self(irq_cfg(irq)->vector); | 2298 | apic->send_IPI_self(irq_cfg(irq)->vector); |
2303 | 2299 | ||
2304 | return 1; | 2300 | return 1; |
2305 | } | 2301 | } |
@@ -2363,7 +2359,7 @@ migrate_ioapic_irq_desc(struct irq_desc *desc, const struct cpumask *mask) | |||
2363 | 2359 | ||
2364 | set_extra_move_desc(desc, mask); | 2360 | set_extra_move_desc(desc, mask); |
2365 | 2361 | ||
2366 | dest = cpu_mask_to_apicid_and(cfg->domain, mask); | 2362 | dest = apic->cpu_mask_to_apicid_and(cfg->domain, mask); |
2367 | 2363 | ||
2368 | modify_ioapic_rte = desc->status & IRQ_LEVEL; | 2364 | modify_ioapic_rte = desc->status & IRQ_LEVEL; |
2369 | if (modify_ioapic_rte) { | 2365 | if (modify_ioapic_rte) { |
@@ -2383,7 +2379,7 @@ migrate_ioapic_irq_desc(struct irq_desc *desc, const struct cpumask *mask) | |||
2383 | if (cfg->move_in_progress) | 2379 | if (cfg->move_in_progress) |
2384 | send_cleanup_vector(cfg); | 2380 | send_cleanup_vector(cfg); |
2385 | 2381 | ||
2386 | cpumask_copy(&desc->affinity, mask); | 2382 | cpumask_copy(desc->affinity, mask); |
2387 | } | 2383 | } |
2388 | 2384 | ||
2389 | static int migrate_irq_remapped_level_desc(struct irq_desc *desc) | 2385 | static int migrate_irq_remapped_level_desc(struct irq_desc *desc) |
@@ -2405,11 +2401,11 @@ static int migrate_irq_remapped_level_desc(struct irq_desc *desc) | |||
2405 | } | 2401 | } |
2406 | 2402 | ||
2407 | /* everthing is clear. we have right of way */ | 2403 | /* everthing is clear. we have right of way */ |
2408 | migrate_ioapic_irq_desc(desc, &desc->pending_mask); | 2404 | migrate_ioapic_irq_desc(desc, desc->pending_mask); |
2409 | 2405 | ||
2410 | ret = 0; | 2406 | ret = 0; |
2411 | desc->status &= ~IRQ_MOVE_PENDING; | 2407 | desc->status &= ~IRQ_MOVE_PENDING; |
2412 | cpumask_clear(&desc->pending_mask); | 2408 | cpumask_clear(desc->pending_mask); |
2413 | 2409 | ||
2414 | unmask: | 2410 | unmask: |
2415 | unmask_IO_APIC_irq_desc(desc); | 2411 | unmask_IO_APIC_irq_desc(desc); |
@@ -2434,7 +2430,7 @@ static void ir_irq_migration(struct work_struct *work) | |||
2434 | continue; | 2430 | continue; |
2435 | } | 2431 | } |
2436 | 2432 | ||
2437 | desc->chip->set_affinity(irq, &desc->pending_mask); | 2433 | desc->chip->set_affinity(irq, desc->pending_mask); |
2438 | spin_unlock_irqrestore(&desc->lock, flags); | 2434 | spin_unlock_irqrestore(&desc->lock, flags); |
2439 | } | 2435 | } |
2440 | } | 2436 | } |
@@ -2448,7 +2444,7 @@ static void set_ir_ioapic_affinity_irq_desc(struct irq_desc *desc, | |||
2448 | { | 2444 | { |
2449 | if (desc->status & IRQ_LEVEL) { | 2445 | if (desc->status & IRQ_LEVEL) { |
2450 | desc->status |= IRQ_MOVE_PENDING; | 2446 | desc->status |= IRQ_MOVE_PENDING; |
2451 | cpumask_copy(&desc->pending_mask, mask); | 2447 | cpumask_copy(desc->pending_mask, mask); |
2452 | migrate_irq_remapped_level_desc(desc); | 2448 | migrate_irq_remapped_level_desc(desc); |
2453 | return; | 2449 | return; |
2454 | } | 2450 | } |
@@ -2516,7 +2512,7 @@ static void irq_complete_move(struct irq_desc **descp) | |||
2516 | 2512 | ||
2517 | /* domain has not changed, but affinity did */ | 2513 | /* domain has not changed, but affinity did */ |
2518 | me = smp_processor_id(); | 2514 | me = smp_processor_id(); |
2519 | if (cpu_isset(me, desc->affinity)) { | 2515 | if (cpumask_test_cpu(me, desc->affinity)) { |
2520 | *descp = desc = move_irq_desc(desc, me); | 2516 | *descp = desc = move_irq_desc(desc, me); |
2521 | /* get the new one */ | 2517 | /* get the new one */ |
2522 | cfg = desc->chip_data; | 2518 | cfg = desc->chip_data; |
@@ -2879,7 +2875,7 @@ static inline void __init check_timer(void) | |||
2879 | * get/set the timer IRQ vector: | 2875 | * get/set the timer IRQ vector: |
2880 | */ | 2876 | */ |
2881 | disable_8259A_irq(0); | 2877 | disable_8259A_irq(0); |
2882 | assign_irq_vector(0, cfg, TARGET_CPUS); | 2878 | assign_irq_vector(0, cfg, apic->target_cpus()); |
2883 | 2879 | ||
2884 | /* | 2880 | /* |
2885 | * As IRQ0 is to be enabled in the 8259A, the virtual | 2881 | * As IRQ0 is to be enabled in the 8259A, the virtual |
@@ -3118,8 +3114,8 @@ static int ioapic_resume(struct sys_device *dev) | |||
3118 | 3114 | ||
3119 | spin_lock_irqsave(&ioapic_lock, flags); | 3115 | spin_lock_irqsave(&ioapic_lock, flags); |
3120 | reg_00.raw = io_apic_read(dev->id, 0); | 3116 | reg_00.raw = io_apic_read(dev->id, 0); |
3121 | if (reg_00.bits.ID != mp_ioapics[dev->id].mp_apicid) { | 3117 | if (reg_00.bits.ID != mp_ioapics[dev->id].apicid) { |
3122 | reg_00.bits.ID = mp_ioapics[dev->id].mp_apicid; | 3118 | reg_00.bits.ID = mp_ioapics[dev->id].apicid; |
3123 | io_apic_write(dev->id, 0, reg_00.raw); | 3119 | io_apic_write(dev->id, 0, reg_00.raw); |
3124 | } | 3120 | } |
3125 | spin_unlock_irqrestore(&ioapic_lock, flags); | 3121 | spin_unlock_irqrestore(&ioapic_lock, flags); |
@@ -3184,7 +3180,7 @@ unsigned int create_irq_nr(unsigned int irq_want) | |||
3184 | 3180 | ||
3185 | irq = 0; | 3181 | irq = 0; |
3186 | spin_lock_irqsave(&vector_lock, flags); | 3182 | spin_lock_irqsave(&vector_lock, flags); |
3187 | for (new = irq_want; new < NR_IRQS; new++) { | 3183 | for (new = irq_want; new < nr_irqs; new++) { |
3188 | if (platform_legacy_irq(new)) | 3184 | if (platform_legacy_irq(new)) |
3189 | continue; | 3185 | continue; |
3190 | 3186 | ||
@@ -3197,7 +3193,7 @@ unsigned int create_irq_nr(unsigned int irq_want) | |||
3197 | 3193 | ||
3198 | if (cfg_new->vector != 0) | 3194 | if (cfg_new->vector != 0) |
3199 | continue; | 3195 | continue; |
3200 | if (__assign_irq_vector(new, cfg_new, TARGET_CPUS) == 0) | 3196 | if (__assign_irq_vector(new, cfg_new, apic->target_cpus()) == 0) |
3201 | irq = new; | 3197 | irq = new; |
3202 | break; | 3198 | break; |
3203 | } | 3199 | } |
@@ -3259,12 +3255,15 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms | |||
3259 | int err; | 3255 | int err; |
3260 | unsigned dest; | 3256 | unsigned dest; |
3261 | 3257 | ||
3258 | if (disable_apic) | ||
3259 | return -ENXIO; | ||
3260 | |||
3262 | cfg = irq_cfg(irq); | 3261 | cfg = irq_cfg(irq); |
3263 | err = assign_irq_vector(irq, cfg, TARGET_CPUS); | 3262 | err = assign_irq_vector(irq, cfg, apic->target_cpus()); |
3264 | if (err) | 3263 | if (err) |
3265 | return err; | 3264 | return err; |
3266 | 3265 | ||
3267 | dest = cpu_mask_to_apicid_and(cfg->domain, TARGET_CPUS); | 3266 | dest = apic->cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus()); |
3268 | 3267 | ||
3269 | #ifdef CONFIG_INTR_REMAP | 3268 | #ifdef CONFIG_INTR_REMAP |
3270 | if (irq_remapped(irq)) { | 3269 | if (irq_remapped(irq)) { |
@@ -3278,9 +3277,9 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms | |||
3278 | memset (&irte, 0, sizeof(irte)); | 3277 | memset (&irte, 0, sizeof(irte)); |
3279 | 3278 | ||
3280 | irte.present = 1; | 3279 | irte.present = 1; |
3281 | irte.dst_mode = INT_DEST_MODE; | 3280 | irte.dst_mode = apic->irq_dest_mode; |
3282 | irte.trigger_mode = 0; /* edge */ | 3281 | irte.trigger_mode = 0; /* edge */ |
3283 | irte.dlvry_mode = INT_DELIVERY_MODE; | 3282 | irte.dlvry_mode = apic->irq_delivery_mode; |
3284 | irte.vector = cfg->vector; | 3283 | irte.vector = cfg->vector; |
3285 | irte.dest_id = IRTE_DEST(dest); | 3284 | irte.dest_id = IRTE_DEST(dest); |
3286 | 3285 | ||
@@ -3298,10 +3297,10 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms | |||
3298 | msg->address_hi = MSI_ADDR_BASE_HI; | 3297 | msg->address_hi = MSI_ADDR_BASE_HI; |
3299 | msg->address_lo = | 3298 | msg->address_lo = |
3300 | MSI_ADDR_BASE_LO | | 3299 | MSI_ADDR_BASE_LO | |
3301 | ((INT_DEST_MODE == 0) ? | 3300 | ((apic->irq_dest_mode == 0) ? |
3302 | MSI_ADDR_DEST_MODE_PHYSICAL: | 3301 | MSI_ADDR_DEST_MODE_PHYSICAL: |
3303 | MSI_ADDR_DEST_MODE_LOGICAL) | | 3302 | MSI_ADDR_DEST_MODE_LOGICAL) | |
3304 | ((INT_DELIVERY_MODE != dest_LowestPrio) ? | 3303 | ((apic->irq_delivery_mode != dest_LowestPrio) ? |
3305 | MSI_ADDR_REDIRECTION_CPU: | 3304 | MSI_ADDR_REDIRECTION_CPU: |
3306 | MSI_ADDR_REDIRECTION_LOWPRI) | | 3305 | MSI_ADDR_REDIRECTION_LOWPRI) | |
3307 | MSI_ADDR_DEST_ID(dest); | 3306 | MSI_ADDR_DEST_ID(dest); |
@@ -3309,7 +3308,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms | |||
3309 | msg->data = | 3308 | msg->data = |
3310 | MSI_DATA_TRIGGER_EDGE | | 3309 | MSI_DATA_TRIGGER_EDGE | |
3311 | MSI_DATA_LEVEL_ASSERT | | 3310 | MSI_DATA_LEVEL_ASSERT | |
3312 | ((INT_DELIVERY_MODE != dest_LowestPrio) ? | 3311 | ((apic->irq_delivery_mode != dest_LowestPrio) ? |
3313 | MSI_DATA_DELIVERY_FIXED: | 3312 | MSI_DATA_DELIVERY_FIXED: |
3314 | MSI_DATA_DELIVERY_LOWPRI) | | 3313 | MSI_DATA_DELIVERY_LOWPRI) | |
3315 | MSI_DATA_VECTOR(cfg->vector); | 3314 | MSI_DATA_VECTOR(cfg->vector); |
@@ -3464,40 +3463,6 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq) | |||
3464 | return 0; | 3463 | return 0; |
3465 | } | 3464 | } |
3466 | 3465 | ||
3467 | int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc) | ||
3468 | { | ||
3469 | unsigned int irq; | ||
3470 | int ret; | ||
3471 | unsigned int irq_want; | ||
3472 | |||
3473 | irq_want = nr_irqs_gsi; | ||
3474 | irq = create_irq_nr(irq_want); | ||
3475 | if (irq == 0) | ||
3476 | return -1; | ||
3477 | |||
3478 | #ifdef CONFIG_INTR_REMAP | ||
3479 | if (!intr_remapping_enabled) | ||
3480 | goto no_ir; | ||
3481 | |||
3482 | ret = msi_alloc_irte(dev, irq, 1); | ||
3483 | if (ret < 0) | ||
3484 | goto error; | ||
3485 | no_ir: | ||
3486 | #endif | ||
3487 | ret = setup_msi_irq(dev, msidesc, irq); | ||
3488 | if (ret < 0) { | ||
3489 | destroy_irq(irq); | ||
3490 | return ret; | ||
3491 | } | ||
3492 | return 0; | ||
3493 | |||
3494 | #ifdef CONFIG_INTR_REMAP | ||
3495 | error: | ||
3496 | destroy_irq(irq); | ||
3497 | return ret; | ||
3498 | #endif | ||
3499 | } | ||
3500 | |||
3501 | int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | 3466 | int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) |
3502 | { | 3467 | { |
3503 | unsigned int irq; | 3468 | unsigned int irq; |
@@ -3727,13 +3692,17 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev) | |||
3727 | struct irq_cfg *cfg; | 3692 | struct irq_cfg *cfg; |
3728 | int err; | 3693 | int err; |
3729 | 3694 | ||
3695 | if (disable_apic) | ||
3696 | return -ENXIO; | ||
3697 | |||
3730 | cfg = irq_cfg(irq); | 3698 | cfg = irq_cfg(irq); |
3731 | err = assign_irq_vector(irq, cfg, TARGET_CPUS); | 3699 | err = assign_irq_vector(irq, cfg, apic->target_cpus()); |
3732 | if (!err) { | 3700 | if (!err) { |
3733 | struct ht_irq_msg msg; | 3701 | struct ht_irq_msg msg; |
3734 | unsigned dest; | 3702 | unsigned dest; |
3735 | 3703 | ||
3736 | dest = cpu_mask_to_apicid_and(cfg->domain, TARGET_CPUS); | 3704 | dest = apic->cpu_mask_to_apicid_and(cfg->domain, |
3705 | apic->target_cpus()); | ||
3737 | 3706 | ||
3738 | msg.address_hi = HT_IRQ_HIGH_DEST_ID(dest); | 3707 | msg.address_hi = HT_IRQ_HIGH_DEST_ID(dest); |
3739 | 3708 | ||
@@ -3741,11 +3710,11 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev) | |||
3741 | HT_IRQ_LOW_BASE | | 3710 | HT_IRQ_LOW_BASE | |
3742 | HT_IRQ_LOW_DEST_ID(dest) | | 3711 | HT_IRQ_LOW_DEST_ID(dest) | |
3743 | HT_IRQ_LOW_VECTOR(cfg->vector) | | 3712 | HT_IRQ_LOW_VECTOR(cfg->vector) | |
3744 | ((INT_DEST_MODE == 0) ? | 3713 | ((apic->irq_dest_mode == 0) ? |
3745 | HT_IRQ_LOW_DM_PHYSICAL : | 3714 | HT_IRQ_LOW_DM_PHYSICAL : |
3746 | HT_IRQ_LOW_DM_LOGICAL) | | 3715 | HT_IRQ_LOW_DM_LOGICAL) | |
3747 | HT_IRQ_LOW_RQEOI_EDGE | | 3716 | HT_IRQ_LOW_RQEOI_EDGE | |
3748 | ((INT_DELIVERY_MODE != dest_LowestPrio) ? | 3717 | ((apic->irq_delivery_mode != dest_LowestPrio) ? |
3749 | HT_IRQ_LOW_MT_FIXED : | 3718 | HT_IRQ_LOW_MT_FIXED : |
3750 | HT_IRQ_LOW_MT_ARBITRATED) | | 3719 | HT_IRQ_LOW_MT_ARBITRATED) | |
3751 | HT_IRQ_LOW_IRQ_MASKED; | 3720 | HT_IRQ_LOW_IRQ_MASKED; |
@@ -3761,7 +3730,7 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev) | |||
3761 | } | 3730 | } |
3762 | #endif /* CONFIG_HT_IRQ */ | 3731 | #endif /* CONFIG_HT_IRQ */ |
3763 | 3732 | ||
3764 | #ifdef CONFIG_X86_64 | 3733 | #ifdef CONFIG_X86_UV |
3765 | /* | 3734 | /* |
3766 | * Re-target the irq to the specified CPU and enable the specified MMR located | 3735 | * Re-target the irq to the specified CPU and enable the specified MMR located |
3767 | * on the specified blade to allow the sending of MSIs to the specified CPU. | 3736 | * on the specified blade to allow the sending of MSIs to the specified CPU. |
@@ -3793,12 +3762,12 @@ int arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade, | |||
3793 | BUG_ON(sizeof(struct uv_IO_APIC_route_entry) != sizeof(unsigned long)); | 3762 | BUG_ON(sizeof(struct uv_IO_APIC_route_entry) != sizeof(unsigned long)); |
3794 | 3763 | ||
3795 | entry->vector = cfg->vector; | 3764 | entry->vector = cfg->vector; |
3796 | entry->delivery_mode = INT_DELIVERY_MODE; | 3765 | entry->delivery_mode = apic->irq_delivery_mode; |
3797 | entry->dest_mode = INT_DEST_MODE; | 3766 | entry->dest_mode = apic->irq_dest_mode; |
3798 | entry->polarity = 0; | 3767 | entry->polarity = 0; |
3799 | entry->trigger = 0; | 3768 | entry->trigger = 0; |
3800 | entry->mask = 0; | 3769 | entry->mask = 0; |
3801 | entry->dest = cpu_mask_to_apicid(eligible_cpu); | 3770 | entry->dest = apic->cpu_mask_to_apicid(eligible_cpu); |
3802 | 3771 | ||
3803 | mmr_pnode = uv_blade_to_pnode(mmr_blade); | 3772 | mmr_pnode = uv_blade_to_pnode(mmr_blade); |
3804 | uv_write_global_mmr64(mmr_pnode, mmr_offset, mmr_value); | 3773 | uv_write_global_mmr64(mmr_pnode, mmr_offset, mmr_value); |
@@ -3851,6 +3820,22 @@ void __init probe_nr_irqs_gsi(void) | |||
3851 | nr_irqs_gsi = nr; | 3820 | nr_irqs_gsi = nr; |
3852 | } | 3821 | } |
3853 | 3822 | ||
3823 | #ifdef CONFIG_SPARSE_IRQ | ||
3824 | int __init arch_probe_nr_irqs(void) | ||
3825 | { | ||
3826 | int nr; | ||
3827 | |||
3828 | nr = ((8 * nr_cpu_ids) > (32 * nr_ioapics) ? | ||
3829 | (NR_VECTORS + (8 * nr_cpu_ids)) : | ||
3830 | (NR_VECTORS + (32 * nr_ioapics))); | ||
3831 | |||
3832 | if (nr < nr_irqs && nr > nr_irqs_gsi) | ||
3833 | nr_irqs = nr; | ||
3834 | |||
3835 | return 0; | ||
3836 | } | ||
3837 | #endif | ||
3838 | |||
3854 | /* -------------------------------------------------------------------------- | 3839 | /* -------------------------------------------------------------------------- |
3855 | ACPI-based IOAPIC Configuration | 3840 | ACPI-based IOAPIC Configuration |
3856 | -------------------------------------------------------------------------- */ | 3841 | -------------------------------------------------------------------------- */ |
@@ -3876,7 +3861,7 @@ int __init io_apic_get_unique_id(int ioapic, int apic_id) | |||
3876 | */ | 3861 | */ |
3877 | 3862 | ||
3878 | if (physids_empty(apic_id_map)) | 3863 | if (physids_empty(apic_id_map)) |
3879 | apic_id_map = ioapic_phys_id_map(phys_cpu_present_map); | 3864 | apic_id_map = apic->ioapic_phys_id_map(phys_cpu_present_map); |
3880 | 3865 | ||
3881 | spin_lock_irqsave(&ioapic_lock, flags); | 3866 | spin_lock_irqsave(&ioapic_lock, flags); |
3882 | reg_00.raw = io_apic_read(ioapic, 0); | 3867 | reg_00.raw = io_apic_read(ioapic, 0); |
@@ -3892,10 +3877,10 @@ int __init io_apic_get_unique_id(int ioapic, int apic_id) | |||
3892 | * Every APIC in a system must have a unique ID or we get lots of nice | 3877 | * Every APIC in a system must have a unique ID or we get lots of nice |
3893 | * 'stuck on smp_invalidate_needed IPI wait' messages. | 3878 | * 'stuck on smp_invalidate_needed IPI wait' messages. |
3894 | */ | 3879 | */ |
3895 | if (check_apicid_used(apic_id_map, apic_id)) { | 3880 | if (apic->check_apicid_used(apic_id_map, apic_id)) { |
3896 | 3881 | ||
3897 | for (i = 0; i < get_physical_broadcast(); i++) { | 3882 | for (i = 0; i < get_physical_broadcast(); i++) { |
3898 | if (!check_apicid_used(apic_id_map, i)) | 3883 | if (!apic->check_apicid_used(apic_id_map, i)) |
3899 | break; | 3884 | break; |
3900 | } | 3885 | } |
3901 | 3886 | ||
@@ -3908,7 +3893,7 @@ int __init io_apic_get_unique_id(int ioapic, int apic_id) | |||
3908 | apic_id = i; | 3893 | apic_id = i; |
3909 | } | 3894 | } |
3910 | 3895 | ||
3911 | tmp = apicid_to_cpu_present(apic_id); | 3896 | tmp = apic->apicid_to_cpu_present(apic_id); |
3912 | physids_or(apic_id_map, apic_id_map, tmp); | 3897 | physids_or(apic_id_map, apic_id_map, tmp); |
3913 | 3898 | ||
3914 | if (reg_00.bits.ID != apic_id) { | 3899 | if (reg_00.bits.ID != apic_id) { |
@@ -3985,8 +3970,8 @@ int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity) | |||
3985 | return -1; | 3970 | return -1; |
3986 | 3971 | ||
3987 | for (i = 0; i < mp_irq_entries; i++) | 3972 | for (i = 0; i < mp_irq_entries; i++) |
3988 | if (mp_irqs[i].mp_irqtype == mp_INT && | 3973 | if (mp_irqs[i].irqtype == mp_INT && |
3989 | mp_irqs[i].mp_srcbusirq == bus_irq) | 3974 | mp_irqs[i].srcbusirq == bus_irq) |
3990 | break; | 3975 | break; |
3991 | if (i >= mp_irq_entries) | 3976 | if (i >= mp_irq_entries) |
3992 | return -1; | 3977 | return -1; |
@@ -4001,7 +3986,7 @@ int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity) | |||
4001 | /* | 3986 | /* |
4002 | * This function currently is only a helper for the i386 smp boot process where | 3987 | * This function currently is only a helper for the i386 smp boot process where |
4003 | * we need to reprogram the ioredtbls to cater for the cpus which have come online | 3988 | * we need to reprogram the ioredtbls to cater for the cpus which have come online |
4004 | * so mask in all cases should simply be TARGET_CPUS | 3989 | * so mask in all cases should simply be apic->target_cpus() |
4005 | */ | 3990 | */ |
4006 | #ifdef CONFIG_SMP | 3991 | #ifdef CONFIG_SMP |
4007 | void __init setup_ioapic_dest(void) | 3992 | void __init setup_ioapic_dest(void) |
@@ -4040,9 +4025,9 @@ void __init setup_ioapic_dest(void) | |||
4040 | */ | 4025 | */ |
4041 | if (desc->status & | 4026 | if (desc->status & |
4042 | (IRQ_NO_BALANCING | IRQ_AFFINITY_SET)) | 4027 | (IRQ_NO_BALANCING | IRQ_AFFINITY_SET)) |
4043 | mask = &desc->affinity; | 4028 | mask = desc->affinity; |
4044 | else | 4029 | else |
4045 | mask = TARGET_CPUS; | 4030 | mask = apic->target_cpus(); |
4046 | 4031 | ||
4047 | #ifdef CONFIG_INTR_REMAP | 4032 | #ifdef CONFIG_INTR_REMAP |
4048 | if (intr_remapping_enabled) | 4033 | if (intr_remapping_enabled) |
@@ -4101,7 +4086,7 @@ void __init ioapic_init_mappings(void) | |||
4101 | ioapic_res = ioapic_setup_resources(); | 4086 | ioapic_res = ioapic_setup_resources(); |
4102 | for (i = 0; i < nr_ioapics; i++) { | 4087 | for (i = 0; i < nr_ioapics; i++) { |
4103 | if (smp_found_config) { | 4088 | if (smp_found_config) { |
4104 | ioapic_phys = mp_ioapics[i].mp_apicaddr; | 4089 | ioapic_phys = mp_ioapics[i].apicaddr; |
4105 | #ifdef CONFIG_X86_32 | 4090 | #ifdef CONFIG_X86_32 |
4106 | if (!ioapic_phys) { | 4091 | if (!ioapic_phys) { |
4107 | printk(KERN_ERR | 4092 | printk(KERN_ERR |
diff --git a/arch/x86/kernel/ipi.c b/arch/x86/kernel/ipi.c index 285bbf8831fa..dbf5445727a9 100644 --- a/arch/x86/kernel/ipi.c +++ b/arch/x86/kernel/ipi.c | |||
@@ -17,147 +17,121 @@ | |||
17 | #include <asm/mmu_context.h> | 17 | #include <asm/mmu_context.h> |
18 | #include <asm/apic.h> | 18 | #include <asm/apic.h> |
19 | #include <asm/proto.h> | 19 | #include <asm/proto.h> |
20 | #include <asm/ipi.h> | ||
20 | 21 | ||
21 | #ifdef CONFIG_X86_32 | 22 | void default_send_IPI_mask_sequence_phys(const struct cpumask *mask, int vector) |
22 | #include <mach_apic.h> | ||
23 | #include <mach_ipi.h> | ||
24 | |||
25 | /* | ||
26 | * the following functions deal with sending IPIs between CPUs. | ||
27 | * | ||
28 | * We use 'broadcast', CPU->CPU IPIs and self-IPIs too. | ||
29 | */ | ||
30 | |||
31 | static inline int __prepare_ICR(unsigned int shortcut, int vector) | ||
32 | { | 23 | { |
33 | unsigned int icr = shortcut | APIC_DEST_LOGICAL; | 24 | unsigned long query_cpu; |
34 | 25 | unsigned long flags; | |
35 | switch (vector) { | 26 | |
36 | default: | 27 | /* |
37 | icr |= APIC_DM_FIXED | vector; | 28 | * Hack. The clustered APIC addressing mode doesn't allow us to send |
38 | break; | 29 | * to an arbitrary mask, so I do a unicast to each CPU instead. |
39 | case NMI_VECTOR: | 30 | * - mbligh |
40 | icr |= APIC_DM_NMI; | 31 | */ |
41 | break; | 32 | local_irq_save(flags); |
33 | for_each_cpu(query_cpu, mask) { | ||
34 | __default_send_IPI_dest_field(per_cpu(x86_cpu_to_apicid, | ||
35 | query_cpu), vector, APIC_DEST_PHYSICAL); | ||
42 | } | 36 | } |
43 | return icr; | 37 | local_irq_restore(flags); |
44 | } | 38 | } |
45 | 39 | ||
46 | static inline int __prepare_ICR2(unsigned int mask) | 40 | void default_send_IPI_mask_allbutself_phys(const struct cpumask *mask, |
41 | int vector) | ||
47 | { | 42 | { |
48 | return SET_APIC_DEST_FIELD(mask); | 43 | unsigned int this_cpu = smp_processor_id(); |
49 | } | 44 | unsigned int query_cpu; |
45 | unsigned long flags; | ||
50 | 46 | ||
51 | void __send_IPI_shortcut(unsigned int shortcut, int vector) | 47 | /* See Hack comment above */ |
52 | { | ||
53 | /* | ||
54 | * Subtle. In the case of the 'never do double writes' workaround | ||
55 | * we have to lock out interrupts to be safe. As we don't care | ||
56 | * of the value read we use an atomic rmw access to avoid costly | ||
57 | * cli/sti. Otherwise we use an even cheaper single atomic write | ||
58 | * to the APIC. | ||
59 | */ | ||
60 | unsigned int cfg; | ||
61 | 48 | ||
62 | /* | 49 | local_irq_save(flags); |
63 | * Wait for idle. | 50 | for_each_cpu(query_cpu, mask) { |
64 | */ | 51 | if (query_cpu == this_cpu) |
65 | apic_wait_icr_idle(); | 52 | continue; |
53 | __default_send_IPI_dest_field(per_cpu(x86_cpu_to_apicid, | ||
54 | query_cpu), vector, APIC_DEST_PHYSICAL); | ||
55 | } | ||
56 | local_irq_restore(flags); | ||
57 | } | ||
66 | 58 | ||
67 | /* | 59 | void default_send_IPI_mask_sequence_logical(const struct cpumask *mask, |
68 | * No need to touch the target chip field | 60 | int vector) |
69 | */ | 61 | { |
70 | cfg = __prepare_ICR(shortcut, vector); | 62 | unsigned long flags; |
63 | unsigned int query_cpu; | ||
71 | 64 | ||
72 | /* | 65 | /* |
73 | * Send the IPI. The write to APIC_ICR fires this off. | 66 | * Hack. The clustered APIC addressing mode doesn't allow us to send |
67 | * to an arbitrary mask, so I do a unicasts to each CPU instead. This | ||
68 | * should be modified to do 1 message per cluster ID - mbligh | ||
74 | */ | 69 | */ |
75 | apic_write(APIC_ICR, cfg); | ||
76 | } | ||
77 | 70 | ||
78 | void send_IPI_self(int vector) | 71 | local_irq_save(flags); |
79 | { | 72 | for_each_cpu(query_cpu, mask) |
80 | __send_IPI_shortcut(APIC_DEST_SELF, vector); | 73 | __default_send_IPI_dest_field( |
74 | apic->cpu_to_logical_apicid(query_cpu), vector, | ||
75 | apic->dest_logical); | ||
76 | local_irq_restore(flags); | ||
81 | } | 77 | } |
82 | 78 | ||
83 | /* | 79 | void default_send_IPI_mask_allbutself_logical(const struct cpumask *mask, |
84 | * This is used to send an IPI with no shorthand notation (the destination is | 80 | int vector) |
85 | * specified in bits 56 to 63 of the ICR). | ||
86 | */ | ||
87 | static inline void __send_IPI_dest_field(unsigned long mask, int vector) | ||
88 | { | 81 | { |
89 | unsigned long cfg; | 82 | unsigned long flags; |
90 | 83 | unsigned int query_cpu; | |
91 | /* | 84 | unsigned int this_cpu = smp_processor_id(); |
92 | * Wait for idle. | ||
93 | */ | ||
94 | if (unlikely(vector == NMI_VECTOR)) | ||
95 | safe_apic_wait_icr_idle(); | ||
96 | else | ||
97 | apic_wait_icr_idle(); | ||
98 | |||
99 | /* | ||
100 | * prepare target chip field | ||
101 | */ | ||
102 | cfg = __prepare_ICR2(mask); | ||
103 | apic_write(APIC_ICR2, cfg); | ||
104 | 85 | ||
105 | /* | 86 | /* See Hack comment above */ |
106 | * program the ICR | ||
107 | */ | ||
108 | cfg = __prepare_ICR(0, vector); | ||
109 | 87 | ||
110 | /* | 88 | local_irq_save(flags); |
111 | * Send the IPI. The write to APIC_ICR fires this off. | 89 | for_each_cpu(query_cpu, mask) { |
112 | */ | 90 | if (query_cpu == this_cpu) |
113 | apic_write(APIC_ICR, cfg); | 91 | continue; |
92 | __default_send_IPI_dest_field( | ||
93 | apic->cpu_to_logical_apicid(query_cpu), vector, | ||
94 | apic->dest_logical); | ||
95 | } | ||
96 | local_irq_restore(flags); | ||
114 | } | 97 | } |
115 | 98 | ||
99 | #ifdef CONFIG_X86_32 | ||
100 | |||
116 | /* | 101 | /* |
117 | * This is only used on smaller machines. | 102 | * This is only used on smaller machines. |
118 | */ | 103 | */ |
119 | void send_IPI_mask_bitmask(const struct cpumask *cpumask, int vector) | 104 | void default_send_IPI_mask_logical(const struct cpumask *cpumask, int vector) |
120 | { | 105 | { |
121 | unsigned long mask = cpumask_bits(cpumask)[0]; | 106 | unsigned long mask = cpumask_bits(cpumask)[0]; |
122 | unsigned long flags; | 107 | unsigned long flags; |
123 | 108 | ||
124 | local_irq_save(flags); | 109 | local_irq_save(flags); |
125 | WARN_ON(mask & ~cpumask_bits(cpu_online_mask)[0]); | 110 | WARN_ON(mask & ~cpumask_bits(cpu_online_mask)[0]); |
126 | __send_IPI_dest_field(mask, vector); | 111 | __default_send_IPI_dest_field(mask, vector, apic->dest_logical); |
127 | local_irq_restore(flags); | 112 | local_irq_restore(flags); |
128 | } | 113 | } |
129 | 114 | ||
130 | void send_IPI_mask_sequence(const struct cpumask *mask, int vector) | 115 | void default_send_IPI_allbutself(int vector) |
131 | { | 116 | { |
132 | unsigned long flags; | ||
133 | unsigned int query_cpu; | ||
134 | |||
135 | /* | 117 | /* |
136 | * Hack. The clustered APIC addressing mode doesn't allow us to send | 118 | * if there are no other CPUs in the system then we get an APIC send |
137 | * to an arbitrary mask, so I do a unicasts to each CPU instead. This | 119 | * error if we try to broadcast, thus avoid sending IPIs in this case. |
138 | * should be modified to do 1 message per cluster ID - mbligh | ||
139 | */ | 120 | */ |
121 | if (!(num_online_cpus() > 1)) | ||
122 | return; | ||
140 | 123 | ||
141 | local_irq_save(flags); | 124 | __default_local_send_IPI_allbutself(vector); |
142 | for_each_cpu(query_cpu, mask) | ||
143 | __send_IPI_dest_field(cpu_to_logical_apicid(query_cpu), vector); | ||
144 | local_irq_restore(flags); | ||
145 | } | 125 | } |
146 | 126 | ||
147 | void send_IPI_mask_allbutself(const struct cpumask *mask, int vector) | 127 | void default_send_IPI_all(int vector) |
148 | { | 128 | { |
149 | unsigned long flags; | 129 | __default_local_send_IPI_all(vector); |
150 | unsigned int query_cpu; | 130 | } |
151 | unsigned int this_cpu = smp_processor_id(); | ||
152 | |||
153 | /* See Hack comment above */ | ||
154 | 131 | ||
155 | local_irq_save(flags); | 132 | void default_send_IPI_self(int vector) |
156 | for_each_cpu(query_cpu, mask) | 133 | { |
157 | if (query_cpu != this_cpu) | 134 | __default_send_IPI_shortcut(APIC_DEST_SELF, vector, apic->dest_logical); |
158 | __send_IPI_dest_field(cpu_to_logical_apicid(query_cpu), | ||
159 | vector); | ||
160 | local_irq_restore(flags); | ||
161 | } | 135 | } |
162 | 136 | ||
163 | /* must come after the send_IPI functions above for inlining */ | 137 | /* must come after the send_IPI functions above for inlining */ |
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index 3973e2df7f87..8b30d0c2512c 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c | |||
@@ -36,11 +36,7 @@ void ack_bad_irq(unsigned int irq) | |||
36 | #endif | 36 | #endif |
37 | } | 37 | } |
38 | 38 | ||
39 | #ifdef CONFIG_X86_32 | 39 | #define irq_stats(x) (&per_cpu(irq_stat, x)) |
40 | # define irq_stats(x) (&per_cpu(irq_stat, x)) | ||
41 | #else | ||
42 | # define irq_stats(x) cpu_pda(x) | ||
43 | #endif | ||
44 | /* | 40 | /* |
45 | * /proc/interrupts printing: | 41 | * /proc/interrupts printing: |
46 | */ | 42 | */ |
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c index 74b9ff7341e9..d802c844991e 100644 --- a/arch/x86/kernel/irq_32.c +++ b/arch/x86/kernel/irq_32.c | |||
@@ -231,7 +231,7 @@ unsigned int do_IRQ(struct pt_regs *regs) | |||
231 | } | 231 | } |
232 | 232 | ||
233 | #ifdef CONFIG_HOTPLUG_CPU | 233 | #ifdef CONFIG_HOTPLUG_CPU |
234 | #include <mach_apic.h> | 234 | #include <asm/genapic.h> |
235 | 235 | ||
236 | /* A cpu has been removed from cpu_online_mask. Reset irq affinities. */ | 236 | /* A cpu has been removed from cpu_online_mask. Reset irq affinities. */ |
237 | void fixup_irqs(void) | 237 | void fixup_irqs(void) |
@@ -248,7 +248,7 @@ void fixup_irqs(void) | |||
248 | if (irq == 2) | 248 | if (irq == 2) |
249 | continue; | 249 | continue; |
250 | 250 | ||
251 | affinity = &desc->affinity; | 251 | affinity = desc->affinity; |
252 | if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { | 252 | if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { |
253 | printk("Breaking affinity for irq %i\n", irq); | 253 | printk("Breaking affinity for irq %i\n", irq); |
254 | affinity = cpu_all_mask; | 254 | affinity = cpu_all_mask; |
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c index 63c88e6ec025..018963aa6ee3 100644 --- a/arch/x86/kernel/irq_64.c +++ b/arch/x86/kernel/irq_64.c | |||
@@ -18,6 +18,13 @@ | |||
18 | #include <linux/smp.h> | 18 | #include <linux/smp.h> |
19 | #include <asm/io_apic.h> | 19 | #include <asm/io_apic.h> |
20 | #include <asm/idle.h> | 20 | #include <asm/idle.h> |
21 | #include <asm/apic.h> | ||
22 | |||
23 | DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat); | ||
24 | EXPORT_PER_CPU_SYMBOL(irq_stat); | ||
25 | |||
26 | DEFINE_PER_CPU(struct pt_regs *, irq_regs); | ||
27 | EXPORT_PER_CPU_SYMBOL(irq_regs); | ||
21 | 28 | ||
22 | /* | 29 | /* |
23 | * Probabilistic stack overflow check: | 30 | * Probabilistic stack overflow check: |
@@ -100,7 +107,7 @@ void fixup_irqs(void) | |||
100 | /* interrupt's are disabled at this point */ | 107 | /* interrupt's are disabled at this point */ |
101 | spin_lock(&desc->lock); | 108 | spin_lock(&desc->lock); |
102 | 109 | ||
103 | affinity = &desc->affinity; | 110 | affinity = desc->affinity; |
104 | if (!irq_has_action(irq) || | 111 | if (!irq_has_action(irq) || |
105 | cpumask_equal(affinity, cpu_online_mask)) { | 112 | cpumask_equal(affinity, cpu_online_mask)) { |
106 | spin_unlock(&desc->lock); | 113 | spin_unlock(&desc->lock); |
diff --git a/arch/x86/kernel/irqinit_32.c b/arch/x86/kernel/irqinit_32.c index 10a09c2f1828..bf629cadec1a 100644 --- a/arch/x86/kernel/irqinit_32.c +++ b/arch/x86/kernel/irqinit_32.c | |||
@@ -78,6 +78,15 @@ void __init init_ISA_irqs(void) | |||
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | /* | ||
82 | * IRQ2 is cascade interrupt to second interrupt controller | ||
83 | */ | ||
84 | static struct irqaction irq2 = { | ||
85 | .handler = no_action, | ||
86 | .mask = CPU_MASK_NONE, | ||
87 | .name = "cascade", | ||
88 | }; | ||
89 | |||
81 | DEFINE_PER_CPU(vector_irq_t, vector_irq) = { | 90 | DEFINE_PER_CPU(vector_irq_t, vector_irq) = { |
82 | [0 ... IRQ0_VECTOR - 1] = -1, | 91 | [0 ... IRQ0_VECTOR - 1] = -1, |
83 | [IRQ0_VECTOR] = 0, | 92 | [IRQ0_VECTOR] = 0, |
@@ -140,8 +149,15 @@ void __init native_init_IRQ(void) | |||
140 | */ | 149 | */ |
141 | alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt); | 150 | alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt); |
142 | 151 | ||
143 | /* IPI for invalidation */ | 152 | /* IPIs for invalidation */ |
144 | alloc_intr_gate(INVALIDATE_TLB_VECTOR, invalidate_interrupt); | 153 | alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+0, invalidate_interrupt0); |
154 | alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+1, invalidate_interrupt1); | ||
155 | alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+2, invalidate_interrupt2); | ||
156 | alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+3, invalidate_interrupt3); | ||
157 | alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+4, invalidate_interrupt4); | ||
158 | alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+5, invalidate_interrupt5); | ||
159 | alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+6, invalidate_interrupt6); | ||
160 | alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+7, invalidate_interrupt7); | ||
145 | 161 | ||
146 | /* IPI for generic function call */ | 162 | /* IPI for generic function call */ |
147 | alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); | 163 | alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); |
@@ -169,6 +185,9 @@ void __init native_init_IRQ(void) | |||
169 | alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt); | 185 | alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt); |
170 | #endif | 186 | #endif |
171 | 187 | ||
188 | if (!acpi_ioapic) | ||
189 | setup_irq(2, &irq2); | ||
190 | |||
172 | /* setup after call gates are initialised (usually add in | 191 | /* setup after call gates are initialised (usually add in |
173 | * the architecture specific gates) | 192 | * the architecture specific gates) |
174 | */ | 193 | */ |
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c index 10435a120d22..5c4f55483849 100644 --- a/arch/x86/kernel/kgdb.c +++ b/arch/x86/kernel/kgdb.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <asm/apicdef.h> | 46 | #include <asm/apicdef.h> |
47 | #include <asm/system.h> | 47 | #include <asm/system.h> |
48 | 48 | ||
49 | #include <mach_ipi.h> | 49 | #include <asm/genapic.h> |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * Put the error code here just in case the user cares: | 52 | * Put the error code here just in case the user cares: |
@@ -347,7 +347,7 @@ void kgdb_post_primary_code(struct pt_regs *regs, int e_vector, int err_code) | |||
347 | */ | 347 | */ |
348 | void kgdb_roundup_cpus(unsigned long flags) | 348 | void kgdb_roundup_cpus(unsigned long flags) |
349 | { | 349 | { |
350 | send_IPI_allbutself(APIC_DM_NMI); | 350 | apic->send_IPI_allbutself(APIC_DM_NMI); |
351 | } | 351 | } |
352 | #endif | 352 | #endif |
353 | 353 | ||
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c index b7f4c929e615..5e9f4fc51385 100644 --- a/arch/x86/kernel/microcode_intel.c +++ b/arch/x86/kernel/microcode_intel.c | |||
@@ -87,9 +87,9 @@ | |||
87 | #include <linux/cpu.h> | 87 | #include <linux/cpu.h> |
88 | #include <linux/firmware.h> | 88 | #include <linux/firmware.h> |
89 | #include <linux/platform_device.h> | 89 | #include <linux/platform_device.h> |
90 | #include <linux/uaccess.h> | ||
90 | 91 | ||
91 | #include <asm/msr.h> | 92 | #include <asm/msr.h> |
92 | #include <asm/uaccess.h> | ||
93 | #include <asm/processor.h> | 93 | #include <asm/processor.h> |
94 | #include <asm/microcode.h> | 94 | #include <asm/microcode.h> |
95 | 95 | ||
@@ -196,7 +196,7 @@ static inline int update_match_cpu(struct cpu_signature *csig, int sig, int pf) | |||
196 | return (!sigmatch(sig, csig->sig, pf, csig->pf)) ? 0 : 1; | 196 | return (!sigmatch(sig, csig->sig, pf, csig->pf)) ? 0 : 1; |
197 | } | 197 | } |
198 | 198 | ||
199 | static inline int | 199 | static inline int |
200 | update_match_revision(struct microcode_header_intel *mc_header, int rev) | 200 | update_match_revision(struct microcode_header_intel *mc_header, int rev) |
201 | { | 201 | { |
202 | return (mc_header->rev <= rev) ? 0 : 1; | 202 | return (mc_header->rev <= rev) ? 0 : 1; |
@@ -442,8 +442,8 @@ static int request_microcode_fw(int cpu, struct device *device) | |||
442 | return ret; | 442 | return ret; |
443 | } | 443 | } |
444 | 444 | ||
445 | ret = generic_load_microcode(cpu, (void*)firmware->data, firmware->size, | 445 | ret = generic_load_microcode(cpu, (void *)firmware->data, |
446 | &get_ucode_fw); | 446 | firmware->size, &get_ucode_fw); |
447 | 447 | ||
448 | release_firmware(firmware); | 448 | release_firmware(firmware); |
449 | 449 | ||
@@ -460,7 +460,7 @@ static int request_microcode_user(int cpu, const void __user *buf, size_t size) | |||
460 | /* We should bind the task to the CPU */ | 460 | /* We should bind the task to the CPU */ |
461 | BUG_ON(cpu != raw_smp_processor_id()); | 461 | BUG_ON(cpu != raw_smp_processor_id()); |
462 | 462 | ||
463 | return generic_load_microcode(cpu, (void*)buf, size, &get_ucode_user); | 463 | return generic_load_microcode(cpu, (void *)buf, size, &get_ucode_user); |
464 | } | 464 | } |
465 | 465 | ||
466 | static void microcode_fini_cpu(int cpu) | 466 | static void microcode_fini_cpu(int cpu) |
diff --git a/arch/x86/kernel/module_32.c b/arch/x86/kernel/module_32.c index 3db0a5442eb1..0edd819050e7 100644 --- a/arch/x86/kernel/module_32.c +++ b/arch/x86/kernel/module_32.c | |||
@@ -42,7 +42,7 @@ void module_free(struct module *mod, void *module_region) | |||
42 | { | 42 | { |
43 | vfree(module_region); | 43 | vfree(module_region); |
44 | /* FIXME: If module_region == mod->init_region, trim exception | 44 | /* FIXME: If module_region == mod->init_region, trim exception |
45 | table entries. */ | 45 | table entries. */ |
46 | } | 46 | } |
47 | 47 | ||
48 | /* We don't need anything special. */ | 48 | /* We don't need anything special. */ |
@@ -113,13 +113,13 @@ int module_finalize(const Elf_Ehdr *hdr, | |||
113 | *para = NULL; | 113 | *para = NULL; |
114 | char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; | 114 | char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; |
115 | 115 | ||
116 | for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) { | 116 | for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) { |
117 | if (!strcmp(".text", secstrings + s->sh_name)) | 117 | if (!strcmp(".text", secstrings + s->sh_name)) |
118 | text = s; | 118 | text = s; |
119 | if (!strcmp(".altinstructions", secstrings + s->sh_name)) | 119 | if (!strcmp(".altinstructions", secstrings + s->sh_name)) |
120 | alt = s; | 120 | alt = s; |
121 | if (!strcmp(".smp_locks", secstrings + s->sh_name)) | 121 | if (!strcmp(".smp_locks", secstrings + s->sh_name)) |
122 | locks= s; | 122 | locks = s; |
123 | if (!strcmp(".parainstructions", secstrings + s->sh_name)) | 123 | if (!strcmp(".parainstructions", secstrings + s->sh_name)) |
124 | para = s; | 124 | para = s; |
125 | } | 125 | } |
diff --git a/arch/x86/kernel/module_64.c b/arch/x86/kernel/module_64.c index 6ba87830d4b1..c23880b90b5c 100644 --- a/arch/x86/kernel/module_64.c +++ b/arch/x86/kernel/module_64.c | |||
@@ -30,14 +30,14 @@ | |||
30 | #include <asm/page.h> | 30 | #include <asm/page.h> |
31 | #include <asm/pgtable.h> | 31 | #include <asm/pgtable.h> |
32 | 32 | ||
33 | #define DEBUGP(fmt...) | 33 | #define DEBUGP(fmt...) |
34 | 34 | ||
35 | #ifndef CONFIG_UML | 35 | #ifndef CONFIG_UML |
36 | void module_free(struct module *mod, void *module_region) | 36 | void module_free(struct module *mod, void *module_region) |
37 | { | 37 | { |
38 | vfree(module_region); | 38 | vfree(module_region); |
39 | /* FIXME: If module_region == mod->init_region, trim exception | 39 | /* FIXME: If module_region == mod->init_region, trim exception |
40 | table entries. */ | 40 | table entries. */ |
41 | } | 41 | } |
42 | 42 | ||
43 | void *module_alloc(unsigned long size) | 43 | void *module_alloc(unsigned long size) |
@@ -77,7 +77,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, | |||
77 | Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr; | 77 | Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr; |
78 | Elf64_Sym *sym; | 78 | Elf64_Sym *sym; |
79 | void *loc; | 79 | void *loc; |
80 | u64 val; | 80 | u64 val; |
81 | 81 | ||
82 | DEBUGP("Applying relocate section %u to %u\n", relsec, | 82 | DEBUGP("Applying relocate section %u to %u\n", relsec, |
83 | sechdrs[relsec].sh_info); | 83 | sechdrs[relsec].sh_info); |
@@ -91,11 +91,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, | |||
91 | sym = (Elf64_Sym *)sechdrs[symindex].sh_addr | 91 | sym = (Elf64_Sym *)sechdrs[symindex].sh_addr |
92 | + ELF64_R_SYM(rel[i].r_info); | 92 | + ELF64_R_SYM(rel[i].r_info); |
93 | 93 | ||
94 | DEBUGP("type %d st_value %Lx r_addend %Lx loc %Lx\n", | 94 | DEBUGP("type %d st_value %Lx r_addend %Lx loc %Lx\n", |
95 | (int)ELF64_R_TYPE(rel[i].r_info), | 95 | (int)ELF64_R_TYPE(rel[i].r_info), |
96 | sym->st_value, rel[i].r_addend, (u64)loc); | 96 | sym->st_value, rel[i].r_addend, (u64)loc); |
97 | 97 | ||
98 | val = sym->st_value + rel[i].r_addend; | 98 | val = sym->st_value + rel[i].r_addend; |
99 | 99 | ||
100 | switch (ELF64_R_TYPE(rel[i].r_info)) { | 100 | switch (ELF64_R_TYPE(rel[i].r_info)) { |
101 | case R_X86_64_NONE: | 101 | case R_X86_64_NONE: |
@@ -113,16 +113,16 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, | |||
113 | if ((s64)val != *(s32 *)loc) | 113 | if ((s64)val != *(s32 *)loc) |
114 | goto overflow; | 114 | goto overflow; |
115 | break; | 115 | break; |
116 | case R_X86_64_PC32: | 116 | case R_X86_64_PC32: |
117 | val -= (u64)loc; | 117 | val -= (u64)loc; |
118 | *(u32 *)loc = val; | 118 | *(u32 *)loc = val; |
119 | #if 0 | 119 | #if 0 |
120 | if ((s64)val != *(s32 *)loc) | 120 | if ((s64)val != *(s32 *)loc) |
121 | goto overflow; | 121 | goto overflow; |
122 | #endif | 122 | #endif |
123 | break; | 123 | break; |
124 | default: | 124 | default: |
125 | printk(KERN_ERR "module %s: Unknown rela relocation: %Lu\n", | 125 | printk(KERN_ERR "module %s: Unknown rela relocation: %llu\n", |
126 | me->name, ELF64_R_TYPE(rel[i].r_info)); | 126 | me->name, ELF64_R_TYPE(rel[i].r_info)); |
127 | return -ENOEXEC; | 127 | return -ENOEXEC; |
128 | } | 128 | } |
@@ -130,7 +130,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, | |||
130 | return 0; | 130 | return 0; |
131 | 131 | ||
132 | overflow: | 132 | overflow: |
133 | printk(KERN_ERR "overflow in relocation type %d val %Lx\n", | 133 | printk(KERN_ERR "overflow in relocation type %d val %Lx\n", |
134 | (int)ELF64_R_TYPE(rel[i].r_info), val); | 134 | (int)ELF64_R_TYPE(rel[i].r_info), val); |
135 | printk(KERN_ERR "`%s' likely not compiled with -mcmodel=kernel\n", | 135 | printk(KERN_ERR "`%s' likely not compiled with -mcmodel=kernel\n", |
136 | me->name); | 136 | me->name); |
@@ -143,13 +143,13 @@ int apply_relocate(Elf_Shdr *sechdrs, | |||
143 | unsigned int relsec, | 143 | unsigned int relsec, |
144 | struct module *me) | 144 | struct module *me) |
145 | { | 145 | { |
146 | printk("non add relocation not supported\n"); | 146 | printk(KERN_ERR "non add relocation not supported\n"); |
147 | return -ENOSYS; | 147 | return -ENOSYS; |
148 | } | 148 | } |
149 | 149 | ||
150 | int module_finalize(const Elf_Ehdr *hdr, | 150 | int module_finalize(const Elf_Ehdr *hdr, |
151 | const Elf_Shdr *sechdrs, | 151 | const Elf_Shdr *sechdrs, |
152 | struct module *me) | 152 | struct module *me) |
153 | { | 153 | { |
154 | const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL, | 154 | const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL, |
155 | *para = NULL; | 155 | *para = NULL; |
@@ -161,7 +161,7 @@ int module_finalize(const Elf_Ehdr *hdr, | |||
161 | if (!strcmp(".altinstructions", secstrings + s->sh_name)) | 161 | if (!strcmp(".altinstructions", secstrings + s->sh_name)) |
162 | alt = s; | 162 | alt = s; |
163 | if (!strcmp(".smp_locks", secstrings + s->sh_name)) | 163 | if (!strcmp(".smp_locks", secstrings + s->sh_name)) |
164 | locks= s; | 164 | locks = s; |
165 | if (!strcmp(".parainstructions", secstrings + s->sh_name)) | 165 | if (!strcmp(".parainstructions", secstrings + s->sh_name)) |
166 | para = s; | 166 | para = s; |
167 | } | 167 | } |
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index a649a4ccad43..66ebb823f390 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * compliant MP-table parsing routines. | 3 | * compliant MP-table parsing routines. |
4 | * | 4 | * |
5 | * (c) 1995 Alan Cox, Building #3 <alan@lxorguk.ukuu.org.uk> | 5 | * (c) 1995 Alan Cox, Building #3 <alan@lxorguk.ukuu.org.uk> |
6 | * (c) 1998, 1999, 2000 Ingo Molnar <mingo@redhat.com> | 6 | * (c) 1998, 1999, 2000, 2009 Ingo Molnar <mingo@redhat.com> |
7 | * (c) 2008 Alexey Starikovskiy <astarikovskiy@suse.de> | 7 | * (c) 2008 Alexey Starikovskiy <astarikovskiy@suse.de> |
8 | */ | 8 | */ |
9 | 9 | ||
@@ -29,12 +29,7 @@ | |||
29 | #include <asm/setup.h> | 29 | #include <asm/setup.h> |
30 | #include <asm/smp.h> | 30 | #include <asm/smp.h> |
31 | 31 | ||
32 | #include <mach_apic.h> | 32 | #include <asm/genapic.h> |
33 | #ifdef CONFIG_X86_32 | ||
34 | #include <mach_apicdef.h> | ||
35 | #include <mach_mpparse.h> | ||
36 | #endif | ||
37 | |||
38 | /* | 33 | /* |
39 | * Checksum an MP configuration block. | 34 | * Checksum an MP configuration block. |
40 | */ | 35 | */ |
@@ -144,11 +139,11 @@ static void __init MP_ioapic_info(struct mpc_ioapic *m) | |||
144 | if (bad_ioapic(m->apicaddr)) | 139 | if (bad_ioapic(m->apicaddr)) |
145 | return; | 140 | return; |
146 | 141 | ||
147 | mp_ioapics[nr_ioapics].mp_apicaddr = m->apicaddr; | 142 | mp_ioapics[nr_ioapics].apicaddr = m->apicaddr; |
148 | mp_ioapics[nr_ioapics].mp_apicid = m->apicid; | 143 | mp_ioapics[nr_ioapics].apicid = m->apicid; |
149 | mp_ioapics[nr_ioapics].mp_type = m->type; | 144 | mp_ioapics[nr_ioapics].type = m->type; |
150 | mp_ioapics[nr_ioapics].mp_apicver = m->apicver; | 145 | mp_ioapics[nr_ioapics].apicver = m->apicver; |
151 | mp_ioapics[nr_ioapics].mp_flags = m->flags; | 146 | mp_ioapics[nr_ioapics].flags = m->flags; |
152 | nr_ioapics++; | 147 | nr_ioapics++; |
153 | } | 148 | } |
154 | 149 | ||
@@ -160,55 +155,55 @@ static void print_MP_intsrc_info(struct mpc_intsrc *m) | |||
160 | m->srcbusirq, m->dstapic, m->dstirq); | 155 | m->srcbusirq, m->dstapic, m->dstirq); |
161 | } | 156 | } |
162 | 157 | ||
163 | static void __init print_mp_irq_info(struct mp_config_intsrc *mp_irq) | 158 | static void __init print_mp_irq_info(struct mpc_intsrc *mp_irq) |
164 | { | 159 | { |
165 | apic_printk(APIC_VERBOSE, "Int: type %d, pol %d, trig %d, bus %02x," | 160 | apic_printk(APIC_VERBOSE, "Int: type %d, pol %d, trig %d, bus %02x," |
166 | " IRQ %02x, APIC ID %x, APIC INT %02x\n", | 161 | " IRQ %02x, APIC ID %x, APIC INT %02x\n", |
167 | mp_irq->mp_irqtype, mp_irq->mp_irqflag & 3, | 162 | mp_irq->irqtype, mp_irq->irqflag & 3, |
168 | (mp_irq->mp_irqflag >> 2) & 3, mp_irq->mp_srcbus, | 163 | (mp_irq->irqflag >> 2) & 3, mp_irq->srcbus, |
169 | mp_irq->mp_srcbusirq, mp_irq->mp_dstapic, mp_irq->mp_dstirq); | 164 | mp_irq->srcbusirq, mp_irq->dstapic, mp_irq->dstirq); |
170 | } | 165 | } |
171 | 166 | ||
172 | static void __init assign_to_mp_irq(struct mpc_intsrc *m, | 167 | static void __init assign_to_mp_irq(struct mpc_intsrc *m, |
173 | struct mp_config_intsrc *mp_irq) | 168 | struct mpc_intsrc *mp_irq) |
174 | { | 169 | { |
175 | mp_irq->mp_dstapic = m->dstapic; | 170 | mp_irq->dstapic = m->dstapic; |
176 | mp_irq->mp_type = m->type; | 171 | mp_irq->type = m->type; |
177 | mp_irq->mp_irqtype = m->irqtype; | 172 | mp_irq->irqtype = m->irqtype; |
178 | mp_irq->mp_irqflag = m->irqflag; | 173 | mp_irq->irqflag = m->irqflag; |
179 | mp_irq->mp_srcbus = m->srcbus; | 174 | mp_irq->srcbus = m->srcbus; |
180 | mp_irq->mp_srcbusirq = m->srcbusirq; | 175 | mp_irq->srcbusirq = m->srcbusirq; |
181 | mp_irq->mp_dstirq = m->dstirq; | 176 | mp_irq->dstirq = m->dstirq; |
182 | } | 177 | } |
183 | 178 | ||
184 | static void __init assign_to_mpc_intsrc(struct mp_config_intsrc *mp_irq, | 179 | static void __init assign_to_mpc_intsrc(struct mpc_intsrc *mp_irq, |
185 | struct mpc_intsrc *m) | 180 | struct mpc_intsrc *m) |
186 | { | 181 | { |
187 | m->dstapic = mp_irq->mp_dstapic; | 182 | m->dstapic = mp_irq->dstapic; |
188 | m->type = mp_irq->mp_type; | 183 | m->type = mp_irq->type; |
189 | m->irqtype = mp_irq->mp_irqtype; | 184 | m->irqtype = mp_irq->irqtype; |
190 | m->irqflag = mp_irq->mp_irqflag; | 185 | m->irqflag = mp_irq->irqflag; |
191 | m->srcbus = mp_irq->mp_srcbus; | 186 | m->srcbus = mp_irq->srcbus; |
192 | m->srcbusirq = mp_irq->mp_srcbusirq; | 187 | m->srcbusirq = mp_irq->srcbusirq; |
193 | m->dstirq = mp_irq->mp_dstirq; | 188 | m->dstirq = mp_irq->dstirq; |
194 | } | 189 | } |
195 | 190 | ||
196 | static int __init mp_irq_mpc_intsrc_cmp(struct mp_config_intsrc *mp_irq, | 191 | static int __init mp_irq_mpc_intsrc_cmp(struct mpc_intsrc *mp_irq, |
197 | struct mpc_intsrc *m) | 192 | struct mpc_intsrc *m) |
198 | { | 193 | { |
199 | if (mp_irq->mp_dstapic != m->dstapic) | 194 | if (mp_irq->dstapic != m->dstapic) |
200 | return 1; | 195 | return 1; |
201 | if (mp_irq->mp_type != m->type) | 196 | if (mp_irq->type != m->type) |
202 | return 2; | 197 | return 2; |
203 | if (mp_irq->mp_irqtype != m->irqtype) | 198 | if (mp_irq->irqtype != m->irqtype) |
204 | return 3; | 199 | return 3; |
205 | if (mp_irq->mp_irqflag != m->irqflag) | 200 | if (mp_irq->irqflag != m->irqflag) |
206 | return 4; | 201 | return 4; |
207 | if (mp_irq->mp_srcbus != m->srcbus) | 202 | if (mp_irq->srcbus != m->srcbus) |
208 | return 5; | 203 | return 5; |
209 | if (mp_irq->mp_srcbusirq != m->srcbusirq) | 204 | if (mp_irq->srcbusirq != m->srcbusirq) |
210 | return 6; | 205 | return 6; |
211 | if (mp_irq->mp_dstirq != m->dstirq) | 206 | if (mp_irq->dstirq != m->dstirq) |
212 | return 7; | 207 | return 7; |
213 | 208 | ||
214 | return 0; | 209 | return 0; |
@@ -292,16 +287,7 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early) | |||
292 | return 0; | 287 | return 0; |
293 | 288 | ||
294 | #ifdef CONFIG_X86_32 | 289 | #ifdef CONFIG_X86_32 |
295 | /* | 290 | generic_mps_oem_check(mpc, oem, str); |
296 | * need to make sure summit and es7000's mps_oem_check is safe to be | ||
297 | * called early via genericarch 's mps_oem_check | ||
298 | */ | ||
299 | if (early) { | ||
300 | #ifdef CONFIG_X86_NUMAQ | ||
301 | numaq_mps_oem_check(mpc, oem, str); | ||
302 | #endif | ||
303 | } else | ||
304 | mps_oem_check(mpc, oem, str); | ||
305 | #endif | 291 | #endif |
306 | /* save the local APIC address, it might be non-default */ | 292 | /* save the local APIC address, it might be non-default */ |
307 | if (!acpi_lapic) | 293 | if (!acpi_lapic) |
@@ -386,13 +372,13 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early) | |||
386 | (*x86_quirks->mpc_record)++; | 372 | (*x86_quirks->mpc_record)++; |
387 | } | 373 | } |
388 | 374 | ||
389 | #ifdef CONFIG_X86_GENERICARCH | 375 | #ifdef CONFIG_X86_BIGSMP |
390 | generic_bigsmp_probe(); | 376 | generic_bigsmp_probe(); |
391 | #endif | 377 | #endif |
392 | 378 | ||
393 | #ifdef CONFIG_X86_32 | 379 | if (apic->setup_apic_routing) |
394 | setup_apic_routing(); | 380 | apic->setup_apic_routing(); |
395 | #endif | 381 | |
396 | if (!num_processors) | 382 | if (!num_processors) |
397 | printk(KERN_ERR "MPTABLE: no processors registered!\n"); | 383 | printk(KERN_ERR "MPTABLE: no processors registered!\n"); |
398 | return num_processors; | 384 | return num_processors; |
@@ -417,7 +403,7 @@ static void __init construct_default_ioirq_mptable(int mpc_default_type) | |||
417 | intsrc.type = MP_INTSRC; | 403 | intsrc.type = MP_INTSRC; |
418 | intsrc.irqflag = 0; /* conforming */ | 404 | intsrc.irqflag = 0; /* conforming */ |
419 | intsrc.srcbus = 0; | 405 | intsrc.srcbus = 0; |
420 | intsrc.dstapic = mp_ioapics[0].mp_apicid; | 406 | intsrc.dstapic = mp_ioapics[0].apicid; |
421 | 407 | ||
422 | intsrc.irqtype = mp_INT; | 408 | intsrc.irqtype = mp_INT; |
423 | 409 | ||
@@ -570,14 +556,14 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type) | |||
570 | } | 556 | } |
571 | } | 557 | } |
572 | 558 | ||
573 | static struct intel_mp_floating *mpf_found; | 559 | static struct mpf_intel *mpf_found; |
574 | 560 | ||
575 | /* | 561 | /* |
576 | * Scan the memory blocks for an SMP configuration block. | 562 | * Scan the memory blocks for an SMP configuration block. |
577 | */ | 563 | */ |
578 | static void __init __get_smp_config(unsigned int early) | 564 | static void __init __get_smp_config(unsigned int early) |
579 | { | 565 | { |
580 | struct intel_mp_floating *mpf = mpf_found; | 566 | struct mpf_intel *mpf = mpf_found; |
581 | 567 | ||
582 | if (!mpf) | 568 | if (!mpf) |
583 | return; | 569 | return; |
@@ -598,9 +584,9 @@ static void __init __get_smp_config(unsigned int early) | |||
598 | } | 584 | } |
599 | 585 | ||
600 | printk(KERN_INFO "Intel MultiProcessor Specification v1.%d\n", | 586 | printk(KERN_INFO "Intel MultiProcessor Specification v1.%d\n", |
601 | mpf->mpf_specification); | 587 | mpf->specification); |
602 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32) | 588 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32) |
603 | if (mpf->mpf_feature2 & (1 << 7)) { | 589 | if (mpf->feature2 & (1 << 7)) { |
604 | printk(KERN_INFO " IMCR and PIC compatibility mode.\n"); | 590 | printk(KERN_INFO " IMCR and PIC compatibility mode.\n"); |
605 | pic_mode = 1; | 591 | pic_mode = 1; |
606 | } else { | 592 | } else { |
@@ -611,7 +597,7 @@ static void __init __get_smp_config(unsigned int early) | |||
611 | /* | 597 | /* |
612 | * Now see if we need to read further. | 598 | * Now see if we need to read further. |
613 | */ | 599 | */ |
614 | if (mpf->mpf_feature1 != 0) { | 600 | if (mpf->feature1 != 0) { |
615 | if (early) { | 601 | if (early) { |
616 | /* | 602 | /* |
617 | * local APIC has default address | 603 | * local APIC has default address |
@@ -621,16 +607,16 @@ static void __init __get_smp_config(unsigned int early) | |||
621 | } | 607 | } |
622 | 608 | ||
623 | printk(KERN_INFO "Default MP configuration #%d\n", | 609 | printk(KERN_INFO "Default MP configuration #%d\n", |
624 | mpf->mpf_feature1); | 610 | mpf->feature1); |
625 | construct_default_ISA_mptable(mpf->mpf_feature1); | 611 | construct_default_ISA_mptable(mpf->feature1); |
626 | 612 | ||
627 | } else if (mpf->mpf_physptr) { | 613 | } else if (mpf->physptr) { |
628 | 614 | ||
629 | /* | 615 | /* |
630 | * Read the physical hardware table. Anything here will | 616 | * Read the physical hardware table. Anything here will |
631 | * override the defaults. | 617 | * override the defaults. |
632 | */ | 618 | */ |
633 | if (!smp_read_mpc(phys_to_virt(mpf->mpf_physptr), early)) { | 619 | if (!smp_read_mpc(phys_to_virt(mpf->physptr), early)) { |
634 | #ifdef CONFIG_X86_LOCAL_APIC | 620 | #ifdef CONFIG_X86_LOCAL_APIC |
635 | smp_found_config = 0; | 621 | smp_found_config = 0; |
636 | #endif | 622 | #endif |
@@ -688,19 +674,19 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, | |||
688 | unsigned reserve) | 674 | unsigned reserve) |
689 | { | 675 | { |
690 | unsigned int *bp = phys_to_virt(base); | 676 | unsigned int *bp = phys_to_virt(base); |
691 | struct intel_mp_floating *mpf; | 677 | struct mpf_intel *mpf; |
692 | 678 | ||
693 | apic_printk(APIC_VERBOSE, "Scan SMP from %p for %ld bytes.\n", | 679 | apic_printk(APIC_VERBOSE, "Scan SMP from %p for %ld bytes.\n", |
694 | bp, length); | 680 | bp, length); |
695 | BUILD_BUG_ON(sizeof(*mpf) != 16); | 681 | BUILD_BUG_ON(sizeof(*mpf) != 16); |
696 | 682 | ||
697 | while (length > 0) { | 683 | while (length > 0) { |
698 | mpf = (struct intel_mp_floating *)bp; | 684 | mpf = (struct mpf_intel *)bp; |
699 | if ((*bp == SMP_MAGIC_IDENT) && | 685 | if ((*bp == SMP_MAGIC_IDENT) && |
700 | (mpf->mpf_length == 1) && | 686 | (mpf->length == 1) && |
701 | !mpf_checksum((unsigned char *)bp, 16) && | 687 | !mpf_checksum((unsigned char *)bp, 16) && |
702 | ((mpf->mpf_specification == 1) | 688 | ((mpf->specification == 1) |
703 | || (mpf->mpf_specification == 4))) { | 689 | || (mpf->specification == 4))) { |
704 | #ifdef CONFIG_X86_LOCAL_APIC | 690 | #ifdef CONFIG_X86_LOCAL_APIC |
705 | smp_found_config = 1; | 691 | smp_found_config = 1; |
706 | #endif | 692 | #endif |
@@ -713,7 +699,7 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, | |||
713 | return 1; | 699 | return 1; |
714 | reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE, | 700 | reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE, |
715 | BOOTMEM_DEFAULT); | 701 | BOOTMEM_DEFAULT); |
716 | if (mpf->mpf_physptr) { | 702 | if (mpf->physptr) { |
717 | unsigned long size = PAGE_SIZE; | 703 | unsigned long size = PAGE_SIZE; |
718 | #ifdef CONFIG_X86_32 | 704 | #ifdef CONFIG_X86_32 |
719 | /* | 705 | /* |
@@ -722,14 +708,14 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, | |||
722 | * the bottom is mapped now. | 708 | * the bottom is mapped now. |
723 | * PC-9800's MPC table places on the very last | 709 | * PC-9800's MPC table places on the very last |
724 | * of physical memory; so that simply reserving | 710 | * of physical memory; so that simply reserving |
725 | * PAGE_SIZE from mpg->mpf_physptr yields BUG() | 711 | * PAGE_SIZE from mpf->physptr yields BUG() |
726 | * in reserve_bootmem. | 712 | * in reserve_bootmem. |
727 | */ | 713 | */ |
728 | unsigned long end = max_low_pfn * PAGE_SIZE; | 714 | unsigned long end = max_low_pfn * PAGE_SIZE; |
729 | if (mpf->mpf_physptr + size > end) | 715 | if (mpf->physptr + size > end) |
730 | size = end - mpf->mpf_physptr; | 716 | size = end - mpf->physptr; |
731 | #endif | 717 | #endif |
732 | reserve_bootmem_generic(mpf->mpf_physptr, size, | 718 | reserve_bootmem_generic(mpf->physptr, size, |
733 | BOOTMEM_DEFAULT); | 719 | BOOTMEM_DEFAULT); |
734 | } | 720 | } |
735 | 721 | ||
@@ -809,15 +795,15 @@ static int __init get_MP_intsrc_index(struct mpc_intsrc *m) | |||
809 | /* not legacy */ | 795 | /* not legacy */ |
810 | 796 | ||
811 | for (i = 0; i < mp_irq_entries; i++) { | 797 | for (i = 0; i < mp_irq_entries; i++) { |
812 | if (mp_irqs[i].mp_irqtype != mp_INT) | 798 | if (mp_irqs[i].irqtype != mp_INT) |
813 | continue; | 799 | continue; |
814 | 800 | ||
815 | if (mp_irqs[i].mp_irqflag != 0x0f) | 801 | if (mp_irqs[i].irqflag != 0x0f) |
816 | continue; | 802 | continue; |
817 | 803 | ||
818 | if (mp_irqs[i].mp_srcbus != m->srcbus) | 804 | if (mp_irqs[i].srcbus != m->srcbus) |
819 | continue; | 805 | continue; |
820 | if (mp_irqs[i].mp_srcbusirq != m->srcbusirq) | 806 | if (mp_irqs[i].srcbusirq != m->srcbusirq) |
821 | continue; | 807 | continue; |
822 | if (irq_used[i]) { | 808 | if (irq_used[i]) { |
823 | /* already claimed */ | 809 | /* already claimed */ |
@@ -922,10 +908,10 @@ static int __init replace_intsrc_all(struct mpc_table *mpc, | |||
922 | if (irq_used[i]) | 908 | if (irq_used[i]) |
923 | continue; | 909 | continue; |
924 | 910 | ||
925 | if (mp_irqs[i].mp_irqtype != mp_INT) | 911 | if (mp_irqs[i].irqtype != mp_INT) |
926 | continue; | 912 | continue; |
927 | 913 | ||
928 | if (mp_irqs[i].mp_irqflag != 0x0f) | 914 | if (mp_irqs[i].irqflag != 0x0f) |
929 | continue; | 915 | continue; |
930 | 916 | ||
931 | if (nr_m_spare > 0) { | 917 | if (nr_m_spare > 0) { |
@@ -1001,7 +987,7 @@ static int __init update_mp_table(void) | |||
1001 | { | 987 | { |
1002 | char str[16]; | 988 | char str[16]; |
1003 | char oem[10]; | 989 | char oem[10]; |
1004 | struct intel_mp_floating *mpf; | 990 | struct mpf_intel *mpf; |
1005 | struct mpc_table *mpc, *mpc_new; | 991 | struct mpc_table *mpc, *mpc_new; |
1006 | 992 | ||
1007 | if (!enable_update_mptable) | 993 | if (!enable_update_mptable) |
@@ -1014,19 +1000,19 @@ static int __init update_mp_table(void) | |||
1014 | /* | 1000 | /* |
1015 | * Now see if we need to go further. | 1001 | * Now see if we need to go further. |
1016 | */ | 1002 | */ |
1017 | if (mpf->mpf_feature1 != 0) | 1003 | if (mpf->feature1 != 0) |
1018 | return 0; | 1004 | return 0; |
1019 | 1005 | ||
1020 | if (!mpf->mpf_physptr) | 1006 | if (!mpf->physptr) |
1021 | return 0; | 1007 | return 0; |
1022 | 1008 | ||
1023 | mpc = phys_to_virt(mpf->mpf_physptr); | 1009 | mpc = phys_to_virt(mpf->physptr); |
1024 | 1010 | ||
1025 | if (!smp_check_mpc(mpc, oem, str)) | 1011 | if (!smp_check_mpc(mpc, oem, str)) |
1026 | return 0; | 1012 | return 0; |
1027 | 1013 | ||
1028 | printk(KERN_INFO "mpf: %lx\n", virt_to_phys(mpf)); | 1014 | printk(KERN_INFO "mpf: %lx\n", virt_to_phys(mpf)); |
1029 | printk(KERN_INFO "mpf_physptr: %x\n", mpf->mpf_physptr); | 1015 | printk(KERN_INFO "physptr: %x\n", mpf->physptr); |
1030 | 1016 | ||
1031 | if (mpc_new_phys && mpc->length > mpc_new_length) { | 1017 | if (mpc_new_phys && mpc->length > mpc_new_length) { |
1032 | mpc_new_phys = 0; | 1018 | mpc_new_phys = 0; |
@@ -1047,23 +1033,23 @@ static int __init update_mp_table(void) | |||
1047 | } | 1033 | } |
1048 | printk(KERN_INFO "use in-positon replacing\n"); | 1034 | printk(KERN_INFO "use in-positon replacing\n"); |
1049 | } else { | 1035 | } else { |
1050 | mpf->mpf_physptr = mpc_new_phys; | 1036 | mpf->physptr = mpc_new_phys; |
1051 | mpc_new = phys_to_virt(mpc_new_phys); | 1037 | mpc_new = phys_to_virt(mpc_new_phys); |
1052 | memcpy(mpc_new, mpc, mpc->length); | 1038 | memcpy(mpc_new, mpc, mpc->length); |
1053 | mpc = mpc_new; | 1039 | mpc = mpc_new; |
1054 | /* check if we can modify that */ | 1040 | /* check if we can modify that */ |
1055 | if (mpc_new_phys - mpf->mpf_physptr) { | 1041 | if (mpc_new_phys - mpf->physptr) { |
1056 | struct intel_mp_floating *mpf_new; | 1042 | struct mpf_intel *mpf_new; |
1057 | /* steal 16 bytes from [0, 1k) */ | 1043 | /* steal 16 bytes from [0, 1k) */ |
1058 | printk(KERN_INFO "mpf new: %x\n", 0x400 - 16); | 1044 | printk(KERN_INFO "mpf new: %x\n", 0x400 - 16); |
1059 | mpf_new = phys_to_virt(0x400 - 16); | 1045 | mpf_new = phys_to_virt(0x400 - 16); |
1060 | memcpy(mpf_new, mpf, 16); | 1046 | memcpy(mpf_new, mpf, 16); |
1061 | mpf = mpf_new; | 1047 | mpf = mpf_new; |
1062 | mpf->mpf_physptr = mpc_new_phys; | 1048 | mpf->physptr = mpc_new_phys; |
1063 | } | 1049 | } |
1064 | mpf->mpf_checksum = 0; | 1050 | mpf->checksum = 0; |
1065 | mpf->mpf_checksum -= mpf_checksum((unsigned char *)mpf, 16); | 1051 | mpf->checksum -= mpf_checksum((unsigned char *)mpf, 16); |
1066 | printk(KERN_INFO "mpf_physptr new: %x\n", mpf->mpf_physptr); | 1052 | printk(KERN_INFO "physptr new: %x\n", mpf->physptr); |
1067 | } | 1053 | } |
1068 | 1054 | ||
1069 | /* | 1055 | /* |
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index 726266695b2c..3cf3413ec626 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c | |||
@@ -35,10 +35,10 @@ | |||
35 | #include <linux/device.h> | 35 | #include <linux/device.h> |
36 | #include <linux/cpu.h> | 36 | #include <linux/cpu.h> |
37 | #include <linux/notifier.h> | 37 | #include <linux/notifier.h> |
38 | #include <linux/uaccess.h> | ||
38 | 39 | ||
39 | #include <asm/processor.h> | 40 | #include <asm/processor.h> |
40 | #include <asm/msr.h> | 41 | #include <asm/msr.h> |
41 | #include <asm/uaccess.h> | ||
42 | #include <asm/system.h> | 42 | #include <asm/system.h> |
43 | 43 | ||
44 | static struct class *msr_class; | 44 | static struct class *msr_class; |
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c index 7228979f1e7f..bdfad80c3cf1 100644 --- a/arch/x86/kernel/nmi.c +++ b/arch/x86/kernel/nmi.c | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | #include <asm/mce.h> | 35 | #include <asm/mce.h> |
36 | 36 | ||
37 | #include <mach_traps.h> | 37 | #include <asm/mach_traps.h> |
38 | 38 | ||
39 | int unknown_nmi_panic; | 39 | int unknown_nmi_panic; |
40 | int nmi_watchdog_enabled; | 40 | int nmi_watchdog_enabled; |
@@ -61,11 +61,7 @@ static int endflag __initdata; | |||
61 | 61 | ||
62 | static inline unsigned int get_nmi_count(int cpu) | 62 | static inline unsigned int get_nmi_count(int cpu) |
63 | { | 63 | { |
64 | #ifdef CONFIG_X86_64 | 64 | return per_cpu(irq_stat, cpu).__nmi_count; |
65 | return cpu_pda(cpu)->__nmi_count; | ||
66 | #else | ||
67 | return nmi_count(cpu); | ||
68 | #endif | ||
69 | } | 65 | } |
70 | 66 | ||
71 | static inline int mce_in_progress(void) | 67 | static inline int mce_in_progress(void) |
@@ -82,12 +78,8 @@ static inline int mce_in_progress(void) | |||
82 | */ | 78 | */ |
83 | static inline unsigned int get_timer_irqs(int cpu) | 79 | static inline unsigned int get_timer_irqs(int cpu) |
84 | { | 80 | { |
85 | #ifdef CONFIG_X86_64 | ||
86 | return read_pda(apic_timer_irqs) + read_pda(irq0_irqs); | ||
87 | #else | ||
88 | return per_cpu(irq_stat, cpu).apic_timer_irqs + | 81 | return per_cpu(irq_stat, cpu).apic_timer_irqs + |
89 | per_cpu(irq_stat, cpu).irq0_irqs; | 82 | per_cpu(irq_stat, cpu).irq0_irqs; |
90 | #endif | ||
91 | } | 83 | } |
92 | 84 | ||
93 | #ifdef CONFIG_SMP | 85 | #ifdef CONFIG_SMP |
diff --git a/arch/x86/kernel/numaq_32.c b/arch/x86/kernel/numaq_32.c index f2191d4f2717..947748e17211 100644 --- a/arch/x86/kernel/numaq_32.c +++ b/arch/x86/kernel/numaq_32.c | |||
@@ -236,7 +236,7 @@ static int __init numaq_setup_ioapic_ids(void) | |||
236 | 236 | ||
237 | static int __init numaq_update_genapic(void) | 237 | static int __init numaq_update_genapic(void) |
238 | { | 238 | { |
239 | genapic->wakeup_cpu = wakeup_secondary_cpu_via_nmi; | 239 | apic->wakeup_cpu = wakeup_secondary_cpu_via_nmi; |
240 | 240 | ||
241 | return 0; | 241 | return 0; |
242 | } | 242 | } |
@@ -291,3 +291,279 @@ int __init get_memcfg_numaq(void) | |||
291 | smp_dump_qct(); | 291 | smp_dump_qct(); |
292 | return 1; | 292 | return 1; |
293 | } | 293 | } |
294 | |||
295 | /* | ||
296 | * APIC driver for the IBM NUMAQ chipset. | ||
297 | */ | ||
298 | #define APIC_DEFINITION 1 | ||
299 | #include <linux/threads.h> | ||
300 | #include <linux/cpumask.h> | ||
301 | #include <asm/mpspec.h> | ||
302 | #include <asm/genapic.h> | ||
303 | #include <asm/fixmap.h> | ||
304 | #include <asm/apicdef.h> | ||
305 | #include <asm/ipi.h> | ||
306 | #include <linux/kernel.h> | ||
307 | #include <linux/string.h> | ||
308 | #include <linux/init.h> | ||
309 | #include <linux/numa.h> | ||
310 | #include <linux/smp.h> | ||
311 | #include <asm/numaq.h> | ||
312 | #include <asm/io.h> | ||
313 | #include <linux/mmzone.h> | ||
314 | #include <linux/nodemask.h> | ||
315 | |||
316 | #define NUMAQ_APIC_DFR_VALUE (APIC_DFR_CLUSTER) | ||
317 | |||
318 | static inline unsigned int numaq_get_apic_id(unsigned long x) | ||
319 | { | ||
320 | return (x >> 24) & 0x0F; | ||
321 | } | ||
322 | |||
323 | static inline void numaq_send_IPI_mask(const struct cpumask *mask, int vector) | ||
324 | { | ||
325 | default_send_IPI_mask_sequence_logical(mask, vector); | ||
326 | } | ||
327 | |||
328 | static inline void numaq_send_IPI_allbutself(int vector) | ||
329 | { | ||
330 | default_send_IPI_mask_allbutself_logical(cpu_online_mask, vector); | ||
331 | } | ||
332 | |||
333 | static inline void numaq_send_IPI_all(int vector) | ||
334 | { | ||
335 | numaq_send_IPI_mask(cpu_online_mask, vector); | ||
336 | } | ||
337 | |||
338 | extern void numaq_mps_oem_check(struct mpc_table *, char *, char *); | ||
339 | |||
340 | #define NUMAQ_TRAMPOLINE_PHYS_LOW (0x8) | ||
341 | #define NUMAQ_TRAMPOLINE_PHYS_HIGH (0xa) | ||
342 | |||
343 | /* | ||
344 | * Because we use NMIs rather than the INIT-STARTUP sequence to | ||
345 | * bootstrap the CPUs, the APIC may be in a weird state. Kick it: | ||
346 | */ | ||
347 | static inline void numaq_smp_callin_clear_local_apic(void) | ||
348 | { | ||
349 | clear_local_APIC(); | ||
350 | } | ||
351 | |||
352 | static inline void | ||
353 | numaq_store_NMI_vector(unsigned short *high, unsigned short *low) | ||
354 | { | ||
355 | printk("Storing NMI vector\n"); | ||
356 | *high = | ||
357 | *((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_HIGH)); | ||
358 | *low = | ||
359 | *((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_LOW)); | ||
360 | } | ||
361 | |||
362 | static inline const cpumask_t *numaq_target_cpus(void) | ||
363 | { | ||
364 | return &CPU_MASK_ALL; | ||
365 | } | ||
366 | |||
367 | static inline unsigned long | ||
368 | numaq_check_apicid_used(physid_mask_t bitmap, int apicid) | ||
369 | { | ||
370 | return physid_isset(apicid, bitmap); | ||
371 | } | ||
372 | |||
373 | static inline unsigned long numaq_check_apicid_present(int bit) | ||
374 | { | ||
375 | return physid_isset(bit, phys_cpu_present_map); | ||
376 | } | ||
377 | |||
378 | #define apicid_cluster(apicid) (apicid & 0xF0) | ||
379 | |||
380 | static inline int numaq_apic_id_registered(void) | ||
381 | { | ||
382 | return 1; | ||
383 | } | ||
384 | |||
385 | static inline void numaq_init_apic_ldr(void) | ||
386 | { | ||
387 | /* Already done in NUMA-Q firmware */ | ||
388 | } | ||
389 | |||
390 | static inline void numaq_setup_apic_routing(void) | ||
391 | { | ||
392 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | ||
393 | "NUMA-Q", nr_ioapics); | ||
394 | } | ||
395 | |||
396 | /* | ||
397 | * Skip adding the timer int on secondary nodes, which causes | ||
398 | * a small but painful rift in the time-space continuum. | ||
399 | */ | ||
400 | static inline int numaq_multi_timer_check(int apic, int irq) | ||
401 | { | ||
402 | return apic != 0 && irq == 0; | ||
403 | } | ||
404 | |||
405 | static inline physid_mask_t numaq_ioapic_phys_id_map(physid_mask_t phys_map) | ||
406 | { | ||
407 | /* We don't have a good way to do this yet - hack */ | ||
408 | return physids_promote(0xFUL); | ||
409 | } | ||
410 | |||
411 | /* Mapping from cpu number to logical apicid */ | ||
412 | extern u8 cpu_2_logical_apicid[]; | ||
413 | |||
414 | static inline int numaq_cpu_to_logical_apicid(int cpu) | ||
415 | { | ||
416 | if (cpu >= nr_cpu_ids) | ||
417 | return BAD_APICID; | ||
418 | return (int)cpu_2_logical_apicid[cpu]; | ||
419 | } | ||
420 | |||
421 | /* | ||
422 | * Supporting over 60 cpus on NUMA-Q requires a locality-dependent | ||
423 | * cpu to APIC ID relation to properly interact with the intelligent | ||
424 | * mode of the cluster controller. | ||
425 | */ | ||
426 | static inline int numaq_cpu_present_to_apicid(int mps_cpu) | ||
427 | { | ||
428 | if (mps_cpu < 60) | ||
429 | return ((mps_cpu >> 2) << 4) | (1 << (mps_cpu & 0x3)); | ||
430 | else | ||
431 | return BAD_APICID; | ||
432 | } | ||
433 | |||
434 | static inline int numaq_apicid_to_node(int logical_apicid) | ||
435 | { | ||
436 | return logical_apicid >> 4; | ||
437 | } | ||
438 | |||
439 | static inline physid_mask_t numaq_apicid_to_cpu_present(int logical_apicid) | ||
440 | { | ||
441 | int node = numaq_apicid_to_node(logical_apicid); | ||
442 | int cpu = __ffs(logical_apicid & 0xf); | ||
443 | |||
444 | return physid_mask_of_physid(cpu + 4*node); | ||
445 | } | ||
446 | |||
447 | extern void *xquad_portio; | ||
448 | |||
449 | static inline int numaq_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
450 | { | ||
451 | return 1; | ||
452 | } | ||
453 | |||
454 | /* | ||
455 | * We use physical apicids here, not logical, so just return the default | ||
456 | * physical broadcast to stop people from breaking us | ||
457 | */ | ||
458 | static inline unsigned int numaq_cpu_mask_to_apicid(const cpumask_t *cpumask) | ||
459 | { | ||
460 | return 0x0F; | ||
461 | } | ||
462 | |||
463 | static inline unsigned int | ||
464 | numaq_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
465 | const struct cpumask *andmask) | ||
466 | { | ||
467 | return 0x0F; | ||
468 | } | ||
469 | |||
470 | /* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */ | ||
471 | static inline int numaq_phys_pkg_id(int cpuid_apic, int index_msb) | ||
472 | { | ||
473 | return cpuid_apic >> index_msb; | ||
474 | } | ||
475 | static int __numaq_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | ||
476 | { | ||
477 | numaq_mps_oem_check(mpc, oem, productid); | ||
478 | return found_numaq; | ||
479 | } | ||
480 | |||
481 | static int probe_numaq(void) | ||
482 | { | ||
483 | /* already know from get_memcfg_numaq() */ | ||
484 | return found_numaq; | ||
485 | } | ||
486 | |||
487 | static void numaq_vector_allocation_domain(int cpu, cpumask_t *retmask) | ||
488 | { | ||
489 | /* Careful. Some cpus do not strictly honor the set of cpus | ||
490 | * specified in the interrupt destination when using lowest | ||
491 | * priority interrupt delivery mode. | ||
492 | * | ||
493 | * In particular there was a hyperthreading cpu observed to | ||
494 | * deliver interrupts to the wrong hyperthread when only one | ||
495 | * hyperthread was specified in the interrupt desitination. | ||
496 | */ | ||
497 | *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } }; | ||
498 | } | ||
499 | |||
500 | static void numaq_setup_portio_remap(void) | ||
501 | { | ||
502 | int num_quads = num_online_nodes(); | ||
503 | |||
504 | if (num_quads <= 1) | ||
505 | return; | ||
506 | |||
507 | printk("Remapping cross-quad port I/O for %d quads\n", num_quads); | ||
508 | xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD); | ||
509 | printk("xquad_portio vaddr 0x%08lx, len %08lx\n", | ||
510 | (u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD); | ||
511 | } | ||
512 | |||
513 | struct genapic apic_numaq = { | ||
514 | |||
515 | .name = "NUMAQ", | ||
516 | .probe = probe_numaq, | ||
517 | .acpi_madt_oem_check = NULL, | ||
518 | .apic_id_registered = numaq_apic_id_registered, | ||
519 | |||
520 | .irq_delivery_mode = dest_LowestPrio, | ||
521 | /* physical delivery on LOCAL quad: */ | ||
522 | .irq_dest_mode = 0, | ||
523 | |||
524 | .target_cpus = numaq_target_cpus, | ||
525 | .disable_esr = 1, | ||
526 | .dest_logical = APIC_DEST_LOGICAL, | ||
527 | .check_apicid_used = numaq_check_apicid_used, | ||
528 | .check_apicid_present = numaq_check_apicid_present, | ||
529 | |||
530 | .vector_allocation_domain = numaq_vector_allocation_domain, | ||
531 | .init_apic_ldr = numaq_init_apic_ldr, | ||
532 | |||
533 | .ioapic_phys_id_map = numaq_ioapic_phys_id_map, | ||
534 | .setup_apic_routing = numaq_setup_apic_routing, | ||
535 | .multi_timer_check = numaq_multi_timer_check, | ||
536 | .apicid_to_node = numaq_apicid_to_node, | ||
537 | .cpu_to_logical_apicid = numaq_cpu_to_logical_apicid, | ||
538 | .cpu_present_to_apicid = numaq_cpu_present_to_apicid, | ||
539 | .apicid_to_cpu_present = numaq_apicid_to_cpu_present, | ||
540 | .setup_portio_remap = numaq_setup_portio_remap, | ||
541 | .check_phys_apicid_present = numaq_check_phys_apicid_present, | ||
542 | .enable_apic_mode = NULL, | ||
543 | .phys_pkg_id = numaq_phys_pkg_id, | ||
544 | .mps_oem_check = __numaq_mps_oem_check, | ||
545 | |||
546 | .get_apic_id = numaq_get_apic_id, | ||
547 | .set_apic_id = NULL, | ||
548 | .apic_id_mask = 0x0F << 24, | ||
549 | |||
550 | .cpu_mask_to_apicid = numaq_cpu_mask_to_apicid, | ||
551 | .cpu_mask_to_apicid_and = numaq_cpu_mask_to_apicid_and, | ||
552 | |||
553 | .send_IPI_mask = numaq_send_IPI_mask, | ||
554 | .send_IPI_mask_allbutself = NULL, | ||
555 | .send_IPI_allbutself = numaq_send_IPI_allbutself, | ||
556 | .send_IPI_all = numaq_send_IPI_all, | ||
557 | .send_IPI_self = default_send_IPI_self, | ||
558 | |||
559 | .wakeup_cpu = NULL, | ||
560 | .trampoline_phys_low = NUMAQ_TRAMPOLINE_PHYS_LOW, | ||
561 | .trampoline_phys_high = NUMAQ_TRAMPOLINE_PHYS_HIGH, | ||
562 | |||
563 | /* We don't do anything here because we use NMI's to boot instead */ | ||
564 | .wait_for_init_deassert = NULL, | ||
565 | |||
566 | .smp_callin_clear_local_apic = numaq_smp_callin_clear_local_apic, | ||
567 | .store_NMI_vector = numaq_store_NMI_vector, | ||
568 | .inquire_remote_apic = NULL, | ||
569 | }; | ||
diff --git a/arch/x86/kernel/paravirt-spinlocks.c b/arch/x86/kernel/paravirt-spinlocks.c index 95777b0faa73..3a7c5a44082e 100644 --- a/arch/x86/kernel/paravirt-spinlocks.c +++ b/arch/x86/kernel/paravirt-spinlocks.c | |||
@@ -26,13 +26,3 @@ struct pv_lock_ops pv_lock_ops = { | |||
26 | }; | 26 | }; |
27 | EXPORT_SYMBOL(pv_lock_ops); | 27 | EXPORT_SYMBOL(pv_lock_ops); |
28 | 28 | ||
29 | void __init paravirt_use_bytelocks(void) | ||
30 | { | ||
31 | #ifdef CONFIG_SMP | ||
32 | pv_lock_ops.spin_is_locked = __byte_spin_is_locked; | ||
33 | pv_lock_ops.spin_is_contended = __byte_spin_is_contended; | ||
34 | pv_lock_ops.spin_lock = __byte_spin_lock; | ||
35 | pv_lock_ops.spin_trylock = __byte_spin_trylock; | ||
36 | pv_lock_ops.spin_unlock = __byte_spin_unlock; | ||
37 | #endif | ||
38 | } | ||
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index e4c8fb608873..202514be5923 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -435,7 +435,6 @@ struct pv_mmu_ops pv_mmu_ops = { | |||
435 | #endif /* PAGETABLE_LEVELS >= 3 */ | 435 | #endif /* PAGETABLE_LEVELS >= 3 */ |
436 | 436 | ||
437 | .pte_val = native_pte_val, | 437 | .pte_val = native_pte_val, |
438 | .pte_flags = native_pte_flags, | ||
439 | .pgd_val = native_pgd_val, | 438 | .pgd_val = native_pgd_val, |
440 | 439 | ||
441 | .make_pte = native_make_pte, | 440 | .make_pte = native_make_pte, |
diff --git a/arch/x86/kernel/probe_32.c b/arch/x86/kernel/probe_32.c new file mode 100644 index 000000000000..22337b75de62 --- /dev/null +++ b/arch/x86/kernel/probe_32.c | |||
@@ -0,0 +1,411 @@ | |||
1 | /* | ||
2 | * Default generic APIC driver. This handles up to 8 CPUs. | ||
3 | * | ||
4 | * Copyright 2003 Andi Kleen, SuSE Labs. | ||
5 | * Subject to the GNU Public License, v.2 | ||
6 | * | ||
7 | * Generic x86 APIC driver probe layer. | ||
8 | */ | ||
9 | #include <linux/threads.h> | ||
10 | #include <linux/cpumask.h> | ||
11 | #include <linux/string.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/ctype.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/errno.h> | ||
16 | #include <asm/fixmap.h> | ||
17 | #include <asm/mpspec.h> | ||
18 | #include <asm/apicdef.h> | ||
19 | #include <asm/genapic.h> | ||
20 | #include <asm/setup.h> | ||
21 | |||
22 | #include <linux/threads.h> | ||
23 | #include <linux/cpumask.h> | ||
24 | #include <asm/mpspec.h> | ||
25 | #include <asm/genapic.h> | ||
26 | #include <asm/fixmap.h> | ||
27 | #include <asm/apicdef.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/string.h> | ||
30 | #include <linux/smp.h> | ||
31 | #include <linux/init.h> | ||
32 | #include <asm/genapic.h> | ||
33 | #include <asm/ipi.h> | ||
34 | |||
35 | #include <linux/smp.h> | ||
36 | #include <linux/init.h> | ||
37 | #include <linux/interrupt.h> | ||
38 | #include <asm/acpi.h> | ||
39 | #include <asm/arch_hooks.h> | ||
40 | #include <asm/e820.h> | ||
41 | #include <asm/setup.h> | ||
42 | |||
43 | #include <asm/genapic.h> | ||
44 | |||
45 | #ifdef CONFIG_HOTPLUG_CPU | ||
46 | #define DEFAULT_SEND_IPI (1) | ||
47 | #else | ||
48 | #define DEFAULT_SEND_IPI (0) | ||
49 | #endif | ||
50 | |||
51 | int no_broadcast = DEFAULT_SEND_IPI; | ||
52 | |||
53 | #ifdef CONFIG_X86_LOCAL_APIC | ||
54 | |||
55 | static void default_vector_allocation_domain(int cpu, struct cpumask *retmask) | ||
56 | { | ||
57 | /* | ||
58 | * Careful. Some cpus do not strictly honor the set of cpus | ||
59 | * specified in the interrupt destination when using lowest | ||
60 | * priority interrupt delivery mode. | ||
61 | * | ||
62 | * In particular there was a hyperthreading cpu observed to | ||
63 | * deliver interrupts to the wrong hyperthread when only one | ||
64 | * hyperthread was specified in the interrupt desitination. | ||
65 | */ | ||
66 | *retmask = (cpumask_t) { { [0] = APIC_ALL_CPUS } }; | ||
67 | } | ||
68 | |||
69 | /* should be called last. */ | ||
70 | static int probe_default(void) | ||
71 | { | ||
72 | return 1; | ||
73 | } | ||
74 | |||
75 | struct genapic apic_default = { | ||
76 | |||
77 | .name = "default", | ||
78 | .probe = probe_default, | ||
79 | .acpi_madt_oem_check = NULL, | ||
80 | .apic_id_registered = default_apic_id_registered, | ||
81 | |||
82 | .irq_delivery_mode = dest_LowestPrio, | ||
83 | /* logical delivery broadcast to all CPUs: */ | ||
84 | .irq_dest_mode = 1, | ||
85 | |||
86 | .target_cpus = default_target_cpus, | ||
87 | .disable_esr = 0, | ||
88 | .dest_logical = APIC_DEST_LOGICAL, | ||
89 | .check_apicid_used = default_check_apicid_used, | ||
90 | .check_apicid_present = default_check_apicid_present, | ||
91 | |||
92 | .vector_allocation_domain = default_vector_allocation_domain, | ||
93 | .init_apic_ldr = default_init_apic_ldr, | ||
94 | |||
95 | .ioapic_phys_id_map = default_ioapic_phys_id_map, | ||
96 | .setup_apic_routing = default_setup_apic_routing, | ||
97 | .multi_timer_check = NULL, | ||
98 | .apicid_to_node = default_apicid_to_node, | ||
99 | .cpu_to_logical_apicid = default_cpu_to_logical_apicid, | ||
100 | .cpu_present_to_apicid = default_cpu_present_to_apicid, | ||
101 | .apicid_to_cpu_present = default_apicid_to_cpu_present, | ||
102 | .setup_portio_remap = NULL, | ||
103 | .check_phys_apicid_present = default_check_phys_apicid_present, | ||
104 | .enable_apic_mode = NULL, | ||
105 | .phys_pkg_id = default_phys_pkg_id, | ||
106 | .mps_oem_check = NULL, | ||
107 | |||
108 | .get_apic_id = default_get_apic_id, | ||
109 | .set_apic_id = NULL, | ||
110 | .apic_id_mask = 0x0F << 24, | ||
111 | |||
112 | .cpu_mask_to_apicid = default_cpu_mask_to_apicid, | ||
113 | .cpu_mask_to_apicid_and = default_cpu_mask_to_apicid_and, | ||
114 | |||
115 | .send_IPI_mask = default_send_IPI_mask_logical, | ||
116 | .send_IPI_mask_allbutself = default_send_IPI_mask_allbutself_logical, | ||
117 | .send_IPI_allbutself = default_send_IPI_allbutself, | ||
118 | .send_IPI_all = default_send_IPI_all, | ||
119 | .send_IPI_self = default_send_IPI_self, | ||
120 | |||
121 | .wakeup_cpu = NULL, | ||
122 | .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, | ||
123 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | ||
124 | |||
125 | .wait_for_init_deassert = default_wait_for_init_deassert, | ||
126 | |||
127 | .smp_callin_clear_local_apic = NULL, | ||
128 | .store_NMI_vector = NULL, | ||
129 | .inquire_remote_apic = default_inquire_remote_apic, | ||
130 | }; | ||
131 | |||
132 | extern struct genapic apic_numaq; | ||
133 | extern struct genapic apic_summit; | ||
134 | extern struct genapic apic_bigsmp; | ||
135 | extern struct genapic apic_es7000; | ||
136 | extern struct genapic apic_default; | ||
137 | |||
138 | struct genapic *apic = &apic_default; | ||
139 | |||
140 | static struct genapic *apic_probe[] __initdata = { | ||
141 | #ifdef CONFIG_X86_NUMAQ | ||
142 | &apic_numaq, | ||
143 | #endif | ||
144 | #ifdef CONFIG_X86_SUMMIT | ||
145 | &apic_summit, | ||
146 | #endif | ||
147 | #ifdef CONFIG_X86_BIGSMP | ||
148 | &apic_bigsmp, | ||
149 | #endif | ||
150 | #ifdef CONFIG_X86_ES7000 | ||
151 | &apic_es7000, | ||
152 | #endif | ||
153 | &apic_default, /* must be last */ | ||
154 | NULL, | ||
155 | }; | ||
156 | |||
157 | static int cmdline_apic __initdata; | ||
158 | static int __init parse_apic(char *arg) | ||
159 | { | ||
160 | int i; | ||
161 | |||
162 | if (!arg) | ||
163 | return -EINVAL; | ||
164 | |||
165 | for (i = 0; apic_probe[i]; i++) { | ||
166 | if (!strcmp(apic_probe[i]->name, arg)) { | ||
167 | apic = apic_probe[i]; | ||
168 | cmdline_apic = 1; | ||
169 | return 0; | ||
170 | } | ||
171 | } | ||
172 | |||
173 | if (x86_quirks->update_genapic) | ||
174 | x86_quirks->update_genapic(); | ||
175 | |||
176 | /* Parsed again by __setup for debug/verbose */ | ||
177 | return 0; | ||
178 | } | ||
179 | early_param("apic", parse_apic); | ||
180 | |||
181 | void __init generic_bigsmp_probe(void) | ||
182 | { | ||
183 | #ifdef CONFIG_X86_BIGSMP | ||
184 | /* | ||
185 | * This routine is used to switch to bigsmp mode when | ||
186 | * - There is no apic= option specified by the user | ||
187 | * - generic_apic_probe() has chosen apic_default as the sub_arch | ||
188 | * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support | ||
189 | */ | ||
190 | |||
191 | if (!cmdline_apic && apic == &apic_default) { | ||
192 | if (apic_bigsmp.probe()) { | ||
193 | apic = &apic_bigsmp; | ||
194 | if (x86_quirks->update_genapic) | ||
195 | x86_quirks->update_genapic(); | ||
196 | printk(KERN_INFO "Overriding APIC driver with %s\n", | ||
197 | apic->name); | ||
198 | } | ||
199 | } | ||
200 | #endif | ||
201 | } | ||
202 | |||
203 | void __init generic_apic_probe(void) | ||
204 | { | ||
205 | if (!cmdline_apic) { | ||
206 | int i; | ||
207 | for (i = 0; apic_probe[i]; i++) { | ||
208 | if (apic_probe[i]->probe()) { | ||
209 | apic = apic_probe[i]; | ||
210 | break; | ||
211 | } | ||
212 | } | ||
213 | /* Not visible without early console */ | ||
214 | if (!apic_probe[i]) | ||
215 | panic("Didn't find an APIC driver"); | ||
216 | |||
217 | if (x86_quirks->update_genapic) | ||
218 | x86_quirks->update_genapic(); | ||
219 | } | ||
220 | printk(KERN_INFO "Using APIC driver %s\n", apic->name); | ||
221 | } | ||
222 | |||
223 | /* These functions can switch the APIC even after the initial ->probe() */ | ||
224 | |||
225 | int __init | ||
226 | generic_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | ||
227 | { | ||
228 | int i; | ||
229 | |||
230 | for (i = 0; apic_probe[i]; ++i) { | ||
231 | if (!apic_probe[i]->mps_oem_check) | ||
232 | continue; | ||
233 | if (!apic_probe[i]->mps_oem_check(mpc, oem, productid)) | ||
234 | continue; | ||
235 | |||
236 | if (!cmdline_apic) { | ||
237 | apic = apic_probe[i]; | ||
238 | if (x86_quirks->update_genapic) | ||
239 | x86_quirks->update_genapic(); | ||
240 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", | ||
241 | apic->name); | ||
242 | } | ||
243 | return 1; | ||
244 | } | ||
245 | return 0; | ||
246 | } | ||
247 | |||
248 | int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
249 | { | ||
250 | int i; | ||
251 | |||
252 | for (i = 0; apic_probe[i]; ++i) { | ||
253 | if (!apic_probe[i]->acpi_madt_oem_check) | ||
254 | continue; | ||
255 | if (!apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) | ||
256 | continue; | ||
257 | |||
258 | if (!cmdline_apic) { | ||
259 | apic = apic_probe[i]; | ||
260 | if (x86_quirks->update_genapic) | ||
261 | x86_quirks->update_genapic(); | ||
262 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", | ||
263 | apic->name); | ||
264 | } | ||
265 | return 1; | ||
266 | } | ||
267 | return 0; | ||
268 | } | ||
269 | |||
270 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
271 | |||
272 | /** | ||
273 | * pre_intr_init_hook - initialisation prior to setting up interrupt vectors | ||
274 | * | ||
275 | * Description: | ||
276 | * Perform any necessary interrupt initialisation prior to setting up | ||
277 | * the "ordinary" interrupt call gates. For legacy reasons, the ISA | ||
278 | * interrupts should be initialised here if the machine emulates a PC | ||
279 | * in any way. | ||
280 | **/ | ||
281 | void __init pre_intr_init_hook(void) | ||
282 | { | ||
283 | if (x86_quirks->arch_pre_intr_init) { | ||
284 | if (x86_quirks->arch_pre_intr_init()) | ||
285 | return; | ||
286 | } | ||
287 | init_ISA_irqs(); | ||
288 | } | ||
289 | |||
290 | /** | ||
291 | * intr_init_hook - post gate setup interrupt initialisation | ||
292 | * | ||
293 | * Description: | ||
294 | * Fill in any interrupts that may have been left out by the general | ||
295 | * init_IRQ() routine. interrupts having to do with the machine rather | ||
296 | * than the devices on the I/O bus (like APIC interrupts in intel MP | ||
297 | * systems) are started here. | ||
298 | **/ | ||
299 | void __init intr_init_hook(void) | ||
300 | { | ||
301 | if (x86_quirks->arch_intr_init) { | ||
302 | if (x86_quirks->arch_intr_init()) | ||
303 | return; | ||
304 | } | ||
305 | } | ||
306 | |||
307 | /** | ||
308 | * pre_setup_arch_hook - hook called prior to any setup_arch() execution | ||
309 | * | ||
310 | * Description: | ||
311 | * generally used to activate any machine specific identification | ||
312 | * routines that may be needed before setup_arch() runs. On Voyager | ||
313 | * this is used to get the board revision and type. | ||
314 | **/ | ||
315 | void __init pre_setup_arch_hook(void) | ||
316 | { | ||
317 | } | ||
318 | |||
319 | /** | ||
320 | * trap_init_hook - initialise system specific traps | ||
321 | * | ||
322 | * Description: | ||
323 | * Called as the final act of trap_init(). Used in VISWS to initialise | ||
324 | * the various board specific APIC traps. | ||
325 | **/ | ||
326 | void __init trap_init_hook(void) | ||
327 | { | ||
328 | if (x86_quirks->arch_trap_init) { | ||
329 | if (x86_quirks->arch_trap_init()) | ||
330 | return; | ||
331 | } | ||
332 | } | ||
333 | |||
334 | static struct irqaction irq0 = { | ||
335 | .handler = timer_interrupt, | ||
336 | .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL, | ||
337 | .mask = CPU_MASK_NONE, | ||
338 | .name = "timer" | ||
339 | }; | ||
340 | |||
341 | /** | ||
342 | * pre_time_init_hook - do any specific initialisations before. | ||
343 | * | ||
344 | **/ | ||
345 | void __init pre_time_init_hook(void) | ||
346 | { | ||
347 | if (x86_quirks->arch_pre_time_init) | ||
348 | x86_quirks->arch_pre_time_init(); | ||
349 | } | ||
350 | |||
351 | /** | ||
352 | * time_init_hook - do any specific initialisations for the system timer. | ||
353 | * | ||
354 | * Description: | ||
355 | * Must plug the system timer interrupt source at HZ into the IRQ listed | ||
356 | * in irq_vectors.h:TIMER_IRQ | ||
357 | **/ | ||
358 | void __init time_init_hook(void) | ||
359 | { | ||
360 | if (x86_quirks->arch_time_init) { | ||
361 | /* | ||
362 | * A nonzero return code does not mean failure, it means | ||
363 | * that the architecture quirk does not want any | ||
364 | * generic (timer) setup to be performed after this: | ||
365 | */ | ||
366 | if (x86_quirks->arch_time_init()) | ||
367 | return; | ||
368 | } | ||
369 | |||
370 | irq0.mask = cpumask_of_cpu(0); | ||
371 | setup_irq(0, &irq0); | ||
372 | } | ||
373 | |||
374 | #ifdef CONFIG_MCA | ||
375 | /** | ||
376 | * mca_nmi_hook - hook into MCA specific NMI chain | ||
377 | * | ||
378 | * Description: | ||
379 | * The MCA (Microchannel Architecture) has an NMI chain for NMI sources | ||
380 | * along the MCA bus. Use this to hook into that chain if you will need | ||
381 | * it. | ||
382 | **/ | ||
383 | void mca_nmi_hook(void) | ||
384 | { | ||
385 | /* | ||
386 | * If I recall correctly, there's a whole bunch of other things that | ||
387 | * we can do to check for NMI problems, but that's all I know about | ||
388 | * at the moment. | ||
389 | */ | ||
390 | pr_warning("NMI generated from unknown source!\n"); | ||
391 | } | ||
392 | #endif | ||
393 | |||
394 | static __init int no_ipi_broadcast(char *str) | ||
395 | { | ||
396 | get_option(&str, &no_broadcast); | ||
397 | pr_info("Using %s mode\n", | ||
398 | no_broadcast ? "No IPI Broadcast" : "IPI Broadcast"); | ||
399 | return 1; | ||
400 | } | ||
401 | __setup("no_ipi_broadcast=", no_ipi_broadcast); | ||
402 | |||
403 | static int __init print_ipi_mode(void) | ||
404 | { | ||
405 | pr_info("Using IPI %s mode\n", | ||
406 | no_broadcast ? "No-Shortcut" : "Shortcut"); | ||
407 | return 0; | ||
408 | } | ||
409 | |||
410 | late_initcall(print_ipi_mode); | ||
411 | |||
diff --git a/arch/x86/kernel/probe_roms_32.c b/arch/x86/kernel/probe_roms_32.c index 675a48c404a5..071e7fea42e5 100644 --- a/arch/x86/kernel/probe_roms_32.c +++ b/arch/x86/kernel/probe_roms_32.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <asm/setup.h> | 18 | #include <asm/setup.h> |
19 | #include <asm/sections.h> | 19 | #include <asm/sections.h> |
20 | #include <asm/io.h> | 20 | #include <asm/io.h> |
21 | #include <setup_arch.h> | 21 | #include <asm/setup_arch.h> |
22 | 22 | ||
23 | static struct resource system_rom_resource = { | 23 | static struct resource system_rom_resource = { |
24 | .name = "System ROM", | 24 | .name = "System ROM", |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index e68bb9e30864..89537f678b2d 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -344,7 +344,7 @@ static void c1e_idle(void) | |||
344 | 344 | ||
345 | void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) | 345 | void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) |
346 | { | 346 | { |
347 | #ifdef CONFIG_X86_SMP | 347 | #ifdef CONFIG_SMP |
348 | if (pm_idle == poll_idle && smp_num_siblings > 1) { | 348 | if (pm_idle == poll_idle && smp_num_siblings > 1) { |
349 | printk(KERN_WARNING "WARNING: polling idle and HT enabled," | 349 | printk(KERN_WARNING "WARNING: polling idle and HT enabled," |
350 | " performance may degrade.\n"); | 350 | " performance may degrade.\n"); |
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index a546f55c77b4..1a1ae8edc40c 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -66,9 +66,6 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); | |||
66 | DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task; | 66 | DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task; |
67 | EXPORT_PER_CPU_SYMBOL(current_task); | 67 | EXPORT_PER_CPU_SYMBOL(current_task); |
68 | 68 | ||
69 | DEFINE_PER_CPU(int, cpu_number); | ||
70 | EXPORT_PER_CPU_SYMBOL(cpu_number); | ||
71 | |||
72 | /* | 69 | /* |
73 | * Return saved PC of a blocked thread. | 70 | * Return saved PC of a blocked thread. |
74 | */ | 71 | */ |
@@ -111,7 +108,6 @@ void cpu_idle(void) | |||
111 | play_dead(); | 108 | play_dead(); |
112 | 109 | ||
113 | local_irq_disable(); | 110 | local_irq_disable(); |
114 | __get_cpu_var(irq_stat).idle_timestamp = jiffies; | ||
115 | /* Don't trace irqs off for idle */ | 111 | /* Don't trace irqs off for idle */ |
116 | stop_critical_timings(); | 112 | stop_critical_timings(); |
117 | pm_idle(); | 113 | pm_idle(); |
@@ -591,7 +587,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
591 | if (prev->gs | next->gs) | 587 | if (prev->gs | next->gs) |
592 | loadsegment(gs, next->gs); | 588 | loadsegment(gs, next->gs); |
593 | 589 | ||
594 | x86_write_percpu(current_task, next_p); | 590 | percpu_write(current_task, next_p); |
595 | 591 | ||
596 | return prev_p; | 592 | return prev_p; |
597 | } | 593 | } |
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 85b4cb5c1980..8eb169e45584 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <stdarg.h> | 17 | #include <stdarg.h> |
18 | 18 | ||
19 | #include <linux/stackprotector.h> | ||
19 | #include <linux/cpu.h> | 20 | #include <linux/cpu.h> |
20 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
21 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
@@ -47,7 +48,6 @@ | |||
47 | #include <asm/processor.h> | 48 | #include <asm/processor.h> |
48 | #include <asm/i387.h> | 49 | #include <asm/i387.h> |
49 | #include <asm/mmu_context.h> | 50 | #include <asm/mmu_context.h> |
50 | #include <asm/pda.h> | ||
51 | #include <asm/prctl.h> | 51 | #include <asm/prctl.h> |
52 | #include <asm/desc.h> | 52 | #include <asm/desc.h> |
53 | #include <asm/proto.h> | 53 | #include <asm/proto.h> |
@@ -58,6 +58,12 @@ | |||
58 | 58 | ||
59 | asmlinkage extern void ret_from_fork(void); | 59 | asmlinkage extern void ret_from_fork(void); |
60 | 60 | ||
61 | DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task; | ||
62 | EXPORT_PER_CPU_SYMBOL(current_task); | ||
63 | |||
64 | DEFINE_PER_CPU(unsigned long, old_rsp); | ||
65 | static DEFINE_PER_CPU(unsigned char, is_idle); | ||
66 | |||
61 | unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED; | 67 | unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED; |
62 | 68 | ||
63 | static ATOMIC_NOTIFIER_HEAD(idle_notifier); | 69 | static ATOMIC_NOTIFIER_HEAD(idle_notifier); |
@@ -76,13 +82,13 @@ EXPORT_SYMBOL_GPL(idle_notifier_unregister); | |||
76 | 82 | ||
77 | void enter_idle(void) | 83 | void enter_idle(void) |
78 | { | 84 | { |
79 | write_pda(isidle, 1); | 85 | percpu_write(is_idle, 1); |
80 | atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL); | 86 | atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL); |
81 | } | 87 | } |
82 | 88 | ||
83 | static void __exit_idle(void) | 89 | static void __exit_idle(void) |
84 | { | 90 | { |
85 | if (test_and_clear_bit_pda(0, isidle) == 0) | 91 | if (x86_test_and_clear_bit_percpu(0, is_idle) == 0) |
86 | return; | 92 | return; |
87 | atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL); | 93 | atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL); |
88 | } | 94 | } |
@@ -112,6 +118,17 @@ static inline void play_dead(void) | |||
112 | void cpu_idle(void) | 118 | void cpu_idle(void) |
113 | { | 119 | { |
114 | current_thread_info()->status |= TS_POLLING; | 120 | current_thread_info()->status |= TS_POLLING; |
121 | |||
122 | /* | ||
123 | * If we're the non-boot CPU, nothing set the PDA stack | ||
124 | * canary up for us - and if we are the boot CPU we have | ||
125 | * a 0 stack canary. This is a good place for updating | ||
126 | * it, as we wont ever return from this function (so the | ||
127 | * invalid canaries already on the stack wont ever | ||
128 | * trigger): | ||
129 | */ | ||
130 | boot_init_stack_canary(); | ||
131 | |||
115 | /* endless idle loop with no priority at all */ | 132 | /* endless idle loop with no priority at all */ |
116 | while (1) { | 133 | while (1) { |
117 | tick_nohz_stop_sched_tick(1); | 134 | tick_nohz_stop_sched_tick(1); |
@@ -397,7 +414,7 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp) | |||
397 | load_gs_index(0); | 414 | load_gs_index(0); |
398 | regs->ip = new_ip; | 415 | regs->ip = new_ip; |
399 | regs->sp = new_sp; | 416 | regs->sp = new_sp; |
400 | write_pda(oldrsp, new_sp); | 417 | percpu_write(old_rsp, new_sp); |
401 | regs->cs = __USER_CS; | 418 | regs->cs = __USER_CS; |
402 | regs->ss = __USER_DS; | 419 | regs->ss = __USER_DS; |
403 | regs->flags = 0x200; | 420 | regs->flags = 0x200; |
@@ -618,21 +635,13 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
618 | /* | 635 | /* |
619 | * Switch the PDA and FPU contexts. | 636 | * Switch the PDA and FPU contexts. |
620 | */ | 637 | */ |
621 | prev->usersp = read_pda(oldrsp); | 638 | prev->usersp = percpu_read(old_rsp); |
622 | write_pda(oldrsp, next->usersp); | 639 | percpu_write(old_rsp, next->usersp); |
623 | write_pda(pcurrent, next_p); | 640 | percpu_write(current_task, next_p); |
624 | 641 | ||
625 | write_pda(kernelstack, | 642 | percpu_write(kernel_stack, |
626 | (unsigned long)task_stack_page(next_p) + | 643 | (unsigned long)task_stack_page(next_p) + |
627 | THREAD_SIZE - PDA_STACKOFFSET); | 644 | THREAD_SIZE - KERNEL_STACK_OFFSET); |
628 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
629 | write_pda(stack_canary, next_p->stack_canary); | ||
630 | /* | ||
631 | * Build time only check to make sure the stack_canary is at | ||
632 | * offset 40 in the pda; this is a gcc ABI requirement | ||
633 | */ | ||
634 | BUILD_BUG_ON(offsetof(struct x8664_pda, stack_canary) != 40); | ||
635 | #endif | ||
636 | 645 | ||
637 | /* | 646 | /* |
638 | * Now maybe reload the debug registers and handle I/O bitmaps | 647 | * Now maybe reload the debug registers and handle I/O bitmaps |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 2b46eb41643b..32e8f0af292c 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <asm/reboot.h> | 14 | #include <asm/reboot.h> |
15 | #include <asm/pci_x86.h> | 15 | #include <asm/pci_x86.h> |
16 | #include <asm/virtext.h> | 16 | #include <asm/virtext.h> |
17 | #include <asm/cpu.h> | ||
17 | 18 | ||
18 | #ifdef CONFIG_X86_32 | 19 | #ifdef CONFIG_X86_32 |
19 | # include <linux/dmi.h> | 20 | # include <linux/dmi.h> |
@@ -23,7 +24,7 @@ | |||
23 | # include <asm/iommu.h> | 24 | # include <asm/iommu.h> |
24 | #endif | 25 | #endif |
25 | 26 | ||
26 | #include <mach_ipi.h> | 27 | #include <asm/genapic.h> |
27 | 28 | ||
28 | /* | 29 | /* |
29 | * Power off function, if any | 30 | * Power off function, if any |
@@ -650,7 +651,7 @@ static int crash_nmi_callback(struct notifier_block *self, | |||
650 | 651 | ||
651 | static void smp_send_nmi_allbutself(void) | 652 | static void smp_send_nmi_allbutself(void) |
652 | { | 653 | { |
653 | send_IPI_allbutself(NMI_VECTOR); | 654 | apic->send_IPI_allbutself(NMI_VECTOR); |
654 | } | 655 | } |
655 | 656 | ||
656 | static struct notifier_block crash_nmi_nb = { | 657 | static struct notifier_block crash_nmi_nb = { |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index c461f6d69074..8d8fa992c9a0 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -81,7 +81,7 @@ | |||
81 | #include <asm/io_apic.h> | 81 | #include <asm/io_apic.h> |
82 | #include <asm/ist.h> | 82 | #include <asm/ist.h> |
83 | #include <asm/vmi.h> | 83 | #include <asm/vmi.h> |
84 | #include <setup_arch.h> | 84 | #include <asm/setup_arch.h> |
85 | #include <asm/bios_ebda.h> | 85 | #include <asm/bios_ebda.h> |
86 | #include <asm/cacheflush.h> | 86 | #include <asm/cacheflush.h> |
87 | #include <asm/processor.h> | 87 | #include <asm/processor.h> |
@@ -89,7 +89,7 @@ | |||
89 | 89 | ||
90 | #include <asm/system.h> | 90 | #include <asm/system.h> |
91 | #include <asm/vsyscall.h> | 91 | #include <asm/vsyscall.h> |
92 | #include <asm/smp.h> | 92 | #include <asm/cpu.h> |
93 | #include <asm/desc.h> | 93 | #include <asm/desc.h> |
94 | #include <asm/dma.h> | 94 | #include <asm/dma.h> |
95 | #include <asm/iommu.h> | 95 | #include <asm/iommu.h> |
@@ -97,7 +97,7 @@ | |||
97 | #include <asm/mmu_context.h> | 97 | #include <asm/mmu_context.h> |
98 | #include <asm/proto.h> | 98 | #include <asm/proto.h> |
99 | 99 | ||
100 | #include <mach_apic.h> | 100 | #include <asm/genapic.h> |
101 | #include <asm/paravirt.h> | 101 | #include <asm/paravirt.h> |
102 | #include <asm/hypervisor.h> | 102 | #include <asm/hypervisor.h> |
103 | 103 | ||
@@ -112,6 +112,20 @@ | |||
112 | #define ARCH_SETUP | 112 | #define ARCH_SETUP |
113 | #endif | 113 | #endif |
114 | 114 | ||
115 | unsigned int boot_cpu_id __read_mostly; | ||
116 | |||
117 | #ifdef CONFIG_X86_64 | ||
118 | int default_cpu_present_to_apicid(int mps_cpu) | ||
119 | { | ||
120 | return __default_cpu_present_to_apicid(mps_cpu); | ||
121 | } | ||
122 | |||
123 | int default_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
124 | { | ||
125 | return __default_check_phys_apicid_present(boot_cpu_physical_apicid); | ||
126 | } | ||
127 | #endif | ||
128 | |||
115 | #ifndef CONFIG_DEBUG_BOOT_PARAMS | 129 | #ifndef CONFIG_DEBUG_BOOT_PARAMS |
116 | struct boot_params __initdata boot_params; | 130 | struct boot_params __initdata boot_params; |
117 | #else | 131 | #else |
@@ -588,10 +602,9 @@ early_param("elfcorehdr", setup_elfcorehdr); | |||
588 | 602 | ||
589 | static int __init default_update_genapic(void) | 603 | static int __init default_update_genapic(void) |
590 | { | 604 | { |
591 | #ifdef CONFIG_X86_SMP | 605 | #ifdef CONFIG_SMP |
592 | # if defined(CONFIG_X86_GENERICARCH) || defined(CONFIG_X86_64) | 606 | if (!apic->wakeup_cpu) |
593 | genapic->wakeup_cpu = wakeup_secondary_cpu_via_init; | 607 | apic->wakeup_cpu = wakeup_secondary_cpu_via_init; |
594 | # endif | ||
595 | #endif | 608 | #endif |
596 | 609 | ||
597 | return 0; | 610 | return 0; |
@@ -892,12 +905,11 @@ void __init setup_arch(char **cmdline_p) | |||
892 | */ | 905 | */ |
893 | acpi_reserve_bootmem(); | 906 | acpi_reserve_bootmem(); |
894 | #endif | 907 | #endif |
895 | #ifdef CONFIG_X86_FIND_SMP_CONFIG | ||
896 | /* | 908 | /* |
897 | * Find and reserve possible boot-time SMP configuration: | 909 | * Find and reserve possible boot-time SMP configuration: |
898 | */ | 910 | */ |
899 | find_smp_config(); | 911 | find_smp_config(); |
900 | #endif | 912 | |
901 | reserve_crashkernel(); | 913 | reserve_crashkernel(); |
902 | 914 | ||
903 | #ifdef CONFIG_X86_64 | 915 | #ifdef CONFIG_X86_64 |
@@ -924,7 +936,7 @@ void __init setup_arch(char **cmdline_p) | |||
924 | map_vsyscall(); | 936 | map_vsyscall(); |
925 | #endif | 937 | #endif |
926 | 938 | ||
927 | #ifdef CONFIG_X86_GENERICARCH | 939 | #if defined(CONFIG_X86_32_NON_STANDARD) || defined(CONFIG_X86_BIGSMP) |
928 | generic_apic_probe(); | 940 | generic_apic_probe(); |
929 | #endif | 941 | #endif |
930 | 942 | ||
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c index 01161077a49c..0d1e7ac439f4 100644 --- a/arch/x86/kernel/setup_percpu.c +++ b/arch/x86/kernel/setup_percpu.c | |||
@@ -13,145 +13,46 @@ | |||
13 | #include <asm/mpspec.h> | 13 | #include <asm/mpspec.h> |
14 | #include <asm/apicdef.h> | 14 | #include <asm/apicdef.h> |
15 | #include <asm/highmem.h> | 15 | #include <asm/highmem.h> |
16 | #include <asm/proto.h> | ||
17 | #include <asm/cpumask.h> | ||
18 | #include <asm/cpu.h> | ||
16 | 19 | ||
17 | #ifdef CONFIG_X86_LOCAL_APIC | 20 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
18 | unsigned int num_processors; | 21 | # define DBG(x...) printk(KERN_DEBUG x) |
19 | unsigned disabled_cpus __cpuinitdata; | ||
20 | /* Processor that is doing the boot up */ | ||
21 | unsigned int boot_cpu_physical_apicid = -1U; | ||
22 | EXPORT_SYMBOL(boot_cpu_physical_apicid); | ||
23 | unsigned int max_physical_apicid; | ||
24 | |||
25 | /* Bitmask of physically existing CPUs */ | ||
26 | physid_mask_t phys_cpu_present_map; | ||
27 | #endif | ||
28 | |||
29 | /* map cpu index to physical APIC ID */ | ||
30 | DEFINE_EARLY_PER_CPU(u16, x86_cpu_to_apicid, BAD_APICID); | ||
31 | DEFINE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid, BAD_APICID); | ||
32 | EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_apicid); | ||
33 | EXPORT_EARLY_PER_CPU_SYMBOL(x86_bios_cpu_apicid); | ||
34 | |||
35 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_64) | ||
36 | #define X86_64_NUMA 1 | ||
37 | |||
38 | /* map cpu index to node index */ | ||
39 | DEFINE_EARLY_PER_CPU(int, x86_cpu_to_node_map, NUMA_NO_NODE); | ||
40 | EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_node_map); | ||
41 | |||
42 | /* which logical CPUs are on which nodes */ | ||
43 | cpumask_t *node_to_cpumask_map; | ||
44 | EXPORT_SYMBOL(node_to_cpumask_map); | ||
45 | |||
46 | /* setup node_to_cpumask_map */ | ||
47 | static void __init setup_node_to_cpumask_map(void); | ||
48 | |||
49 | #else | 22 | #else |
50 | static inline void setup_node_to_cpumask_map(void) { } | 23 | # define DBG(x...) |
51 | #endif | 24 | #endif |
52 | 25 | ||
53 | #if defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) && defined(CONFIG_X86_SMP) | 26 | DEFINE_PER_CPU(int, cpu_number); |
54 | /* | 27 | EXPORT_PER_CPU_SYMBOL(cpu_number); |
55 | * Copy data used in early init routines from the initial arrays to the | ||
56 | * per cpu data areas. These arrays then become expendable and the | ||
57 | * *_early_ptr's are zeroed indicating that the static arrays are gone. | ||
58 | */ | ||
59 | static void __init setup_per_cpu_maps(void) | ||
60 | { | ||
61 | int cpu; | ||
62 | 28 | ||
63 | for_each_possible_cpu(cpu) { | 29 | #ifdef CONFIG_X86_64 |
64 | per_cpu(x86_cpu_to_apicid, cpu) = | 30 | #define BOOT_PERCPU_OFFSET ((unsigned long)__per_cpu_load) |
65 | early_per_cpu_map(x86_cpu_to_apicid, cpu); | 31 | #else |
66 | per_cpu(x86_bios_cpu_apicid, cpu) = | 32 | #define BOOT_PERCPU_OFFSET 0 |
67 | early_per_cpu_map(x86_bios_cpu_apicid, cpu); | ||
68 | #ifdef X86_64_NUMA | ||
69 | per_cpu(x86_cpu_to_node_map, cpu) = | ||
70 | early_per_cpu_map(x86_cpu_to_node_map, cpu); | ||
71 | #endif | 33 | #endif |
72 | } | ||
73 | 34 | ||
74 | /* indicate the early static arrays will soon be gone */ | 35 | DEFINE_PER_CPU(unsigned long, this_cpu_off) = BOOT_PERCPU_OFFSET; |
75 | early_per_cpu_ptr(x86_cpu_to_apicid) = NULL; | 36 | EXPORT_PER_CPU_SYMBOL(this_cpu_off); |
76 | early_per_cpu_ptr(x86_bios_cpu_apicid) = NULL; | ||
77 | #ifdef X86_64_NUMA | ||
78 | early_per_cpu_ptr(x86_cpu_to_node_map) = NULL; | ||
79 | #endif | ||
80 | } | ||
81 | 37 | ||
82 | #ifdef CONFIG_X86_32 | 38 | unsigned long __per_cpu_offset[NR_CPUS] __read_mostly = { |
83 | /* | 39 | [0 ... NR_CPUS-1] = BOOT_PERCPU_OFFSET, |
84 | * Great future not-so-futuristic plan: make i386 and x86_64 do it | 40 | }; |
85 | * the same way | ||
86 | */ | ||
87 | unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; | ||
88 | EXPORT_SYMBOL(__per_cpu_offset); | 41 | EXPORT_SYMBOL(__per_cpu_offset); |
89 | static inline void setup_cpu_pda_map(void) { } | ||
90 | |||
91 | #elif !defined(CONFIG_SMP) | ||
92 | static inline void setup_cpu_pda_map(void) { } | ||
93 | |||
94 | #else /* CONFIG_SMP && CONFIG_X86_64 */ | ||
95 | |||
96 | /* | ||
97 | * Allocate cpu_pda pointer table and array via alloc_bootmem. | ||
98 | */ | ||
99 | static void __init setup_cpu_pda_map(void) | ||
100 | { | ||
101 | char *pda; | ||
102 | struct x8664_pda **new_cpu_pda; | ||
103 | unsigned long size; | ||
104 | int cpu; | ||
105 | |||
106 | size = roundup(sizeof(struct x8664_pda), cache_line_size()); | ||
107 | |||
108 | /* allocate cpu_pda array and pointer table */ | ||
109 | { | ||
110 | unsigned long tsize = nr_cpu_ids * sizeof(void *); | ||
111 | unsigned long asize = size * (nr_cpu_ids - 1); | ||
112 | 42 | ||
113 | tsize = roundup(tsize, cache_line_size()); | 43 | static inline void setup_percpu_segment(int cpu) |
114 | new_cpu_pda = alloc_bootmem(tsize + asize); | ||
115 | pda = (char *)new_cpu_pda + tsize; | ||
116 | } | ||
117 | |||
118 | /* initialize pointer table to static pda's */ | ||
119 | for_each_possible_cpu(cpu) { | ||
120 | if (cpu == 0) { | ||
121 | /* leave boot cpu pda in place */ | ||
122 | new_cpu_pda[0] = cpu_pda(0); | ||
123 | continue; | ||
124 | } | ||
125 | new_cpu_pda[cpu] = (struct x8664_pda *)pda; | ||
126 | new_cpu_pda[cpu]->in_bootmem = 1; | ||
127 | pda += size; | ||
128 | } | ||
129 | |||
130 | /* point to new pointer table */ | ||
131 | _cpu_pda = new_cpu_pda; | ||
132 | } | ||
133 | |||
134 | #endif /* CONFIG_SMP && CONFIG_X86_64 */ | ||
135 | |||
136 | #ifdef CONFIG_X86_64 | ||
137 | |||
138 | /* correctly size the local cpu masks */ | ||
139 | static void __init setup_cpu_local_masks(void) | ||
140 | { | 44 | { |
141 | alloc_bootmem_cpumask_var(&cpu_initialized_mask); | 45 | #ifdef CONFIG_X86_32 |
142 | alloc_bootmem_cpumask_var(&cpu_callin_mask); | 46 | struct desc_struct gdt; |
143 | alloc_bootmem_cpumask_var(&cpu_callout_mask); | ||
144 | alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask); | ||
145 | } | ||
146 | |||
147 | #else /* CONFIG_X86_32 */ | ||
148 | 47 | ||
149 | static inline void setup_cpu_local_masks(void) | 48 | pack_descriptor(&gdt, per_cpu_offset(cpu), 0xFFFFF, |
150 | { | 49 | 0x2 | DESCTYPE_S, 0x8); |
50 | gdt.s = 1; | ||
51 | write_gdt_entry(get_cpu_gdt_table(cpu), | ||
52 | GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S); | ||
53 | #endif | ||
151 | } | 54 | } |
152 | 55 | ||
153 | #endif /* CONFIG_X86_32 */ | ||
154 | |||
155 | /* | 56 | /* |
156 | * Great future plan: | 57 | * Great future plan: |
157 | * Declare PDA itself and support (irqstack,tss,pgd) as per cpu data. | 58 | * Declare PDA itself and support (irqstack,tss,pgd) as per cpu data. |
@@ -159,18 +60,12 @@ static inline void setup_cpu_local_masks(void) | |||
159 | */ | 60 | */ |
160 | void __init setup_per_cpu_areas(void) | 61 | void __init setup_per_cpu_areas(void) |
161 | { | 62 | { |
162 | ssize_t size, old_size; | 63 | ssize_t size; |
163 | char *ptr; | 64 | char *ptr; |
164 | int cpu; | 65 | int cpu; |
165 | unsigned long align = 1; | ||
166 | |||
167 | /* Setup cpu_pda map */ | ||
168 | setup_cpu_pda_map(); | ||
169 | 66 | ||
170 | /* Copy section for each CPU (we discard the original) */ | 67 | /* Copy section for each CPU (we discard the original) */ |
171 | old_size = PERCPU_ENOUGH_ROOM; | 68 | size = roundup(PERCPU_ENOUGH_ROOM, PAGE_SIZE); |
172 | align = max_t(unsigned long, PAGE_SIZE, align); | ||
173 | size = roundup(old_size, align); | ||
174 | 69 | ||
175 | pr_info("NR_CPUS:%d nr_cpumask_bits:%d nr_cpu_ids:%d nr_node_ids:%d\n", | 70 | pr_info("NR_CPUS:%d nr_cpumask_bits:%d nr_cpu_ids:%d nr_node_ids:%d\n", |
176 | NR_CPUS, nr_cpumask_bits, nr_cpu_ids, nr_node_ids); | 71 | NR_CPUS, nr_cpumask_bits, nr_cpu_ids, nr_node_ids); |
@@ -179,30 +74,67 @@ void __init setup_per_cpu_areas(void) | |||
179 | 74 | ||
180 | for_each_possible_cpu(cpu) { | 75 | for_each_possible_cpu(cpu) { |
181 | #ifndef CONFIG_NEED_MULTIPLE_NODES | 76 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
182 | ptr = __alloc_bootmem(size, align, | 77 | ptr = alloc_bootmem_pages(size); |
183 | __pa(MAX_DMA_ADDRESS)); | ||
184 | #else | 78 | #else |
185 | int node = early_cpu_to_node(cpu); | 79 | int node = early_cpu_to_node(cpu); |
186 | if (!node_online(node) || !NODE_DATA(node)) { | 80 | if (!node_online(node) || !NODE_DATA(node)) { |
187 | ptr = __alloc_bootmem(size, align, | 81 | ptr = alloc_bootmem_pages(size); |
188 | __pa(MAX_DMA_ADDRESS)); | ||
189 | pr_info("cpu %d has no node %d or node-local memory\n", | 82 | pr_info("cpu %d has no node %d or node-local memory\n", |
190 | cpu, node); | 83 | cpu, node); |
191 | pr_debug("per cpu data for cpu%d at %016lx\n", | 84 | pr_debug("per cpu data for cpu%d at %016lx\n", |
192 | cpu, __pa(ptr)); | 85 | cpu, __pa(ptr)); |
193 | } else { | 86 | } else { |
194 | ptr = __alloc_bootmem_node(NODE_DATA(node), size, align, | 87 | ptr = alloc_bootmem_pages_node(NODE_DATA(node), size); |
195 | __pa(MAX_DMA_ADDRESS)); | ||
196 | pr_debug("per cpu data for cpu%d on node%d at %016lx\n", | 88 | pr_debug("per cpu data for cpu%d on node%d at %016lx\n", |
197 | cpu, node, __pa(ptr)); | 89 | cpu, node, __pa(ptr)); |
198 | } | 90 | } |
199 | #endif | 91 | #endif |
92 | |||
93 | memcpy(ptr, __per_cpu_load, __per_cpu_end - __per_cpu_start); | ||
200 | per_cpu_offset(cpu) = ptr - __per_cpu_start; | 94 | per_cpu_offset(cpu) = ptr - __per_cpu_start; |
201 | memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); | 95 | per_cpu(this_cpu_off, cpu) = per_cpu_offset(cpu); |
96 | per_cpu(cpu_number, cpu) = cpu; | ||
97 | setup_percpu_segment(cpu); | ||
98 | /* | ||
99 | * Copy data used in early init routines from the | ||
100 | * initial arrays to the per cpu data areas. These | ||
101 | * arrays then become expendable and the *_early_ptr's | ||
102 | * are zeroed indicating that the static arrays are | ||
103 | * gone. | ||
104 | */ | ||
105 | #ifdef CONFIG_X86_LOCAL_APIC | ||
106 | per_cpu(x86_cpu_to_apicid, cpu) = | ||
107 | early_per_cpu_map(x86_cpu_to_apicid, cpu); | ||
108 | per_cpu(x86_bios_cpu_apicid, cpu) = | ||
109 | early_per_cpu_map(x86_bios_cpu_apicid, cpu); | ||
110 | #endif | ||
111 | #ifdef CONFIG_X86_64 | ||
112 | per_cpu(irq_stack_ptr, cpu) = | ||
113 | per_cpu(irq_stack_union.irq_stack, cpu) + | ||
114 | IRQ_STACK_SIZE - 64; | ||
115 | #ifdef CONFIG_NUMA | ||
116 | per_cpu(x86_cpu_to_node_map, cpu) = | ||
117 | early_per_cpu_map(x86_cpu_to_node_map, cpu); | ||
118 | #endif | ||
119 | #endif | ||
120 | /* | ||
121 | * Up to this point, the boot CPU has been using .data.init | ||
122 | * area. Reload any changed state for the boot CPU. | ||
123 | */ | ||
124 | if (cpu == boot_cpu_id) | ||
125 | switch_to_new_gdt(); | ||
126 | |||
127 | DBG("PERCPU: cpu %4d %p\n", cpu, ptr); | ||
202 | } | 128 | } |
203 | 129 | ||
204 | /* Setup percpu data maps */ | 130 | /* indicate the early static arrays will soon be gone */ |
205 | setup_per_cpu_maps(); | 131 | #ifdef CONFIG_X86_LOCAL_APIC |
132 | early_per_cpu_ptr(x86_cpu_to_apicid) = NULL; | ||
133 | early_per_cpu_ptr(x86_bios_cpu_apicid) = NULL; | ||
134 | #endif | ||
135 | #if defined(CONFIG_X86_64) && defined(CONFIG_NUMA) | ||
136 | early_per_cpu_ptr(x86_cpu_to_node_map) = NULL; | ||
137 | #endif | ||
206 | 138 | ||
207 | /* Setup node to cpumask map */ | 139 | /* Setup node to cpumask map */ |
208 | setup_node_to_cpumask_map(); | 140 | setup_node_to_cpumask_map(); |
@@ -210,199 +142,3 @@ void __init setup_per_cpu_areas(void) | |||
210 | /* Setup cpu initialized, callin, callout masks */ | 142 | /* Setup cpu initialized, callin, callout masks */ |
211 | setup_cpu_local_masks(); | 143 | setup_cpu_local_masks(); |
212 | } | 144 | } |
213 | |||
214 | #endif | ||
215 | |||
216 | #ifdef X86_64_NUMA | ||
217 | |||
218 | /* | ||
219 | * Allocate node_to_cpumask_map based on number of available nodes | ||
220 | * Requires node_possible_map to be valid. | ||
221 | * | ||
222 | * Note: node_to_cpumask() is not valid until after this is done. | ||
223 | */ | ||
224 | static void __init setup_node_to_cpumask_map(void) | ||
225 | { | ||
226 | unsigned int node, num = 0; | ||
227 | cpumask_t *map; | ||
228 | |||
229 | /* setup nr_node_ids if not done yet */ | ||
230 | if (nr_node_ids == MAX_NUMNODES) { | ||
231 | for_each_node_mask(node, node_possible_map) | ||
232 | num = node; | ||
233 | nr_node_ids = num + 1; | ||
234 | } | ||
235 | |||
236 | /* allocate the map */ | ||
237 | map = alloc_bootmem_low(nr_node_ids * sizeof(cpumask_t)); | ||
238 | |||
239 | pr_debug("Node to cpumask map at %p for %d nodes\n", | ||
240 | map, nr_node_ids); | ||
241 | |||
242 | /* node_to_cpumask() will now work */ | ||
243 | node_to_cpumask_map = map; | ||
244 | } | ||
245 | |||
246 | void __cpuinit numa_set_node(int cpu, int node) | ||
247 | { | ||
248 | int *cpu_to_node_map = early_per_cpu_ptr(x86_cpu_to_node_map); | ||
249 | |||
250 | if (cpu_pda(cpu) && node != NUMA_NO_NODE) | ||
251 | cpu_pda(cpu)->nodenumber = node; | ||
252 | |||
253 | if (cpu_to_node_map) | ||
254 | cpu_to_node_map[cpu] = node; | ||
255 | |||
256 | else if (per_cpu_offset(cpu)) | ||
257 | per_cpu(x86_cpu_to_node_map, cpu) = node; | ||
258 | |||
259 | else | ||
260 | pr_debug("Setting node for non-present cpu %d\n", cpu); | ||
261 | } | ||
262 | |||
263 | void __cpuinit numa_clear_node(int cpu) | ||
264 | { | ||
265 | numa_set_node(cpu, NUMA_NO_NODE); | ||
266 | } | ||
267 | |||
268 | #ifndef CONFIG_DEBUG_PER_CPU_MAPS | ||
269 | |||
270 | void __cpuinit numa_add_cpu(int cpu) | ||
271 | { | ||
272 | cpu_set(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); | ||
273 | } | ||
274 | |||
275 | void __cpuinit numa_remove_cpu(int cpu) | ||
276 | { | ||
277 | cpu_clear(cpu, node_to_cpumask_map[cpu_to_node(cpu)]); | ||
278 | } | ||
279 | |||
280 | #else /* CONFIG_DEBUG_PER_CPU_MAPS */ | ||
281 | |||
282 | /* | ||
283 | * --------- debug versions of the numa functions --------- | ||
284 | */ | ||
285 | static void __cpuinit numa_set_cpumask(int cpu, int enable) | ||
286 | { | ||
287 | int node = cpu_to_node(cpu); | ||
288 | cpumask_t *mask; | ||
289 | char buf[64]; | ||
290 | |||
291 | if (node_to_cpumask_map == NULL) { | ||
292 | printk(KERN_ERR "node_to_cpumask_map NULL\n"); | ||
293 | dump_stack(); | ||
294 | return; | ||
295 | } | ||
296 | |||
297 | mask = &node_to_cpumask_map[node]; | ||
298 | if (enable) | ||
299 | cpu_set(cpu, *mask); | ||
300 | else | ||
301 | cpu_clear(cpu, *mask); | ||
302 | |||
303 | cpulist_scnprintf(buf, sizeof(buf), mask); | ||
304 | printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n", | ||
305 | enable ? "numa_add_cpu" : "numa_remove_cpu", cpu, node, buf); | ||
306 | } | ||
307 | |||
308 | void __cpuinit numa_add_cpu(int cpu) | ||
309 | { | ||
310 | numa_set_cpumask(cpu, 1); | ||
311 | } | ||
312 | |||
313 | void __cpuinit numa_remove_cpu(int cpu) | ||
314 | { | ||
315 | numa_set_cpumask(cpu, 0); | ||
316 | } | ||
317 | |||
318 | int cpu_to_node(int cpu) | ||
319 | { | ||
320 | if (early_per_cpu_ptr(x86_cpu_to_node_map)) { | ||
321 | printk(KERN_WARNING | ||
322 | "cpu_to_node(%d): usage too early!\n", cpu); | ||
323 | dump_stack(); | ||
324 | return early_per_cpu_ptr(x86_cpu_to_node_map)[cpu]; | ||
325 | } | ||
326 | return per_cpu(x86_cpu_to_node_map, cpu); | ||
327 | } | ||
328 | EXPORT_SYMBOL(cpu_to_node); | ||
329 | |||
330 | /* | ||
331 | * Same function as cpu_to_node() but used if called before the | ||
332 | * per_cpu areas are setup. | ||
333 | */ | ||
334 | int early_cpu_to_node(int cpu) | ||
335 | { | ||
336 | if (early_per_cpu_ptr(x86_cpu_to_node_map)) | ||
337 | return early_per_cpu_ptr(x86_cpu_to_node_map)[cpu]; | ||
338 | |||
339 | if (!per_cpu_offset(cpu)) { | ||
340 | printk(KERN_WARNING | ||
341 | "early_cpu_to_node(%d): no per_cpu area!\n", cpu); | ||
342 | dump_stack(); | ||
343 | return NUMA_NO_NODE; | ||
344 | } | ||
345 | return per_cpu(x86_cpu_to_node_map, cpu); | ||
346 | } | ||
347 | |||
348 | |||
349 | /* empty cpumask */ | ||
350 | static const cpumask_t cpu_mask_none; | ||
351 | |||
352 | /* | ||
353 | * Returns a pointer to the bitmask of CPUs on Node 'node'. | ||
354 | */ | ||
355 | const cpumask_t *cpumask_of_node(int node) | ||
356 | { | ||
357 | if (node_to_cpumask_map == NULL) { | ||
358 | printk(KERN_WARNING | ||
359 | "cpumask_of_node(%d): no node_to_cpumask_map!\n", | ||
360 | node); | ||
361 | dump_stack(); | ||
362 | return (const cpumask_t *)&cpu_online_map; | ||
363 | } | ||
364 | if (node >= nr_node_ids) { | ||
365 | printk(KERN_WARNING | ||
366 | "cpumask_of_node(%d): node > nr_node_ids(%d)\n", | ||
367 | node, nr_node_ids); | ||
368 | dump_stack(); | ||
369 | return &cpu_mask_none; | ||
370 | } | ||
371 | return &node_to_cpumask_map[node]; | ||
372 | } | ||
373 | EXPORT_SYMBOL(cpumask_of_node); | ||
374 | |||
375 | /* | ||
376 | * Returns a bitmask of CPUs on Node 'node'. | ||
377 | * | ||
378 | * Side note: this function creates the returned cpumask on the stack | ||
379 | * so with a high NR_CPUS count, excessive stack space is used. The | ||
380 | * node_to_cpumask_ptr function should be used whenever possible. | ||
381 | */ | ||
382 | cpumask_t node_to_cpumask(int node) | ||
383 | { | ||
384 | if (node_to_cpumask_map == NULL) { | ||
385 | printk(KERN_WARNING | ||
386 | "node_to_cpumask(%d): no node_to_cpumask_map!\n", node); | ||
387 | dump_stack(); | ||
388 | return cpu_online_map; | ||
389 | } | ||
390 | if (node >= nr_node_ids) { | ||
391 | printk(KERN_WARNING | ||
392 | "node_to_cpumask(%d): node > nr_node_ids(%d)\n", | ||
393 | node, nr_node_ids); | ||
394 | dump_stack(); | ||
395 | return cpu_mask_none; | ||
396 | } | ||
397 | return node_to_cpumask_map[node]; | ||
398 | } | ||
399 | EXPORT_SYMBOL(node_to_cpumask); | ||
400 | |||
401 | /* | ||
402 | * --------- end of debug versions of the numa functions --------- | ||
403 | */ | ||
404 | |||
405 | #endif /* CONFIG_DEBUG_PER_CPU_MAPS */ | ||
406 | |||
407 | #endif /* X86_64_NUMA */ | ||
408 | |||
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index df0587f24c54..7fc78b019815 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
@@ -51,24 +51,24 @@ | |||
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #define COPY(x) { \ | 53 | #define COPY(x) { \ |
54 | err |= __get_user(regs->x, &sc->x); \ | 54 | get_user_ex(regs->x, &sc->x); \ |
55 | } | 55 | } |
56 | 56 | ||
57 | #define COPY_SEG(seg) { \ | 57 | #define COPY_SEG(seg) { \ |
58 | unsigned short tmp; \ | 58 | unsigned short tmp; \ |
59 | err |= __get_user(tmp, &sc->seg); \ | 59 | get_user_ex(tmp, &sc->seg); \ |
60 | regs->seg = tmp; \ | 60 | regs->seg = tmp; \ |
61 | } | 61 | } |
62 | 62 | ||
63 | #define COPY_SEG_CPL3(seg) { \ | 63 | #define COPY_SEG_CPL3(seg) { \ |
64 | unsigned short tmp; \ | 64 | unsigned short tmp; \ |
65 | err |= __get_user(tmp, &sc->seg); \ | 65 | get_user_ex(tmp, &sc->seg); \ |
66 | regs->seg = tmp | 3; \ | 66 | regs->seg = tmp | 3; \ |
67 | } | 67 | } |
68 | 68 | ||
69 | #define GET_SEG(seg) { \ | 69 | #define GET_SEG(seg) { \ |
70 | unsigned short tmp; \ | 70 | unsigned short tmp; \ |
71 | err |= __get_user(tmp, &sc->seg); \ | 71 | get_user_ex(tmp, &sc->seg); \ |
72 | loadsegment(seg, tmp); \ | 72 | loadsegment(seg, tmp); \ |
73 | } | 73 | } |
74 | 74 | ||
@@ -83,45 +83,49 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, | |||
83 | /* Always make any pending restarted system calls return -EINTR */ | 83 | /* Always make any pending restarted system calls return -EINTR */ |
84 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | 84 | current_thread_info()->restart_block.fn = do_no_restart_syscall; |
85 | 85 | ||
86 | get_user_try { | ||
87 | |||
86 | #ifdef CONFIG_X86_32 | 88 | #ifdef CONFIG_X86_32 |
87 | GET_SEG(gs); | 89 | GET_SEG(gs); |
88 | COPY_SEG(fs); | 90 | COPY_SEG(fs); |
89 | COPY_SEG(es); | 91 | COPY_SEG(es); |
90 | COPY_SEG(ds); | 92 | COPY_SEG(ds); |
91 | #endif /* CONFIG_X86_32 */ | 93 | #endif /* CONFIG_X86_32 */ |
92 | 94 | ||
93 | COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); | 95 | COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); |
94 | COPY(dx); COPY(cx); COPY(ip); | 96 | COPY(dx); COPY(cx); COPY(ip); |
95 | 97 | ||
96 | #ifdef CONFIG_X86_64 | 98 | #ifdef CONFIG_X86_64 |
97 | COPY(r8); | 99 | COPY(r8); |
98 | COPY(r9); | 100 | COPY(r9); |
99 | COPY(r10); | 101 | COPY(r10); |
100 | COPY(r11); | 102 | COPY(r11); |
101 | COPY(r12); | 103 | COPY(r12); |
102 | COPY(r13); | 104 | COPY(r13); |
103 | COPY(r14); | 105 | COPY(r14); |
104 | COPY(r15); | 106 | COPY(r15); |
105 | #endif /* CONFIG_X86_64 */ | 107 | #endif /* CONFIG_X86_64 */ |
106 | 108 | ||
107 | #ifdef CONFIG_X86_32 | 109 | #ifdef CONFIG_X86_32 |
108 | COPY_SEG_CPL3(cs); | 110 | COPY_SEG_CPL3(cs); |
109 | COPY_SEG_CPL3(ss); | 111 | COPY_SEG_CPL3(ss); |
110 | #else /* !CONFIG_X86_32 */ | 112 | #else /* !CONFIG_X86_32 */ |
111 | /* Kernel saves and restores only the CS segment register on signals, | 113 | /* Kernel saves and restores only the CS segment register on signals, |
112 | * which is the bare minimum needed to allow mixed 32/64-bit code. | 114 | * which is the bare minimum needed to allow mixed 32/64-bit code. |
113 | * App's signal handler can save/restore other segments if needed. */ | 115 | * App's signal handler can save/restore other segments if needed. */ |
114 | COPY_SEG_CPL3(cs); | 116 | COPY_SEG_CPL3(cs); |
115 | #endif /* CONFIG_X86_32 */ | 117 | #endif /* CONFIG_X86_32 */ |
116 | 118 | ||
117 | err |= __get_user(tmpflags, &sc->flags); | 119 | get_user_ex(tmpflags, &sc->flags); |
118 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); | 120 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); |
119 | regs->orig_ax = -1; /* disable syscall checks */ | 121 | regs->orig_ax = -1; /* disable syscall checks */ |
122 | |||
123 | get_user_ex(buf, &sc->fpstate); | ||
124 | err |= restore_i387_xstate(buf); | ||
120 | 125 | ||
121 | err |= __get_user(buf, &sc->fpstate); | 126 | get_user_ex(*pax, &sc->ax); |
122 | err |= restore_i387_xstate(buf); | 127 | } get_user_catch(err); |
123 | 128 | ||
124 | err |= __get_user(*pax, &sc->ax); | ||
125 | return err; | 129 | return err; |
126 | } | 130 | } |
127 | 131 | ||
@@ -131,57 +135,60 @@ setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate, | |||
131 | { | 135 | { |
132 | int err = 0; | 136 | int err = 0; |
133 | 137 | ||
138 | put_user_try { | ||
139 | |||
134 | #ifdef CONFIG_X86_32 | 140 | #ifdef CONFIG_X86_32 |
135 | { | 141 | { |
136 | unsigned int tmp; | 142 | unsigned int tmp; |
137 | 143 | ||
138 | savesegment(gs, tmp); | 144 | savesegment(gs, tmp); |
139 | err |= __put_user(tmp, (unsigned int __user *)&sc->gs); | 145 | put_user_ex(tmp, (unsigned int __user *)&sc->gs); |
140 | } | 146 | } |
141 | err |= __put_user(regs->fs, (unsigned int __user *)&sc->fs); | 147 | put_user_ex(regs->fs, (unsigned int __user *)&sc->fs); |
142 | err |= __put_user(regs->es, (unsigned int __user *)&sc->es); | 148 | put_user_ex(regs->es, (unsigned int __user *)&sc->es); |
143 | err |= __put_user(regs->ds, (unsigned int __user *)&sc->ds); | 149 | put_user_ex(regs->ds, (unsigned int __user *)&sc->ds); |
144 | #endif /* CONFIG_X86_32 */ | 150 | #endif /* CONFIG_X86_32 */ |
145 | 151 | ||
146 | err |= __put_user(regs->di, &sc->di); | 152 | put_user_ex(regs->di, &sc->di); |
147 | err |= __put_user(regs->si, &sc->si); | 153 | put_user_ex(regs->si, &sc->si); |
148 | err |= __put_user(regs->bp, &sc->bp); | 154 | put_user_ex(regs->bp, &sc->bp); |
149 | err |= __put_user(regs->sp, &sc->sp); | 155 | put_user_ex(regs->sp, &sc->sp); |
150 | err |= __put_user(regs->bx, &sc->bx); | 156 | put_user_ex(regs->bx, &sc->bx); |
151 | err |= __put_user(regs->dx, &sc->dx); | 157 | put_user_ex(regs->dx, &sc->dx); |
152 | err |= __put_user(regs->cx, &sc->cx); | 158 | put_user_ex(regs->cx, &sc->cx); |
153 | err |= __put_user(regs->ax, &sc->ax); | 159 | put_user_ex(regs->ax, &sc->ax); |
154 | #ifdef CONFIG_X86_64 | 160 | #ifdef CONFIG_X86_64 |
155 | err |= __put_user(regs->r8, &sc->r8); | 161 | put_user_ex(regs->r8, &sc->r8); |
156 | err |= __put_user(regs->r9, &sc->r9); | 162 | put_user_ex(regs->r9, &sc->r9); |
157 | err |= __put_user(regs->r10, &sc->r10); | 163 | put_user_ex(regs->r10, &sc->r10); |
158 | err |= __put_user(regs->r11, &sc->r11); | 164 | put_user_ex(regs->r11, &sc->r11); |
159 | err |= __put_user(regs->r12, &sc->r12); | 165 | put_user_ex(regs->r12, &sc->r12); |
160 | err |= __put_user(regs->r13, &sc->r13); | 166 | put_user_ex(regs->r13, &sc->r13); |
161 | err |= __put_user(regs->r14, &sc->r14); | 167 | put_user_ex(regs->r14, &sc->r14); |
162 | err |= __put_user(regs->r15, &sc->r15); | 168 | put_user_ex(regs->r15, &sc->r15); |
163 | #endif /* CONFIG_X86_64 */ | 169 | #endif /* CONFIG_X86_64 */ |
164 | 170 | ||
165 | err |= __put_user(current->thread.trap_no, &sc->trapno); | 171 | put_user_ex(current->thread.trap_no, &sc->trapno); |
166 | err |= __put_user(current->thread.error_code, &sc->err); | 172 | put_user_ex(current->thread.error_code, &sc->err); |
167 | err |= __put_user(regs->ip, &sc->ip); | 173 | put_user_ex(regs->ip, &sc->ip); |
168 | #ifdef CONFIG_X86_32 | 174 | #ifdef CONFIG_X86_32 |
169 | err |= __put_user(regs->cs, (unsigned int __user *)&sc->cs); | 175 | put_user_ex(regs->cs, (unsigned int __user *)&sc->cs); |
170 | err |= __put_user(regs->flags, &sc->flags); | 176 | put_user_ex(regs->flags, &sc->flags); |
171 | err |= __put_user(regs->sp, &sc->sp_at_signal); | 177 | put_user_ex(regs->sp, &sc->sp_at_signal); |
172 | err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss); | 178 | put_user_ex(regs->ss, (unsigned int __user *)&sc->ss); |
173 | #else /* !CONFIG_X86_32 */ | 179 | #else /* !CONFIG_X86_32 */ |
174 | err |= __put_user(regs->flags, &sc->flags); | 180 | put_user_ex(regs->flags, &sc->flags); |
175 | err |= __put_user(regs->cs, &sc->cs); | 181 | put_user_ex(regs->cs, &sc->cs); |
176 | err |= __put_user(0, &sc->gs); | 182 | put_user_ex(0, &sc->gs); |
177 | err |= __put_user(0, &sc->fs); | 183 | put_user_ex(0, &sc->fs); |
178 | #endif /* CONFIG_X86_32 */ | 184 | #endif /* CONFIG_X86_32 */ |
179 | 185 | ||
180 | err |= __put_user(fpstate, &sc->fpstate); | 186 | put_user_ex(fpstate, &sc->fpstate); |
181 | 187 | ||
182 | /* non-iBCS2 extensions.. */ | 188 | /* non-iBCS2 extensions.. */ |
183 | err |= __put_user(mask, &sc->oldmask); | 189 | put_user_ex(mask, &sc->oldmask); |
184 | err |= __put_user(current->thread.cr2, &sc->cr2); | 190 | put_user_ex(current->thread.cr2, &sc->cr2); |
191 | } put_user_catch(err); | ||
185 | 192 | ||
186 | return err; | 193 | return err; |
187 | } | 194 | } |
@@ -336,43 +343,41 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
336 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 343 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
337 | return -EFAULT; | 344 | return -EFAULT; |
338 | 345 | ||
339 | err |= __put_user(sig, &frame->sig); | 346 | put_user_try { |
340 | err |= __put_user(&frame->info, &frame->pinfo); | 347 | put_user_ex(sig, &frame->sig); |
341 | err |= __put_user(&frame->uc, &frame->puc); | 348 | put_user_ex(&frame->info, &frame->pinfo); |
342 | err |= copy_siginfo_to_user(&frame->info, info); | 349 | put_user_ex(&frame->uc, &frame->puc); |
343 | if (err) | 350 | err |= copy_siginfo_to_user(&frame->info, info); |
344 | return -EFAULT; | ||
345 | |||
346 | /* Create the ucontext. */ | ||
347 | if (cpu_has_xsave) | ||
348 | err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags); | ||
349 | else | ||
350 | err |= __put_user(0, &frame->uc.uc_flags); | ||
351 | err |= __put_user(0, &frame->uc.uc_link); | ||
352 | err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); | ||
353 | err |= __put_user(sas_ss_flags(regs->sp), | ||
354 | &frame->uc.uc_stack.ss_flags); | ||
355 | err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); | ||
356 | err |= setup_sigcontext(&frame->uc.uc_mcontext, fpstate, | ||
357 | regs, set->sig[0]); | ||
358 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | ||
359 | if (err) | ||
360 | return -EFAULT; | ||
361 | 351 | ||
362 | /* Set up to return from userspace. */ | 352 | /* Create the ucontext. */ |
363 | restorer = VDSO32_SYMBOL(current->mm->context.vdso, rt_sigreturn); | 353 | if (cpu_has_xsave) |
364 | if (ka->sa.sa_flags & SA_RESTORER) | 354 | put_user_ex(UC_FP_XSTATE, &frame->uc.uc_flags); |
365 | restorer = ka->sa.sa_restorer; | 355 | else |
366 | err |= __put_user(restorer, &frame->pretcode); | 356 | put_user_ex(0, &frame->uc.uc_flags); |
357 | put_user_ex(0, &frame->uc.uc_link); | ||
358 | put_user_ex(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); | ||
359 | put_user_ex(sas_ss_flags(regs->sp), | ||
360 | &frame->uc.uc_stack.ss_flags); | ||
361 | put_user_ex(current->sas_ss_size, &frame->uc.uc_stack.ss_size); | ||
362 | err |= setup_sigcontext(&frame->uc.uc_mcontext, fpstate, | ||
363 | regs, set->sig[0]); | ||
364 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | ||
365 | |||
366 | /* Set up to return from userspace. */ | ||
367 | restorer = VDSO32_SYMBOL(current->mm->context.vdso, rt_sigreturn); | ||
368 | if (ka->sa.sa_flags & SA_RESTORER) | ||
369 | restorer = ka->sa.sa_restorer; | ||
370 | put_user_ex(restorer, &frame->pretcode); | ||
367 | 371 | ||
368 | /* | 372 | /* |
369 | * This is movl $__NR_rt_sigreturn, %ax ; int $0x80 | 373 | * This is movl $__NR_rt_sigreturn, %ax ; int $0x80 |
370 | * | 374 | * |
371 | * WE DO NOT USE IT ANY MORE! It's only left here for historical | 375 | * WE DO NOT USE IT ANY MORE! It's only left here for historical |
372 | * reasons and because gdb uses it as a signature to notice | 376 | * reasons and because gdb uses it as a signature to notice |
373 | * signal handler stack frames. | 377 | * signal handler stack frames. |
374 | */ | 378 | */ |
375 | err |= __put_user(*((u64 *)&rt_retcode), (u64 *)frame->retcode); | 379 | put_user_ex(*((u64 *)&rt_retcode), (u64 *)frame->retcode); |
380 | } put_user_catch(err); | ||
376 | 381 | ||
377 | if (err) | 382 | if (err) |
378 | return -EFAULT; | 383 | return -EFAULT; |
@@ -436,28 +441,30 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
436 | return -EFAULT; | 441 | return -EFAULT; |
437 | } | 442 | } |
438 | 443 | ||
439 | /* Create the ucontext. */ | 444 | put_user_try { |
440 | if (cpu_has_xsave) | 445 | /* Create the ucontext. */ |
441 | err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags); | 446 | if (cpu_has_xsave) |
442 | else | 447 | put_user_ex(UC_FP_XSTATE, &frame->uc.uc_flags); |
443 | err |= __put_user(0, &frame->uc.uc_flags); | 448 | else |
444 | err |= __put_user(0, &frame->uc.uc_link); | 449 | put_user_ex(0, &frame->uc.uc_flags); |
445 | err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp); | 450 | put_user_ex(0, &frame->uc.uc_link); |
446 | err |= __put_user(sas_ss_flags(regs->sp), | 451 | put_user_ex(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp); |
447 | &frame->uc.uc_stack.ss_flags); | 452 | put_user_ex(sas_ss_flags(regs->sp), |
448 | err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size); | 453 | &frame->uc.uc_stack.ss_flags); |
449 | err |= setup_sigcontext(&frame->uc.uc_mcontext, fp, regs, set->sig[0]); | 454 | put_user_ex(me->sas_ss_size, &frame->uc.uc_stack.ss_size); |
450 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 455 | err |= setup_sigcontext(&frame->uc.uc_mcontext, fp, regs, set->sig[0]); |
451 | 456 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | |
452 | /* Set up to return from userspace. If provided, use a stub | 457 | |
453 | already in userspace. */ | 458 | /* Set up to return from userspace. If provided, use a stub |
454 | /* x86-64 should always use SA_RESTORER. */ | 459 | already in userspace. */ |
455 | if (ka->sa.sa_flags & SA_RESTORER) { | 460 | /* x86-64 should always use SA_RESTORER. */ |
456 | err |= __put_user(ka->sa.sa_restorer, &frame->pretcode); | 461 | if (ka->sa.sa_flags & SA_RESTORER) { |
457 | } else { | 462 | put_user_ex(ka->sa.sa_restorer, &frame->pretcode); |
458 | /* could use a vstub here */ | 463 | } else { |
459 | return -EFAULT; | 464 | /* could use a vstub here */ |
460 | } | 465 | err |= -EFAULT; |
466 | } | ||
467 | } put_user_catch(err); | ||
461 | 468 | ||
462 | if (err) | 469 | if (err) |
463 | return -EFAULT; | 470 | return -EFAULT; |
@@ -509,31 +516,41 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, | |||
509 | struct old_sigaction __user *oact) | 516 | struct old_sigaction __user *oact) |
510 | { | 517 | { |
511 | struct k_sigaction new_ka, old_ka; | 518 | struct k_sigaction new_ka, old_ka; |
512 | int ret; | 519 | int ret = 0; |
513 | 520 | ||
514 | if (act) { | 521 | if (act) { |
515 | old_sigset_t mask; | 522 | old_sigset_t mask; |
516 | 523 | ||
517 | if (!access_ok(VERIFY_READ, act, sizeof(*act)) || | 524 | if (!access_ok(VERIFY_READ, act, sizeof(*act))) |
518 | __get_user(new_ka.sa.sa_handler, &act->sa_handler) || | ||
519 | __get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) | ||
520 | return -EFAULT; | 525 | return -EFAULT; |
521 | 526 | ||
522 | __get_user(new_ka.sa.sa_flags, &act->sa_flags); | 527 | get_user_try { |
523 | __get_user(mask, &act->sa_mask); | 528 | get_user_ex(new_ka.sa.sa_handler, &act->sa_handler); |
529 | get_user_ex(new_ka.sa.sa_flags, &act->sa_flags); | ||
530 | get_user_ex(mask, &act->sa_mask); | ||
531 | get_user_ex(new_ka.sa.sa_restorer, &act->sa_restorer); | ||
532 | } get_user_catch(ret); | ||
533 | |||
534 | if (ret) | ||
535 | return -EFAULT; | ||
524 | siginitset(&new_ka.sa.sa_mask, mask); | 536 | siginitset(&new_ka.sa.sa_mask, mask); |
525 | } | 537 | } |
526 | 538 | ||
527 | ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); | 539 | ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); |
528 | 540 | ||
529 | if (!ret && oact) { | 541 | if (!ret && oact) { |
530 | if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || | 542 | if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact))) |
531 | __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || | ||
532 | __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) | ||
533 | return -EFAULT; | 543 | return -EFAULT; |
534 | 544 | ||
535 | __put_user(old_ka.sa.sa_flags, &oact->sa_flags); | 545 | put_user_try { |
536 | __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask); | 546 | put_user_ex(old_ka.sa.sa_handler, &oact->sa_handler); |
547 | put_user_ex(old_ka.sa.sa_flags, &oact->sa_flags); | ||
548 | put_user_ex(old_ka.sa.sa_mask.sig[0], &oact->sa_mask); | ||
549 | put_user_ex(old_ka.sa.sa_restorer, &oact->sa_restorer); | ||
550 | } put_user_catch(ret); | ||
551 | |||
552 | if (ret) | ||
553 | return -EFAULT; | ||
537 | } | 554 | } |
538 | 555 | ||
539 | return ret; | 556 | return ret; |
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index e6faa3316bd2..eaaffae31cc0 100644 --- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Intel SMP support routines. | 2 | * Intel SMP support routines. |
3 | * | 3 | * |
4 | * (c) 1995 Alan Cox, Building #3 <alan@lxorguk.ukuu.org.uk> | 4 | * (c) 1995 Alan Cox, Building #3 <alan@lxorguk.ukuu.org.uk> |
5 | * (c) 1998-99, 2000 Ingo Molnar <mingo@redhat.com> | 5 | * (c) 1998-99, 2000, 2009 Ingo Molnar <mingo@redhat.com> |
6 | * (c) 2002,2003 Andi Kleen, SuSE Labs. | 6 | * (c) 2002,2003 Andi Kleen, SuSE Labs. |
7 | * | 7 | * |
8 | * i386 and x86_64 integration by Glauber Costa <gcosta@redhat.com> | 8 | * i386 and x86_64 integration by Glauber Costa <gcosta@redhat.com> |
@@ -26,8 +26,7 @@ | |||
26 | #include <asm/tlbflush.h> | 26 | #include <asm/tlbflush.h> |
27 | #include <asm/mmu_context.h> | 27 | #include <asm/mmu_context.h> |
28 | #include <asm/proto.h> | 28 | #include <asm/proto.h> |
29 | #include <mach_ipi.h> | 29 | #include <asm/genapic.h> |
30 | #include <mach_apic.h> | ||
31 | /* | 30 | /* |
32 | * Some notes on x86 processor bugs affecting SMP operation: | 31 | * Some notes on x86 processor bugs affecting SMP operation: |
33 | * | 32 | * |
@@ -118,12 +117,12 @@ static void native_smp_send_reschedule(int cpu) | |||
118 | WARN_ON(1); | 117 | WARN_ON(1); |
119 | return; | 118 | return; |
120 | } | 119 | } |
121 | send_IPI_mask(cpumask_of(cpu), RESCHEDULE_VECTOR); | 120 | apic->send_IPI_mask(cpumask_of(cpu), RESCHEDULE_VECTOR); |
122 | } | 121 | } |
123 | 122 | ||
124 | void native_send_call_func_single_ipi(int cpu) | 123 | void native_send_call_func_single_ipi(int cpu) |
125 | { | 124 | { |
126 | send_IPI_mask(cpumask_of(cpu), CALL_FUNCTION_SINGLE_VECTOR); | 125 | apic->send_IPI_mask(cpumask_of(cpu), CALL_FUNCTION_SINGLE_VECTOR); |
127 | } | 126 | } |
128 | 127 | ||
129 | void native_send_call_func_ipi(const struct cpumask *mask) | 128 | void native_send_call_func_ipi(const struct cpumask *mask) |
@@ -131,7 +130,7 @@ void native_send_call_func_ipi(const struct cpumask *mask) | |||
131 | cpumask_var_t allbutself; | 130 | cpumask_var_t allbutself; |
132 | 131 | ||
133 | if (!alloc_cpumask_var(&allbutself, GFP_ATOMIC)) { | 132 | if (!alloc_cpumask_var(&allbutself, GFP_ATOMIC)) { |
134 | send_IPI_mask(mask, CALL_FUNCTION_VECTOR); | 133 | apic->send_IPI_mask(mask, CALL_FUNCTION_VECTOR); |
135 | return; | 134 | return; |
136 | } | 135 | } |
137 | 136 | ||
@@ -140,9 +139,9 @@ void native_send_call_func_ipi(const struct cpumask *mask) | |||
140 | 139 | ||
141 | if (cpumask_equal(mask, allbutself) && | 140 | if (cpumask_equal(mask, allbutself) && |
142 | cpumask_equal(cpu_online_mask, cpu_callout_mask)) | 141 | cpumask_equal(cpu_online_mask, cpu_callout_mask)) |
143 | send_IPI_allbutself(CALL_FUNCTION_VECTOR); | 142 | apic->send_IPI_allbutself(CALL_FUNCTION_VECTOR); |
144 | else | 143 | else |
145 | send_IPI_mask(mask, CALL_FUNCTION_VECTOR); | 144 | apic->send_IPI_mask(mask, CALL_FUNCTION_VECTOR); |
146 | 145 | ||
147 | free_cpumask_var(allbutself); | 146 | free_cpumask_var(allbutself); |
148 | } | 147 | } |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index bb1a3b1fc87f..96f7d304f5c9 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * x86 SMP booting functions | 2 | * x86 SMP booting functions |
3 | * | 3 | * |
4 | * (c) 1995 Alan Cox, Building #3 <alan@lxorguk.ukuu.org.uk> | 4 | * (c) 1995 Alan Cox, Building #3 <alan@lxorguk.ukuu.org.uk> |
5 | * (c) 1998, 1999, 2000 Ingo Molnar <mingo@redhat.com> | 5 | * (c) 1998, 1999, 2000, 2009 Ingo Molnar <mingo@redhat.com> |
6 | * Copyright 2001 Andi Kleen, SuSE Labs. | 6 | * Copyright 2001 Andi Kleen, SuSE Labs. |
7 | * | 7 | * |
8 | * Much of the core SMP work is based on previous work by Thomas Radke, to | 8 | * Much of the core SMP work is based on previous work by Thomas Radke, to |
@@ -53,7 +53,6 @@ | |||
53 | #include <asm/nmi.h> | 53 | #include <asm/nmi.h> |
54 | #include <asm/irq.h> | 54 | #include <asm/irq.h> |
55 | #include <asm/idle.h> | 55 | #include <asm/idle.h> |
56 | #include <asm/smp.h> | ||
57 | #include <asm/trampoline.h> | 56 | #include <asm/trampoline.h> |
58 | #include <asm/cpu.h> | 57 | #include <asm/cpu.h> |
59 | #include <asm/numa.h> | 58 | #include <asm/numa.h> |
@@ -63,11 +62,11 @@ | |||
63 | #include <asm/vmi.h> | 62 | #include <asm/vmi.h> |
64 | #include <asm/genapic.h> | 63 | #include <asm/genapic.h> |
65 | #include <asm/setup.h> | 64 | #include <asm/setup.h> |
65 | #include <asm/uv/uv.h> | ||
66 | #include <linux/mc146818rtc.h> | 66 | #include <linux/mc146818rtc.h> |
67 | 67 | ||
68 | #include <mach_apic.h> | 68 | #include <asm/genapic.h> |
69 | #include <mach_wakecpu.h> | 69 | #include <asm/smpboot_hooks.h> |
70 | #include <smpboot_hooks.h> | ||
71 | 70 | ||
72 | #ifdef CONFIG_X86_32 | 71 | #ifdef CONFIG_X86_32 |
73 | u8 apicid_2_node[MAX_APICID]; | 72 | u8 apicid_2_node[MAX_APICID]; |
@@ -163,7 +162,7 @@ static void map_cpu_to_logical_apicid(void) | |||
163 | { | 162 | { |
164 | int cpu = smp_processor_id(); | 163 | int cpu = smp_processor_id(); |
165 | int apicid = logical_smp_processor_id(); | 164 | int apicid = logical_smp_processor_id(); |
166 | int node = apicid_to_node(apicid); | 165 | int node = apic->apicid_to_node(apicid); |
167 | 166 | ||
168 | if (!node_online(node)) | 167 | if (!node_online(node)) |
169 | node = first_online_node; | 168 | node = first_online_node; |
@@ -196,7 +195,8 @@ static void __cpuinit smp_callin(void) | |||
196 | * our local APIC. We have to wait for the IPI or we'll | 195 | * our local APIC. We have to wait for the IPI or we'll |
197 | * lock up on an APIC access. | 196 | * lock up on an APIC access. |
198 | */ | 197 | */ |
199 | wait_for_init_deassert(&init_deasserted); | 198 | if (apic->wait_for_init_deassert) |
199 | apic->wait_for_init_deassert(&init_deasserted); | ||
200 | 200 | ||
201 | /* | 201 | /* |
202 | * (This works even if the APIC is not enabled.) | 202 | * (This works even if the APIC is not enabled.) |
@@ -243,7 +243,8 @@ static void __cpuinit smp_callin(void) | |||
243 | */ | 243 | */ |
244 | 244 | ||
245 | pr_debug("CALLIN, before setup_local_APIC().\n"); | 245 | pr_debug("CALLIN, before setup_local_APIC().\n"); |
246 | smp_callin_clear_local_apic(); | 246 | if (apic->smp_callin_clear_local_apic) |
247 | apic->smp_callin_clear_local_apic(); | ||
247 | setup_local_APIC(); | 248 | setup_local_APIC(); |
248 | end_local_APIC_setup(); | 249 | end_local_APIC_setup(); |
249 | map_cpu_to_logical_apicid(); | 250 | map_cpu_to_logical_apicid(); |
@@ -583,7 +584,7 @@ wakeup_secondary_cpu_via_nmi(int logical_apicid, unsigned long start_eip) | |||
583 | /* Target chip */ | 584 | /* Target chip */ |
584 | /* Boot on the stack */ | 585 | /* Boot on the stack */ |
585 | /* Kick the second */ | 586 | /* Kick the second */ |
586 | apic_icr_write(APIC_DM_NMI | APIC_DEST_LOGICAL, logical_apicid); | 587 | apic_icr_write(APIC_DM_NMI | apic->dest_logical, logical_apicid); |
587 | 588 | ||
588 | pr_debug("Waiting for send to finish...\n"); | 589 | pr_debug("Waiting for send to finish...\n"); |
589 | send_status = safe_apic_wait_icr_idle(); | 590 | send_status = safe_apic_wait_icr_idle(); |
@@ -745,57 +746,11 @@ static void __cpuinit do_fork_idle(struct work_struct *work) | |||
745 | complete(&c_idle->done); | 746 | complete(&c_idle->done); |
746 | } | 747 | } |
747 | 748 | ||
748 | #ifdef CONFIG_X86_64 | ||
749 | |||
750 | /* __ref because it's safe to call free_bootmem when after_bootmem == 0. */ | ||
751 | static void __ref free_bootmem_pda(struct x8664_pda *oldpda) | ||
752 | { | ||
753 | if (!after_bootmem) | ||
754 | free_bootmem((unsigned long)oldpda, sizeof(*oldpda)); | ||
755 | } | ||
756 | |||
757 | /* | ||
758 | * Allocate node local memory for the AP pda. | ||
759 | * | ||
760 | * Must be called after the _cpu_pda pointer table is initialized. | ||
761 | */ | ||
762 | int __cpuinit get_local_pda(int cpu) | ||
763 | { | ||
764 | struct x8664_pda *oldpda, *newpda; | ||
765 | unsigned long size = sizeof(struct x8664_pda); | ||
766 | int node = cpu_to_node(cpu); | ||
767 | |||
768 | if (cpu_pda(cpu) && !cpu_pda(cpu)->in_bootmem) | ||
769 | return 0; | ||
770 | |||
771 | oldpda = cpu_pda(cpu); | ||
772 | newpda = kmalloc_node(size, GFP_ATOMIC, node); | ||
773 | if (!newpda) { | ||
774 | printk(KERN_ERR "Could not allocate node local PDA " | ||
775 | "for CPU %d on node %d\n", cpu, node); | ||
776 | |||
777 | if (oldpda) | ||
778 | return 0; /* have a usable pda */ | ||
779 | else | ||
780 | return -1; | ||
781 | } | ||
782 | |||
783 | if (oldpda) { | ||
784 | memcpy(newpda, oldpda, size); | ||
785 | free_bootmem_pda(oldpda); | ||
786 | } | ||
787 | |||
788 | newpda->in_bootmem = 0; | ||
789 | cpu_pda(cpu) = newpda; | ||
790 | return 0; | ||
791 | } | ||
792 | #endif /* CONFIG_X86_64 */ | ||
793 | |||
794 | static int __cpuinit do_boot_cpu(int apicid, int cpu) | 749 | static int __cpuinit do_boot_cpu(int apicid, int cpu) |
795 | /* | 750 | /* |
796 | * NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad | 751 | * NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad |
797 | * (ie clustered apic addressing mode), this is a LOGICAL apic ID. | 752 | * (ie clustered apic addressing mode), this is a LOGICAL apic ID. |
798 | * Returns zero if CPU booted OK, else error code from wakeup_secondary_cpu. | 753 | * Returns zero if CPU booted OK, else error code from ->wakeup_cpu. |
799 | */ | 754 | */ |
800 | { | 755 | { |
801 | unsigned long boot_error = 0; | 756 | unsigned long boot_error = 0; |
@@ -808,16 +763,6 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu) | |||
808 | }; | 763 | }; |
809 | INIT_WORK(&c_idle.work, do_fork_idle); | 764 | INIT_WORK(&c_idle.work, do_fork_idle); |
810 | 765 | ||
811 | #ifdef CONFIG_X86_64 | ||
812 | /* Allocate node local memory for AP pdas */ | ||
813 | if (cpu > 0) { | ||
814 | boot_error = get_local_pda(cpu); | ||
815 | if (boot_error) | ||
816 | goto restore_state; | ||
817 | /* if can't get pda memory, can't start cpu */ | ||
818 | } | ||
819 | #endif | ||
820 | |||
821 | alternatives_smp_switch(1); | 766 | alternatives_smp_switch(1); |
822 | 767 | ||
823 | c_idle.idle = get_idle_for_cpu(cpu); | 768 | c_idle.idle = get_idle_for_cpu(cpu); |
@@ -847,14 +792,16 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu) | |||
847 | 792 | ||
848 | set_idle_for_cpu(cpu, c_idle.idle); | 793 | set_idle_for_cpu(cpu, c_idle.idle); |
849 | do_rest: | 794 | do_rest: |
850 | #ifdef CONFIG_X86_32 | ||
851 | per_cpu(current_task, cpu) = c_idle.idle; | 795 | per_cpu(current_task, cpu) = c_idle.idle; |
852 | init_gdt(cpu); | 796 | #ifdef CONFIG_X86_32 |
853 | /* Stack for startup_32 can be just as for start_secondary onwards */ | 797 | /* Stack for startup_32 can be just as for start_secondary onwards */ |
854 | irq_ctx_init(cpu); | 798 | irq_ctx_init(cpu); |
855 | #else | 799 | #else |
856 | cpu_pda(cpu)->pcurrent = c_idle.idle; | ||
857 | clear_tsk_thread_flag(c_idle.idle, TIF_FORK); | 800 | clear_tsk_thread_flag(c_idle.idle, TIF_FORK); |
801 | initial_gs = per_cpu_offset(cpu); | ||
802 | per_cpu(kernel_stack, cpu) = | ||
803 | (unsigned long)task_stack_page(c_idle.idle) - | ||
804 | KERNEL_STACK_OFFSET + THREAD_SIZE; | ||
858 | #endif | 805 | #endif |
859 | early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); | 806 | early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); |
860 | initial_code = (unsigned long)start_secondary; | 807 | initial_code = (unsigned long)start_secondary; |
@@ -878,7 +825,8 @@ do_rest: | |||
878 | 825 | ||
879 | pr_debug("Setting warm reset code and vector.\n"); | 826 | pr_debug("Setting warm reset code and vector.\n"); |
880 | 827 | ||
881 | store_NMI_vector(&nmi_high, &nmi_low); | 828 | if (apic->store_NMI_vector) |
829 | apic->store_NMI_vector(&nmi_high, &nmi_low); | ||
882 | 830 | ||
883 | smpboot_setup_warm_reset_vector(start_ip); | 831 | smpboot_setup_warm_reset_vector(start_ip); |
884 | /* | 832 | /* |
@@ -893,7 +841,7 @@ do_rest: | |||
893 | /* | 841 | /* |
894 | * Starting actual IPI sequence... | 842 | * Starting actual IPI sequence... |
895 | */ | 843 | */ |
896 | boot_error = wakeup_secondary_cpu(apicid, start_ip); | 844 | boot_error = apic->wakeup_cpu(apicid, start_ip); |
897 | 845 | ||
898 | if (!boot_error) { | 846 | if (!boot_error) { |
899 | /* | 847 | /* |
@@ -927,13 +875,11 @@ do_rest: | |||
927 | else | 875 | else |
928 | /* trampoline code not run */ | 876 | /* trampoline code not run */ |
929 | printk(KERN_ERR "Not responding.\n"); | 877 | printk(KERN_ERR "Not responding.\n"); |
930 | if (get_uv_system_type() != UV_NON_UNIQUE_APIC) | 878 | if (apic->inquire_remote_apic) |
931 | inquire_remote_apic(apicid); | 879 | apic->inquire_remote_apic(apicid); |
932 | } | 880 | } |
933 | } | 881 | } |
934 | #ifdef CONFIG_X86_64 | 882 | |
935 | restore_state: | ||
936 | #endif | ||
937 | if (boot_error) { | 883 | if (boot_error) { |
938 | /* Try to put things back the way they were before ... */ | 884 | /* Try to put things back the way they were before ... */ |
939 | numa_remove_cpu(cpu); /* was set by numa_add_cpu */ | 885 | numa_remove_cpu(cpu); /* was set by numa_add_cpu */ |
@@ -961,7 +907,7 @@ restore_state: | |||
961 | 907 | ||
962 | int __cpuinit native_cpu_up(unsigned int cpu) | 908 | int __cpuinit native_cpu_up(unsigned int cpu) |
963 | { | 909 | { |
964 | int apicid = cpu_present_to_apicid(cpu); | 910 | int apicid = apic->cpu_present_to_apicid(cpu); |
965 | unsigned long flags; | 911 | unsigned long flags; |
966 | int err; | 912 | int err; |
967 | 913 | ||
@@ -1054,14 +1000,14 @@ static int __init smp_sanity_check(unsigned max_cpus) | |||
1054 | { | 1000 | { |
1055 | preempt_disable(); | 1001 | preempt_disable(); |
1056 | 1002 | ||
1057 | #if defined(CONFIG_X86_PC) && defined(CONFIG_X86_32) | 1003 | #if !defined(CONFIG_X86_BIGSMP) && defined(CONFIG_X86_32) |
1058 | if (def_to_bigsmp && nr_cpu_ids > 8) { | 1004 | if (def_to_bigsmp && nr_cpu_ids > 8) { |
1059 | unsigned int cpu; | 1005 | unsigned int cpu; |
1060 | unsigned nr; | 1006 | unsigned nr; |
1061 | 1007 | ||
1062 | printk(KERN_WARNING | 1008 | printk(KERN_WARNING |
1063 | "More than 8 CPUs detected - skipping them.\n" | 1009 | "More than 8 CPUs detected - skipping them.\n" |
1064 | "Use CONFIG_X86_GENERICARCH and CONFIG_X86_BIGSMP.\n"); | 1010 | "Use CONFIG_X86_BIGSMP.\n"); |
1065 | 1011 | ||
1066 | nr = 0; | 1012 | nr = 0; |
1067 | for_each_present_cpu(cpu) { | 1013 | for_each_present_cpu(cpu) { |
@@ -1107,7 +1053,7 @@ static int __init smp_sanity_check(unsigned max_cpus) | |||
1107 | * Should not be necessary because the MP table should list the boot | 1053 | * Should not be necessary because the MP table should list the boot |
1108 | * CPU too, but we do it for the sake of robustness anyway. | 1054 | * CPU too, but we do it for the sake of robustness anyway. |
1109 | */ | 1055 | */ |
1110 | if (!check_phys_apicid_present(boot_cpu_physical_apicid)) { | 1056 | if (!apic->check_phys_apicid_present(boot_cpu_physical_apicid)) { |
1111 | printk(KERN_NOTICE | 1057 | printk(KERN_NOTICE |
1112 | "weird, boot CPU (#%d) not listed by the BIOS.\n", | 1058 | "weird, boot CPU (#%d) not listed by the BIOS.\n", |
1113 | boot_cpu_physical_apicid); | 1059 | boot_cpu_physical_apicid); |
@@ -1125,6 +1071,7 @@ static int __init smp_sanity_check(unsigned max_cpus) | |||
1125 | printk(KERN_ERR "... forcing use of dummy APIC emulation." | 1071 | printk(KERN_ERR "... forcing use of dummy APIC emulation." |
1126 | "(tell your hw vendor)\n"); | 1072 | "(tell your hw vendor)\n"); |
1127 | smpboot_clear_io_apic(); | 1073 | smpboot_clear_io_apic(); |
1074 | arch_disable_smp_support(); | ||
1128 | return -1; | 1075 | return -1; |
1129 | } | 1076 | } |
1130 | 1077 | ||
@@ -1183,7 +1130,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
1183 | 1130 | ||
1184 | #ifdef CONFIG_X86_64 | 1131 | #ifdef CONFIG_X86_64 |
1185 | enable_IR_x2apic(); | 1132 | enable_IR_x2apic(); |
1186 | setup_apic_routing(); | 1133 | default_setup_apic_routing(); |
1187 | #endif | 1134 | #endif |
1188 | 1135 | ||
1189 | if (smp_sanity_check(max_cpus) < 0) { | 1136 | if (smp_sanity_check(max_cpus) < 0) { |
@@ -1218,7 +1165,8 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
1218 | 1165 | ||
1219 | map_cpu_to_logical_apicid(); | 1166 | map_cpu_to_logical_apicid(); |
1220 | 1167 | ||
1221 | setup_portio_remap(); | 1168 | if (apic->setup_portio_remap) |
1169 | apic->setup_portio_remap(); | ||
1222 | 1170 | ||
1223 | smpboot_setup_io_apic(); | 1171 | smpboot_setup_io_apic(); |
1224 | /* | 1172 | /* |
@@ -1240,9 +1188,6 @@ out: | |||
1240 | void __init native_smp_prepare_boot_cpu(void) | 1188 | void __init native_smp_prepare_boot_cpu(void) |
1241 | { | 1189 | { |
1242 | int me = smp_processor_id(); | 1190 | int me = smp_processor_id(); |
1243 | #ifdef CONFIG_X86_32 | ||
1244 | init_gdt(me); | ||
1245 | #endif | ||
1246 | switch_to_new_gdt(); | 1191 | switch_to_new_gdt(); |
1247 | /* already set me in cpu_online_mask in boot_cpu_init() */ | 1192 | /* already set me in cpu_online_mask in boot_cpu_init() */ |
1248 | cpumask_set_cpu(me, cpu_callout_mask); | 1193 | cpumask_set_cpu(me, cpu_callout_mask); |
diff --git a/arch/x86/kernel/smpcommon.c b/arch/x86/kernel/smpcommon.c deleted file mode 100644 index 397e309839dd..000000000000 --- a/arch/x86/kernel/smpcommon.c +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | /* | ||
2 | * SMP stuff which is common to all sub-architectures. | ||
3 | */ | ||
4 | #include <linux/module.h> | ||
5 | #include <asm/smp.h> | ||
6 | |||
7 | #ifdef CONFIG_X86_32 | ||
8 | DEFINE_PER_CPU(unsigned long, this_cpu_off); | ||
9 | EXPORT_PER_CPU_SYMBOL(this_cpu_off); | ||
10 | |||
11 | /* | ||
12 | * Initialize the CPU's GDT. This is either the boot CPU doing itself | ||
13 | * (still using the master per-cpu area), or a CPU doing it for a | ||
14 | * secondary which will soon come up. | ||
15 | */ | ||
16 | __cpuinit void init_gdt(int cpu) | ||
17 | { | ||
18 | struct desc_struct gdt; | ||
19 | |||
20 | pack_descriptor(&gdt, __per_cpu_offset[cpu], 0xFFFFF, | ||
21 | 0x2 | DESCTYPE_S, 0x8); | ||
22 | gdt.s = 1; | ||
23 | |||
24 | write_gdt_entry(get_cpu_gdt_table(cpu), | ||
25 | GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S); | ||
26 | |||
27 | per_cpu(this_cpu_off, cpu) = __per_cpu_offset[cpu]; | ||
28 | per_cpu(cpu_number, cpu) = cpu; | ||
29 | } | ||
30 | #endif | ||
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c index 10786af95545..f7bddc2e37d1 100644 --- a/arch/x86/kernel/stacktrace.c +++ b/arch/x86/kernel/stacktrace.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Stack trace management functions | 2 | * Stack trace management functions |
3 | * | 3 | * |
4 | * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> | 4 | * Copyright (C) 2006-2009 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> |
5 | */ | 5 | */ |
6 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
7 | #include <linux/stacktrace.h> | 7 | #include <linux/stacktrace.h> |
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/summit_32.c index 7b987852e876..1e733eff9b33 100644 --- a/arch/x86/kernel/summit_32.c +++ b/arch/x86/kernel/summit_32.c | |||
@@ -30,8 +30,364 @@ | |||
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <asm/io.h> | 31 | #include <asm/io.h> |
32 | #include <asm/bios_ebda.h> | 32 | #include <asm/bios_ebda.h> |
33 | #include <asm/summit/mpparse.h> | ||
34 | 33 | ||
34 | /* | ||
35 | * APIC driver for the IBM "Summit" chipset. | ||
36 | */ | ||
37 | #define APIC_DEFINITION 1 | ||
38 | #include <linux/threads.h> | ||
39 | #include <linux/cpumask.h> | ||
40 | #include <asm/mpspec.h> | ||
41 | #include <asm/apic.h> | ||
42 | #include <asm/smp.h> | ||
43 | #include <asm/genapic.h> | ||
44 | #include <asm/fixmap.h> | ||
45 | #include <asm/apicdef.h> | ||
46 | #include <asm/ipi.h> | ||
47 | #include <linux/kernel.h> | ||
48 | #include <linux/string.h> | ||
49 | #include <linux/init.h> | ||
50 | #include <linux/gfp.h> | ||
51 | #include <linux/smp.h> | ||
52 | |||
53 | static inline unsigned summit_get_apic_id(unsigned long x) | ||
54 | { | ||
55 | return (x >> 24) & 0xFF; | ||
56 | } | ||
57 | |||
58 | static inline void summit_send_IPI_mask(const cpumask_t *mask, int vector) | ||
59 | { | ||
60 | default_send_IPI_mask_sequence_logical(mask, vector); | ||
61 | } | ||
62 | |||
63 | static inline void summit_send_IPI_allbutself(int vector) | ||
64 | { | ||
65 | cpumask_t mask = cpu_online_map; | ||
66 | cpu_clear(smp_processor_id(), mask); | ||
67 | |||
68 | if (!cpus_empty(mask)) | ||
69 | summit_send_IPI_mask(&mask, vector); | ||
70 | } | ||
71 | |||
72 | static inline void summit_send_IPI_all(int vector) | ||
73 | { | ||
74 | summit_send_IPI_mask(&cpu_online_map, vector); | ||
75 | } | ||
76 | |||
77 | #include <asm/tsc.h> | ||
78 | |||
79 | extern int use_cyclone; | ||
80 | |||
81 | #ifdef CONFIG_X86_SUMMIT_NUMA | ||
82 | extern void setup_summit(void); | ||
83 | #else | ||
84 | #define setup_summit() {} | ||
85 | #endif | ||
86 | |||
87 | static inline int | ||
88 | summit_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | ||
89 | { | ||
90 | if (!strncmp(oem, "IBM ENSW", 8) && | ||
91 | (!strncmp(productid, "VIGIL SMP", 9) | ||
92 | || !strncmp(productid, "EXA", 3) | ||
93 | || !strncmp(productid, "RUTHLESS SMP", 12))){ | ||
94 | mark_tsc_unstable("Summit based system"); | ||
95 | use_cyclone = 1; /*enable cyclone-timer*/ | ||
96 | setup_summit(); | ||
97 | return 1; | ||
98 | } | ||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | /* Hook from generic ACPI tables.c */ | ||
103 | static inline int summit_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
104 | { | ||
105 | if (!strncmp(oem_id, "IBM", 3) && | ||
106 | (!strncmp(oem_table_id, "SERVIGIL", 8) | ||
107 | || !strncmp(oem_table_id, "EXA", 3))){ | ||
108 | mark_tsc_unstable("Summit based system"); | ||
109 | use_cyclone = 1; /*enable cyclone-timer*/ | ||
110 | setup_summit(); | ||
111 | return 1; | ||
112 | } | ||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | struct rio_table_hdr { | ||
117 | unsigned char version; /* Version number of this data structure */ | ||
118 | /* Version 3 adds chassis_num & WP_index */ | ||
119 | unsigned char num_scal_dev; /* # of Scalability devices (Twisters for Vigil) */ | ||
120 | unsigned char num_rio_dev; /* # of RIO I/O devices (Cyclones and Winnipegs) */ | ||
121 | } __attribute__((packed)); | ||
122 | |||
123 | struct scal_detail { | ||
124 | unsigned char node_id; /* Scalability Node ID */ | ||
125 | unsigned long CBAR; /* Address of 1MB register space */ | ||
126 | unsigned char port0node; /* Node ID port connected to: 0xFF=None */ | ||
127 | unsigned char port0port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
128 | unsigned char port1node; /* Node ID port connected to: 0xFF = None */ | ||
129 | unsigned char port1port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
130 | unsigned char port2node; /* Node ID port connected to: 0xFF = None */ | ||
131 | unsigned char port2port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
132 | unsigned char chassis_num; /* 1 based Chassis number (1 = boot node) */ | ||
133 | } __attribute__((packed)); | ||
134 | |||
135 | struct rio_detail { | ||
136 | unsigned char node_id; /* RIO Node ID */ | ||
137 | unsigned long BBAR; /* Address of 1MB register space */ | ||
138 | unsigned char type; /* Type of device */ | ||
139 | unsigned char owner_id; /* For WPEG: Node ID of Cyclone that owns this WPEG*/ | ||
140 | /* For CYC: Node ID of Twister that owns this CYC */ | ||
141 | unsigned char port0node; /* Node ID port connected to: 0xFF=None */ | ||
142 | unsigned char port0port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
143 | unsigned char port1node; /* Node ID port connected to: 0xFF=None */ | ||
144 | unsigned char port1port; /* Port num port connected to: 0,1,2, or 0xFF=None */ | ||
145 | unsigned char first_slot; /* For WPEG: Lowest slot number below this WPEG */ | ||
146 | /* For CYC: 0 */ | ||
147 | unsigned char status; /* For WPEG: Bit 0 = 1 : the XAPIC is used */ | ||
148 | /* = 0 : the XAPIC is not used, ie:*/ | ||
149 | /* ints fwded to another XAPIC */ | ||
150 | /* Bits1:7 Reserved */ | ||
151 | /* For CYC: Bits0:7 Reserved */ | ||
152 | unsigned char WP_index; /* For WPEG: WPEG instance index - lower ones have */ | ||
153 | /* lower slot numbers/PCI bus numbers */ | ||
154 | /* For CYC: No meaning */ | ||
155 | unsigned char chassis_num; /* 1 based Chassis number */ | ||
156 | /* For LookOut WPEGs this field indicates the */ | ||
157 | /* Expansion Chassis #, enumerated from Boot */ | ||
158 | /* Node WPEG external port, then Boot Node CYC */ | ||
159 | /* external port, then Next Vigil chassis WPEG */ | ||
160 | /* external port, etc. */ | ||
161 | /* Shared Lookouts have only 1 chassis number (the */ | ||
162 | /* first one assigned) */ | ||
163 | } __attribute__((packed)); | ||
164 | |||
165 | |||
166 | typedef enum { | ||
167 | CompatTwister = 0, /* Compatibility Twister */ | ||
168 | AltTwister = 1, /* Alternate Twister of internal 8-way */ | ||
169 | CompatCyclone = 2, /* Compatibility Cyclone */ | ||
170 | AltCyclone = 3, /* Alternate Cyclone of internal 8-way */ | ||
171 | CompatWPEG = 4, /* Compatibility WPEG */ | ||
172 | AltWPEG = 5, /* Second Planar WPEG */ | ||
173 | LookOutAWPEG = 6, /* LookOut WPEG */ | ||
174 | LookOutBWPEG = 7, /* LookOut WPEG */ | ||
175 | } node_type; | ||
176 | |||
177 | static inline int is_WPEG(struct rio_detail *rio){ | ||
178 | return (rio->type == CompatWPEG || rio->type == AltWPEG || | ||
179 | rio->type == LookOutAWPEG || rio->type == LookOutBWPEG); | ||
180 | } | ||
181 | |||
182 | |||
183 | /* In clustered mode, the high nibble of APIC ID is a cluster number. | ||
184 | * The low nibble is a 4-bit bitmap. */ | ||
185 | #define XAPIC_DEST_CPUS_SHIFT 4 | ||
186 | #define XAPIC_DEST_CPUS_MASK ((1u << XAPIC_DEST_CPUS_SHIFT) - 1) | ||
187 | #define XAPIC_DEST_CLUSTER_MASK (XAPIC_DEST_CPUS_MASK << XAPIC_DEST_CPUS_SHIFT) | ||
188 | |||
189 | #define SUMMIT_APIC_DFR_VALUE (APIC_DFR_CLUSTER) | ||
190 | |||
191 | static inline const cpumask_t *summit_target_cpus(void) | ||
192 | { | ||
193 | /* CPU_MASK_ALL (0xff) has undefined behaviour with | ||
194 | * dest_LowestPrio mode logical clustered apic interrupt routing | ||
195 | * Just start on cpu 0. IRQ balancing will spread load | ||
196 | */ | ||
197 | return &cpumask_of_cpu(0); | ||
198 | } | ||
199 | |||
200 | static inline unsigned long | ||
201 | summit_check_apicid_used(physid_mask_t bitmap, int apicid) | ||
202 | { | ||
203 | return 0; | ||
204 | } | ||
205 | |||
206 | /* we don't use the phys_cpu_present_map to indicate apicid presence */ | ||
207 | static inline unsigned long summit_check_apicid_present(int bit) | ||
208 | { | ||
209 | return 1; | ||
210 | } | ||
211 | |||
212 | #define apicid_cluster(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK) | ||
213 | |||
214 | extern u8 cpu_2_logical_apicid[]; | ||
215 | |||
216 | static inline void summit_init_apic_ldr(void) | ||
217 | { | ||
218 | unsigned long val, id; | ||
219 | int count = 0; | ||
220 | u8 my_id = (u8)hard_smp_processor_id(); | ||
221 | u8 my_cluster = (u8)apicid_cluster(my_id); | ||
222 | #ifdef CONFIG_SMP | ||
223 | u8 lid; | ||
224 | int i; | ||
225 | |||
226 | /* Create logical APIC IDs by counting CPUs already in cluster. */ | ||
227 | for (count = 0, i = nr_cpu_ids; --i >= 0; ) { | ||
228 | lid = cpu_2_logical_apicid[i]; | ||
229 | if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster) | ||
230 | ++count; | ||
231 | } | ||
232 | #endif | ||
233 | /* We only have a 4 wide bitmap in cluster mode. If a deranged | ||
234 | * BIOS puts 5 CPUs in one APIC cluster, we're hosed. */ | ||
235 | BUG_ON(count >= XAPIC_DEST_CPUS_SHIFT); | ||
236 | id = my_cluster | (1UL << count); | ||
237 | apic_write(APIC_DFR, SUMMIT_APIC_DFR_VALUE); | ||
238 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | ||
239 | val |= SET_APIC_LOGICAL_ID(id); | ||
240 | apic_write(APIC_LDR, val); | ||
241 | } | ||
242 | |||
243 | static inline int summit_apic_id_registered(void) | ||
244 | { | ||
245 | return 1; | ||
246 | } | ||
247 | |||
248 | static inline void summit_setup_apic_routing(void) | ||
249 | { | ||
250 | printk("Enabling APIC mode: Summit. Using %d I/O APICs\n", | ||
251 | nr_ioapics); | ||
252 | } | ||
253 | |||
254 | static inline int summit_apicid_to_node(int logical_apicid) | ||
255 | { | ||
256 | #ifdef CONFIG_SMP | ||
257 | return apicid_2_node[hard_smp_processor_id()]; | ||
258 | #else | ||
259 | return 0; | ||
260 | #endif | ||
261 | } | ||
262 | |||
263 | /* Mapping from cpu number to logical apicid */ | ||
264 | static inline int summit_cpu_to_logical_apicid(int cpu) | ||
265 | { | ||
266 | #ifdef CONFIG_SMP | ||
267 | if (cpu >= nr_cpu_ids) | ||
268 | return BAD_APICID; | ||
269 | return (int)cpu_2_logical_apicid[cpu]; | ||
270 | #else | ||
271 | return logical_smp_processor_id(); | ||
272 | #endif | ||
273 | } | ||
274 | |||
275 | static inline int summit_cpu_present_to_apicid(int mps_cpu) | ||
276 | { | ||
277 | if (mps_cpu < nr_cpu_ids) | ||
278 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
279 | else | ||
280 | return BAD_APICID; | ||
281 | } | ||
282 | |||
283 | static inline physid_mask_t | ||
284 | summit_ioapic_phys_id_map(physid_mask_t phys_id_map) | ||
285 | { | ||
286 | /* For clustered we don't have a good way to do this yet - hack */ | ||
287 | return physids_promote(0x0F); | ||
288 | } | ||
289 | |||
290 | static inline physid_mask_t summit_apicid_to_cpu_present(int apicid) | ||
291 | { | ||
292 | return physid_mask_of_physid(0); | ||
293 | } | ||
294 | |||
295 | static inline void summit_setup_portio_remap(void) | ||
296 | { | ||
297 | } | ||
298 | |||
299 | static inline int summit_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
300 | { | ||
301 | return 1; | ||
302 | } | ||
303 | |||
304 | static inline unsigned int summit_cpu_mask_to_apicid(const cpumask_t *cpumask) | ||
305 | { | ||
306 | int cpus_found = 0; | ||
307 | int num_bits_set; | ||
308 | int apicid; | ||
309 | int cpu; | ||
310 | |||
311 | num_bits_set = cpus_weight(*cpumask); | ||
312 | /* Return id to all */ | ||
313 | if (num_bits_set >= nr_cpu_ids) | ||
314 | return 0xFF; | ||
315 | /* | ||
316 | * The cpus in the mask must all be on the apic cluster. If are not | ||
317 | * on the same apicid cluster return default value of target_cpus(): | ||
318 | */ | ||
319 | cpu = first_cpu(*cpumask); | ||
320 | apicid = summit_cpu_to_logical_apicid(cpu); | ||
321 | |||
322 | while (cpus_found < num_bits_set) { | ||
323 | if (cpu_isset(cpu, *cpumask)) { | ||
324 | int new_apicid = summit_cpu_to_logical_apicid(cpu); | ||
325 | |||
326 | if (apicid_cluster(apicid) != | ||
327 | apicid_cluster(new_apicid)) { | ||
328 | printk ("%s: Not a valid mask!\n", __func__); | ||
329 | |||
330 | return 0xFF; | ||
331 | } | ||
332 | apicid = apicid | new_apicid; | ||
333 | cpus_found++; | ||
334 | } | ||
335 | cpu++; | ||
336 | } | ||
337 | return apicid; | ||
338 | } | ||
339 | |||
340 | static inline unsigned int | ||
341 | summit_cpu_mask_to_apicid_and(const struct cpumask *inmask, | ||
342 | const struct cpumask *andmask) | ||
343 | { | ||
344 | int apicid = summit_cpu_to_logical_apicid(0); | ||
345 | cpumask_var_t cpumask; | ||
346 | |||
347 | if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC)) | ||
348 | return apicid; | ||
349 | |||
350 | cpumask_and(cpumask, inmask, andmask); | ||
351 | cpumask_and(cpumask, cpumask, cpu_online_mask); | ||
352 | apicid = summit_cpu_mask_to_apicid(cpumask); | ||
353 | |||
354 | free_cpumask_var(cpumask); | ||
355 | |||
356 | return apicid; | ||
357 | } | ||
358 | |||
359 | /* | ||
360 | * cpuid returns the value latched in the HW at reset, not the APIC ID | ||
361 | * register's value. For any box whose BIOS changes APIC IDs, like | ||
362 | * clustered APIC systems, we must use hard_smp_processor_id. | ||
363 | * | ||
364 | * See Intel's IA-32 SW Dev's Manual Vol2 under CPUID. | ||
365 | */ | ||
366 | static inline int summit_phys_pkg_id(int cpuid_apic, int index_msb) | ||
367 | { | ||
368 | return hard_smp_processor_id() >> index_msb; | ||
369 | } | ||
370 | |||
371 | static int probe_summit(void) | ||
372 | { | ||
373 | /* probed later in mptable/ACPI hooks */ | ||
374 | return 0; | ||
375 | } | ||
376 | |||
377 | static void summit_vector_allocation_domain(int cpu, cpumask_t *retmask) | ||
378 | { | ||
379 | /* Careful. Some cpus do not strictly honor the set of cpus | ||
380 | * specified in the interrupt destination when using lowest | ||
381 | * priority interrupt delivery mode. | ||
382 | * | ||
383 | * In particular there was a hyperthreading cpu observed to | ||
384 | * deliver interrupts to the wrong hyperthread when only one | ||
385 | * hyperthread was specified in the interrupt desitination. | ||
386 | */ | ||
387 | *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } }; | ||
388 | } | ||
389 | |||
390 | #ifdef CONFIG_X86_SUMMIT_NUMA | ||
35 | static struct rio_table_hdr *rio_table_hdr __initdata; | 391 | static struct rio_table_hdr *rio_table_hdr __initdata; |
36 | static struct scal_detail *scal_devs[MAX_NUMNODES] __initdata; | 392 | static struct scal_detail *scal_devs[MAX_NUMNODES] __initdata; |
37 | static struct rio_detail *rio_devs[MAX_NUMNODES*4] __initdata; | 393 | static struct rio_detail *rio_devs[MAX_NUMNODES*4] __initdata; |
@@ -186,3 +542,61 @@ void __init setup_summit(void) | |||
186 | next_wpeg = 0; | 542 | next_wpeg = 0; |
187 | } while (next_wpeg != 0); | 543 | } while (next_wpeg != 0); |
188 | } | 544 | } |
545 | #endif | ||
546 | |||
547 | struct genapic apic_summit = { | ||
548 | |||
549 | .name = "summit", | ||
550 | .probe = probe_summit, | ||
551 | .acpi_madt_oem_check = summit_acpi_madt_oem_check, | ||
552 | .apic_id_registered = summit_apic_id_registered, | ||
553 | |||
554 | .irq_delivery_mode = dest_LowestPrio, | ||
555 | /* logical delivery broadcast to all CPUs: */ | ||
556 | .irq_dest_mode = 1, | ||
557 | |||
558 | .target_cpus = summit_target_cpus, | ||
559 | .disable_esr = 1, | ||
560 | .dest_logical = APIC_DEST_LOGICAL, | ||
561 | .check_apicid_used = summit_check_apicid_used, | ||
562 | .check_apicid_present = summit_check_apicid_present, | ||
563 | |||
564 | .vector_allocation_domain = summit_vector_allocation_domain, | ||
565 | .init_apic_ldr = summit_init_apic_ldr, | ||
566 | |||
567 | .ioapic_phys_id_map = summit_ioapic_phys_id_map, | ||
568 | .setup_apic_routing = summit_setup_apic_routing, | ||
569 | .multi_timer_check = NULL, | ||
570 | .apicid_to_node = summit_apicid_to_node, | ||
571 | .cpu_to_logical_apicid = summit_cpu_to_logical_apicid, | ||
572 | .cpu_present_to_apicid = summit_cpu_present_to_apicid, | ||
573 | .apicid_to_cpu_present = summit_apicid_to_cpu_present, | ||
574 | .setup_portio_remap = NULL, | ||
575 | .check_phys_apicid_present = summit_check_phys_apicid_present, | ||
576 | .enable_apic_mode = NULL, | ||
577 | .phys_pkg_id = summit_phys_pkg_id, | ||
578 | .mps_oem_check = summit_mps_oem_check, | ||
579 | |||
580 | .get_apic_id = summit_get_apic_id, | ||
581 | .set_apic_id = NULL, | ||
582 | .apic_id_mask = 0xFF << 24, | ||
583 | |||
584 | .cpu_mask_to_apicid = summit_cpu_mask_to_apicid, | ||
585 | .cpu_mask_to_apicid_and = summit_cpu_mask_to_apicid_and, | ||
586 | |||
587 | .send_IPI_mask = summit_send_IPI_mask, | ||
588 | .send_IPI_mask_allbutself = NULL, | ||
589 | .send_IPI_allbutself = summit_send_IPI_allbutself, | ||
590 | .send_IPI_all = summit_send_IPI_all, | ||
591 | .send_IPI_self = default_send_IPI_self, | ||
592 | |||
593 | .wakeup_cpu = NULL, | ||
594 | .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, | ||
595 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | ||
596 | |||
597 | .wait_for_init_deassert = default_wait_for_init_deassert, | ||
598 | |||
599 | .smp_callin_clear_local_apic = NULL, | ||
600 | .store_NMI_vector = NULL, | ||
601 | .inquire_remote_apic = default_inquire_remote_apic, | ||
602 | }; | ||
diff --git a/arch/x86/kernel/time_32.c b/arch/x86/kernel/time_32.c index 3985cac0ed47..764c74e871f2 100644 --- a/arch/x86/kernel/time_32.c +++ b/arch/x86/kernel/time_32.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <asm/time.h> | 38 | #include <asm/time.h> |
39 | #include <asm/timer.h> | 39 | #include <asm/timer.h> |
40 | 40 | ||
41 | #include "do_timer.h" | 41 | #include <asm/do_timer.h> |
42 | 42 | ||
43 | int timer_ack; | 43 | int timer_ack; |
44 | 44 | ||
diff --git a/arch/x86/kernel/tlb_32.c b/arch/x86/kernel/tlb_32.c deleted file mode 100644 index ce5054642247..000000000000 --- a/arch/x86/kernel/tlb_32.c +++ /dev/null | |||
@@ -1,256 +0,0 @@ | |||
1 | #include <linux/spinlock.h> | ||
2 | #include <linux/cpu.h> | ||
3 | #include <linux/interrupt.h> | ||
4 | |||
5 | #include <asm/tlbflush.h> | ||
6 | |||
7 | DEFINE_PER_CPU(struct tlb_state, cpu_tlbstate) | ||
8 | ____cacheline_aligned = { &init_mm, 0, }; | ||
9 | |||
10 | /* must come after the send_IPI functions above for inlining */ | ||
11 | #include <mach_ipi.h> | ||
12 | |||
13 | /* | ||
14 | * Smarter SMP flushing macros. | ||
15 | * c/o Linus Torvalds. | ||
16 | * | ||
17 | * These mean you can really definitely utterly forget about | ||
18 | * writing to user space from interrupts. (Its not allowed anyway). | ||
19 | * | ||
20 | * Optimizations Manfred Spraul <manfred@colorfullife.com> | ||
21 | */ | ||
22 | |||
23 | static cpumask_t flush_cpumask; | ||
24 | static struct mm_struct *flush_mm; | ||
25 | static unsigned long flush_va; | ||
26 | static DEFINE_SPINLOCK(tlbstate_lock); | ||
27 | |||
28 | /* | ||
29 | * We cannot call mmdrop() because we are in interrupt context, | ||
30 | * instead update mm->cpu_vm_mask. | ||
31 | * | ||
32 | * We need to reload %cr3 since the page tables may be going | ||
33 | * away from under us.. | ||
34 | */ | ||
35 | void leave_mm(int cpu) | ||
36 | { | ||
37 | BUG_ON(x86_read_percpu(cpu_tlbstate.state) == TLBSTATE_OK); | ||
38 | cpu_clear(cpu, x86_read_percpu(cpu_tlbstate.active_mm)->cpu_vm_mask); | ||
39 | load_cr3(swapper_pg_dir); | ||
40 | } | ||
41 | EXPORT_SYMBOL_GPL(leave_mm); | ||
42 | |||
43 | /* | ||
44 | * | ||
45 | * The flush IPI assumes that a thread switch happens in this order: | ||
46 | * [cpu0: the cpu that switches] | ||
47 | * 1) switch_mm() either 1a) or 1b) | ||
48 | * 1a) thread switch to a different mm | ||
49 | * 1a1) cpu_clear(cpu, old_mm->cpu_vm_mask); | ||
50 | * Stop ipi delivery for the old mm. This is not synchronized with | ||
51 | * the other cpus, but smp_invalidate_interrupt ignore flush ipis | ||
52 | * for the wrong mm, and in the worst case we perform a superfluous | ||
53 | * tlb flush. | ||
54 | * 1a2) set cpu_tlbstate to TLBSTATE_OK | ||
55 | * Now the smp_invalidate_interrupt won't call leave_mm if cpu0 | ||
56 | * was in lazy tlb mode. | ||
57 | * 1a3) update cpu_tlbstate[].active_mm | ||
58 | * Now cpu0 accepts tlb flushes for the new mm. | ||
59 | * 1a4) cpu_set(cpu, new_mm->cpu_vm_mask); | ||
60 | * Now the other cpus will send tlb flush ipis. | ||
61 | * 1a4) change cr3. | ||
62 | * 1b) thread switch without mm change | ||
63 | * cpu_tlbstate[].active_mm is correct, cpu0 already handles | ||
64 | * flush ipis. | ||
65 | * 1b1) set cpu_tlbstate to TLBSTATE_OK | ||
66 | * 1b2) test_and_set the cpu bit in cpu_vm_mask. | ||
67 | * Atomically set the bit [other cpus will start sending flush ipis], | ||
68 | * and test the bit. | ||
69 | * 1b3) if the bit was 0: leave_mm was called, flush the tlb. | ||
70 | * 2) switch %%esp, ie current | ||
71 | * | ||
72 | * The interrupt must handle 2 special cases: | ||
73 | * - cr3 is changed before %%esp, ie. it cannot use current->{active_,}mm. | ||
74 | * - the cpu performs speculative tlb reads, i.e. even if the cpu only | ||
75 | * runs in kernel space, the cpu could load tlb entries for user space | ||
76 | * pages. | ||
77 | * | ||
78 | * The good news is that cpu_tlbstate is local to each cpu, no | ||
79 | * write/read ordering problems. | ||
80 | */ | ||
81 | |||
82 | /* | ||
83 | * TLB flush IPI: | ||
84 | * | ||
85 | * 1) Flush the tlb entries if the cpu uses the mm that's being flushed. | ||
86 | * 2) Leave the mm if we are in the lazy tlb mode. | ||
87 | */ | ||
88 | |||
89 | void smp_invalidate_interrupt(struct pt_regs *regs) | ||
90 | { | ||
91 | unsigned long cpu; | ||
92 | |||
93 | cpu = get_cpu(); | ||
94 | |||
95 | if (!cpu_isset(cpu, flush_cpumask)) | ||
96 | goto out; | ||
97 | /* | ||
98 | * This was a BUG() but until someone can quote me the | ||
99 | * line from the intel manual that guarantees an IPI to | ||
100 | * multiple CPUs is retried _only_ on the erroring CPUs | ||
101 | * its staying as a return | ||
102 | * | ||
103 | * BUG(); | ||
104 | */ | ||
105 | |||
106 | if (flush_mm == x86_read_percpu(cpu_tlbstate.active_mm)) { | ||
107 | if (x86_read_percpu(cpu_tlbstate.state) == TLBSTATE_OK) { | ||
108 | if (flush_va == TLB_FLUSH_ALL) | ||
109 | local_flush_tlb(); | ||
110 | else | ||
111 | __flush_tlb_one(flush_va); | ||
112 | } else | ||
113 | leave_mm(cpu); | ||
114 | } | ||
115 | ack_APIC_irq(); | ||
116 | smp_mb__before_clear_bit(); | ||
117 | cpu_clear(cpu, flush_cpumask); | ||
118 | smp_mb__after_clear_bit(); | ||
119 | out: | ||
120 | put_cpu_no_resched(); | ||
121 | inc_irq_stat(irq_tlb_count); | ||
122 | } | ||
123 | |||
124 | void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm, | ||
125 | unsigned long va) | ||
126 | { | ||
127 | cpumask_t cpumask = *cpumaskp; | ||
128 | |||
129 | /* | ||
130 | * A couple of (to be removed) sanity checks: | ||
131 | * | ||
132 | * - current CPU must not be in mask | ||
133 | * - mask must exist :) | ||
134 | */ | ||
135 | BUG_ON(cpus_empty(cpumask)); | ||
136 | BUG_ON(cpu_isset(smp_processor_id(), cpumask)); | ||
137 | BUG_ON(!mm); | ||
138 | |||
139 | #ifdef CONFIG_HOTPLUG_CPU | ||
140 | /* If a CPU which we ran on has gone down, OK. */ | ||
141 | cpus_and(cpumask, cpumask, cpu_online_map); | ||
142 | if (unlikely(cpus_empty(cpumask))) | ||
143 | return; | ||
144 | #endif | ||
145 | |||
146 | /* | ||
147 | * i'm not happy about this global shared spinlock in the | ||
148 | * MM hot path, but we'll see how contended it is. | ||
149 | * AK: x86-64 has a faster method that could be ported. | ||
150 | */ | ||
151 | spin_lock(&tlbstate_lock); | ||
152 | |||
153 | flush_mm = mm; | ||
154 | flush_va = va; | ||
155 | cpus_or(flush_cpumask, cpumask, flush_cpumask); | ||
156 | |||
157 | /* | ||
158 | * Make the above memory operations globally visible before | ||
159 | * sending the IPI. | ||
160 | */ | ||
161 | smp_mb(); | ||
162 | /* | ||
163 | * We have to send the IPI only to | ||
164 | * CPUs affected. | ||
165 | */ | ||
166 | send_IPI_mask(&cpumask, INVALIDATE_TLB_VECTOR); | ||
167 | |||
168 | while (!cpus_empty(flush_cpumask)) | ||
169 | /* nothing. lockup detection does not belong here */ | ||
170 | cpu_relax(); | ||
171 | |||
172 | flush_mm = NULL; | ||
173 | flush_va = 0; | ||
174 | spin_unlock(&tlbstate_lock); | ||
175 | } | ||
176 | |||
177 | void flush_tlb_current_task(void) | ||
178 | { | ||
179 | struct mm_struct *mm = current->mm; | ||
180 | cpumask_t cpu_mask; | ||
181 | |||
182 | preempt_disable(); | ||
183 | cpu_mask = mm->cpu_vm_mask; | ||
184 | cpu_clear(smp_processor_id(), cpu_mask); | ||
185 | |||
186 | local_flush_tlb(); | ||
187 | if (!cpus_empty(cpu_mask)) | ||
188 | flush_tlb_others(cpu_mask, mm, TLB_FLUSH_ALL); | ||
189 | preempt_enable(); | ||
190 | } | ||
191 | |||
192 | void flush_tlb_mm(struct mm_struct *mm) | ||
193 | { | ||
194 | cpumask_t cpu_mask; | ||
195 | |||
196 | preempt_disable(); | ||
197 | cpu_mask = mm->cpu_vm_mask; | ||
198 | cpu_clear(smp_processor_id(), cpu_mask); | ||
199 | |||
200 | if (current->active_mm == mm) { | ||
201 | if (current->mm) | ||
202 | local_flush_tlb(); | ||
203 | else | ||
204 | leave_mm(smp_processor_id()); | ||
205 | } | ||
206 | if (!cpus_empty(cpu_mask)) | ||
207 | flush_tlb_others(cpu_mask, mm, TLB_FLUSH_ALL); | ||
208 | |||
209 | preempt_enable(); | ||
210 | } | ||
211 | |||
212 | void flush_tlb_page(struct vm_area_struct *vma, unsigned long va) | ||
213 | { | ||
214 | struct mm_struct *mm = vma->vm_mm; | ||
215 | cpumask_t cpu_mask; | ||
216 | |||
217 | preempt_disable(); | ||
218 | cpu_mask = mm->cpu_vm_mask; | ||
219 | cpu_clear(smp_processor_id(), cpu_mask); | ||
220 | |||
221 | if (current->active_mm == mm) { | ||
222 | if (current->mm) | ||
223 | __flush_tlb_one(va); | ||
224 | else | ||
225 | leave_mm(smp_processor_id()); | ||
226 | } | ||
227 | |||
228 | if (!cpus_empty(cpu_mask)) | ||
229 | flush_tlb_others(cpu_mask, mm, va); | ||
230 | |||
231 | preempt_enable(); | ||
232 | } | ||
233 | EXPORT_SYMBOL(flush_tlb_page); | ||
234 | |||
235 | static void do_flush_tlb_all(void *info) | ||
236 | { | ||
237 | unsigned long cpu = smp_processor_id(); | ||
238 | |||
239 | __flush_tlb_all(); | ||
240 | if (x86_read_percpu(cpu_tlbstate.state) == TLBSTATE_LAZY) | ||
241 | leave_mm(cpu); | ||
242 | } | ||
243 | |||
244 | void flush_tlb_all(void) | ||
245 | { | ||
246 | on_each_cpu(do_flush_tlb_all, NULL, 1); | ||
247 | } | ||
248 | |||
249 | void reset_lazy_tlbstate(void) | ||
250 | { | ||
251 | int cpu = raw_smp_processor_id(); | ||
252 | |||
253 | per_cpu(cpu_tlbstate, cpu).state = 0; | ||
254 | per_cpu(cpu_tlbstate, cpu).active_mm = &init_mm; | ||
255 | } | ||
256 | |||
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c index 6812b829ed83..755ede02b13f 100644 --- a/arch/x86/kernel/tlb_uv.c +++ b/arch/x86/kernel/tlb_uv.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | 12 | ||
13 | #include <asm/mmu_context.h> | 13 | #include <asm/mmu_context.h> |
14 | #include <asm/uv/uv.h> | ||
14 | #include <asm/uv/uv_mmrs.h> | 15 | #include <asm/uv/uv_mmrs.h> |
15 | #include <asm/uv/uv_hub.h> | 16 | #include <asm/uv/uv_hub.h> |
16 | #include <asm/uv/uv_bau.h> | 17 | #include <asm/uv/uv_bau.h> |
@@ -19,7 +20,7 @@ | |||
19 | #include <asm/tsc.h> | 20 | #include <asm/tsc.h> |
20 | #include <asm/irq_vectors.h> | 21 | #include <asm/irq_vectors.h> |
21 | 22 | ||
22 | #include <mach_apic.h> | 23 | #include <asm/genapic.h> |
23 | 24 | ||
24 | static struct bau_control **uv_bau_table_bases __read_mostly; | 25 | static struct bau_control **uv_bau_table_bases __read_mostly; |
25 | static int uv_bau_retry_limit __read_mostly; | 26 | static int uv_bau_retry_limit __read_mostly; |
@@ -210,14 +211,15 @@ static int uv_wait_completion(struct bau_desc *bau_desc, | |||
210 | * | 211 | * |
211 | * Send a broadcast and wait for a broadcast message to complete. | 212 | * Send a broadcast and wait for a broadcast message to complete. |
212 | * | 213 | * |
213 | * The cpumaskp mask contains the cpus the broadcast was sent to. | 214 | * The flush_mask contains the cpus the broadcast was sent to. |
214 | * | 215 | * |
215 | * Returns 1 if all remote flushing was done. The mask is zeroed. | 216 | * Returns NULL if all remote flushing was done. The mask is zeroed. |
216 | * Returns 0 if some remote flushing remains to be done. The mask is left | 217 | * Returns @flush_mask if some remote flushing remains to be done. The |
217 | * unchanged. | 218 | * mask will have some bits still set. |
218 | */ | 219 | */ |
219 | int uv_flush_send_and_wait(int cpu, int this_blade, struct bau_desc *bau_desc, | 220 | const struct cpumask *uv_flush_send_and_wait(int cpu, int this_blade, |
220 | cpumask_t *cpumaskp) | 221 | struct bau_desc *bau_desc, |
222 | struct cpumask *flush_mask) | ||
221 | { | 223 | { |
222 | int completion_status = 0; | 224 | int completion_status = 0; |
223 | int right_shift; | 225 | int right_shift; |
@@ -264,59 +266,69 @@ int uv_flush_send_and_wait(int cpu, int this_blade, struct bau_desc *bau_desc, | |||
264 | * Success, so clear the remote cpu's from the mask so we don't | 266 | * Success, so clear the remote cpu's from the mask so we don't |
265 | * use the IPI method of shootdown on them. | 267 | * use the IPI method of shootdown on them. |
266 | */ | 268 | */ |
267 | for_each_cpu_mask(bit, *cpumaskp) { | 269 | for_each_cpu(bit, flush_mask) { |
268 | blade = uv_cpu_to_blade_id(bit); | 270 | blade = uv_cpu_to_blade_id(bit); |
269 | if (blade == this_blade) | 271 | if (blade == this_blade) |
270 | continue; | 272 | continue; |
271 | cpu_clear(bit, *cpumaskp); | 273 | cpumask_clear_cpu(bit, flush_mask); |
272 | } | 274 | } |
273 | if (!cpus_empty(*cpumaskp)) | 275 | if (!cpumask_empty(flush_mask)) |
274 | return 0; | 276 | return flush_mask; |
275 | return 1; | 277 | return NULL; |
276 | } | 278 | } |
277 | 279 | ||
278 | /** | 280 | /** |
279 | * uv_flush_tlb_others - globally purge translation cache of a virtual | 281 | * uv_flush_tlb_others - globally purge translation cache of a virtual |
280 | * address or all TLB's | 282 | * address or all TLB's |
281 | * @cpumaskp: mask of all cpu's in which the address is to be removed | 283 | * @cpumask: mask of all cpu's in which the address is to be removed |
282 | * @mm: mm_struct containing virtual address range | 284 | * @mm: mm_struct containing virtual address range |
283 | * @va: virtual address to be removed (or TLB_FLUSH_ALL for all TLB's on cpu) | 285 | * @va: virtual address to be removed (or TLB_FLUSH_ALL for all TLB's on cpu) |
286 | * @cpu: the current cpu | ||
284 | * | 287 | * |
285 | * This is the entry point for initiating any UV global TLB shootdown. | 288 | * This is the entry point for initiating any UV global TLB shootdown. |
286 | * | 289 | * |
287 | * Purges the translation caches of all specified processors of the given | 290 | * Purges the translation caches of all specified processors of the given |
288 | * virtual address, or purges all TLB's on specified processors. | 291 | * virtual address, or purges all TLB's on specified processors. |
289 | * | 292 | * |
290 | * The caller has derived the cpumaskp from the mm_struct and has subtracted | 293 | * The caller has derived the cpumask from the mm_struct. This function |
291 | * the local cpu from the mask. This function is called only if there | 294 | * is called only if there are bits set in the mask. (e.g. flush_tlb_page()) |
292 | * are bits set in the mask. (e.g. flush_tlb_page()) | ||
293 | * | 295 | * |
294 | * The cpumaskp is converted into a nodemask of the nodes containing | 296 | * The cpumask is converted into a nodemask of the nodes containing |
295 | * the cpus. | 297 | * the cpus. |
296 | * | 298 | * |
297 | * Returns 1 if all remote flushing was done. | 299 | * Note that this function should be called with preemption disabled. |
298 | * Returns 0 if some remote flushing remains to be done. | 300 | * |
301 | * Returns NULL if all remote flushing was done. | ||
302 | * Returns pointer to cpumask if some remote flushing remains to be | ||
303 | * done. The returned pointer is valid till preemption is re-enabled. | ||
299 | */ | 304 | */ |
300 | int uv_flush_tlb_others(cpumask_t *cpumaskp, struct mm_struct *mm, | 305 | const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, |
301 | unsigned long va) | 306 | struct mm_struct *mm, |
307 | unsigned long va, unsigned int cpu) | ||
302 | { | 308 | { |
309 | static DEFINE_PER_CPU(cpumask_t, flush_tlb_mask); | ||
310 | struct cpumask *flush_mask = &__get_cpu_var(flush_tlb_mask); | ||
303 | int i; | 311 | int i; |
304 | int bit; | 312 | int bit; |
305 | int blade; | 313 | int blade; |
306 | int cpu; | 314 | int uv_cpu; |
307 | int this_blade; | 315 | int this_blade; |
308 | int locals = 0; | 316 | int locals = 0; |
309 | struct bau_desc *bau_desc; | 317 | struct bau_desc *bau_desc; |
310 | 318 | ||
311 | cpu = uv_blade_processor_id(); | 319 | WARN_ON(!in_atomic()); |
320 | |||
321 | cpumask_andnot(flush_mask, cpumask, cpumask_of(cpu)); | ||
322 | |||
323 | uv_cpu = uv_blade_processor_id(); | ||
312 | this_blade = uv_numa_blade_id(); | 324 | this_blade = uv_numa_blade_id(); |
313 | bau_desc = __get_cpu_var(bau_control).descriptor_base; | 325 | bau_desc = __get_cpu_var(bau_control).descriptor_base; |
314 | bau_desc += UV_ITEMS_PER_DESCRIPTOR * cpu; | 326 | bau_desc += UV_ITEMS_PER_DESCRIPTOR * uv_cpu; |
315 | 327 | ||
316 | bau_nodes_clear(&bau_desc->distribution, UV_DISTRIBUTION_SIZE); | 328 | bau_nodes_clear(&bau_desc->distribution, UV_DISTRIBUTION_SIZE); |
317 | 329 | ||
318 | i = 0; | 330 | i = 0; |
319 | for_each_cpu_mask(bit, *cpumaskp) { | 331 | for_each_cpu(bit, flush_mask) { |
320 | blade = uv_cpu_to_blade_id(bit); | 332 | blade = uv_cpu_to_blade_id(bit); |
321 | BUG_ON(blade > (UV_DISTRIBUTION_SIZE - 1)); | 333 | BUG_ON(blade > (UV_DISTRIBUTION_SIZE - 1)); |
322 | if (blade == this_blade) { | 334 | if (blade == this_blade) { |
@@ -331,17 +343,17 @@ int uv_flush_tlb_others(cpumask_t *cpumaskp, struct mm_struct *mm, | |||
331 | * no off_node flushing; return status for local node | 343 | * no off_node flushing; return status for local node |
332 | */ | 344 | */ |
333 | if (locals) | 345 | if (locals) |
334 | return 0; | 346 | return flush_mask; |
335 | else | 347 | else |
336 | return 1; | 348 | return NULL; |
337 | } | 349 | } |
338 | __get_cpu_var(ptcstats).requestor++; | 350 | __get_cpu_var(ptcstats).requestor++; |
339 | __get_cpu_var(ptcstats).ntargeted += i; | 351 | __get_cpu_var(ptcstats).ntargeted += i; |
340 | 352 | ||
341 | bau_desc->payload.address = va; | 353 | bau_desc->payload.address = va; |
342 | bau_desc->payload.sending_cpu = smp_processor_id(); | 354 | bau_desc->payload.sending_cpu = cpu; |
343 | 355 | ||
344 | return uv_flush_send_and_wait(cpu, this_blade, bau_desc, cpumaskp); | 356 | return uv_flush_send_and_wait(uv_cpu, this_blade, bau_desc, flush_mask); |
345 | } | 357 | } |
346 | 358 | ||
347 | /* | 359 | /* |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 98c2d055284b..214bc327a0c3 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -54,12 +54,11 @@ | |||
54 | #include <asm/desc.h> | 54 | #include <asm/desc.h> |
55 | #include <asm/i387.h> | 55 | #include <asm/i387.h> |
56 | 56 | ||
57 | #include <mach_traps.h> | 57 | #include <asm/mach_traps.h> |
58 | 58 | ||
59 | #ifdef CONFIG_X86_64 | 59 | #ifdef CONFIG_X86_64 |
60 | #include <asm/pgalloc.h> | 60 | #include <asm/pgalloc.h> |
61 | #include <asm/proto.h> | 61 | #include <asm/proto.h> |
62 | #include <asm/pda.h> | ||
63 | #else | 62 | #else |
64 | #include <asm/processor-flags.h> | 63 | #include <asm/processor-flags.h> |
65 | #include <asm/arch_hooks.h> | 64 | #include <asm/arch_hooks.h> |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 599e58168631..83d53ce5d4c4 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -773,7 +773,7 @@ __cpuinit int unsynchronized_tsc(void) | |||
773 | if (!cpu_has_tsc || tsc_unstable) | 773 | if (!cpu_has_tsc || tsc_unstable) |
774 | return 1; | 774 | return 1; |
775 | 775 | ||
776 | #ifdef CONFIG_X86_SMP | 776 | #ifdef CONFIG_SMP |
777 | if (apic_is_clustered_box()) | 777 | if (apic_is_clustered_box()) |
778 | return 1; | 778 | return 1; |
779 | #endif | 779 | #endif |
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c index d801d06af068..4fd646e6dd43 100644 --- a/arch/x86/kernel/visws_quirks.c +++ b/arch/x86/kernel/visws_quirks.c | |||
@@ -32,9 +32,9 @@ | |||
32 | #include <asm/e820.h> | 32 | #include <asm/e820.h> |
33 | #include <asm/io.h> | 33 | #include <asm/io.h> |
34 | 34 | ||
35 | #include <mach_ipi.h> | 35 | #include <asm/genapic.h> |
36 | 36 | ||
37 | #include "mach_apic.h" | 37 | #include <asm/genapic.h> |
38 | 38 | ||
39 | #include <linux/kernel_stat.h> | 39 | #include <linux/kernel_stat.h> |
40 | 40 | ||
@@ -200,7 +200,7 @@ static void __init MP_processor_info(struct mpc_cpu *m) | |||
200 | return; | 200 | return; |
201 | } | 201 | } |
202 | 202 | ||
203 | apic_cpus = apicid_to_cpu_present(m->apicid); | 203 | apic_cpus = apic->apicid_to_cpu_present(m->apicid); |
204 | physids_or(phys_cpu_present_map, phys_cpu_present_map, apic_cpus); | 204 | physids_or(phys_cpu_present_map, phys_cpu_present_map, apic_cpus); |
205 | /* | 205 | /* |
206 | * Validate version | 206 | * Validate version |
diff --git a/arch/x86/kernel/vmiclock_32.c b/arch/x86/kernel/vmiclock_32.c index c4c1f9e09402..a4791ef412d1 100644 --- a/arch/x86/kernel/vmiclock_32.c +++ b/arch/x86/kernel/vmiclock_32.c | |||
@@ -256,7 +256,7 @@ void __devinit vmi_time_bsp_init(void) | |||
256 | */ | 256 | */ |
257 | clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL); | 257 | clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL); |
258 | local_irq_disable(); | 258 | local_irq_disable(); |
259 | #ifdef CONFIG_X86_SMP | 259 | #ifdef CONFIG_SMP |
260 | /* | 260 | /* |
261 | * XXX handle_percpu_irq only defined for SMP; we need to switch over | 261 | * XXX handle_percpu_irq only defined for SMP; we need to switch over |
262 | * to using it, since this is a local interrupt, which each CPU must | 262 | * to using it, since this is a local interrupt, which each CPU must |
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S index 82c67559dde7..3eba7f7bac05 100644 --- a/arch/x86/kernel/vmlinux_32.lds.S +++ b/arch/x86/kernel/vmlinux_32.lds.S | |||
@@ -178,14 +178,7 @@ SECTIONS | |||
178 | __initramfs_end = .; | 178 | __initramfs_end = .; |
179 | } | 179 | } |
180 | #endif | 180 | #endif |
181 | . = ALIGN(PAGE_SIZE); | 181 | PERCPU(PAGE_SIZE) |
182 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { | ||
183 | __per_cpu_start = .; | ||
184 | *(.data.percpu.page_aligned) | ||
185 | *(.data.percpu) | ||
186 | *(.data.percpu.shared_aligned) | ||
187 | __per_cpu_end = .; | ||
188 | } | ||
189 | . = ALIGN(PAGE_SIZE); | 182 | . = ALIGN(PAGE_SIZE); |
190 | /* freed after init ends here */ | 183 | /* freed after init ends here */ |
191 | 184 | ||
diff --git a/arch/x86/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S index 1a614c0e6bef..c9740996430a 100644 --- a/arch/x86/kernel/vmlinux_64.lds.S +++ b/arch/x86/kernel/vmlinux_64.lds.S | |||
@@ -5,6 +5,7 @@ | |||
5 | #define LOAD_OFFSET __START_KERNEL_map | 5 | #define LOAD_OFFSET __START_KERNEL_map |
6 | 6 | ||
7 | #include <asm-generic/vmlinux.lds.h> | 7 | #include <asm-generic/vmlinux.lds.h> |
8 | #include <asm/asm-offsets.h> | ||
8 | #include <asm/page.h> | 9 | #include <asm/page.h> |
9 | 10 | ||
10 | #undef i386 /* in case the preprocessor is a 32bit one */ | 11 | #undef i386 /* in case the preprocessor is a 32bit one */ |
@@ -13,12 +14,14 @@ OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") | |||
13 | OUTPUT_ARCH(i386:x86-64) | 14 | OUTPUT_ARCH(i386:x86-64) |
14 | ENTRY(phys_startup_64) | 15 | ENTRY(phys_startup_64) |
15 | jiffies_64 = jiffies; | 16 | jiffies_64 = jiffies; |
16 | _proxy_pda = 1; | ||
17 | PHDRS { | 17 | PHDRS { |
18 | text PT_LOAD FLAGS(5); /* R_E */ | 18 | text PT_LOAD FLAGS(5); /* R_E */ |
19 | data PT_LOAD FLAGS(7); /* RWE */ | 19 | data PT_LOAD FLAGS(7); /* RWE */ |
20 | user PT_LOAD FLAGS(7); /* RWE */ | 20 | user PT_LOAD FLAGS(7); /* RWE */ |
21 | data.init PT_LOAD FLAGS(7); /* RWE */ | 21 | data.init PT_LOAD FLAGS(7); /* RWE */ |
22 | #ifdef CONFIG_SMP | ||
23 | percpu PT_LOAD FLAGS(7); /* RWE */ | ||
24 | #endif | ||
22 | note PT_NOTE FLAGS(0); /* ___ */ | 25 | note PT_NOTE FLAGS(0); /* ___ */ |
23 | } | 26 | } |
24 | SECTIONS | 27 | SECTIONS |
@@ -208,14 +211,28 @@ SECTIONS | |||
208 | __initramfs_end = .; | 211 | __initramfs_end = .; |
209 | #endif | 212 | #endif |
210 | 213 | ||
214 | #ifdef CONFIG_SMP | ||
215 | /* | ||
216 | * percpu offsets are zero-based on SMP. PERCPU_VADDR() changes the | ||
217 | * output PHDR, so the next output section - __data_nosave - should | ||
218 | * switch it back to data.init. Also, pda should be at the head of | ||
219 | * percpu area. Preallocate it and define the percpu offset symbol | ||
220 | * so that it can be accessed as a percpu variable. | ||
221 | */ | ||
222 | . = ALIGN(PAGE_SIZE); | ||
223 | PERCPU_VADDR(0, :percpu) | ||
224 | #else | ||
211 | PERCPU(PAGE_SIZE) | 225 | PERCPU(PAGE_SIZE) |
226 | #endif | ||
212 | 227 | ||
213 | . = ALIGN(PAGE_SIZE); | 228 | . = ALIGN(PAGE_SIZE); |
214 | __init_end = .; | 229 | __init_end = .; |
215 | 230 | ||
216 | . = ALIGN(PAGE_SIZE); | 231 | . = ALIGN(PAGE_SIZE); |
217 | __nosave_begin = .; | 232 | __nosave_begin = .; |
218 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) } | 233 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { |
234 | *(.data.nosave) | ||
235 | } :data.init /* switch back to data.init, see PERCPU_VADDR() above */ | ||
219 | . = ALIGN(PAGE_SIZE); | 236 | . = ALIGN(PAGE_SIZE); |
220 | __nosave_end = .; | 237 | __nosave_end = .; |
221 | 238 | ||
@@ -244,3 +261,8 @@ SECTIONS | |||
244 | */ | 261 | */ |
245 | ASSERT((_end - _text <= KERNEL_IMAGE_SIZE), | 262 | ASSERT((_end - _text <= KERNEL_IMAGE_SIZE), |
246 | "kernel image bigger than KERNEL_IMAGE_SIZE") | 263 | "kernel image bigger than KERNEL_IMAGE_SIZE") |
264 | |||
265 | #ifdef CONFIG_SMP | ||
266 | ASSERT((per_cpu__irq_stack_union == 0), | ||
267 | "irq_stack_union is not at start of per-cpu area"); | ||
268 | #endif | ||
diff --git a/arch/x86/kernel/x8664_ksyms_64.c b/arch/x86/kernel/x8664_ksyms_64.c index 695e426aa354..3909e3ba5ce3 100644 --- a/arch/x86/kernel/x8664_ksyms_64.c +++ b/arch/x86/kernel/x8664_ksyms_64.c | |||
@@ -58,5 +58,3 @@ EXPORT_SYMBOL(__memcpy); | |||
58 | EXPORT_SYMBOL(empty_zero_page); | 58 | EXPORT_SYMBOL(empty_zero_page); |
59 | EXPORT_SYMBOL(init_level4_pgt); | 59 | EXPORT_SYMBOL(init_level4_pgt); |
60 | EXPORT_SYMBOL(load_gs_index); | 60 | EXPORT_SYMBOL(load_gs_index); |
61 | |||
62 | EXPORT_SYMBOL(_proxy_pda); | ||
diff --git a/arch/x86/mach-default/Makefile b/arch/x86/mach-default/Makefile deleted file mode 100644 index 012fe34459e6..000000000000 --- a/arch/x86/mach-default/Makefile +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the linux kernel. | ||
3 | # | ||
4 | |||
5 | obj-y := setup.o | ||
diff --git a/arch/x86/mach-default/setup.c b/arch/x86/mach-default/setup.c deleted file mode 100644 index a265a7c63190..000000000000 --- a/arch/x86/mach-default/setup.c +++ /dev/null | |||
@@ -1,174 +0,0 @@ | |||
1 | /* | ||
2 | * Machine specific setup for generic | ||
3 | */ | ||
4 | |||
5 | #include <linux/smp.h> | ||
6 | #include <linux/init.h> | ||
7 | #include <linux/interrupt.h> | ||
8 | #include <asm/acpi.h> | ||
9 | #include <asm/arch_hooks.h> | ||
10 | #include <asm/e820.h> | ||
11 | #include <asm/setup.h> | ||
12 | |||
13 | #include <mach_ipi.h> | ||
14 | |||
15 | #ifdef CONFIG_HOTPLUG_CPU | ||
16 | #define DEFAULT_SEND_IPI (1) | ||
17 | #else | ||
18 | #define DEFAULT_SEND_IPI (0) | ||
19 | #endif | ||
20 | |||
21 | int no_broadcast = DEFAULT_SEND_IPI; | ||
22 | |||
23 | /** | ||
24 | * pre_intr_init_hook - initialisation prior to setting up interrupt vectors | ||
25 | * | ||
26 | * Description: | ||
27 | * Perform any necessary interrupt initialisation prior to setting up | ||
28 | * the "ordinary" interrupt call gates. For legacy reasons, the ISA | ||
29 | * interrupts should be initialised here if the machine emulates a PC | ||
30 | * in any way. | ||
31 | **/ | ||
32 | void __init pre_intr_init_hook(void) | ||
33 | { | ||
34 | if (x86_quirks->arch_pre_intr_init) { | ||
35 | if (x86_quirks->arch_pre_intr_init()) | ||
36 | return; | ||
37 | } | ||
38 | init_ISA_irqs(); | ||
39 | } | ||
40 | |||
41 | /* | ||
42 | * IRQ2 is cascade interrupt to second interrupt controller | ||
43 | */ | ||
44 | static struct irqaction irq2 = { | ||
45 | .handler = no_action, | ||
46 | .mask = CPU_MASK_NONE, | ||
47 | .name = "cascade", | ||
48 | }; | ||
49 | |||
50 | /** | ||
51 | * intr_init_hook - post gate setup interrupt initialisation | ||
52 | * | ||
53 | * Description: | ||
54 | * Fill in any interrupts that may have been left out by the general | ||
55 | * init_IRQ() routine. interrupts having to do with the machine rather | ||
56 | * than the devices on the I/O bus (like APIC interrupts in intel MP | ||
57 | * systems) are started here. | ||
58 | **/ | ||
59 | void __init intr_init_hook(void) | ||
60 | { | ||
61 | if (x86_quirks->arch_intr_init) { | ||
62 | if (x86_quirks->arch_intr_init()) | ||
63 | return; | ||
64 | } | ||
65 | if (!acpi_ioapic) | ||
66 | setup_irq(2, &irq2); | ||
67 | |||
68 | } | ||
69 | |||
70 | /** | ||
71 | * pre_setup_arch_hook - hook called prior to any setup_arch() execution | ||
72 | * | ||
73 | * Description: | ||
74 | * generally used to activate any machine specific identification | ||
75 | * routines that may be needed before setup_arch() runs. On Voyager | ||
76 | * this is used to get the board revision and type. | ||
77 | **/ | ||
78 | void __init pre_setup_arch_hook(void) | ||
79 | { | ||
80 | } | ||
81 | |||
82 | /** | ||
83 | * trap_init_hook - initialise system specific traps | ||
84 | * | ||
85 | * Description: | ||
86 | * Called as the final act of trap_init(). Used in VISWS to initialise | ||
87 | * the various board specific APIC traps. | ||
88 | **/ | ||
89 | void __init trap_init_hook(void) | ||
90 | { | ||
91 | if (x86_quirks->arch_trap_init) { | ||
92 | if (x86_quirks->arch_trap_init()) | ||
93 | return; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | static struct irqaction irq0 = { | ||
98 | .handler = timer_interrupt, | ||
99 | .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL, | ||
100 | .mask = CPU_MASK_NONE, | ||
101 | .name = "timer" | ||
102 | }; | ||
103 | |||
104 | /** | ||
105 | * pre_time_init_hook - do any specific initialisations before. | ||
106 | * | ||
107 | **/ | ||
108 | void __init pre_time_init_hook(void) | ||
109 | { | ||
110 | if (x86_quirks->arch_pre_time_init) | ||
111 | x86_quirks->arch_pre_time_init(); | ||
112 | } | ||
113 | |||
114 | /** | ||
115 | * time_init_hook - do any specific initialisations for the system timer. | ||
116 | * | ||
117 | * Description: | ||
118 | * Must plug the system timer interrupt source at HZ into the IRQ listed | ||
119 | * in irq_vectors.h:TIMER_IRQ | ||
120 | **/ | ||
121 | void __init time_init_hook(void) | ||
122 | { | ||
123 | if (x86_quirks->arch_time_init) { | ||
124 | /* | ||
125 | * A nonzero return code does not mean failure, it means | ||
126 | * that the architecture quirk does not want any | ||
127 | * generic (timer) setup to be performed after this: | ||
128 | */ | ||
129 | if (x86_quirks->arch_time_init()) | ||
130 | return; | ||
131 | } | ||
132 | |||
133 | irq0.mask = cpumask_of_cpu(0); | ||
134 | setup_irq(0, &irq0); | ||
135 | } | ||
136 | |||
137 | #ifdef CONFIG_MCA | ||
138 | /** | ||
139 | * mca_nmi_hook - hook into MCA specific NMI chain | ||
140 | * | ||
141 | * Description: | ||
142 | * The MCA (Microchannel Architecture) has an NMI chain for NMI sources | ||
143 | * along the MCA bus. Use this to hook into that chain if you will need | ||
144 | * it. | ||
145 | **/ | ||
146 | void mca_nmi_hook(void) | ||
147 | { | ||
148 | /* | ||
149 | * If I recall correctly, there's a whole bunch of other things that | ||
150 | * we can do to check for NMI problems, but that's all I know about | ||
151 | * at the moment. | ||
152 | */ | ||
153 | pr_warning("NMI generated from unknown source!\n"); | ||
154 | } | ||
155 | #endif | ||
156 | |||
157 | static __init int no_ipi_broadcast(char *str) | ||
158 | { | ||
159 | get_option(&str, &no_broadcast); | ||
160 | pr_info("Using %s mode\n", | ||
161 | no_broadcast ? "No IPI Broadcast" : "IPI Broadcast"); | ||
162 | return 1; | ||
163 | } | ||
164 | __setup("no_ipi_broadcast=", no_ipi_broadcast); | ||
165 | |||
166 | static int __init print_ipi_mode(void) | ||
167 | { | ||
168 | pr_info("Using IPI %s mode\n", | ||
169 | no_broadcast ? "No-Shortcut" : "Shortcut"); | ||
170 | return 0; | ||
171 | } | ||
172 | |||
173 | late_initcall(print_ipi_mode); | ||
174 | |||
diff --git a/arch/x86/mach-generic/Makefile b/arch/x86/mach-generic/Makefile deleted file mode 100644 index 6730f4e7c744..000000000000 --- a/arch/x86/mach-generic/Makefile +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the generic architecture | ||
3 | # | ||
4 | |||
5 | EXTRA_CFLAGS := -Iarch/x86/kernel | ||
6 | |||
7 | obj-y := probe.o default.o | ||
8 | obj-$(CONFIG_X86_NUMAQ) += numaq.o | ||
9 | obj-$(CONFIG_X86_SUMMIT) += summit.o | ||
10 | obj-$(CONFIG_X86_BIGSMP) += bigsmp.o | ||
11 | obj-$(CONFIG_X86_ES7000) += es7000.o | ||
diff --git a/arch/x86/mach-generic/bigsmp.c b/arch/x86/mach-generic/bigsmp.c deleted file mode 100644 index bc4c7840b2a8..000000000000 --- a/arch/x86/mach-generic/bigsmp.c +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* | ||
2 | * APIC driver for "bigsmp" XAPIC machines with more than 8 virtual CPUs. | ||
3 | * Drives the local APIC in "clustered mode". | ||
4 | */ | ||
5 | #define APIC_DEFINITION 1 | ||
6 | #include <linux/threads.h> | ||
7 | #include <linux/cpumask.h> | ||
8 | #include <asm/mpspec.h> | ||
9 | #include <asm/genapic.h> | ||
10 | #include <asm/fixmap.h> | ||
11 | #include <asm/apicdef.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/dmi.h> | ||
15 | #include <asm/bigsmp/apicdef.h> | ||
16 | #include <linux/smp.h> | ||
17 | #include <asm/bigsmp/apic.h> | ||
18 | #include <asm/bigsmp/ipi.h> | ||
19 | #include <asm/mach-default/mach_mpparse.h> | ||
20 | #include <asm/mach-default/mach_wakecpu.h> | ||
21 | |||
22 | static int dmi_bigsmp; /* can be set by dmi scanners */ | ||
23 | |||
24 | static int hp_ht_bigsmp(const struct dmi_system_id *d) | ||
25 | { | ||
26 | printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident); | ||
27 | dmi_bigsmp = 1; | ||
28 | return 0; | ||
29 | } | ||
30 | |||
31 | |||
32 | static const struct dmi_system_id bigsmp_dmi_table[] = { | ||
33 | { hp_ht_bigsmp, "HP ProLiant DL760 G2", | ||
34 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), | ||
35 | DMI_MATCH(DMI_BIOS_VERSION, "P44-"),} | ||
36 | }, | ||
37 | |||
38 | { hp_ht_bigsmp, "HP ProLiant DL740", | ||
39 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), | ||
40 | DMI_MATCH(DMI_BIOS_VERSION, "P47-"),} | ||
41 | }, | ||
42 | { } | ||
43 | }; | ||
44 | |||
45 | static void vector_allocation_domain(int cpu, cpumask_t *retmask) | ||
46 | { | ||
47 | cpus_clear(*retmask); | ||
48 | cpu_set(cpu, *retmask); | ||
49 | } | ||
50 | |||
51 | static int probe_bigsmp(void) | ||
52 | { | ||
53 | if (def_to_bigsmp) | ||
54 | dmi_bigsmp = 1; | ||
55 | else | ||
56 | dmi_check_system(bigsmp_dmi_table); | ||
57 | return dmi_bigsmp; | ||
58 | } | ||
59 | |||
60 | struct genapic apic_bigsmp = APIC_INIT("bigsmp", probe_bigsmp); | ||
diff --git a/arch/x86/mach-generic/default.c b/arch/x86/mach-generic/default.c deleted file mode 100644 index e63a4a76d8cd..000000000000 --- a/arch/x86/mach-generic/default.c +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | /* | ||
2 | * Default generic APIC driver. This handles up to 8 CPUs. | ||
3 | */ | ||
4 | #define APIC_DEFINITION 1 | ||
5 | #include <linux/threads.h> | ||
6 | #include <linux/cpumask.h> | ||
7 | #include <asm/mpspec.h> | ||
8 | #include <asm/mach-default/mach_apicdef.h> | ||
9 | #include <asm/genapic.h> | ||
10 | #include <asm/fixmap.h> | ||
11 | #include <asm/apicdef.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/string.h> | ||
14 | #include <linux/smp.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <asm/mach-default/mach_apic.h> | ||
17 | #include <asm/mach-default/mach_ipi.h> | ||
18 | #include <asm/mach-default/mach_mpparse.h> | ||
19 | #include <asm/mach-default/mach_wakecpu.h> | ||
20 | |||
21 | /* should be called last. */ | ||
22 | static int probe_default(void) | ||
23 | { | ||
24 | return 1; | ||
25 | } | ||
26 | |||
27 | struct genapic apic_default = APIC_INIT("default", probe_default); | ||
diff --git a/arch/x86/mach-generic/es7000.c b/arch/x86/mach-generic/es7000.c deleted file mode 100644 index c2ded1448024..000000000000 --- a/arch/x86/mach-generic/es7000.c +++ /dev/null | |||
@@ -1,103 +0,0 @@ | |||
1 | /* | ||
2 | * APIC driver for the Unisys ES7000 chipset. | ||
3 | */ | ||
4 | #define APIC_DEFINITION 1 | ||
5 | #include <linux/threads.h> | ||
6 | #include <linux/cpumask.h> | ||
7 | #include <asm/mpspec.h> | ||
8 | #include <asm/genapic.h> | ||
9 | #include <asm/fixmap.h> | ||
10 | #include <asm/apicdef.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/string.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <asm/es7000/apicdef.h> | ||
15 | #include <linux/smp.h> | ||
16 | #include <asm/es7000/apic.h> | ||
17 | #include <asm/es7000/ipi.h> | ||
18 | #include <asm/es7000/mpparse.h> | ||
19 | #include <asm/mach-default/mach_wakecpu.h> | ||
20 | |||
21 | void __init es7000_update_genapic_to_cluster(void) | ||
22 | { | ||
23 | genapic->target_cpus = target_cpus_cluster; | ||
24 | genapic->int_delivery_mode = INT_DELIVERY_MODE_CLUSTER; | ||
25 | genapic->int_dest_mode = INT_DEST_MODE_CLUSTER; | ||
26 | genapic->no_balance_irq = NO_BALANCE_IRQ_CLUSTER; | ||
27 | |||
28 | genapic->init_apic_ldr = init_apic_ldr_cluster; | ||
29 | |||
30 | genapic->cpu_mask_to_apicid = cpu_mask_to_apicid_cluster; | ||
31 | } | ||
32 | |||
33 | static int probe_es7000(void) | ||
34 | { | ||
35 | /* probed later in mptable/ACPI hooks */ | ||
36 | return 0; | ||
37 | } | ||
38 | |||
39 | extern void es7000_sw_apic(void); | ||
40 | static void __init enable_apic_mode(void) | ||
41 | { | ||
42 | es7000_sw_apic(); | ||
43 | return; | ||
44 | } | ||
45 | |||
46 | static __init int | ||
47 | mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | ||
48 | { | ||
49 | if (mpc->oemptr) { | ||
50 | struct mpc_oemtable *oem_table = | ||
51 | (struct mpc_oemtable *)mpc->oemptr; | ||
52 | if (!strncmp(oem, "UNISYS", 6)) | ||
53 | return parse_unisys_oem((char *)oem_table); | ||
54 | } | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | #ifdef CONFIG_ACPI | ||
59 | /* Hook from generic ACPI tables.c */ | ||
60 | static int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
61 | { | ||
62 | unsigned long oem_addr = 0; | ||
63 | int check_dsdt; | ||
64 | int ret = 0; | ||
65 | |||
66 | /* check dsdt at first to avoid clear fix_map for oem_addr */ | ||
67 | check_dsdt = es7000_check_dsdt(); | ||
68 | |||
69 | if (!find_unisys_acpi_oem_table(&oem_addr)) { | ||
70 | if (check_dsdt) | ||
71 | ret = parse_unisys_oem((char *)oem_addr); | ||
72 | else { | ||
73 | setup_unisys(); | ||
74 | ret = 1; | ||
75 | } | ||
76 | /* | ||
77 | * we need to unmap it | ||
78 | */ | ||
79 | unmap_unisys_acpi_oem_table(oem_addr); | ||
80 | } | ||
81 | return ret; | ||
82 | } | ||
83 | #else | ||
84 | static int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
85 | { | ||
86 | return 0; | ||
87 | } | ||
88 | #endif | ||
89 | |||
90 | static void vector_allocation_domain(int cpu, cpumask_t *retmask) | ||
91 | { | ||
92 | /* Careful. Some cpus do not strictly honor the set of cpus | ||
93 | * specified in the interrupt destination when using lowest | ||
94 | * priority interrupt delivery mode. | ||
95 | * | ||
96 | * In particular there was a hyperthreading cpu observed to | ||
97 | * deliver interrupts to the wrong hyperthread when only one | ||
98 | * hyperthread was specified in the interrupt desitination. | ||
99 | */ | ||
100 | *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } }; | ||
101 | } | ||
102 | |||
103 | struct genapic __initdata_refok apic_es7000 = APIC_INIT("es7000", probe_es7000); | ||
diff --git a/arch/x86/mach-generic/numaq.c b/arch/x86/mach-generic/numaq.c deleted file mode 100644 index 3679e2255645..000000000000 --- a/arch/x86/mach-generic/numaq.c +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /* | ||
2 | * APIC driver for the IBM NUMAQ chipset. | ||
3 | */ | ||
4 | #define APIC_DEFINITION 1 | ||
5 | #include <linux/threads.h> | ||
6 | #include <linux/cpumask.h> | ||
7 | #include <asm/mpspec.h> | ||
8 | #include <asm/genapic.h> | ||
9 | #include <asm/fixmap.h> | ||
10 | #include <asm/apicdef.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/string.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <asm/numaq/apicdef.h> | ||
15 | #include <linux/smp.h> | ||
16 | #include <asm/numaq/apic.h> | ||
17 | #include <asm/numaq/ipi.h> | ||
18 | #include <asm/numaq/mpparse.h> | ||
19 | #include <asm/numaq/wakecpu.h> | ||
20 | #include <asm/numaq.h> | ||
21 | |||
22 | static int mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | ||
23 | { | ||
24 | numaq_mps_oem_check(mpc, oem, productid); | ||
25 | return found_numaq; | ||
26 | } | ||
27 | |||
28 | static int probe_numaq(void) | ||
29 | { | ||
30 | /* already know from get_memcfg_numaq() */ | ||
31 | return found_numaq; | ||
32 | } | ||
33 | |||
34 | /* Hook from generic ACPI tables.c */ | ||
35 | static int acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
36 | { | ||
37 | return 0; | ||
38 | } | ||
39 | |||
40 | static void vector_allocation_domain(int cpu, cpumask_t *retmask) | ||
41 | { | ||
42 | /* Careful. Some cpus do not strictly honor the set of cpus | ||
43 | * specified in the interrupt destination when using lowest | ||
44 | * priority interrupt delivery mode. | ||
45 | * | ||
46 | * In particular there was a hyperthreading cpu observed to | ||
47 | * deliver interrupts to the wrong hyperthread when only one | ||
48 | * hyperthread was specified in the interrupt desitination. | ||
49 | */ | ||
50 | *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } }; | ||
51 | } | ||
52 | |||
53 | struct genapic apic_numaq = APIC_INIT("NUMAQ", probe_numaq); | ||
diff --git a/arch/x86/mach-generic/probe.c b/arch/x86/mach-generic/probe.c deleted file mode 100644 index 15a38daef1a8..000000000000 --- a/arch/x86/mach-generic/probe.c +++ /dev/null | |||
@@ -1,152 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2003 Andi Kleen, SuSE Labs. | ||
3 | * Subject to the GNU Public License, v.2 | ||
4 | * | ||
5 | * Generic x86 APIC driver probe layer. | ||
6 | */ | ||
7 | #include <linux/threads.h> | ||
8 | #include <linux/cpumask.h> | ||
9 | #include <linux/string.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/ctype.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/errno.h> | ||
14 | #include <asm/fixmap.h> | ||
15 | #include <asm/mpspec.h> | ||
16 | #include <asm/apicdef.h> | ||
17 | #include <asm/genapic.h> | ||
18 | #include <asm/setup.h> | ||
19 | |||
20 | extern struct genapic apic_numaq; | ||
21 | extern struct genapic apic_summit; | ||
22 | extern struct genapic apic_bigsmp; | ||
23 | extern struct genapic apic_es7000; | ||
24 | extern struct genapic apic_default; | ||
25 | |||
26 | struct genapic *genapic = &apic_default; | ||
27 | |||
28 | static struct genapic *apic_probe[] __initdata = { | ||
29 | #ifdef CONFIG_X86_NUMAQ | ||
30 | &apic_numaq, | ||
31 | #endif | ||
32 | #ifdef CONFIG_X86_SUMMIT | ||
33 | &apic_summit, | ||
34 | #endif | ||
35 | #ifdef CONFIG_X86_BIGSMP | ||
36 | &apic_bigsmp, | ||
37 | #endif | ||
38 | #ifdef CONFIG_X86_ES7000 | ||
39 | &apic_es7000, | ||
40 | #endif | ||
41 | &apic_default, /* must be last */ | ||
42 | NULL, | ||
43 | }; | ||
44 | |||
45 | static int cmdline_apic __initdata; | ||
46 | static int __init parse_apic(char *arg) | ||
47 | { | ||
48 | int i; | ||
49 | |||
50 | if (!arg) | ||
51 | return -EINVAL; | ||
52 | |||
53 | for (i = 0; apic_probe[i]; i++) { | ||
54 | if (!strcmp(apic_probe[i]->name, arg)) { | ||
55 | genapic = apic_probe[i]; | ||
56 | cmdline_apic = 1; | ||
57 | return 0; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | if (x86_quirks->update_genapic) | ||
62 | x86_quirks->update_genapic(); | ||
63 | |||
64 | /* Parsed again by __setup for debug/verbose */ | ||
65 | return 0; | ||
66 | } | ||
67 | early_param("apic", parse_apic); | ||
68 | |||
69 | void __init generic_bigsmp_probe(void) | ||
70 | { | ||
71 | #ifdef CONFIG_X86_BIGSMP | ||
72 | /* | ||
73 | * This routine is used to switch to bigsmp mode when | ||
74 | * - There is no apic= option specified by the user | ||
75 | * - generic_apic_probe() has chosen apic_default as the sub_arch | ||
76 | * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support | ||
77 | */ | ||
78 | |||
79 | if (!cmdline_apic && genapic == &apic_default) { | ||
80 | if (apic_bigsmp.probe()) { | ||
81 | genapic = &apic_bigsmp; | ||
82 | if (x86_quirks->update_genapic) | ||
83 | x86_quirks->update_genapic(); | ||
84 | printk(KERN_INFO "Overriding APIC driver with %s\n", | ||
85 | genapic->name); | ||
86 | } | ||
87 | } | ||
88 | #endif | ||
89 | } | ||
90 | |||
91 | void __init generic_apic_probe(void) | ||
92 | { | ||
93 | if (!cmdline_apic) { | ||
94 | int i; | ||
95 | for (i = 0; apic_probe[i]; i++) { | ||
96 | if (apic_probe[i]->probe()) { | ||
97 | genapic = apic_probe[i]; | ||
98 | break; | ||
99 | } | ||
100 | } | ||
101 | /* Not visible without early console */ | ||
102 | if (!apic_probe[i]) | ||
103 | panic("Didn't find an APIC driver"); | ||
104 | |||
105 | if (x86_quirks->update_genapic) | ||
106 | x86_quirks->update_genapic(); | ||
107 | } | ||
108 | printk(KERN_INFO "Using APIC driver %s\n", genapic->name); | ||
109 | } | ||
110 | |||
111 | /* These functions can switch the APIC even after the initial ->probe() */ | ||
112 | |||
113 | int __init mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | ||
114 | { | ||
115 | int i; | ||
116 | for (i = 0; apic_probe[i]; ++i) { | ||
117 | if (apic_probe[i]->mps_oem_check(mpc, oem, productid)) { | ||
118 | if (!cmdline_apic) { | ||
119 | genapic = apic_probe[i]; | ||
120 | if (x86_quirks->update_genapic) | ||
121 | x86_quirks->update_genapic(); | ||
122 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", | ||
123 | genapic->name); | ||
124 | } | ||
125 | return 1; | ||
126 | } | ||
127 | } | ||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
132 | { | ||
133 | int i; | ||
134 | for (i = 0; apic_probe[i]; ++i) { | ||
135 | if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) { | ||
136 | if (!cmdline_apic) { | ||
137 | genapic = apic_probe[i]; | ||
138 | if (x86_quirks->update_genapic) | ||
139 | x86_quirks->update_genapic(); | ||
140 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", | ||
141 | genapic->name); | ||
142 | } | ||
143 | return 1; | ||
144 | } | ||
145 | } | ||
146 | return 0; | ||
147 | } | ||
148 | |||
149 | int hard_smp_processor_id(void) | ||
150 | { | ||
151 | return genapic->get_apic_id(*(unsigned long *)(APIC_BASE+APIC_ID)); | ||
152 | } | ||
diff --git a/arch/x86/mach-generic/summit.c b/arch/x86/mach-generic/summit.c deleted file mode 100644 index 2821ffc188b5..000000000000 --- a/arch/x86/mach-generic/summit.c +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * APIC driver for the IBM "Summit" chipset. | ||
3 | */ | ||
4 | #define APIC_DEFINITION 1 | ||
5 | #include <linux/threads.h> | ||
6 | #include <linux/cpumask.h> | ||
7 | #include <asm/mpspec.h> | ||
8 | #include <asm/genapic.h> | ||
9 | #include <asm/fixmap.h> | ||
10 | #include <asm/apicdef.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/string.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <asm/summit/apicdef.h> | ||
15 | #include <linux/smp.h> | ||
16 | #include <asm/summit/apic.h> | ||
17 | #include <asm/summit/ipi.h> | ||
18 | #include <asm/summit/mpparse.h> | ||
19 | #include <asm/mach-default/mach_wakecpu.h> | ||
20 | |||
21 | static int probe_summit(void) | ||
22 | { | ||
23 | /* probed later in mptable/ACPI hooks */ | ||
24 | return 0; | ||
25 | } | ||
26 | |||
27 | static void vector_allocation_domain(int cpu, cpumask_t *retmask) | ||
28 | { | ||
29 | /* Careful. Some cpus do not strictly honor the set of cpus | ||
30 | * specified in the interrupt destination when using lowest | ||
31 | * priority interrupt delivery mode. | ||
32 | * | ||
33 | * In particular there was a hyperthreading cpu observed to | ||
34 | * deliver interrupts to the wrong hyperthread when only one | ||
35 | * hyperthread was specified in the interrupt desitination. | ||
36 | */ | ||
37 | *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } }; | ||
38 | } | ||
39 | |||
40 | struct genapic apic_summit = APIC_INIT("summit", probe_summit); | ||
diff --git a/arch/x86/mach-rdc321x/Makefile b/arch/x86/mach-rdc321x/Makefile deleted file mode 100644 index 8325b4ca431c..000000000000 --- a/arch/x86/mach-rdc321x/Makefile +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the RDC321x specific parts of the kernel | ||
3 | # | ||
4 | obj-$(CONFIG_X86_RDC321X) := gpio.o platform.o | ||
5 | |||
diff --git a/arch/x86/mach-rdc321x/gpio.c b/arch/x86/mach-rdc321x/gpio.c deleted file mode 100644 index 247f33d3a407..000000000000 --- a/arch/x86/mach-rdc321x/gpio.c +++ /dev/null | |||
@@ -1,194 +0,0 @@ | |||
1 | /* | ||
2 | * GPIO support for RDC SoC R3210/R8610 | ||
3 | * | ||
4 | * Copyright (C) 2007, Florian Fainelli <florian@openwrt.org> | ||
5 | * Copyright (C) 2008, Volker Weiss <dev@tintuc.de> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | |||
24 | #include <linux/spinlock.h> | ||
25 | #include <linux/io.h> | ||
26 | #include <linux/types.h> | ||
27 | #include <linux/module.h> | ||
28 | |||
29 | #include <asm/gpio.h> | ||
30 | #include <asm/mach-rdc321x/rdc321x_defs.h> | ||
31 | |||
32 | |||
33 | /* spin lock to protect our private copy of GPIO data register plus | ||
34 | the access to PCI conf registers. */ | ||
35 | static DEFINE_SPINLOCK(gpio_lock); | ||
36 | |||
37 | /* copy of GPIO data registers */ | ||
38 | static u32 gpio_data_reg1; | ||
39 | static u32 gpio_data_reg2; | ||
40 | |||
41 | static u32 gpio_request_data[2]; | ||
42 | |||
43 | |||
44 | static inline void rdc321x_conf_write(unsigned addr, u32 value) | ||
45 | { | ||
46 | outl((1 << 31) | (7 << 11) | addr, RDC3210_CFGREG_ADDR); | ||
47 | outl(value, RDC3210_CFGREG_DATA); | ||
48 | } | ||
49 | |||
50 | static inline void rdc321x_conf_or(unsigned addr, u32 value) | ||
51 | { | ||
52 | outl((1 << 31) | (7 << 11) | addr, RDC3210_CFGREG_ADDR); | ||
53 | value |= inl(RDC3210_CFGREG_DATA); | ||
54 | outl(value, RDC3210_CFGREG_DATA); | ||
55 | } | ||
56 | |||
57 | static inline u32 rdc321x_conf_read(unsigned addr) | ||
58 | { | ||
59 | outl((1 << 31) | (7 << 11) | addr, RDC3210_CFGREG_ADDR); | ||
60 | |||
61 | return inl(RDC3210_CFGREG_DATA); | ||
62 | } | ||
63 | |||
64 | /* configure pin as GPIO */ | ||
65 | static void rdc321x_configure_gpio(unsigned gpio) | ||
66 | { | ||
67 | unsigned long flags; | ||
68 | |||
69 | spin_lock_irqsave(&gpio_lock, flags); | ||
70 | rdc321x_conf_or(gpio < 32 | ||
71 | ? RDC321X_GPIO_CTRL_REG1 : RDC321X_GPIO_CTRL_REG2, | ||
72 | 1 << (gpio & 0x1f)); | ||
73 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
74 | } | ||
75 | |||
76 | /* initially setup the 2 copies of the gpio data registers. | ||
77 | This function must be called by the platform setup code. */ | ||
78 | void __init rdc321x_gpio_setup() | ||
79 | { | ||
80 | /* this might not be, what others (BIOS, bootloader, etc.) | ||
81 | wrote to these registers before, but it's a good guess. Still | ||
82 | better than just using 0xffffffff. */ | ||
83 | |||
84 | gpio_data_reg1 = rdc321x_conf_read(RDC321X_GPIO_DATA_REG1); | ||
85 | gpio_data_reg2 = rdc321x_conf_read(RDC321X_GPIO_DATA_REG2); | ||
86 | } | ||
87 | |||
88 | /* determine, if gpio number is valid */ | ||
89 | static inline int rdc321x_is_gpio(unsigned gpio) | ||
90 | { | ||
91 | return gpio <= RDC321X_MAX_GPIO; | ||
92 | } | ||
93 | |||
94 | /* request GPIO */ | ||
95 | int rdc_gpio_request(unsigned gpio, const char *label) | ||
96 | { | ||
97 | unsigned long flags; | ||
98 | |||
99 | if (!rdc321x_is_gpio(gpio)) | ||
100 | return -EINVAL; | ||
101 | |||
102 | spin_lock_irqsave(&gpio_lock, flags); | ||
103 | if (gpio_request_data[(gpio & 0x20) ? 1 : 0] & (1 << (gpio & 0x1f))) | ||
104 | goto inuse; | ||
105 | gpio_request_data[(gpio & 0x20) ? 1 : 0] |= (1 << (gpio & 0x1f)); | ||
106 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
107 | |||
108 | return 0; | ||
109 | inuse: | ||
110 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
111 | return -EINVAL; | ||
112 | } | ||
113 | EXPORT_SYMBOL(rdc_gpio_request); | ||
114 | |||
115 | /* release previously-claimed GPIO */ | ||
116 | void rdc_gpio_free(unsigned gpio) | ||
117 | { | ||
118 | unsigned long flags; | ||
119 | |||
120 | if (!rdc321x_is_gpio(gpio)) | ||
121 | return; | ||
122 | |||
123 | spin_lock_irqsave(&gpio_lock, flags); | ||
124 | gpio_request_data[(gpio & 0x20) ? 1 : 0] &= ~(1 << (gpio & 0x1f)); | ||
125 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
126 | } | ||
127 | EXPORT_SYMBOL(rdc_gpio_free); | ||
128 | |||
129 | /* read GPIO pin */ | ||
130 | int rdc_gpio_get_value(unsigned gpio) | ||
131 | { | ||
132 | u32 reg; | ||
133 | unsigned long flags; | ||
134 | |||
135 | spin_lock_irqsave(&gpio_lock, flags); | ||
136 | reg = rdc321x_conf_read(gpio < 32 | ||
137 | ? RDC321X_GPIO_DATA_REG1 : RDC321X_GPIO_DATA_REG2); | ||
138 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
139 | |||
140 | return (1 << (gpio & 0x1f)) & reg ? 1 : 0; | ||
141 | } | ||
142 | EXPORT_SYMBOL(rdc_gpio_get_value); | ||
143 | |||
144 | /* set GPIO pin to value */ | ||
145 | void rdc_gpio_set_value(unsigned gpio, int value) | ||
146 | { | ||
147 | unsigned long flags; | ||
148 | u32 reg; | ||
149 | |||
150 | reg = 1 << (gpio & 0x1f); | ||
151 | if (gpio < 32) { | ||
152 | spin_lock_irqsave(&gpio_lock, flags); | ||
153 | if (value) | ||
154 | gpio_data_reg1 |= reg; | ||
155 | else | ||
156 | gpio_data_reg1 &= ~reg; | ||
157 | rdc321x_conf_write(RDC321X_GPIO_DATA_REG1, gpio_data_reg1); | ||
158 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
159 | } else { | ||
160 | spin_lock_irqsave(&gpio_lock, flags); | ||
161 | if (value) | ||
162 | gpio_data_reg2 |= reg; | ||
163 | else | ||
164 | gpio_data_reg2 &= ~reg; | ||
165 | rdc321x_conf_write(RDC321X_GPIO_DATA_REG2, gpio_data_reg2); | ||
166 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
167 | } | ||
168 | } | ||
169 | EXPORT_SYMBOL(rdc_gpio_set_value); | ||
170 | |||
171 | /* configure GPIO pin as input */ | ||
172 | int rdc_gpio_direction_input(unsigned gpio) | ||
173 | { | ||
174 | if (!rdc321x_is_gpio(gpio)) | ||
175 | return -EINVAL; | ||
176 | |||
177 | rdc321x_configure_gpio(gpio); | ||
178 | |||
179 | return 0; | ||
180 | } | ||
181 | EXPORT_SYMBOL(rdc_gpio_direction_input); | ||
182 | |||
183 | /* configure GPIO pin as output and set value */ | ||
184 | int rdc_gpio_direction_output(unsigned gpio, int value) | ||
185 | { | ||
186 | if (!rdc321x_is_gpio(gpio)) | ||
187 | return -EINVAL; | ||
188 | |||
189 | gpio_set_value(gpio, value); | ||
190 | rdc321x_configure_gpio(gpio); | ||
191 | |||
192 | return 0; | ||
193 | } | ||
194 | EXPORT_SYMBOL(rdc_gpio_direction_output); | ||
diff --git a/arch/x86/mach-rdc321x/platform.c b/arch/x86/mach-rdc321x/platform.c deleted file mode 100644 index 4f4e50c3ad3b..000000000000 --- a/arch/x86/mach-rdc321x/platform.c +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | /* | ||
2 | * Generic RDC321x platform devices | ||
3 | * | ||
4 | * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version 2 | ||
9 | * of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the | ||
18 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | * Boston, MA 02110-1301, USA. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #include <linux/init.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/list.h> | ||
26 | #include <linux/device.h> | ||
27 | #include <linux/platform_device.h> | ||
28 | #include <linux/leds.h> | ||
29 | |||
30 | #include <asm/gpio.h> | ||
31 | |||
32 | /* LEDS */ | ||
33 | static struct gpio_led default_leds[] = { | ||
34 | { .name = "rdc:dmz", .gpio = 1, }, | ||
35 | }; | ||
36 | |||
37 | static struct gpio_led_platform_data rdc321x_led_data = { | ||
38 | .num_leds = ARRAY_SIZE(default_leds), | ||
39 | .leds = default_leds, | ||
40 | }; | ||
41 | |||
42 | static struct platform_device rdc321x_leds = { | ||
43 | .name = "leds-gpio", | ||
44 | .id = -1, | ||
45 | .dev = { | ||
46 | .platform_data = &rdc321x_led_data, | ||
47 | } | ||
48 | }; | ||
49 | |||
50 | /* Watchdog */ | ||
51 | static struct platform_device rdc321x_wdt = { | ||
52 | .name = "rdc321x-wdt", | ||
53 | .id = -1, | ||
54 | .num_resources = 0, | ||
55 | }; | ||
56 | |||
57 | static struct platform_device *rdc321x_devs[] = { | ||
58 | &rdc321x_leds, | ||
59 | &rdc321x_wdt | ||
60 | }; | ||
61 | |||
62 | static int __init rdc_board_setup(void) | ||
63 | { | ||
64 | rdc321x_gpio_setup(); | ||
65 | |||
66 | return platform_add_devices(rdc321x_devs, ARRAY_SIZE(rdc321x_devs)); | ||
67 | } | ||
68 | |||
69 | arch_initcall(rdc_board_setup); | ||
diff --git a/arch/x86/mach-voyager/setup.c b/arch/x86/mach-voyager/setup.c index d914a7996a66..66b7eb57d8e4 100644 --- a/arch/x86/mach-voyager/setup.c +++ b/arch/x86/mach-voyager/setup.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <asm/e820.h> | 9 | #include <asm/e820.h> |
10 | #include <asm/io.h> | 10 | #include <asm/io.h> |
11 | #include <asm/setup.h> | 11 | #include <asm/setup.h> |
12 | #include <asm/cpu.h> | ||
12 | 13 | ||
13 | void __init pre_intr_init_hook(void) | 14 | void __init pre_intr_init_hook(void) |
14 | { | 15 | { |
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c index 7ffcdeec4631..328cb0ce62f0 100644 --- a/arch/x86/mach-voyager/voyager_smp.c +++ b/arch/x86/mach-voyager/voyager_smp.c | |||
@@ -400,7 +400,7 @@ void __init find_smp_config(void) | |||
400 | VOYAGER_SUS_IN_CONTROL_PORT); | 400 | VOYAGER_SUS_IN_CONTROL_PORT); |
401 | 401 | ||
402 | current_thread_info()->cpu = boot_cpu_id; | 402 | current_thread_info()->cpu = boot_cpu_id; |
403 | x86_write_percpu(cpu_number, boot_cpu_id); | 403 | percpu_write(cpu_number, boot_cpu_id); |
404 | } | 404 | } |
405 | 405 | ||
406 | /* | 406 | /* |
@@ -528,7 +528,6 @@ static void __init do_boot_cpu(__u8 cpu) | |||
528 | /* init_tasks (in sched.c) is indexed logically */ | 528 | /* init_tasks (in sched.c) is indexed logically */ |
529 | stack_start.sp = (void *)idle->thread.sp; | 529 | stack_start.sp = (void *)idle->thread.sp; |
530 | 530 | ||
531 | init_gdt(cpu); | ||
532 | per_cpu(current_task, cpu) = idle; | 531 | per_cpu(current_task, cpu) = idle; |
533 | early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); | 532 | early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); |
534 | irq_ctx_init(cpu); | 533 | irq_ctx_init(cpu); |
@@ -1745,7 +1744,6 @@ static void __init voyager_smp_prepare_cpus(unsigned int max_cpus) | |||
1745 | 1744 | ||
1746 | static void __cpuinit voyager_smp_prepare_boot_cpu(void) | 1745 | static void __cpuinit voyager_smp_prepare_boot_cpu(void) |
1747 | { | 1746 | { |
1748 | init_gdt(smp_processor_id()); | ||
1749 | switch_to_new_gdt(); | 1747 | switch_to_new_gdt(); |
1750 | 1748 | ||
1751 | cpu_online_map = cpumask_of_cpu(smp_processor_id()); | 1749 | cpu_online_map = cpumask_of_cpu(smp_processor_id()); |
@@ -1779,7 +1777,6 @@ static void __init voyager_smp_cpus_done(unsigned int max_cpus) | |||
1779 | void __init smp_setup_processor_id(void) | 1777 | void __init smp_setup_processor_id(void) |
1780 | { | 1778 | { |
1781 | current_thread_info()->cpu = hard_smp_processor_id(); | 1779 | current_thread_info()->cpu = hard_smp_processor_id(); |
1782 | x86_write_percpu(cpu_number, hard_smp_processor_id()); | ||
1783 | } | 1780 | } |
1784 | 1781 | ||
1785 | static void voyager_send_call_func(const struct cpumask *callmask) | 1782 | static void voyager_send_call_func(const struct cpumask *callmask) |
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile index d8cc96a2738f..2b938a384910 100644 --- a/arch/x86/mm/Makefile +++ b/arch/x86/mm/Makefile | |||
@@ -1,6 +1,8 @@ | |||
1 | obj-y := init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \ | 1 | obj-y := init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \ |
2 | pat.o pgtable.o gup.o | 2 | pat.o pgtable.o gup.o |
3 | 3 | ||
4 | obj-$(CONFIG_SMP) += tlb.o | ||
5 | |||
4 | obj-$(CONFIG_X86_32) += pgtable_32.o iomap_32.o | 6 | obj-$(CONFIG_X86_32) += pgtable_32.o iomap_32.o |
5 | 7 | ||
6 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o | 8 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o |
diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c index 7e8db53528a7..61b41ca3b5a2 100644 --- a/arch/x86/mm/extable.c +++ b/arch/x86/mm/extable.c | |||
@@ -23,6 +23,12 @@ int fixup_exception(struct pt_regs *regs) | |||
23 | 23 | ||
24 | fixup = search_exception_tables(regs->ip); | 24 | fixup = search_exception_tables(regs->ip); |
25 | if (fixup) { | 25 | if (fixup) { |
26 | /* If fixup is less than 16, it means uaccess error */ | ||
27 | if (fixup->fixup < 16) { | ||
28 | current_thread_info()->uaccess_err = -EFAULT; | ||
29 | regs->ip += fixup->fixup; | ||
30 | return 1; | ||
31 | } | ||
26 | regs->ip = fixup->fixup; | 32 | regs->ip = fixup->fixup; |
27 | return 1; | 33 | return 1; |
28 | } | 34 | } |
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 90dfae511a41..d3eee74f830a 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/kprobes.h> | 26 | #include <linux/kprobes.h> |
27 | #include <linux/uaccess.h> | 27 | #include <linux/uaccess.h> |
28 | #include <linux/kdebug.h> | 28 | #include <linux/kdebug.h> |
29 | #include <linux/magic.h> | ||
29 | 30 | ||
30 | #include <asm/system.h> | 31 | #include <asm/system.h> |
31 | #include <asm/desc.h> | 32 | #include <asm/desc.h> |
@@ -91,8 +92,8 @@ static inline int notify_page_fault(struct pt_regs *regs) | |||
91 | * | 92 | * |
92 | * Opcode checker based on code by Richard Brunner | 93 | * Opcode checker based on code by Richard Brunner |
93 | */ | 94 | */ |
94 | static int is_prefetch(struct pt_regs *regs, unsigned long addr, | 95 | static int is_prefetch(struct pt_regs *regs, unsigned long error_code, |
95 | unsigned long error_code) | 96 | unsigned long addr) |
96 | { | 97 | { |
97 | unsigned char *instr; | 98 | unsigned char *instr; |
98 | int scan_more = 1; | 99 | int scan_more = 1; |
@@ -409,17 +410,16 @@ static void show_fault_oops(struct pt_regs *regs, unsigned long error_code, | |||
409 | } | 410 | } |
410 | 411 | ||
411 | #ifdef CONFIG_X86_64 | 412 | #ifdef CONFIG_X86_64 |
412 | static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs, | 413 | static noinline void pgtable_bad(struct pt_regs *regs, |
413 | unsigned long error_code) | 414 | unsigned long error_code, unsigned long address) |
414 | { | 415 | { |
415 | unsigned long flags = oops_begin(); | 416 | unsigned long flags = oops_begin(); |
416 | int sig = SIGKILL; | 417 | int sig = SIGKILL; |
417 | struct task_struct *tsk; | 418 | struct task_struct *tsk = current; |
418 | 419 | ||
419 | printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", | 420 | printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", |
420 | current->comm, address); | 421 | tsk->comm, address); |
421 | dump_pagetable(address); | 422 | dump_pagetable(address); |
422 | tsk = current; | ||
423 | tsk->thread.cr2 = address; | 423 | tsk->thread.cr2 = address; |
424 | tsk->thread.trap_no = 14; | 424 | tsk->thread.trap_no = 14; |
425 | tsk->thread.error_code = error_code; | 425 | tsk->thread.error_code = error_code; |
@@ -429,6 +429,196 @@ static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs, | |||
429 | } | 429 | } |
430 | #endif | 430 | #endif |
431 | 431 | ||
432 | static noinline void no_context(struct pt_regs *regs, | ||
433 | unsigned long error_code, unsigned long address) | ||
434 | { | ||
435 | struct task_struct *tsk = current; | ||
436 | unsigned long *stackend; | ||
437 | |||
438 | #ifdef CONFIG_X86_64 | ||
439 | unsigned long flags; | ||
440 | int sig; | ||
441 | #endif | ||
442 | |||
443 | /* Are we prepared to handle this kernel fault? */ | ||
444 | if (fixup_exception(regs)) | ||
445 | return; | ||
446 | |||
447 | /* | ||
448 | * X86_32 | ||
449 | * Valid to do another page fault here, because if this fault | ||
450 | * had been triggered by is_prefetch fixup_exception would have | ||
451 | * handled it. | ||
452 | * | ||
453 | * X86_64 | ||
454 | * Hall of shame of CPU/BIOS bugs. | ||
455 | */ | ||
456 | if (is_prefetch(regs, error_code, address)) | ||
457 | return; | ||
458 | |||
459 | if (is_errata93(regs, address)) | ||
460 | return; | ||
461 | |||
462 | /* | ||
463 | * Oops. The kernel tried to access some bad page. We'll have to | ||
464 | * terminate things with extreme prejudice. | ||
465 | */ | ||
466 | #ifdef CONFIG_X86_32 | ||
467 | bust_spinlocks(1); | ||
468 | #else | ||
469 | flags = oops_begin(); | ||
470 | #endif | ||
471 | |||
472 | show_fault_oops(regs, error_code, address); | ||
473 | |||
474 | stackend = end_of_stack(tsk); | ||
475 | if (*stackend != STACK_END_MAGIC) | ||
476 | printk(KERN_ALERT "Thread overran stack, or stack corrupted\n"); | ||
477 | |||
478 | tsk->thread.cr2 = address; | ||
479 | tsk->thread.trap_no = 14; | ||
480 | tsk->thread.error_code = error_code; | ||
481 | |||
482 | #ifdef CONFIG_X86_32 | ||
483 | die("Oops", regs, error_code); | ||
484 | bust_spinlocks(0); | ||
485 | do_exit(SIGKILL); | ||
486 | #else | ||
487 | sig = SIGKILL; | ||
488 | if (__die("Oops", regs, error_code)) | ||
489 | sig = 0; | ||
490 | /* Executive summary in case the body of the oops scrolled away */ | ||
491 | printk(KERN_EMERG "CR2: %016lx\n", address); | ||
492 | oops_end(flags, regs, sig); | ||
493 | #endif | ||
494 | } | ||
495 | |||
496 | static void __bad_area_nosemaphore(struct pt_regs *regs, | ||
497 | unsigned long error_code, unsigned long address, | ||
498 | int si_code) | ||
499 | { | ||
500 | struct task_struct *tsk = current; | ||
501 | |||
502 | /* User mode accesses just cause a SIGSEGV */ | ||
503 | if (error_code & PF_USER) { | ||
504 | /* | ||
505 | * It's possible to have interrupts off here. | ||
506 | */ | ||
507 | local_irq_enable(); | ||
508 | |||
509 | /* | ||
510 | * Valid to do another page fault here because this one came | ||
511 | * from user space. | ||
512 | */ | ||
513 | if (is_prefetch(regs, error_code, address)) | ||
514 | return; | ||
515 | |||
516 | if (is_errata100(regs, address)) | ||
517 | return; | ||
518 | |||
519 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && | ||
520 | printk_ratelimit()) { | ||
521 | printk( | ||
522 | "%s%s[%d]: segfault at %lx ip %p sp %p error %lx", | ||
523 | task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, | ||
524 | tsk->comm, task_pid_nr(tsk), address, | ||
525 | (void *) regs->ip, (void *) regs->sp, error_code); | ||
526 | print_vma_addr(" in ", regs->ip); | ||
527 | printk("\n"); | ||
528 | } | ||
529 | |||
530 | tsk->thread.cr2 = address; | ||
531 | /* Kernel addresses are always protection faults */ | ||
532 | tsk->thread.error_code = error_code | (address >= TASK_SIZE); | ||
533 | tsk->thread.trap_no = 14; | ||
534 | force_sig_info_fault(SIGSEGV, si_code, address, tsk); | ||
535 | return; | ||
536 | } | ||
537 | |||
538 | if (is_f00f_bug(regs, address)) | ||
539 | return; | ||
540 | |||
541 | no_context(regs, error_code, address); | ||
542 | } | ||
543 | |||
544 | static noinline void bad_area_nosemaphore(struct pt_regs *regs, | ||
545 | unsigned long error_code, unsigned long address) | ||
546 | { | ||
547 | __bad_area_nosemaphore(regs, error_code, address, SEGV_MAPERR); | ||
548 | } | ||
549 | |||
550 | static void __bad_area(struct pt_regs *regs, | ||
551 | unsigned long error_code, unsigned long address, | ||
552 | int si_code) | ||
553 | { | ||
554 | struct mm_struct *mm = current->mm; | ||
555 | |||
556 | /* | ||
557 | * Something tried to access memory that isn't in our memory map.. | ||
558 | * Fix it, but check if it's kernel or user first.. | ||
559 | */ | ||
560 | up_read(&mm->mmap_sem); | ||
561 | |||
562 | __bad_area_nosemaphore(regs, error_code, address, si_code); | ||
563 | } | ||
564 | |||
565 | static noinline void bad_area(struct pt_regs *regs, | ||
566 | unsigned long error_code, unsigned long address) | ||
567 | { | ||
568 | __bad_area(regs, error_code, address, SEGV_MAPERR); | ||
569 | } | ||
570 | |||
571 | static noinline void bad_area_access_error(struct pt_regs *regs, | ||
572 | unsigned long error_code, unsigned long address) | ||
573 | { | ||
574 | __bad_area(regs, error_code, address, SEGV_ACCERR); | ||
575 | } | ||
576 | |||
577 | /* TODO: fixup for "mm-invoke-oom-killer-from-page-fault.patch" */ | ||
578 | static void out_of_memory(struct pt_regs *regs, | ||
579 | unsigned long error_code, unsigned long address) | ||
580 | { | ||
581 | /* | ||
582 | * We ran out of memory, call the OOM killer, and return the userspace | ||
583 | * (which will retry the fault, or kill us if we got oom-killed). | ||
584 | */ | ||
585 | up_read(¤t->mm->mmap_sem); | ||
586 | pagefault_out_of_memory(); | ||
587 | } | ||
588 | |||
589 | static void do_sigbus(struct pt_regs *regs, | ||
590 | unsigned long error_code, unsigned long address) | ||
591 | { | ||
592 | struct task_struct *tsk = current; | ||
593 | struct mm_struct *mm = tsk->mm; | ||
594 | |||
595 | up_read(&mm->mmap_sem); | ||
596 | |||
597 | /* Kernel mode? Handle exceptions or die */ | ||
598 | if (!(error_code & PF_USER)) | ||
599 | no_context(regs, error_code, address); | ||
600 | #ifdef CONFIG_X86_32 | ||
601 | /* User space => ok to do another page fault */ | ||
602 | if (is_prefetch(regs, error_code, address)) | ||
603 | return; | ||
604 | #endif | ||
605 | tsk->thread.cr2 = address; | ||
606 | tsk->thread.error_code = error_code; | ||
607 | tsk->thread.trap_no = 14; | ||
608 | force_sig_info_fault(SIGBUS, BUS_ADRERR, address, tsk); | ||
609 | } | ||
610 | |||
611 | static noinline void mm_fault_error(struct pt_regs *regs, | ||
612 | unsigned long error_code, unsigned long address, unsigned int fault) | ||
613 | { | ||
614 | if (fault & VM_FAULT_OOM) | ||
615 | out_of_memory(regs, error_code, address); | ||
616 | else if (fault & VM_FAULT_SIGBUS) | ||
617 | do_sigbus(regs, error_code, address); | ||
618 | else | ||
619 | BUG(); | ||
620 | } | ||
621 | |||
432 | static int spurious_fault_check(unsigned long error_code, pte_t *pte) | 622 | static int spurious_fault_check(unsigned long error_code, pte_t *pte) |
433 | { | 623 | { |
434 | if ((error_code & PF_WRITE) && !pte_write(*pte)) | 624 | if ((error_code & PF_WRITE) && !pte_write(*pte)) |
@@ -448,8 +638,8 @@ static int spurious_fault_check(unsigned long error_code, pte_t *pte) | |||
448 | * There are no security implications to leaving a stale TLB when | 638 | * There are no security implications to leaving a stale TLB when |
449 | * increasing the permissions on a page. | 639 | * increasing the permissions on a page. |
450 | */ | 640 | */ |
451 | static int spurious_fault(unsigned long address, | 641 | static noinline int spurious_fault(unsigned long error_code, |
452 | unsigned long error_code) | 642 | unsigned long address) |
453 | { | 643 | { |
454 | pgd_t *pgd; | 644 | pgd_t *pgd; |
455 | pud_t *pud; | 645 | pud_t *pud; |
@@ -494,7 +684,7 @@ static int spurious_fault(unsigned long address, | |||
494 | * | 684 | * |
495 | * This assumes no large pages in there. | 685 | * This assumes no large pages in there. |
496 | */ | 686 | */ |
497 | static int vmalloc_fault(unsigned long address) | 687 | static noinline int vmalloc_fault(unsigned long address) |
498 | { | 688 | { |
499 | #ifdef CONFIG_X86_32 | 689 | #ifdef CONFIG_X86_32 |
500 | unsigned long pgd_paddr; | 690 | unsigned long pgd_paddr; |
@@ -573,6 +763,25 @@ static int vmalloc_fault(unsigned long address) | |||
573 | 763 | ||
574 | int show_unhandled_signals = 1; | 764 | int show_unhandled_signals = 1; |
575 | 765 | ||
766 | static inline int access_error(unsigned long error_code, int write, | ||
767 | struct vm_area_struct *vma) | ||
768 | { | ||
769 | if (write) { | ||
770 | /* write, present and write, not present */ | ||
771 | if (unlikely(!(vma->vm_flags & VM_WRITE))) | ||
772 | return 1; | ||
773 | } else if (unlikely(error_code & PF_PROT)) { | ||
774 | /* read, present */ | ||
775 | return 1; | ||
776 | } else { | ||
777 | /* read, not present */ | ||
778 | if (unlikely(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))) | ||
779 | return 1; | ||
780 | } | ||
781 | |||
782 | return 0; | ||
783 | } | ||
784 | |||
576 | /* | 785 | /* |
577 | * This routine handles page faults. It determines the address, | 786 | * This routine handles page faults. It determines the address, |
578 | * and the problem, and then passes it off to one of the appropriate | 787 | * and the problem, and then passes it off to one of the appropriate |
@@ -583,16 +792,12 @@ asmlinkage | |||
583 | #endif | 792 | #endif |
584 | void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | 793 | void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) |
585 | { | 794 | { |
795 | unsigned long address; | ||
586 | struct task_struct *tsk; | 796 | struct task_struct *tsk; |
587 | struct mm_struct *mm; | 797 | struct mm_struct *mm; |
588 | struct vm_area_struct *vma; | 798 | struct vm_area_struct *vma; |
589 | unsigned long address; | 799 | int write; |
590 | int write, si_code; | ||
591 | int fault; | 800 | int fault; |
592 | #ifdef CONFIG_X86_64 | ||
593 | unsigned long flags; | ||
594 | int sig; | ||
595 | #endif | ||
596 | 801 | ||
597 | tsk = current; | 802 | tsk = current; |
598 | mm = tsk->mm; | 803 | mm = tsk->mm; |
@@ -601,9 +806,7 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
601 | /* get the address */ | 806 | /* get the address */ |
602 | address = read_cr2(); | 807 | address = read_cr2(); |
603 | 808 | ||
604 | si_code = SEGV_MAPERR; | 809 | if (unlikely(notify_page_fault(regs))) |
605 | |||
606 | if (notify_page_fault(regs)) | ||
607 | return; | 810 | return; |
608 | if (unlikely(kmmio_fault(regs, address))) | 811 | if (unlikely(kmmio_fault(regs, address))) |
609 | return; | 812 | return; |
@@ -631,17 +834,17 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
631 | return; | 834 | return; |
632 | 835 | ||
633 | /* Can handle a stale RO->RW TLB */ | 836 | /* Can handle a stale RO->RW TLB */ |
634 | if (spurious_fault(address, error_code)) | 837 | if (spurious_fault(error_code, address)) |
635 | return; | 838 | return; |
636 | 839 | ||
637 | /* | 840 | /* |
638 | * Don't take the mm semaphore here. If we fixup a prefetch | 841 | * Don't take the mm semaphore here. If we fixup a prefetch |
639 | * fault we could otherwise deadlock. | 842 | * fault we could otherwise deadlock. |
640 | */ | 843 | */ |
641 | goto bad_area_nosemaphore; | 844 | bad_area_nosemaphore(regs, error_code, address); |
845 | return; | ||
642 | } | 846 | } |
643 | 847 | ||
644 | |||
645 | /* | 848 | /* |
646 | * It's safe to allow irq's after cr2 has been saved and the | 849 | * It's safe to allow irq's after cr2 has been saved and the |
647 | * vmalloc fault has been handled. | 850 | * vmalloc fault has been handled. |
@@ -657,15 +860,17 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
657 | 860 | ||
658 | #ifdef CONFIG_X86_64 | 861 | #ifdef CONFIG_X86_64 |
659 | if (unlikely(error_code & PF_RSVD)) | 862 | if (unlikely(error_code & PF_RSVD)) |
660 | pgtable_bad(address, regs, error_code); | 863 | pgtable_bad(regs, error_code, address); |
661 | #endif | 864 | #endif |
662 | 865 | ||
663 | /* | 866 | /* |
664 | * If we're in an interrupt, have no user context or are running in an | 867 | * If we're in an interrupt, have no user context or are running in an |
665 | * atomic region then we must not take the fault. | 868 | * atomic region then we must not take the fault. |
666 | */ | 869 | */ |
667 | if (unlikely(in_atomic() || !mm)) | 870 | if (unlikely(in_atomic() || !mm)) { |
668 | goto bad_area_nosemaphore; | 871 | bad_area_nosemaphore(regs, error_code, address); |
872 | return; | ||
873 | } | ||
669 | 874 | ||
670 | /* | 875 | /* |
671 | * When running in the kernel we expect faults to occur only to | 876 | * When running in the kernel we expect faults to occur only to |
@@ -683,20 +888,26 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
683 | * source. If this is invalid we can skip the address space check, | 888 | * source. If this is invalid we can skip the address space check, |
684 | * thus avoiding the deadlock. | 889 | * thus avoiding the deadlock. |
685 | */ | 890 | */ |
686 | if (!down_read_trylock(&mm->mmap_sem)) { | 891 | if (unlikely(!down_read_trylock(&mm->mmap_sem))) { |
687 | if ((error_code & PF_USER) == 0 && | 892 | if ((error_code & PF_USER) == 0 && |
688 | !search_exception_tables(regs->ip)) | 893 | !search_exception_tables(regs->ip)) { |
689 | goto bad_area_nosemaphore; | 894 | bad_area_nosemaphore(regs, error_code, address); |
895 | return; | ||
896 | } | ||
690 | down_read(&mm->mmap_sem); | 897 | down_read(&mm->mmap_sem); |
691 | } | 898 | } |
692 | 899 | ||
693 | vma = find_vma(mm, address); | 900 | vma = find_vma(mm, address); |
694 | if (!vma) | 901 | if (unlikely(!vma)) { |
695 | goto bad_area; | 902 | bad_area(regs, error_code, address); |
696 | if (vma->vm_start <= address) | 903 | return; |
904 | } | ||
905 | if (likely(vma->vm_start <= address)) | ||
697 | goto good_area; | 906 | goto good_area; |
698 | if (!(vma->vm_flags & VM_GROWSDOWN)) | 907 | if (unlikely(!(vma->vm_flags & VM_GROWSDOWN))) { |
699 | goto bad_area; | 908 | bad_area(regs, error_code, address); |
909 | return; | ||
910 | } | ||
700 | if (error_code & PF_USER) { | 911 | if (error_code & PF_USER) { |
701 | /* | 912 | /* |
702 | * Accessing the stack below %sp is always a bug. | 913 | * Accessing the stack below %sp is always a bug. |
@@ -704,31 +915,25 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
704 | * and pusha to work. ("enter $65535,$31" pushes | 915 | * and pusha to work. ("enter $65535,$31" pushes |
705 | * 32 pointers and then decrements %sp by 65535.) | 916 | * 32 pointers and then decrements %sp by 65535.) |
706 | */ | 917 | */ |
707 | if (address + 65536 + 32 * sizeof(unsigned long) < regs->sp) | 918 | if (unlikely(address + 65536 + 32 * sizeof(unsigned long) < regs->sp)) { |
708 | goto bad_area; | 919 | bad_area(regs, error_code, address); |
920 | return; | ||
921 | } | ||
709 | } | 922 | } |
710 | if (expand_stack(vma, address)) | 923 | if (unlikely(expand_stack(vma, address))) { |
711 | goto bad_area; | 924 | bad_area(regs, error_code, address); |
712 | /* | 925 | return; |
713 | * Ok, we have a good vm_area for this memory access, so | 926 | } |
714 | * we can handle it.. | 927 | |
715 | */ | 928 | /* |
929 | * Ok, we have a good vm_area for this memory access, so | ||
930 | * we can handle it.. | ||
931 | */ | ||
716 | good_area: | 932 | good_area: |
717 | si_code = SEGV_ACCERR; | 933 | write = error_code & PF_WRITE; |
718 | write = 0; | 934 | if (unlikely(access_error(error_code, write, vma))) { |
719 | switch (error_code & (PF_PROT|PF_WRITE)) { | 935 | bad_area_access_error(regs, error_code, address); |
720 | default: /* 3: write, present */ | 936 | return; |
721 | /* fall through */ | ||
722 | case PF_WRITE: /* write, not present */ | ||
723 | if (!(vma->vm_flags & VM_WRITE)) | ||
724 | goto bad_area; | ||
725 | write++; | ||
726 | break; | ||
727 | case PF_PROT: /* read, present */ | ||
728 | goto bad_area; | ||
729 | case 0: /* read, not present */ | ||
730 | if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) | ||
731 | goto bad_area; | ||
732 | } | 937 | } |
733 | 938 | ||
734 | /* | 939 | /* |
@@ -738,11 +943,8 @@ good_area: | |||
738 | */ | 943 | */ |
739 | fault = handle_mm_fault(mm, vma, address, write); | 944 | fault = handle_mm_fault(mm, vma, address, write); |
740 | if (unlikely(fault & VM_FAULT_ERROR)) { | 945 | if (unlikely(fault & VM_FAULT_ERROR)) { |
741 | if (fault & VM_FAULT_OOM) | 946 | mm_fault_error(regs, error_code, address, fault); |
742 | goto out_of_memory; | 947 | return; |
743 | else if (fault & VM_FAULT_SIGBUS) | ||
744 | goto do_sigbus; | ||
745 | BUG(); | ||
746 | } | 948 | } |
747 | if (fault & VM_FAULT_MAJOR) | 949 | if (fault & VM_FAULT_MAJOR) |
748 | tsk->maj_flt++; | 950 | tsk->maj_flt++; |
@@ -760,128 +962,6 @@ good_area: | |||
760 | } | 962 | } |
761 | #endif | 963 | #endif |
762 | up_read(&mm->mmap_sem); | 964 | up_read(&mm->mmap_sem); |
763 | return; | ||
764 | |||
765 | /* | ||
766 | * Something tried to access memory that isn't in our memory map.. | ||
767 | * Fix it, but check if it's kernel or user first.. | ||
768 | */ | ||
769 | bad_area: | ||
770 | up_read(&mm->mmap_sem); | ||
771 | |||
772 | bad_area_nosemaphore: | ||
773 | /* User mode accesses just cause a SIGSEGV */ | ||
774 | if (error_code & PF_USER) { | ||
775 | /* | ||
776 | * It's possible to have interrupts off here. | ||
777 | */ | ||
778 | local_irq_enable(); | ||
779 | |||
780 | /* | ||
781 | * Valid to do another page fault here because this one came | ||
782 | * from user space. | ||
783 | */ | ||
784 | if (is_prefetch(regs, address, error_code)) | ||
785 | return; | ||
786 | |||
787 | if (is_errata100(regs, address)) | ||
788 | return; | ||
789 | |||
790 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && | ||
791 | printk_ratelimit()) { | ||
792 | printk( | ||
793 | "%s%s[%d]: segfault at %lx ip %p sp %p error %lx", | ||
794 | task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, | ||
795 | tsk->comm, task_pid_nr(tsk), address, | ||
796 | (void *) regs->ip, (void *) regs->sp, error_code); | ||
797 | print_vma_addr(" in ", regs->ip); | ||
798 | printk("\n"); | ||
799 | } | ||
800 | |||
801 | tsk->thread.cr2 = address; | ||
802 | /* Kernel addresses are always protection faults */ | ||
803 | tsk->thread.error_code = error_code | (address >= TASK_SIZE); | ||
804 | tsk->thread.trap_no = 14; | ||
805 | force_sig_info_fault(SIGSEGV, si_code, address, tsk); | ||
806 | return; | ||
807 | } | ||
808 | |||
809 | if (is_f00f_bug(regs, address)) | ||
810 | return; | ||
811 | |||
812 | no_context: | ||
813 | /* Are we prepared to handle this kernel fault? */ | ||
814 | if (fixup_exception(regs)) | ||
815 | return; | ||
816 | |||
817 | /* | ||
818 | * X86_32 | ||
819 | * Valid to do another page fault here, because if this fault | ||
820 | * had been triggered by is_prefetch fixup_exception would have | ||
821 | * handled it. | ||
822 | * | ||
823 | * X86_64 | ||
824 | * Hall of shame of CPU/BIOS bugs. | ||
825 | */ | ||
826 | if (is_prefetch(regs, address, error_code)) | ||
827 | return; | ||
828 | |||
829 | if (is_errata93(regs, address)) | ||
830 | return; | ||
831 | |||
832 | /* | ||
833 | * Oops. The kernel tried to access some bad page. We'll have to | ||
834 | * terminate things with extreme prejudice. | ||
835 | */ | ||
836 | #ifdef CONFIG_X86_32 | ||
837 | bust_spinlocks(1); | ||
838 | #else | ||
839 | flags = oops_begin(); | ||
840 | #endif | ||
841 | |||
842 | show_fault_oops(regs, error_code, address); | ||
843 | |||
844 | tsk->thread.cr2 = address; | ||
845 | tsk->thread.trap_no = 14; | ||
846 | tsk->thread.error_code = error_code; | ||
847 | |||
848 | #ifdef CONFIG_X86_32 | ||
849 | die("Oops", regs, error_code); | ||
850 | bust_spinlocks(0); | ||
851 | do_exit(SIGKILL); | ||
852 | #else | ||
853 | sig = SIGKILL; | ||
854 | if (__die("Oops", regs, error_code)) | ||
855 | sig = 0; | ||
856 | /* Executive summary in case the body of the oops scrolled away */ | ||
857 | printk(KERN_EMERG "CR2: %016lx\n", address); | ||
858 | oops_end(flags, regs, sig); | ||
859 | #endif | ||
860 | |||
861 | out_of_memory: | ||
862 | /* | ||
863 | * We ran out of memory, call the OOM killer, and return the userspace | ||
864 | * (which will retry the fault, or kill us if we got oom-killed). | ||
865 | */ | ||
866 | up_read(&mm->mmap_sem); | ||
867 | pagefault_out_of_memory(); | ||
868 | return; | ||
869 | |||
870 | do_sigbus: | ||
871 | up_read(&mm->mmap_sem); | ||
872 | |||
873 | /* Kernel mode? Handle exceptions or die */ | ||
874 | if (!(error_code & PF_USER)) | ||
875 | goto no_context; | ||
876 | #ifdef CONFIG_X86_32 | ||
877 | /* User space => ok to do another page fault */ | ||
878 | if (is_prefetch(regs, address, error_code)) | ||
879 | return; | ||
880 | #endif | ||
881 | tsk->thread.cr2 = address; | ||
882 | tsk->thread.error_code = error_code; | ||
883 | tsk->thread.trap_no = 14; | ||
884 | force_sig_info_fault(SIGBUS, BUS_ADRERR, address, tsk); | ||
885 | } | 965 | } |
886 | 966 | ||
887 | DEFINE_SPINLOCK(pgd_lock); | 967 | DEFINE_SPINLOCK(pgd_lock); |
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 2cef05074413..00263bf07a88 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <asm/paravirt.h> | 49 | #include <asm/paravirt.h> |
50 | #include <asm/setup.h> | 50 | #include <asm/setup.h> |
51 | #include <asm/cacheflush.h> | 51 | #include <asm/cacheflush.h> |
52 | #include <asm/smp.h> | ||
53 | 52 | ||
54 | unsigned int __VMALLOC_RESERVE = 128 << 20; | 53 | unsigned int __VMALLOC_RESERVE = 128 << 20; |
55 | 54 | ||
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index af750ab973b6..1448bcb7f22f 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -367,7 +367,7 @@ EXPORT_SYMBOL(ioremap_nocache); | |||
367 | * | 367 | * |
368 | * Must be freed with iounmap. | 368 | * Must be freed with iounmap. |
369 | */ | 369 | */ |
370 | void __iomem *ioremap_wc(unsigned long phys_addr, unsigned long size) | 370 | void __iomem *ioremap_wc(resource_size_t phys_addr, unsigned long size) |
371 | { | 371 | { |
372 | if (pat_enabled) | 372 | if (pat_enabled) |
373 | return __ioremap_caller(phys_addr, size, _PAGE_CACHE_WC, | 373 | return __ioremap_caller(phys_addr, size, _PAGE_CACHE_WC, |
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c index 56fe7124fbec..165829600566 100644 --- a/arch/x86/mm/mmap.c +++ b/arch/x86/mm/mmap.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Based on code by Ingo Molnar and Andi Kleen, copyrighted | 4 | * Based on code by Ingo Molnar and Andi Kleen, copyrighted |
5 | * as follows: | 5 | * as follows: |
6 | * | 6 | * |
7 | * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. | 7 | * Copyright 2003-2009 Red Hat Inc. |
8 | * All Rights Reserved. | 8 | * All Rights Reserved. |
9 | * Copyright 2005 Andi Kleen, SUSE Labs. | 9 | * Copyright 2005 Andi Kleen, SUSE Labs. |
10 | * Copyright 2007 Jiri Kosina, SUSE Labs. | 10 | * Copyright 2007 Jiri Kosina, SUSE Labs. |
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index 71a14f89f89e..08d140fbc31b 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
@@ -20,6 +20,12 @@ | |||
20 | #include <asm/acpi.h> | 20 | #include <asm/acpi.h> |
21 | #include <asm/k8.h> | 21 | #include <asm/k8.h> |
22 | 22 | ||
23 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | ||
24 | # define DBG(x...) printk(KERN_DEBUG x) | ||
25 | #else | ||
26 | # define DBG(x...) | ||
27 | #endif | ||
28 | |||
23 | struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; | 29 | struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; |
24 | EXPORT_SYMBOL(node_data); | 30 | EXPORT_SYMBOL(node_data); |
25 | 31 | ||
@@ -33,6 +39,21 @@ int numa_off __initdata; | |||
33 | static unsigned long __initdata nodemap_addr; | 39 | static unsigned long __initdata nodemap_addr; |
34 | static unsigned long __initdata nodemap_size; | 40 | static unsigned long __initdata nodemap_size; |
35 | 41 | ||
42 | DEFINE_PER_CPU(int, node_number) = 0; | ||
43 | EXPORT_PER_CPU_SYMBOL(node_number); | ||
44 | |||
45 | /* | ||
46 | * Map cpu index to node index | ||
47 | */ | ||
48 | DEFINE_EARLY_PER_CPU(int, x86_cpu_to_node_map, NUMA_NO_NODE); | ||
49 | EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_node_map); | ||
50 | |||
51 | /* | ||
52 | * Which logical CPUs are on which nodes | ||
53 | */ | ||
54 | cpumask_t *node_to_cpumask_map; | ||
55 | EXPORT_SYMBOL(node_to_cpumask_map); | ||
56 | |||
36 | /* | 57 | /* |
37 | * Given a shift value, try to populate memnodemap[] | 58 | * Given a shift value, try to populate memnodemap[] |
38 | * Returns : | 59 | * Returns : |
@@ -640,3 +661,199 @@ void __init init_cpu_to_node(void) | |||
640 | #endif | 661 | #endif |
641 | 662 | ||
642 | 663 | ||
664 | /* | ||
665 | * Allocate node_to_cpumask_map based on number of available nodes | ||
666 | * Requires node_possible_map to be valid. | ||
667 | * | ||
668 | * Note: node_to_cpumask() is not valid until after this is done. | ||
669 | * (Use CONFIG_DEBUG_PER_CPU_MAPS to check this.) | ||
670 | */ | ||
671 | void __init setup_node_to_cpumask_map(void) | ||
672 | { | ||
673 | unsigned int node, num = 0; | ||
674 | cpumask_t *map; | ||
675 | |||
676 | /* setup nr_node_ids if not done yet */ | ||
677 | if (nr_node_ids == MAX_NUMNODES) { | ||
678 | for_each_node_mask(node, node_possible_map) | ||
679 | num = node; | ||
680 | nr_node_ids = num + 1; | ||
681 | } | ||
682 | |||
683 | /* allocate the map */ | ||
684 | map = alloc_bootmem_low(nr_node_ids * sizeof(cpumask_t)); | ||
685 | DBG("node_to_cpumask_map at %p for %d nodes\n", map, nr_node_ids); | ||
686 | |||
687 | pr_debug("Node to cpumask map at %p for %d nodes\n", | ||
688 | map, nr_node_ids); | ||
689 | |||
690 | /* node_to_cpumask() will now work */ | ||
691 | node_to_cpumask_map = map; | ||
692 | } | ||
693 | |||
694 | void __cpuinit numa_set_node(int cpu, int node) | ||
695 | { | ||
696 | int *cpu_to_node_map = early_per_cpu_ptr(x86_cpu_to_node_map); | ||
697 | |||
698 | /* early setting, no percpu area yet */ | ||
699 | if (cpu_to_node_map) { | ||
700 | cpu_to_node_map[cpu] = node; | ||
701 | return; | ||
702 | } | ||
703 | |||
704 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | ||
705 | if (cpu >= nr_cpu_ids || !per_cpu_offset(cpu)) { | ||
706 | printk(KERN_ERR "numa_set_node: invalid cpu# (%d)\n", cpu); | ||
707 | dump_stack(); | ||
708 | return; | ||
709 | } | ||
710 | #endif | ||
711 | per_cpu(x86_cpu_to_node_map, cpu) = node; | ||
712 | |||
713 | if (node != NUMA_NO_NODE) | ||
714 | per_cpu(node_number, cpu) = node; | ||
715 | } | ||
716 | |||
717 | void __cpuinit numa_clear_node(int cpu) | ||
718 | { | ||
719 | numa_set_node(cpu, NUMA_NO_NODE); | ||
720 | } | ||
721 | |||
722 | #ifndef CONFIG_DEBUG_PER_CPU_MAPS | ||
723 | |||
724 | void __cpuinit numa_add_cpu(int cpu) | ||
725 | { | ||
726 | cpu_set(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); | ||
727 | } | ||
728 | |||
729 | void __cpuinit numa_remove_cpu(int cpu) | ||
730 | { | ||
731 | cpu_clear(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); | ||
732 | } | ||
733 | |||
734 | #else /* CONFIG_DEBUG_PER_CPU_MAPS */ | ||
735 | |||
736 | /* | ||
737 | * --------- debug versions of the numa functions --------- | ||
738 | */ | ||
739 | static void __cpuinit numa_set_cpumask(int cpu, int enable) | ||
740 | { | ||
741 | int node = early_cpu_to_node(cpu); | ||
742 | cpumask_t *mask; | ||
743 | char buf[64]; | ||
744 | |||
745 | if (node_to_cpumask_map == NULL) { | ||
746 | printk(KERN_ERR "node_to_cpumask_map NULL\n"); | ||
747 | dump_stack(); | ||
748 | return; | ||
749 | } | ||
750 | |||
751 | mask = &node_to_cpumask_map[node]; | ||
752 | if (enable) | ||
753 | cpu_set(cpu, *mask); | ||
754 | else | ||
755 | cpu_clear(cpu, *mask); | ||
756 | |||
757 | cpulist_scnprintf(buf, sizeof(buf), mask); | ||
758 | printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n", | ||
759 | enable ? "numa_add_cpu" : "numa_remove_cpu", cpu, node, buf); | ||
760 | } | ||
761 | |||
762 | void __cpuinit numa_add_cpu(int cpu) | ||
763 | { | ||
764 | numa_set_cpumask(cpu, 1); | ||
765 | } | ||
766 | |||
767 | void __cpuinit numa_remove_cpu(int cpu) | ||
768 | { | ||
769 | numa_set_cpumask(cpu, 0); | ||
770 | } | ||
771 | |||
772 | int cpu_to_node(int cpu) | ||
773 | { | ||
774 | if (early_per_cpu_ptr(x86_cpu_to_node_map)) { | ||
775 | printk(KERN_WARNING | ||
776 | "cpu_to_node(%d): usage too early!\n", cpu); | ||
777 | dump_stack(); | ||
778 | return early_per_cpu_ptr(x86_cpu_to_node_map)[cpu]; | ||
779 | } | ||
780 | return per_cpu(x86_cpu_to_node_map, cpu); | ||
781 | } | ||
782 | EXPORT_SYMBOL(cpu_to_node); | ||
783 | |||
784 | /* | ||
785 | * Same function as cpu_to_node() but used if called before the | ||
786 | * per_cpu areas are setup. | ||
787 | */ | ||
788 | int early_cpu_to_node(int cpu) | ||
789 | { | ||
790 | if (early_per_cpu_ptr(x86_cpu_to_node_map)) | ||
791 | return early_per_cpu_ptr(x86_cpu_to_node_map)[cpu]; | ||
792 | |||
793 | if (!per_cpu_offset(cpu)) { | ||
794 | printk(KERN_WARNING | ||
795 | "early_cpu_to_node(%d): no per_cpu area!\n", cpu); | ||
796 | dump_stack(); | ||
797 | return NUMA_NO_NODE; | ||
798 | } | ||
799 | return per_cpu(x86_cpu_to_node_map, cpu); | ||
800 | } | ||
801 | |||
802 | |||
803 | /* empty cpumask */ | ||
804 | static const cpumask_t cpu_mask_none; | ||
805 | |||
806 | /* | ||
807 | * Returns a pointer to the bitmask of CPUs on Node 'node'. | ||
808 | */ | ||
809 | const cpumask_t *cpumask_of_node(int node) | ||
810 | { | ||
811 | if (node_to_cpumask_map == NULL) { | ||
812 | printk(KERN_WARNING | ||
813 | "cpumask_of_node(%d): no node_to_cpumask_map!\n", | ||
814 | node); | ||
815 | dump_stack(); | ||
816 | return (const cpumask_t *)&cpu_online_map; | ||
817 | } | ||
818 | if (node >= nr_node_ids) { | ||
819 | printk(KERN_WARNING | ||
820 | "cpumask_of_node(%d): node > nr_node_ids(%d)\n", | ||
821 | node, nr_node_ids); | ||
822 | dump_stack(); | ||
823 | return &cpu_mask_none; | ||
824 | } | ||
825 | return &node_to_cpumask_map[node]; | ||
826 | } | ||
827 | EXPORT_SYMBOL(cpumask_of_node); | ||
828 | |||
829 | /* | ||
830 | * Returns a bitmask of CPUs on Node 'node'. | ||
831 | * | ||
832 | * Side note: this function creates the returned cpumask on the stack | ||
833 | * so with a high NR_CPUS count, excessive stack space is used. The | ||
834 | * node_to_cpumask_ptr function should be used whenever possible. | ||
835 | */ | ||
836 | cpumask_t node_to_cpumask(int node) | ||
837 | { | ||
838 | if (node_to_cpumask_map == NULL) { | ||
839 | printk(KERN_WARNING | ||
840 | "node_to_cpumask(%d): no node_to_cpumask_map!\n", node); | ||
841 | dump_stack(); | ||
842 | return cpu_online_map; | ||
843 | } | ||
844 | if (node >= nr_node_ids) { | ||
845 | printk(KERN_WARNING | ||
846 | "node_to_cpumask(%d): node > nr_node_ids(%d)\n", | ||
847 | node, nr_node_ids); | ||
848 | dump_stack(); | ||
849 | return cpu_mask_none; | ||
850 | } | ||
851 | return node_to_cpumask_map[node]; | ||
852 | } | ||
853 | EXPORT_SYMBOL(node_to_cpumask); | ||
854 | |||
855 | /* | ||
856 | * --------- end of debug versions of the numa functions --------- | ||
857 | */ | ||
858 | |||
859 | #endif /* CONFIG_DEBUG_PER_CPU_MAPS */ | ||
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 7b61036427df..9127e31c7268 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #ifdef CONFIG_X86_PAT | 30 | #ifdef CONFIG_X86_PAT |
31 | int __read_mostly pat_enabled = 1; | 31 | int __read_mostly pat_enabled = 1; |
32 | 32 | ||
33 | void __cpuinit pat_disable(char *reason) | 33 | void __cpuinit pat_disable(const char *reason) |
34 | { | 34 | { |
35 | pat_enabled = 0; | 35 | pat_enabled = 0; |
36 | printk(KERN_INFO "%s\n", reason); | 36 | printk(KERN_INFO "%s\n", reason); |
@@ -42,6 +42,11 @@ static int __init nopat(char *str) | |||
42 | return 0; | 42 | return 0; |
43 | } | 43 | } |
44 | early_param("nopat", nopat); | 44 | early_param("nopat", nopat); |
45 | #else | ||
46 | static inline void pat_disable(const char *reason) | ||
47 | { | ||
48 | (void)reason; | ||
49 | } | ||
45 | #endif | 50 | #endif |
46 | 51 | ||
47 | 52 | ||
@@ -78,16 +83,20 @@ void pat_init(void) | |||
78 | if (!pat_enabled) | 83 | if (!pat_enabled) |
79 | return; | 84 | return; |
80 | 85 | ||
81 | /* Paranoia check. */ | 86 | if (!cpu_has_pat) { |
82 | if (!cpu_has_pat && boot_pat_state) { | 87 | if (!boot_pat_state) { |
83 | /* | 88 | pat_disable("PAT not supported by CPU."); |
84 | * If this happens we are on a secondary CPU, but | 89 | return; |
85 | * switched to PAT on the boot CPU. We have no way to | 90 | } else { |
86 | * undo PAT. | 91 | /* |
87 | */ | 92 | * If this happens we are on a secondary CPU, but |
88 | printk(KERN_ERR "PAT enabled, " | 93 | * switched to PAT on the boot CPU. We have no way to |
89 | "but not supported by secondary CPU\n"); | 94 | * undo PAT. |
90 | BUG(); | 95 | */ |
96 | printk(KERN_ERR "PAT enabled, " | ||
97 | "but not supported by secondary CPU\n"); | ||
98 | BUG(); | ||
99 | } | ||
91 | } | 100 | } |
92 | 101 | ||
93 | /* Set PWT to Write-Combining. All other bits stay the same */ | 102 | /* Set PWT to Write-Combining. All other bits stay the same */ |
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c index 09737c8af074..15df1baee100 100644 --- a/arch/x86/mm/srat_64.c +++ b/arch/x86/mm/srat_64.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/numa.h> | 21 | #include <asm/numa.h> |
22 | #include <asm/e820.h> | 22 | #include <asm/e820.h> |
23 | #include <asm/genapic.h> | 23 | #include <asm/genapic.h> |
24 | #include <asm/uv/uv.h> | ||
24 | 25 | ||
25 | int acpi_numa __initdata; | 26 | int acpi_numa __initdata; |
26 | 27 | ||
diff --git a/arch/x86/kernel/tlb_64.c b/arch/x86/mm/tlb.c index f8be6f1d2e48..14c5af4d11e6 100644 --- a/arch/x86/kernel/tlb_64.c +++ b/arch/x86/mm/tlb.c | |||
@@ -1,24 +1,20 @@ | |||
1 | #include <linux/init.h> | 1 | #include <linux/init.h> |
2 | 2 | ||
3 | #include <linux/mm.h> | 3 | #include <linux/mm.h> |
4 | #include <linux/delay.h> | ||
5 | #include <linux/spinlock.h> | 4 | #include <linux/spinlock.h> |
6 | #include <linux/smp.h> | 5 | #include <linux/smp.h> |
7 | #include <linux/kernel_stat.h> | ||
8 | #include <linux/mc146818rtc.h> | ||
9 | #include <linux/interrupt.h> | 6 | #include <linux/interrupt.h> |
7 | #include <linux/module.h> | ||
10 | 8 | ||
11 | #include <asm/mtrr.h> | ||
12 | #include <asm/pgalloc.h> | ||
13 | #include <asm/tlbflush.h> | 9 | #include <asm/tlbflush.h> |
14 | #include <asm/mmu_context.h> | 10 | #include <asm/mmu_context.h> |
15 | #include <asm/proto.h> | 11 | #include <asm/apic.h> |
16 | #include <asm/apicdef.h> | 12 | #include <asm/uv/uv.h> |
17 | #include <asm/idle.h> | ||
18 | #include <asm/uv/uv_hub.h> | ||
19 | #include <asm/uv/uv_bau.h> | ||
20 | 13 | ||
21 | #include <mach_ipi.h> | 14 | DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) |
15 | = { &init_mm, 0, }; | ||
16 | |||
17 | #include <asm/genapic.h> | ||
22 | /* | 18 | /* |
23 | * Smarter SMP flushing macros. | 19 | * Smarter SMP flushing macros. |
24 | * c/o Linus Torvalds. | 20 | * c/o Linus Torvalds. |
@@ -33,7 +29,7 @@ | |||
33 | * To avoid global state use 8 different call vectors. | 29 | * To avoid global state use 8 different call vectors. |
34 | * Each CPU uses a specific vector to trigger flushes on other | 30 | * Each CPU uses a specific vector to trigger flushes on other |
35 | * CPUs. Depending on the received vector the target CPUs look into | 31 | * CPUs. Depending on the received vector the target CPUs look into |
36 | * the right per cpu variable for the flush data. | 32 | * the right array slot for the flush data. |
37 | * | 33 | * |
38 | * With more than 8 CPUs they are hashed to the 8 available | 34 | * With more than 8 CPUs they are hashed to the 8 available |
39 | * vectors. The limited global vector space forces us to this right now. | 35 | * vectors. The limited global vector space forces us to this right now. |
@@ -43,18 +39,18 @@ | |||
43 | 39 | ||
44 | union smp_flush_state { | 40 | union smp_flush_state { |
45 | struct { | 41 | struct { |
46 | cpumask_t flush_cpumask; | ||
47 | struct mm_struct *flush_mm; | 42 | struct mm_struct *flush_mm; |
48 | unsigned long flush_va; | 43 | unsigned long flush_va; |
49 | spinlock_t tlbstate_lock; | 44 | spinlock_t tlbstate_lock; |
45 | DECLARE_BITMAP(flush_cpumask, NR_CPUS); | ||
50 | }; | 46 | }; |
51 | char pad[SMP_CACHE_BYTES]; | 47 | char pad[CONFIG_X86_INTERNODE_CACHE_BYTES]; |
52 | } ____cacheline_aligned; | 48 | } ____cacheline_internodealigned_in_smp; |
53 | 49 | ||
54 | /* State is put into the per CPU data section, but padded | 50 | /* State is put into the per CPU data section, but padded |
55 | to a full cache line because other CPUs can access it and we don't | 51 | to a full cache line because other CPUs can access it and we don't |
56 | want false sharing in the per cpu data segment. */ | 52 | want false sharing in the per cpu data segment. */ |
57 | static DEFINE_PER_CPU(union smp_flush_state, flush_state); | 53 | static union smp_flush_state flush_state[NUM_INVALIDATE_TLB_VECTORS]; |
58 | 54 | ||
59 | /* | 55 | /* |
60 | * We cannot call mmdrop() because we are in interrupt context, | 56 | * We cannot call mmdrop() because we are in interrupt context, |
@@ -62,9 +58,9 @@ static DEFINE_PER_CPU(union smp_flush_state, flush_state); | |||
62 | */ | 58 | */ |
63 | void leave_mm(int cpu) | 59 | void leave_mm(int cpu) |
64 | { | 60 | { |
65 | if (read_pda(mmu_state) == TLBSTATE_OK) | 61 | if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK) |
66 | BUG(); | 62 | BUG(); |
67 | cpu_clear(cpu, read_pda(active_mm)->cpu_vm_mask); | 63 | cpu_clear(cpu, percpu_read(cpu_tlbstate.active_mm)->cpu_vm_mask); |
68 | load_cr3(swapper_pg_dir); | 64 | load_cr3(swapper_pg_dir); |
69 | } | 65 | } |
70 | EXPORT_SYMBOL_GPL(leave_mm); | 66 | EXPORT_SYMBOL_GPL(leave_mm); |
@@ -117,10 +113,20 @@ EXPORT_SYMBOL_GPL(leave_mm); | |||
117 | * Interrupts are disabled. | 113 | * Interrupts are disabled. |
118 | */ | 114 | */ |
119 | 115 | ||
120 | asmlinkage void smp_invalidate_interrupt(struct pt_regs *regs) | 116 | /* |
117 | * FIXME: use of asmlinkage is not consistent. On x86_64 it's noop | ||
118 | * but still used for documentation purpose but the usage is slightly | ||
119 | * inconsistent. On x86_32, asmlinkage is regparm(0) but interrupt | ||
120 | * entry calls in with the first parameter in %eax. Maybe define | ||
121 | * intrlinkage? | ||
122 | */ | ||
123 | #ifdef CONFIG_X86_64 | ||
124 | asmlinkage | ||
125 | #endif | ||
126 | void smp_invalidate_interrupt(struct pt_regs *regs) | ||
121 | { | 127 | { |
122 | int cpu; | 128 | unsigned int cpu; |
123 | int sender; | 129 | unsigned int sender; |
124 | union smp_flush_state *f; | 130 | union smp_flush_state *f; |
125 | 131 | ||
126 | cpu = smp_processor_id(); | 132 | cpu = smp_processor_id(); |
@@ -129,9 +135,9 @@ asmlinkage void smp_invalidate_interrupt(struct pt_regs *regs) | |||
129 | * Use that to determine where the sender put the data. | 135 | * Use that to determine where the sender put the data. |
130 | */ | 136 | */ |
131 | sender = ~regs->orig_ax - INVALIDATE_TLB_VECTOR_START; | 137 | sender = ~regs->orig_ax - INVALIDATE_TLB_VECTOR_START; |
132 | f = &per_cpu(flush_state, sender); | 138 | f = &flush_state[sender]; |
133 | 139 | ||
134 | if (!cpu_isset(cpu, f->flush_cpumask)) | 140 | if (!cpumask_test_cpu(cpu, to_cpumask(f->flush_cpumask))) |
135 | goto out; | 141 | goto out; |
136 | /* | 142 | /* |
137 | * This was a BUG() but until someone can quote me the | 143 | * This was a BUG() but until someone can quote me the |
@@ -142,8 +148,8 @@ asmlinkage void smp_invalidate_interrupt(struct pt_regs *regs) | |||
142 | * BUG(); | 148 | * BUG(); |
143 | */ | 149 | */ |
144 | 150 | ||
145 | if (f->flush_mm == read_pda(active_mm)) { | 151 | if (f->flush_mm == percpu_read(cpu_tlbstate.active_mm)) { |
146 | if (read_pda(mmu_state) == TLBSTATE_OK) { | 152 | if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK) { |
147 | if (f->flush_va == TLB_FLUSH_ALL) | 153 | if (f->flush_va == TLB_FLUSH_ALL) |
148 | local_flush_tlb(); | 154 | local_flush_tlb(); |
149 | else | 155 | else |
@@ -153,23 +159,21 @@ asmlinkage void smp_invalidate_interrupt(struct pt_regs *regs) | |||
153 | } | 159 | } |
154 | out: | 160 | out: |
155 | ack_APIC_irq(); | 161 | ack_APIC_irq(); |
156 | cpu_clear(cpu, f->flush_cpumask); | 162 | smp_mb__before_clear_bit(); |
163 | cpumask_clear_cpu(cpu, to_cpumask(f->flush_cpumask)); | ||
164 | smp_mb__after_clear_bit(); | ||
157 | inc_irq_stat(irq_tlb_count); | 165 | inc_irq_stat(irq_tlb_count); |
158 | } | 166 | } |
159 | 167 | ||
160 | void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm, | 168 | static void flush_tlb_others_ipi(const struct cpumask *cpumask, |
161 | unsigned long va) | 169 | struct mm_struct *mm, unsigned long va) |
162 | { | 170 | { |
163 | int sender; | 171 | unsigned int sender; |
164 | union smp_flush_state *f; | 172 | union smp_flush_state *f; |
165 | cpumask_t cpumask = *cpumaskp; | ||
166 | |||
167 | if (is_uv_system() && uv_flush_tlb_others(&cpumask, mm, va)) | ||
168 | return; | ||
169 | 173 | ||
170 | /* Caller has disabled preemption */ | 174 | /* Caller has disabled preemption */ |
171 | sender = smp_processor_id() % NUM_INVALIDATE_TLB_VECTORS; | 175 | sender = smp_processor_id() % NUM_INVALIDATE_TLB_VECTORS; |
172 | f = &per_cpu(flush_state, sender); | 176 | f = &flush_state[sender]; |
173 | 177 | ||
174 | /* | 178 | /* |
175 | * Could avoid this lock when | 179 | * Could avoid this lock when |
@@ -180,7 +184,8 @@ void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm, | |||
180 | 184 | ||
181 | f->flush_mm = mm; | 185 | f->flush_mm = mm; |
182 | f->flush_va = va; | 186 | f->flush_va = va; |
183 | cpus_or(f->flush_cpumask, cpumask, f->flush_cpumask); | 187 | cpumask_andnot(to_cpumask(f->flush_cpumask), |
188 | cpumask, cpumask_of(smp_processor_id())); | ||
184 | 189 | ||
185 | /* | 190 | /* |
186 | * Make the above memory operations globally visible before | 191 | * Make the above memory operations globally visible before |
@@ -191,9 +196,10 @@ void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm, | |||
191 | * We have to send the IPI only to | 196 | * We have to send the IPI only to |
192 | * CPUs affected. | 197 | * CPUs affected. |
193 | */ | 198 | */ |
194 | send_IPI_mask(&cpumask, INVALIDATE_TLB_VECTOR_START + sender); | 199 | apic->send_IPI_mask(to_cpumask(f->flush_cpumask), |
200 | INVALIDATE_TLB_VECTOR_START + sender); | ||
195 | 201 | ||
196 | while (!cpus_empty(f->flush_cpumask)) | 202 | while (!cpumask_empty(to_cpumask(f->flush_cpumask))) |
197 | cpu_relax(); | 203 | cpu_relax(); |
198 | 204 | ||
199 | f->flush_mm = NULL; | 205 | f->flush_mm = NULL; |
@@ -201,12 +207,28 @@ void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm, | |||
201 | spin_unlock(&f->tlbstate_lock); | 207 | spin_unlock(&f->tlbstate_lock); |
202 | } | 208 | } |
203 | 209 | ||
210 | void native_flush_tlb_others(const struct cpumask *cpumask, | ||
211 | struct mm_struct *mm, unsigned long va) | ||
212 | { | ||
213 | if (is_uv_system()) { | ||
214 | unsigned int cpu; | ||
215 | |||
216 | cpu = get_cpu(); | ||
217 | cpumask = uv_flush_tlb_others(cpumask, mm, va, cpu); | ||
218 | if (cpumask) | ||
219 | flush_tlb_others_ipi(cpumask, mm, va); | ||
220 | put_cpu(); | ||
221 | return; | ||
222 | } | ||
223 | flush_tlb_others_ipi(cpumask, mm, va); | ||
224 | } | ||
225 | |||
204 | static int __cpuinit init_smp_flush(void) | 226 | static int __cpuinit init_smp_flush(void) |
205 | { | 227 | { |
206 | int i; | 228 | int i; |
207 | 229 | ||
208 | for_each_possible_cpu(i) | 230 | for (i = 0; i < ARRAY_SIZE(flush_state); i++) |
209 | spin_lock_init(&per_cpu(flush_state, i).tlbstate_lock); | 231 | spin_lock_init(&flush_state[i].tlbstate_lock); |
210 | 232 | ||
211 | return 0; | 233 | return 0; |
212 | } | 234 | } |
@@ -215,25 +237,18 @@ core_initcall(init_smp_flush); | |||
215 | void flush_tlb_current_task(void) | 237 | void flush_tlb_current_task(void) |
216 | { | 238 | { |
217 | struct mm_struct *mm = current->mm; | 239 | struct mm_struct *mm = current->mm; |
218 | cpumask_t cpu_mask; | ||
219 | 240 | ||
220 | preempt_disable(); | 241 | preempt_disable(); |
221 | cpu_mask = mm->cpu_vm_mask; | ||
222 | cpu_clear(smp_processor_id(), cpu_mask); | ||
223 | 242 | ||
224 | local_flush_tlb(); | 243 | local_flush_tlb(); |
225 | if (!cpus_empty(cpu_mask)) | 244 | if (cpumask_any_but(&mm->cpu_vm_mask, smp_processor_id()) < nr_cpu_ids) |
226 | flush_tlb_others(cpu_mask, mm, TLB_FLUSH_ALL); | 245 | flush_tlb_others(&mm->cpu_vm_mask, mm, TLB_FLUSH_ALL); |
227 | preempt_enable(); | 246 | preempt_enable(); |
228 | } | 247 | } |
229 | 248 | ||
230 | void flush_tlb_mm(struct mm_struct *mm) | 249 | void flush_tlb_mm(struct mm_struct *mm) |
231 | { | 250 | { |
232 | cpumask_t cpu_mask; | ||
233 | |||
234 | preempt_disable(); | 251 | preempt_disable(); |
235 | cpu_mask = mm->cpu_vm_mask; | ||
236 | cpu_clear(smp_processor_id(), cpu_mask); | ||
237 | 252 | ||
238 | if (current->active_mm == mm) { | 253 | if (current->active_mm == mm) { |
239 | if (current->mm) | 254 | if (current->mm) |
@@ -241,8 +256,8 @@ void flush_tlb_mm(struct mm_struct *mm) | |||
241 | else | 256 | else |
242 | leave_mm(smp_processor_id()); | 257 | leave_mm(smp_processor_id()); |
243 | } | 258 | } |
244 | if (!cpus_empty(cpu_mask)) | 259 | if (cpumask_any_but(&mm->cpu_vm_mask, smp_processor_id()) < nr_cpu_ids) |
245 | flush_tlb_others(cpu_mask, mm, TLB_FLUSH_ALL); | 260 | flush_tlb_others(&mm->cpu_vm_mask, mm, TLB_FLUSH_ALL); |
246 | 261 | ||
247 | preempt_enable(); | 262 | preempt_enable(); |
248 | } | 263 | } |
@@ -250,11 +265,8 @@ void flush_tlb_mm(struct mm_struct *mm) | |||
250 | void flush_tlb_page(struct vm_area_struct *vma, unsigned long va) | 265 | void flush_tlb_page(struct vm_area_struct *vma, unsigned long va) |
251 | { | 266 | { |
252 | struct mm_struct *mm = vma->vm_mm; | 267 | struct mm_struct *mm = vma->vm_mm; |
253 | cpumask_t cpu_mask; | ||
254 | 268 | ||
255 | preempt_disable(); | 269 | preempt_disable(); |
256 | cpu_mask = mm->cpu_vm_mask; | ||
257 | cpu_clear(smp_processor_id(), cpu_mask); | ||
258 | 270 | ||
259 | if (current->active_mm == mm) { | 271 | if (current->active_mm == mm) { |
260 | if (current->mm) | 272 | if (current->mm) |
@@ -263,8 +275,8 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long va) | |||
263 | leave_mm(smp_processor_id()); | 275 | leave_mm(smp_processor_id()); |
264 | } | 276 | } |
265 | 277 | ||
266 | if (!cpus_empty(cpu_mask)) | 278 | if (cpumask_any_but(&mm->cpu_vm_mask, smp_processor_id()) < nr_cpu_ids) |
267 | flush_tlb_others(cpu_mask, mm, va); | 279 | flush_tlb_others(&mm->cpu_vm_mask, mm, va); |
268 | 280 | ||
269 | preempt_enable(); | 281 | preempt_enable(); |
270 | } | 282 | } |
@@ -274,7 +286,7 @@ static void do_flush_tlb_all(void *info) | |||
274 | unsigned long cpu = smp_processor_id(); | 286 | unsigned long cpu = smp_processor_id(); |
275 | 287 | ||
276 | __flush_tlb_all(); | 288 | __flush_tlb_all(); |
277 | if (read_pda(mmu_state) == TLBSTATE_LAZY) | 289 | if (percpu_read(cpu_tlbstate.state) == TLBSTATE_LAZY) |
278 | leave_mm(cpu); | 290 | leave_mm(cpu); |
279 | } | 291 | } |
280 | 292 | ||
diff --git a/arch/x86/pci/numaq_32.c b/arch/x86/pci/numaq_32.c index 2089354968a2..1b2d773612e7 100644 --- a/arch/x86/pci/numaq_32.c +++ b/arch/x86/pci/numaq_32.c | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <linux/pci.h> | 5 | #include <linux/pci.h> |
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
7 | #include <linux/nodemask.h> | 7 | #include <linux/nodemask.h> |
8 | #include <mach_apic.h> | 8 | #include <asm/genapic.h> |
9 | #include <asm/mpspec.h> | 9 | #include <asm/mpspec.h> |
10 | #include <asm/pci_x86.h> | 10 | #include <asm/pci_x86.h> |
11 | 11 | ||
diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c index b82cae970dfd..1c975cc9839e 100644 --- a/arch/x86/pci/pcbios.c +++ b/arch/x86/pci/pcbios.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | #include <linux/uaccess.h> | 8 | #include <linux/uaccess.h> |
9 | #include <asm/pci_x86.h> | 9 | #include <asm/pci_x86.h> |
10 | #include <asm/mach-default/pci-functions.h> | 10 | #include <asm/pci-functions.h> |
11 | 11 | ||
12 | /* BIOS32 signature: "_32_" */ | 12 | /* BIOS32 signature: "_32_" */ |
13 | #define BIOS32_SIGNATURE (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24)) | 13 | #define BIOS32_SIGNATURE (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24)) |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index bea215230b20..6b3f7eef57e3 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -634,35 +634,27 @@ static void xen_flush_tlb_single(unsigned long addr) | |||
634 | preempt_enable(); | 634 | preempt_enable(); |
635 | } | 635 | } |
636 | 636 | ||
637 | static void xen_flush_tlb_others(const cpumask_t *cpus, struct mm_struct *mm, | 637 | static void xen_flush_tlb_others(const struct cpumask *cpus, |
638 | unsigned long va) | 638 | struct mm_struct *mm, unsigned long va) |
639 | { | 639 | { |
640 | struct { | 640 | struct { |
641 | struct mmuext_op op; | 641 | struct mmuext_op op; |
642 | cpumask_t mask; | 642 | DECLARE_BITMAP(mask, NR_CPUS); |
643 | } *args; | 643 | } *args; |
644 | cpumask_t cpumask = *cpus; | ||
645 | struct multicall_space mcs; | 644 | struct multicall_space mcs; |
646 | 645 | ||
647 | /* | 646 | BUG_ON(cpumask_empty(cpus)); |
648 | * A couple of (to be removed) sanity checks: | ||
649 | * | ||
650 | * - current CPU must not be in mask | ||
651 | * - mask must exist :) | ||
652 | */ | ||
653 | BUG_ON(cpus_empty(cpumask)); | ||
654 | BUG_ON(cpu_isset(smp_processor_id(), cpumask)); | ||
655 | BUG_ON(!mm); | 647 | BUG_ON(!mm); |
656 | 648 | ||
657 | /* If a CPU which we ran on has gone down, OK. */ | ||
658 | cpus_and(cpumask, cpumask, cpu_online_map); | ||
659 | if (cpus_empty(cpumask)) | ||
660 | return; | ||
661 | |||
662 | mcs = xen_mc_entry(sizeof(*args)); | 649 | mcs = xen_mc_entry(sizeof(*args)); |
663 | args = mcs.args; | 650 | args = mcs.args; |
664 | args->mask = cpumask; | 651 | args->op.arg2.vcpumask = to_cpumask(args->mask); |
665 | args->op.arg2.vcpumask = &args->mask; | 652 | |
653 | /* Remove us, and any offline CPUS. */ | ||
654 | cpumask_and(to_cpumask(args->mask), cpus, cpu_online_mask); | ||
655 | cpumask_clear_cpu(smp_processor_id(), to_cpumask(args->mask)); | ||
656 | if (unlikely(cpumask_empty(to_cpumask(args->mask)))) | ||
657 | goto issue; | ||
666 | 658 | ||
667 | if (va == TLB_FLUSH_ALL) { | 659 | if (va == TLB_FLUSH_ALL) { |
668 | args->op.cmd = MMUEXT_TLB_FLUSH_MULTI; | 660 | args->op.cmd = MMUEXT_TLB_FLUSH_MULTI; |
@@ -673,6 +665,7 @@ static void xen_flush_tlb_others(const cpumask_t *cpus, struct mm_struct *mm, | |||
673 | 665 | ||
674 | MULTI_mmuext_op(mcs.mc, &args->op, 1, NULL, DOMID_SELF); | 666 | MULTI_mmuext_op(mcs.mc, &args->op, 1, NULL, DOMID_SELF); |
675 | 667 | ||
668 | issue: | ||
676 | xen_mc_issue(PARAVIRT_LAZY_MMU); | 669 | xen_mc_issue(PARAVIRT_LAZY_MMU); |
677 | } | 670 | } |
678 | 671 | ||
@@ -702,17 +695,17 @@ static void xen_write_cr0(unsigned long cr0) | |||
702 | 695 | ||
703 | static void xen_write_cr2(unsigned long cr2) | 696 | static void xen_write_cr2(unsigned long cr2) |
704 | { | 697 | { |
705 | x86_read_percpu(xen_vcpu)->arch.cr2 = cr2; | 698 | percpu_read(xen_vcpu)->arch.cr2 = cr2; |
706 | } | 699 | } |
707 | 700 | ||
708 | static unsigned long xen_read_cr2(void) | 701 | static unsigned long xen_read_cr2(void) |
709 | { | 702 | { |
710 | return x86_read_percpu(xen_vcpu)->arch.cr2; | 703 | return percpu_read(xen_vcpu)->arch.cr2; |
711 | } | 704 | } |
712 | 705 | ||
713 | static unsigned long xen_read_cr2_direct(void) | 706 | static unsigned long xen_read_cr2_direct(void) |
714 | { | 707 | { |
715 | return x86_read_percpu(xen_vcpu_info.arch.cr2); | 708 | return percpu_read(xen_vcpu_info.arch.cr2); |
716 | } | 709 | } |
717 | 710 | ||
718 | static void xen_write_cr4(unsigned long cr4) | 711 | static void xen_write_cr4(unsigned long cr4) |
@@ -725,12 +718,12 @@ static void xen_write_cr4(unsigned long cr4) | |||
725 | 718 | ||
726 | static unsigned long xen_read_cr3(void) | 719 | static unsigned long xen_read_cr3(void) |
727 | { | 720 | { |
728 | return x86_read_percpu(xen_cr3); | 721 | return percpu_read(xen_cr3); |
729 | } | 722 | } |
730 | 723 | ||
731 | static void set_current_cr3(void *v) | 724 | static void set_current_cr3(void *v) |
732 | { | 725 | { |
733 | x86_write_percpu(xen_current_cr3, (unsigned long)v); | 726 | percpu_write(xen_current_cr3, (unsigned long)v); |
734 | } | 727 | } |
735 | 728 | ||
736 | static void __xen_write_cr3(bool kernel, unsigned long cr3) | 729 | static void __xen_write_cr3(bool kernel, unsigned long cr3) |
@@ -755,7 +748,7 @@ static void __xen_write_cr3(bool kernel, unsigned long cr3) | |||
755 | MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); | 748 | MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); |
756 | 749 | ||
757 | if (kernel) { | 750 | if (kernel) { |
758 | x86_write_percpu(xen_cr3, cr3); | 751 | percpu_write(xen_cr3, cr3); |
759 | 752 | ||
760 | /* Update xen_current_cr3 once the batch has actually | 753 | /* Update xen_current_cr3 once the batch has actually |
761 | been submitted. */ | 754 | been submitted. */ |
@@ -771,7 +764,7 @@ static void xen_write_cr3(unsigned long cr3) | |||
771 | 764 | ||
772 | /* Update while interrupts are disabled, so its atomic with | 765 | /* Update while interrupts are disabled, so its atomic with |
773 | respect to ipis */ | 766 | respect to ipis */ |
774 | x86_write_percpu(xen_cr3, cr3); | 767 | percpu_write(xen_cr3, cr3); |
775 | 768 | ||
776 | __xen_write_cr3(true, cr3); | 769 | __xen_write_cr3(true, cr3); |
777 | 770 | ||
@@ -1314,7 +1307,6 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = { | |||
1314 | .ptep_modify_prot_commit = __ptep_modify_prot_commit, | 1307 | .ptep_modify_prot_commit = __ptep_modify_prot_commit, |
1315 | 1308 | ||
1316 | .pte_val = xen_pte_val, | 1309 | .pte_val = xen_pte_val, |
1317 | .pte_flags = native_pte_flags, | ||
1318 | .pgd_val = xen_pgd_val, | 1310 | .pgd_val = xen_pgd_val, |
1319 | 1311 | ||
1320 | .make_pte = xen_make_pte, | 1312 | .make_pte = xen_make_pte, |
@@ -1652,7 +1644,6 @@ asmlinkage void __init xen_start_kernel(void) | |||
1652 | #ifdef CONFIG_X86_64 | 1644 | #ifdef CONFIG_X86_64 |
1653 | /* Disable until direct per-cpu data access. */ | 1645 | /* Disable until direct per-cpu data access. */ |
1654 | have_vcpu_info_placement = 0; | 1646 | have_vcpu_info_placement = 0; |
1655 | x86_64_init_pda(); | ||
1656 | #endif | 1647 | #endif |
1657 | 1648 | ||
1658 | xen_smp_init(); | 1649 | xen_smp_init(); |
diff --git a/arch/x86/xen/irq.c b/arch/x86/xen/irq.c index bb042608c602..2e8271431e1a 100644 --- a/arch/x86/xen/irq.c +++ b/arch/x86/xen/irq.c | |||
@@ -39,7 +39,7 @@ static unsigned long xen_save_fl(void) | |||
39 | struct vcpu_info *vcpu; | 39 | struct vcpu_info *vcpu; |
40 | unsigned long flags; | 40 | unsigned long flags; |
41 | 41 | ||
42 | vcpu = x86_read_percpu(xen_vcpu); | 42 | vcpu = percpu_read(xen_vcpu); |
43 | 43 | ||
44 | /* flag has opposite sense of mask */ | 44 | /* flag has opposite sense of mask */ |
45 | flags = !vcpu->evtchn_upcall_mask; | 45 | flags = !vcpu->evtchn_upcall_mask; |
@@ -62,7 +62,7 @@ static void xen_restore_fl(unsigned long flags) | |||
62 | make sure we're don't switch CPUs between getting the vcpu | 62 | make sure we're don't switch CPUs between getting the vcpu |
63 | pointer and updating the mask. */ | 63 | pointer and updating the mask. */ |
64 | preempt_disable(); | 64 | preempt_disable(); |
65 | vcpu = x86_read_percpu(xen_vcpu); | 65 | vcpu = percpu_read(xen_vcpu); |
66 | vcpu->evtchn_upcall_mask = flags; | 66 | vcpu->evtchn_upcall_mask = flags; |
67 | preempt_enable_no_resched(); | 67 | preempt_enable_no_resched(); |
68 | 68 | ||
@@ -83,7 +83,7 @@ static void xen_irq_disable(void) | |||
83 | make sure we're don't switch CPUs between getting the vcpu | 83 | make sure we're don't switch CPUs between getting the vcpu |
84 | pointer and updating the mask. */ | 84 | pointer and updating the mask. */ |
85 | preempt_disable(); | 85 | preempt_disable(); |
86 | x86_read_percpu(xen_vcpu)->evtchn_upcall_mask = 1; | 86 | percpu_read(xen_vcpu)->evtchn_upcall_mask = 1; |
87 | preempt_enable_no_resched(); | 87 | preempt_enable_no_resched(); |
88 | } | 88 | } |
89 | 89 | ||
@@ -96,7 +96,7 @@ static void xen_irq_enable(void) | |||
96 | the caller is confused and is trying to re-enable interrupts | 96 | the caller is confused and is trying to re-enable interrupts |
97 | on an indeterminate processor. */ | 97 | on an indeterminate processor. */ |
98 | 98 | ||
99 | vcpu = x86_read_percpu(xen_vcpu); | 99 | vcpu = percpu_read(xen_vcpu); |
100 | vcpu->evtchn_upcall_mask = 0; | 100 | vcpu->evtchn_upcall_mask = 0; |
101 | 101 | ||
102 | /* Doesn't matter if we get preempted here, because any | 102 | /* Doesn't matter if we get preempted here, because any |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 503c240e26c7..98cb9869eb24 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -1063,18 +1063,14 @@ static void drop_other_mm_ref(void *info) | |||
1063 | struct mm_struct *mm = info; | 1063 | struct mm_struct *mm = info; |
1064 | struct mm_struct *active_mm; | 1064 | struct mm_struct *active_mm; |
1065 | 1065 | ||
1066 | #ifdef CONFIG_X86_64 | 1066 | active_mm = percpu_read(cpu_tlbstate.active_mm); |
1067 | active_mm = read_pda(active_mm); | ||
1068 | #else | ||
1069 | active_mm = __get_cpu_var(cpu_tlbstate).active_mm; | ||
1070 | #endif | ||
1071 | 1067 | ||
1072 | if (active_mm == mm) | 1068 | if (active_mm == mm) |
1073 | leave_mm(smp_processor_id()); | 1069 | leave_mm(smp_processor_id()); |
1074 | 1070 | ||
1075 | /* If this cpu still has a stale cr3 reference, then make sure | 1071 | /* If this cpu still has a stale cr3 reference, then make sure |
1076 | it has been flushed. */ | 1072 | it has been flushed. */ |
1077 | if (x86_read_percpu(xen_current_cr3) == __pa(mm->pgd)) { | 1073 | if (percpu_read(xen_current_cr3) == __pa(mm->pgd)) { |
1078 | load_cr3(swapper_pg_dir); | 1074 | load_cr3(swapper_pg_dir); |
1079 | arch_flush_lazy_cpu_mode(); | 1075 | arch_flush_lazy_cpu_mode(); |
1080 | } | 1076 | } |
diff --git a/arch/x86/xen/multicalls.h b/arch/x86/xen/multicalls.h index fa3e10725d98..9e565da5d1f7 100644 --- a/arch/x86/xen/multicalls.h +++ b/arch/x86/xen/multicalls.h | |||
@@ -41,7 +41,7 @@ static inline void xen_mc_issue(unsigned mode) | |||
41 | xen_mc_flush(); | 41 | xen_mc_flush(); |
42 | 42 | ||
43 | /* restore flags saved in xen_mc_batch */ | 43 | /* restore flags saved in xen_mc_batch */ |
44 | local_irq_restore(x86_read_percpu(xen_mc_irq_flags)); | 44 | local_irq_restore(percpu_read(xen_mc_irq_flags)); |
45 | } | 45 | } |
46 | 46 | ||
47 | /* Set up a callback to be called when the current batch is flushed */ | 47 | /* Set up a callback to be called when the current batch is flushed */ |
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index c44e2069c7c7..7735e3dd359c 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c | |||
@@ -50,11 +50,7 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id); | |||
50 | */ | 50 | */ |
51 | static irqreturn_t xen_reschedule_interrupt(int irq, void *dev_id) | 51 | static irqreturn_t xen_reschedule_interrupt(int irq, void *dev_id) |
52 | { | 52 | { |
53 | #ifdef CONFIG_X86_32 | 53 | inc_irq_stat(irq_resched_count); |
54 | __get_cpu_var(irq_stat).irq_resched_count++; | ||
55 | #else | ||
56 | add_pda(irq_resched_count, 1); | ||
57 | #endif | ||
58 | 54 | ||
59 | return IRQ_HANDLED; | 55 | return IRQ_HANDLED; |
60 | } | 56 | } |
@@ -78,7 +74,7 @@ static __cpuinit void cpu_bringup(void) | |||
78 | xen_setup_cpu_clockevents(); | 74 | xen_setup_cpu_clockevents(); |
79 | 75 | ||
80 | cpu_set(cpu, cpu_online_map); | 76 | cpu_set(cpu, cpu_online_map); |
81 | x86_write_percpu(cpu_state, CPU_ONLINE); | 77 | percpu_write(cpu_state, CPU_ONLINE); |
82 | wmb(); | 78 | wmb(); |
83 | 79 | ||
84 | /* We can take interrupts now: we're officially "up". */ | 80 | /* We can take interrupts now: we're officially "up". */ |
@@ -283,22 +279,10 @@ static int __cpuinit xen_cpu_up(unsigned int cpu) | |||
283 | struct task_struct *idle = idle_task(cpu); | 279 | struct task_struct *idle = idle_task(cpu); |
284 | int rc; | 280 | int rc; |
285 | 281 | ||
286 | #ifdef CONFIG_X86_64 | ||
287 | /* Allocate node local memory for AP pdas */ | ||
288 | WARN_ON(cpu == 0); | ||
289 | if (cpu > 0) { | ||
290 | rc = get_local_pda(cpu); | ||
291 | if (rc) | ||
292 | return rc; | ||
293 | } | ||
294 | #endif | ||
295 | |||
296 | #ifdef CONFIG_X86_32 | ||
297 | init_gdt(cpu); | ||
298 | per_cpu(current_task, cpu) = idle; | 282 | per_cpu(current_task, cpu) = idle; |
283 | #ifdef CONFIG_X86_32 | ||
299 | irq_ctx_init(cpu); | 284 | irq_ctx_init(cpu); |
300 | #else | 285 | #else |
301 | cpu_pda(cpu)->pcurrent = idle; | ||
302 | clear_tsk_thread_flag(idle, TIF_FORK); | 286 | clear_tsk_thread_flag(idle, TIF_FORK); |
303 | #endif | 287 | #endif |
304 | xen_setup_timer(cpu); | 288 | xen_setup_timer(cpu); |
@@ -445,11 +429,7 @@ static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id) | |||
445 | { | 429 | { |
446 | irq_enter(); | 430 | irq_enter(); |
447 | generic_smp_call_function_interrupt(); | 431 | generic_smp_call_function_interrupt(); |
448 | #ifdef CONFIG_X86_32 | 432 | inc_irq_stat(irq_call_count); |
449 | __get_cpu_var(irq_stat).irq_call_count++; | ||
450 | #else | ||
451 | add_pda(irq_call_count, 1); | ||
452 | #endif | ||
453 | irq_exit(); | 433 | irq_exit(); |
454 | 434 | ||
455 | return IRQ_HANDLED; | 435 | return IRQ_HANDLED; |
@@ -459,11 +439,7 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id) | |||
459 | { | 439 | { |
460 | irq_enter(); | 440 | irq_enter(); |
461 | generic_smp_call_function_single_interrupt(); | 441 | generic_smp_call_function_single_interrupt(); |
462 | #ifdef CONFIG_X86_32 | 442 | inc_irq_stat(irq_call_count); |
463 | __get_cpu_var(irq_stat).irq_call_count++; | ||
464 | #else | ||
465 | add_pda(irq_call_count, 1); | ||
466 | #endif | ||
467 | irq_exit(); | 443 | irq_exit(); |
468 | 444 | ||
469 | return IRQ_HANDLED; | 445 | return IRQ_HANDLED; |
diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c index 212ffe012b76..95be7b434724 100644 --- a/arch/x86/xen/suspend.c +++ b/arch/x86/xen/suspend.c | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <asm/xen/hypercall.h> | 7 | #include <asm/xen/hypercall.h> |
8 | #include <asm/xen/page.h> | 8 | #include <asm/xen/page.h> |
9 | #include <asm/fixmap.h> | ||
9 | 10 | ||
10 | #include "xen-ops.h" | 11 | #include "xen-ops.h" |
11 | #include "mmu.h" | 12 | #include "mmu.h" |
diff --git a/arch/x86/xen/xen-asm_64.S b/arch/x86/xen/xen-asm_64.S index 05794c566e87..d6fc51f4ce85 100644 --- a/arch/x86/xen/xen-asm_64.S +++ b/arch/x86/xen/xen-asm_64.S | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <asm/processor-flags.h> | 17 | #include <asm/processor-flags.h> |
18 | #include <asm/errno.h> | 18 | #include <asm/errno.h> |
19 | #include <asm/segment.h> | 19 | #include <asm/segment.h> |
20 | #include <asm/percpu.h> | ||
20 | 21 | ||
21 | #include <xen/interface/xen.h> | 22 | #include <xen/interface/xen.h> |
22 | 23 | ||
@@ -28,12 +29,10 @@ | |||
28 | 29 | ||
29 | #if 1 | 30 | #if 1 |
30 | /* | 31 | /* |
31 | x86-64 does not yet support direct access to percpu variables | 32 | FIXME: x86_64 now can support direct access to percpu variables |
32 | via a segment override, so we just need to make sure this code | 33 | via a segment override. Update xen accordingly. |
33 | never gets used | ||
34 | */ | 34 | */ |
35 | #define BUG ud2a | 35 | #define BUG ud2a |
36 | #define PER_CPU_VAR(var, off) 0xdeadbeef | ||
37 | #endif | 36 | #endif |
38 | 37 | ||
39 | /* | 38 | /* |
@@ -45,14 +44,14 @@ ENTRY(xen_irq_enable_direct) | |||
45 | BUG | 44 | BUG |
46 | 45 | ||
47 | /* Unmask events */ | 46 | /* Unmask events */ |
48 | movb $0, PER_CPU_VAR(xen_vcpu_info, XEN_vcpu_info_mask) | 47 | movb $0, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_mask |
49 | 48 | ||
50 | /* Preempt here doesn't matter because that will deal with | 49 | /* Preempt here doesn't matter because that will deal with |
51 | any pending interrupts. The pending check may end up being | 50 | any pending interrupts. The pending check may end up being |
52 | run on the wrong CPU, but that doesn't hurt. */ | 51 | run on the wrong CPU, but that doesn't hurt. */ |
53 | 52 | ||
54 | /* Test for pending */ | 53 | /* Test for pending */ |
55 | testb $0xff, PER_CPU_VAR(xen_vcpu_info, XEN_vcpu_info_pending) | 54 | testb $0xff, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_pending |
56 | jz 1f | 55 | jz 1f |
57 | 56 | ||
58 | 2: call check_events | 57 | 2: call check_events |
@@ -69,7 +68,7 @@ ENDPATCH(xen_irq_enable_direct) | |||
69 | ENTRY(xen_irq_disable_direct) | 68 | ENTRY(xen_irq_disable_direct) |
70 | BUG | 69 | BUG |
71 | 70 | ||
72 | movb $1, PER_CPU_VAR(xen_vcpu_info, XEN_vcpu_info_mask) | 71 | movb $1, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_mask |
73 | ENDPATCH(xen_irq_disable_direct) | 72 | ENDPATCH(xen_irq_disable_direct) |
74 | ret | 73 | ret |
75 | ENDPROC(xen_irq_disable_direct) | 74 | ENDPROC(xen_irq_disable_direct) |
@@ -87,7 +86,7 @@ ENDPATCH(xen_irq_disable_direct) | |||
87 | ENTRY(xen_save_fl_direct) | 86 | ENTRY(xen_save_fl_direct) |
88 | BUG | 87 | BUG |
89 | 88 | ||
90 | testb $0xff, PER_CPU_VAR(xen_vcpu_info, XEN_vcpu_info_mask) | 89 | testb $0xff, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_mask |
91 | setz %ah | 90 | setz %ah |
92 | addb %ah,%ah | 91 | addb %ah,%ah |
93 | ENDPATCH(xen_save_fl_direct) | 92 | ENDPATCH(xen_save_fl_direct) |
@@ -107,13 +106,13 @@ ENTRY(xen_restore_fl_direct) | |||
107 | BUG | 106 | BUG |
108 | 107 | ||
109 | testb $X86_EFLAGS_IF>>8, %ah | 108 | testb $X86_EFLAGS_IF>>8, %ah |
110 | setz PER_CPU_VAR(xen_vcpu_info, XEN_vcpu_info_mask) | 109 | setz PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_mask |
111 | /* Preempt here doesn't matter because that will deal with | 110 | /* Preempt here doesn't matter because that will deal with |
112 | any pending interrupts. The pending check may end up being | 111 | any pending interrupts. The pending check may end up being |
113 | run on the wrong CPU, but that doesn't hurt. */ | 112 | run on the wrong CPU, but that doesn't hurt. */ |
114 | 113 | ||
115 | /* check for unmasked and pending */ | 114 | /* check for unmasked and pending */ |
116 | cmpw $0x0001, PER_CPU_VAR(xen_vcpu_info, XEN_vcpu_info_pending) | 115 | cmpw $0x0001, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_pending |
117 | jz 1f | 116 | jz 1f |
118 | 2: call check_events | 117 | 2: call check_events |
119 | 1: | 118 | 1: |
@@ -195,11 +194,11 @@ RELOC(xen_sysexit, 1b+1) | |||
195 | ENTRY(xen_sysret64) | 194 | ENTRY(xen_sysret64) |
196 | /* We're already on the usermode stack at this point, but still | 195 | /* We're already on the usermode stack at this point, but still |
197 | with the kernel gs, so we can easily switch back */ | 196 | with the kernel gs, so we can easily switch back */ |
198 | movq %rsp, %gs:pda_oldrsp | 197 | movq %rsp, PER_CPU_VAR(old_rsp) |
199 | movq %gs:pda_kernelstack,%rsp | 198 | movq PER_CPU_VAR(kernel_stack),%rsp |
200 | 199 | ||
201 | pushq $__USER_DS | 200 | pushq $__USER_DS |
202 | pushq %gs:pda_oldrsp | 201 | pushq PER_CPU_VAR(old_rsp) |
203 | pushq %r11 | 202 | pushq %r11 |
204 | pushq $__USER_CS | 203 | pushq $__USER_CS |
205 | pushq %rcx | 204 | pushq %rcx |
@@ -212,11 +211,11 @@ RELOC(xen_sysret64, 1b+1) | |||
212 | ENTRY(xen_sysret32) | 211 | ENTRY(xen_sysret32) |
213 | /* We're already on the usermode stack at this point, but still | 212 | /* We're already on the usermode stack at this point, but still |
214 | with the kernel gs, so we can easily switch back */ | 213 | with the kernel gs, so we can easily switch back */ |
215 | movq %rsp, %gs:pda_oldrsp | 214 | movq %rsp, PER_CPU_VAR(old_rsp) |
216 | movq %gs:pda_kernelstack, %rsp | 215 | movq PER_CPU_VAR(kernel_stack), %rsp |
217 | 216 | ||
218 | pushq $__USER32_DS | 217 | pushq $__USER32_DS |
219 | pushq %gs:pda_oldrsp | 218 | pushq PER_CPU_VAR(old_rsp) |
220 | pushq %r11 | 219 | pushq %r11 |
221 | pushq $__USER32_CS | 220 | pushq $__USER32_CS |
222 | pushq %rcx | 221 | pushq %rcx |
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 719ee5c1c8d9..5b257a57bc57 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -107,7 +107,7 @@ static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL); | |||
107 | /* | 107 | /* |
108 | * Print cpu online, possible, present, and system maps | 108 | * Print cpu online, possible, present, and system maps |
109 | */ | 109 | */ |
110 | static ssize_t print_cpus_map(char *buf, cpumask_t *map) | 110 | static ssize_t print_cpus_map(char *buf, const struct cpumask *map) |
111 | { | 111 | { |
112 | int n = cpulist_scnprintf(buf, PAGE_SIZE-2, map); | 112 | int n = cpulist_scnprintf(buf, PAGE_SIZE-2, map); |
113 | 113 | ||
diff --git a/drivers/base/topology.c b/drivers/base/topology.c index a778fb52b11f..bf6b13206d00 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c | |||
@@ -31,7 +31,10 @@ | |||
31 | #include <linux/hardirq.h> | 31 | #include <linux/hardirq.h> |
32 | #include <linux/topology.h> | 32 | #include <linux/topology.h> |
33 | 33 | ||
34 | #define define_one_ro(_name) \ | 34 | #define define_one_ro_named(_name, _func) \ |
35 | static SYSDEV_ATTR(_name, 0444, _func, NULL) | ||
36 | |||
37 | #define define_one_ro(_name) \ | ||
35 | static SYSDEV_ATTR(_name, 0444, show_##_name, NULL) | 38 | static SYSDEV_ATTR(_name, 0444, show_##_name, NULL) |
36 | 39 | ||
37 | #define define_id_show_func(name) \ | 40 | #define define_id_show_func(name) \ |
@@ -42,8 +45,8 @@ static ssize_t show_##name(struct sys_device *dev, \ | |||
42 | return sprintf(buf, "%d\n", topology_##name(cpu)); \ | 45 | return sprintf(buf, "%d\n", topology_##name(cpu)); \ |
43 | } | 46 | } |
44 | 47 | ||
45 | #if defined(topology_thread_siblings) || defined(topology_core_siblings) | 48 | #if defined(topology_thread_cpumask) || defined(topology_core_cpumask) |
46 | static ssize_t show_cpumap(int type, cpumask_t *mask, char *buf) | 49 | static ssize_t show_cpumap(int type, const struct cpumask *mask, char *buf) |
47 | { | 50 | { |
48 | ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE - 1, PAGE_SIZE) - buf; | 51 | ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE - 1, PAGE_SIZE) - buf; |
49 | int n = 0; | 52 | int n = 0; |
@@ -65,7 +68,7 @@ static ssize_t show_##name(struct sys_device *dev, \ | |||
65 | struct sysdev_attribute *attr, char *buf) \ | 68 | struct sysdev_attribute *attr, char *buf) \ |
66 | { \ | 69 | { \ |
67 | unsigned int cpu = dev->id; \ | 70 | unsigned int cpu = dev->id; \ |
68 | return show_cpumap(0, &(topology_##name(cpu)), buf); \ | 71 | return show_cpumap(0, topology_##name(cpu), buf); \ |
69 | } | 72 | } |
70 | 73 | ||
71 | #define define_siblings_show_list(name) \ | 74 | #define define_siblings_show_list(name) \ |
@@ -74,7 +77,7 @@ static ssize_t show_##name##_list(struct sys_device *dev, \ | |||
74 | char *buf) \ | 77 | char *buf) \ |
75 | { \ | 78 | { \ |
76 | unsigned int cpu = dev->id; \ | 79 | unsigned int cpu = dev->id; \ |
77 | return show_cpumap(1, &(topology_##name(cpu)), buf); \ | 80 | return show_cpumap(1, topology_##name(cpu), buf); \ |
78 | } | 81 | } |
79 | 82 | ||
80 | #else | 83 | #else |
@@ -82,9 +85,7 @@ static ssize_t show_##name##_list(struct sys_device *dev, \ | |||
82 | static ssize_t show_##name(struct sys_device *dev, \ | 85 | static ssize_t show_##name(struct sys_device *dev, \ |
83 | struct sysdev_attribute *attr, char *buf) \ | 86 | struct sysdev_attribute *attr, char *buf) \ |
84 | { \ | 87 | { \ |
85 | unsigned int cpu = dev->id; \ | 88 | return show_cpumap(0, topology_##name(dev->id), buf); \ |
86 | cpumask_t mask = topology_##name(cpu); \ | ||
87 | return show_cpumap(0, &mask, buf); \ | ||
88 | } | 89 | } |
89 | 90 | ||
90 | #define define_siblings_show_list(name) \ | 91 | #define define_siblings_show_list(name) \ |
@@ -92,9 +93,7 @@ static ssize_t show_##name##_list(struct sys_device *dev, \ | |||
92 | struct sysdev_attribute *attr, \ | 93 | struct sysdev_attribute *attr, \ |
93 | char *buf) \ | 94 | char *buf) \ |
94 | { \ | 95 | { \ |
95 | unsigned int cpu = dev->id; \ | 96 | return show_cpumap(1, topology_##name(dev->id), buf); \ |
96 | cpumask_t mask = topology_##name(cpu); \ | ||
97 | return show_cpumap(1, &mask, buf); \ | ||
98 | } | 97 | } |
99 | #endif | 98 | #endif |
100 | 99 | ||
@@ -107,13 +106,13 @@ define_one_ro(physical_package_id); | |||
107 | define_id_show_func(core_id); | 106 | define_id_show_func(core_id); |
108 | define_one_ro(core_id); | 107 | define_one_ro(core_id); |
109 | 108 | ||
110 | define_siblings_show_func(thread_siblings); | 109 | define_siblings_show_func(thread_cpumask); |
111 | define_one_ro(thread_siblings); | 110 | define_one_ro_named(thread_siblings, show_thread_cpumask); |
112 | define_one_ro(thread_siblings_list); | 111 | define_one_ro_named(thread_siblings_list, show_thread_cpumask_list); |
113 | 112 | ||
114 | define_siblings_show_func(core_siblings); | 113 | define_siblings_show_func(core_cpumask); |
115 | define_one_ro(core_siblings); | 114 | define_one_ro_named(core_siblings, show_core_cpumask); |
116 | define_one_ro(core_siblings_list); | 115 | define_one_ro_named(core_siblings_list, show_core_cpumask_list); |
117 | 116 | ||
118 | static struct attribute *default_attrs[] = { | 117 | static struct attribute *default_attrs[] = { |
119 | &attr_physical_package_id.attr, | 118 | &attr_physical_package_id.attr, |
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c index e1129fad96dd..ee19b6e8fcb4 100644 --- a/drivers/clocksource/acpi_pm.c +++ b/drivers/clocksource/acpi_pm.c | |||
@@ -143,7 +143,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_LE, | |||
143 | #endif | 143 | #endif |
144 | 144 | ||
145 | #ifndef CONFIG_X86_64 | 145 | #ifndef CONFIG_X86_64 |
146 | #include "mach_timer.h" | 146 | #include <asm/mach_timer.h> |
147 | #define PMTMR_EXPECTED_RATE \ | 147 | #define PMTMR_EXPECTED_RATE \ |
148 | ((CALIBRATE_LATCH * (PMTMR_TICKS_PER_SEC >> 10)) / (CLOCK_TICK_RATE>>10)) | 148 | ((CALIBRATE_LATCH * (PMTMR_TICKS_PER_SEC >> 10)) / (CLOCK_TICK_RATE>>10)) |
149 | /* | 149 | /* |
diff --git a/drivers/clocksource/cyclone.c b/drivers/clocksource/cyclone.c index 1bde303b970b..8615059a8729 100644 --- a/drivers/clocksource/cyclone.c +++ b/drivers/clocksource/cyclone.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <asm/pgtable.h> | 7 | #include <asm/pgtable.h> |
8 | #include <asm/io.h> | 8 | #include <asm/io.h> |
9 | 9 | ||
10 | #include "mach_timer.h" | 10 | #include <asm/mach_timer.h> |
11 | 11 | ||
12 | #define CYCLONE_CBAR_ADDR 0xFEB00CD0 /* base address ptr */ | 12 | #define CYCLONE_CBAR_ADDR 0xFEB00CD0 /* base address ptr */ |
13 | #define CYCLONE_PMCC_OFFSET 0x51A0 /* offset to control register */ | 13 | #define CYCLONE_PMCC_OFFSET 0x51A0 /* offset to control register */ |
diff --git a/drivers/eisa/Kconfig b/drivers/eisa/Kconfig index c0646576cf47..2705284f6223 100644 --- a/drivers/eisa/Kconfig +++ b/drivers/eisa/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | config EISA_VLB_PRIMING | 4 | config EISA_VLB_PRIMING |
5 | bool "Vesa Local Bus priming" | 5 | bool "Vesa Local Bus priming" |
6 | depends on X86_PC && EISA | 6 | depends on X86 && EISA |
7 | default n | 7 | default n |
8 | ---help--- | 8 | ---help--- |
9 | Activate this option if your system contains a Vesa Local | 9 | Activate this option if your system contains a Vesa Local |
@@ -24,11 +24,11 @@ config EISA_PCI_EISA | |||
24 | When in doubt, say Y. | 24 | When in doubt, say Y. |
25 | 25 | ||
26 | # Using EISA_VIRTUAL_ROOT on something other than an Alpha or | 26 | # Using EISA_VIRTUAL_ROOT on something other than an Alpha or |
27 | # an X86_PC may lead to crashes... | 27 | # an X86 may lead to crashes... |
28 | 28 | ||
29 | config EISA_VIRTUAL_ROOT | 29 | config EISA_VIRTUAL_ROOT |
30 | bool "EISA virtual root device" | 30 | bool "EISA virtual root device" |
31 | depends on EISA && (ALPHA || X86_PC) | 31 | depends on EISA && (ALPHA || X86) |
32 | default y | 32 | default y |
33 | ---help--- | 33 | ---help--- |
34 | Activate this option if your system only have EISA bus | 34 | Activate this option if your system only have EISA bus |
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c index 777fba48d2d3..3009e0171e54 100644 --- a/drivers/firmware/dcdbas.c +++ b/drivers/firmware/dcdbas.c | |||
@@ -244,7 +244,7 @@ static ssize_t host_control_on_shutdown_store(struct device *dev, | |||
244 | */ | 244 | */ |
245 | int dcdbas_smi_request(struct smi_cmd *smi_cmd) | 245 | int dcdbas_smi_request(struct smi_cmd *smi_cmd) |
246 | { | 246 | { |
247 | cpumask_t old_mask; | 247 | cpumask_var_t old_mask; |
248 | int ret = 0; | 248 | int ret = 0; |
249 | 249 | ||
250 | if (smi_cmd->magic != SMI_CMD_MAGIC) { | 250 | if (smi_cmd->magic != SMI_CMD_MAGIC) { |
@@ -254,8 +254,11 @@ int dcdbas_smi_request(struct smi_cmd *smi_cmd) | |||
254 | } | 254 | } |
255 | 255 | ||
256 | /* SMI requires CPU 0 */ | 256 | /* SMI requires CPU 0 */ |
257 | old_mask = current->cpus_allowed; | 257 | if (!alloc_cpumask_var(&old_mask, GFP_KERNEL)) |
258 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(0)); | 258 | return -ENOMEM; |
259 | |||
260 | cpumask_copy(old_mask, ¤t->cpus_allowed); | ||
261 | set_cpus_allowed_ptr(current, cpumask_of(0)); | ||
259 | if (smp_processor_id() != 0) { | 262 | if (smp_processor_id() != 0) { |
260 | dev_dbg(&dcdbas_pdev->dev, "%s: failed to get CPU 0\n", | 263 | dev_dbg(&dcdbas_pdev->dev, "%s: failed to get CPU 0\n", |
261 | __func__); | 264 | __func__); |
@@ -275,7 +278,8 @@ int dcdbas_smi_request(struct smi_cmd *smi_cmd) | |||
275 | ); | 278 | ); |
276 | 279 | ||
277 | out: | 280 | out: |
278 | set_cpus_allowed_ptr(current, &old_mask); | 281 | set_cpus_allowed_ptr(current, old_mask); |
282 | free_cpumask_var(old_mask); | ||
279 | return ret; | 283 | return ret; |
280 | } | 284 | } |
281 | 285 | ||
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 35561689ff38..ea2638b41982 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -13,11 +13,11 @@ menuconfig INPUT_KEYBOARD | |||
13 | if INPUT_KEYBOARD | 13 | if INPUT_KEYBOARD |
14 | 14 | ||
15 | config KEYBOARD_ATKBD | 15 | config KEYBOARD_ATKBD |
16 | tristate "AT keyboard" if EMBEDDED || !X86_PC | 16 | tristate "AT keyboard" if EMBEDDED || !X86 |
17 | default y | 17 | default y |
18 | select SERIO | 18 | select SERIO |
19 | select SERIO_LIBPS2 | 19 | select SERIO_LIBPS2 |
20 | select SERIO_I8042 if X86_PC | 20 | select SERIO_I8042 if X86 |
21 | select SERIO_GSCPS2 if GSC | 21 | select SERIO_GSCPS2 if GSC |
22 | help | 22 | help |
23 | Say Y here if you want to use a standard AT or PS/2 keyboard. Usually | 23 | Say Y here if you want to use a standard AT or PS/2 keyboard. Usually |
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig index 093c8c1bca74..9bef935ef19f 100644 --- a/drivers/input/mouse/Kconfig +++ b/drivers/input/mouse/Kconfig | |||
@@ -17,7 +17,7 @@ config MOUSE_PS2 | |||
17 | default y | 17 | default y |
18 | select SERIO | 18 | select SERIO |
19 | select SERIO_LIBPS2 | 19 | select SERIO_LIBPS2 |
20 | select SERIO_I8042 if X86_PC | 20 | select SERIO_I8042 if X86 |
21 | select SERIO_GSCPS2 if GSC | 21 | select SERIO_GSCPS2 if GSC |
22 | help | 22 | help |
23 | Say Y here if you have a PS/2 mouse connected to your system. This | 23 | Say Y here if you have a PS/2 mouse connected to your system. This |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 56073199ceba..396d935012f2 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -162,7 +162,7 @@ config ENCLOSURE_SERVICES | |||
162 | config SGI_XP | 162 | config SGI_XP |
163 | tristate "Support communication between SGI SSIs" | 163 | tristate "Support communication between SGI SSIs" |
164 | depends on NET | 164 | depends on NET |
165 | depends on (IA64_GENERIC || IA64_SGI_SN2 || IA64_SGI_UV || X86_64) && SMP | 165 | depends on (IA64_GENERIC || IA64_SGI_SN2 || IA64_SGI_UV || X86_UV) && SMP |
166 | select IA64_UNCACHED_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2 | 166 | select IA64_UNCACHED_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2 |
167 | select GENERIC_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2 | 167 | select GENERIC_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2 |
168 | select SGI_GRU if (IA64_GENERIC || IA64_SGI_UV || X86_64) && SMP | 168 | select SGI_GRU if (IA64_GENERIC || IA64_SGI_UV || X86_64) && SMP |
@@ -189,7 +189,7 @@ config HP_ILO | |||
189 | 189 | ||
190 | config SGI_GRU | 190 | config SGI_GRU |
191 | tristate "SGI GRU driver" | 191 | tristate "SGI GRU driver" |
192 | depends on (X86_64 || IA64_SGI_UV || IA64_GENERIC) && SMP | 192 | depends on (X86_UV || IA64_SGI_UV || IA64_GENERIC) && SMP |
193 | default n | 193 | default n |
194 | select MMU_NOTIFIER | 194 | select MMU_NOTIFIER |
195 | ---help--- | 195 | ---help--- |
diff --git a/drivers/misc/sgi-gru/gru.h b/drivers/misc/sgi-gru/gru.h index f93f03a9e6e9..1b5f579df15f 100644 --- a/drivers/misc/sgi-gru/gru.h +++ b/drivers/misc/sgi-gru/gru.h | |||
@@ -19,6 +19,8 @@ | |||
19 | #ifndef __GRU_H__ | 19 | #ifndef __GRU_H__ |
20 | #define __GRU_H__ | 20 | #define __GRU_H__ |
21 | 21 | ||
22 | #include <asm/uv/uv.h> | ||
23 | |||
22 | /* | 24 | /* |
23 | * GRU architectural definitions | 25 | * GRU architectural definitions |
24 | */ | 26 | */ |
diff --git a/drivers/misc/sgi-xp/xp.h b/drivers/misc/sgi-xp/xp.h index 7b4cbd5e03e9..069ad3a1c2ac 100644 --- a/drivers/misc/sgi-xp/xp.h +++ b/drivers/misc/sgi-xp/xp.h | |||
@@ -15,6 +15,8 @@ | |||
15 | 15 | ||
16 | #include <linux/mutex.h> | 16 | #include <linux/mutex.h> |
17 | 17 | ||
18 | #include <asm/uv/uv.h> | ||
19 | |||
18 | #ifdef CONFIG_IA64 | 20 | #ifdef CONFIG_IA64 |
19 | #include <asm/system.h> | 21 | #include <asm/system.h> |
20 | #include <asm/sn/arch.h> /* defines is_shub1() and is_shub2() */ | 22 | #include <asm/sn/arch.h> /* defines is_shub1() and is_shub2() */ |
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c index 89218f7cfaa7..6576170de962 100644 --- a/drivers/misc/sgi-xp/xpc_main.c +++ b/drivers/misc/sgi-xp/xpc_main.c | |||
@@ -318,7 +318,7 @@ xpc_hb_checker(void *ignore) | |||
318 | 318 | ||
319 | /* this thread was marked active by xpc_hb_init() */ | 319 | /* this thread was marked active by xpc_hb_init() */ |
320 | 320 | ||
321 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(XPC_HB_CHECK_CPU)); | 321 | set_cpus_allowed_ptr(current, cpumask_of(XPC_HB_CHECK_CPU)); |
322 | 322 | ||
323 | /* set our heartbeating to other partitions into motion */ | 323 | /* set our heartbeating to other partitions into motion */ |
324 | xpc_hb_check_timeout = jiffies + (xpc_hb_check_interval * HZ); | 324 | xpc_hb_check_timeout = jiffies + (xpc_hb_check_interval * HZ); |
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 8b12e6e109d3..2ff88791cebc 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig | |||
@@ -273,7 +273,7 @@ config MTD_NAND_CAFE | |||
273 | 273 | ||
274 | config MTD_NAND_CS553X | 274 | config MTD_NAND_CS553X |
275 | tristate "NAND support for CS5535/CS5536 (AMD Geode companion chip)" | 275 | tristate "NAND support for CS5535/CS5536 (AMD Geode companion chip)" |
276 | depends on X86_32 && (X86_PC || X86_GENERICARCH) | 276 | depends on X86_32 |
277 | help | 277 | help |
278 | The CS553x companion chips for the AMD Geode processor | 278 | The CS553x companion chips for the AMD Geode processor |
279 | include NAND flash controllers with built-in hardware ECC | 279 | include NAND flash controllers with built-in hardware ECC |
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index ab0e09bf154d..847e9bb0098f 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -854,20 +854,27 @@ static void efx_fini_io(struct efx_nic *efx) | |||
854 | * interrupts across them. */ | 854 | * interrupts across them. */ |
855 | static int efx_wanted_rx_queues(void) | 855 | static int efx_wanted_rx_queues(void) |
856 | { | 856 | { |
857 | cpumask_t core_mask; | 857 | cpumask_var_t core_mask; |
858 | int count; | 858 | int count; |
859 | int cpu; | 859 | int cpu; |
860 | 860 | ||
861 | cpus_clear(core_mask); | 861 | if (!alloc_cpumask_var(&core_mask, GFP_KERNEL)) { |
862 | printk(KERN_WARNING | ||
863 | "efx.c: allocation failure, irq balancing hobbled\n"); | ||
864 | return 1; | ||
865 | } | ||
866 | |||
867 | cpumask_clear(core_mask); | ||
862 | count = 0; | 868 | count = 0; |
863 | for_each_online_cpu(cpu) { | 869 | for_each_online_cpu(cpu) { |
864 | if (!cpu_isset(cpu, core_mask)) { | 870 | if (!cpumask_test_cpu(cpu, core_mask)) { |
865 | ++count; | 871 | ++count; |
866 | cpus_or(core_mask, core_mask, | 872 | cpumask_or(core_mask, core_mask, |
867 | topology_core_siblings(cpu)); | 873 | topology_core_cpumask(cpu)); |
868 | } | 874 | } |
869 | } | 875 | } |
870 | 876 | ||
877 | free_cpumask_var(core_mask); | ||
871 | return count; | 878 | return count; |
872 | } | 879 | } |
873 | 880 | ||
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c index 9da5a4b81133..c3ea5fa7d05a 100644 --- a/drivers/oprofile/buffer_sync.c +++ b/drivers/oprofile/buffer_sync.c | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | static LIST_HEAD(dying_tasks); | 39 | static LIST_HEAD(dying_tasks); |
40 | static LIST_HEAD(dead_tasks); | 40 | static LIST_HEAD(dead_tasks); |
41 | static cpumask_t marked_cpus = CPU_MASK_NONE; | 41 | static cpumask_var_t marked_cpus; |
42 | static DEFINE_SPINLOCK(task_mortuary); | 42 | static DEFINE_SPINLOCK(task_mortuary); |
43 | static void process_task_mortuary(void); | 43 | static void process_task_mortuary(void); |
44 | 44 | ||
@@ -456,10 +456,10 @@ static void mark_done(int cpu) | |||
456 | { | 456 | { |
457 | int i; | 457 | int i; |
458 | 458 | ||
459 | cpu_set(cpu, marked_cpus); | 459 | cpumask_set_cpu(cpu, marked_cpus); |
460 | 460 | ||
461 | for_each_online_cpu(i) { | 461 | for_each_online_cpu(i) { |
462 | if (!cpu_isset(i, marked_cpus)) | 462 | if (!cpumask_test_cpu(i, marked_cpus)) |
463 | return; | 463 | return; |
464 | } | 464 | } |
465 | 465 | ||
@@ -468,7 +468,7 @@ static void mark_done(int cpu) | |||
468 | */ | 468 | */ |
469 | process_task_mortuary(); | 469 | process_task_mortuary(); |
470 | 470 | ||
471 | cpus_clear(marked_cpus); | 471 | cpumask_clear(marked_cpus); |
472 | } | 472 | } |
473 | 473 | ||
474 | 474 | ||
@@ -565,6 +565,20 @@ void sync_buffer(int cpu) | |||
565 | mutex_unlock(&buffer_mutex); | 565 | mutex_unlock(&buffer_mutex); |
566 | } | 566 | } |
567 | 567 | ||
568 | int __init buffer_sync_init(void) | ||
569 | { | ||
570 | if (!alloc_cpumask_var(&marked_cpus, GFP_KERNEL)) | ||
571 | return -ENOMEM; | ||
572 | |||
573 | cpumask_clear(marked_cpus); | ||
574 | return 0; | ||
575 | } | ||
576 | |||
577 | void __exit buffer_sync_cleanup(void) | ||
578 | { | ||
579 | free_cpumask_var(marked_cpus); | ||
580 | } | ||
581 | |||
568 | /* The function can be used to add a buffer worth of data directly to | 582 | /* The function can be used to add a buffer worth of data directly to |
569 | * the kernel buffer. The buffer is assumed to be a circular buffer. | 583 | * the kernel buffer. The buffer is assumed to be a circular buffer. |
570 | * Take the entries from index start and end at index end, wrapping | 584 | * Take the entries from index start and end at index end, wrapping |
diff --git a/drivers/oprofile/buffer_sync.h b/drivers/oprofile/buffer_sync.h index 3110732c1835..0ebf5db62679 100644 --- a/drivers/oprofile/buffer_sync.h +++ b/drivers/oprofile/buffer_sync.h | |||
@@ -19,4 +19,8 @@ void sync_stop(void); | |||
19 | /* sync the given CPU's buffer */ | 19 | /* sync the given CPU's buffer */ |
20 | void sync_buffer(int cpu); | 20 | void sync_buffer(int cpu); |
21 | 21 | ||
22 | /* initialize/destroy the buffer system. */ | ||
23 | int buffer_sync_init(void); | ||
24 | void buffer_sync_cleanup(void); | ||
25 | |||
22 | #endif /* OPROFILE_BUFFER_SYNC_H */ | 26 | #endif /* OPROFILE_BUFFER_SYNC_H */ |
diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c index 3cffce90f82a..ced39f602292 100644 --- a/drivers/oprofile/oprof.c +++ b/drivers/oprofile/oprof.c | |||
@@ -183,6 +183,10 @@ static int __init oprofile_init(void) | |||
183 | { | 183 | { |
184 | int err; | 184 | int err; |
185 | 185 | ||
186 | err = buffer_sync_init(); | ||
187 | if (err) | ||
188 | return err; | ||
189 | |||
186 | err = oprofile_arch_init(&oprofile_ops); | 190 | err = oprofile_arch_init(&oprofile_ops); |
187 | 191 | ||
188 | if (err < 0 || timer) { | 192 | if (err < 0 || timer) { |
@@ -191,8 +195,10 @@ static int __init oprofile_init(void) | |||
191 | } | 195 | } |
192 | 196 | ||
193 | err = oprofilefs_register(); | 197 | err = oprofilefs_register(); |
194 | if (err) | 198 | if (err) { |
195 | oprofile_arch_exit(); | 199 | oprofile_arch_exit(); |
200 | buffer_sync_cleanup(); | ||
201 | } | ||
196 | 202 | ||
197 | return err; | 203 | return err; |
198 | } | 204 | } |
@@ -202,6 +208,7 @@ static void __exit oprofile_exit(void) | |||
202 | { | 208 | { |
203 | oprofilefs_unregister(); | 209 | oprofilefs_unregister(); |
204 | oprofile_arch_exit(); | 210 | oprofile_arch_exit(); |
211 | buffer_sync_cleanup(); | ||
205 | } | 212 | } |
206 | 213 | ||
207 | 214 | ||
diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c index f78371b22529..5a57753ea9fc 100644 --- a/drivers/pci/intr_remapping.c +++ b/drivers/pci/intr_remapping.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/irq.h> | 6 | #include <linux/irq.h> |
7 | #include <asm/io_apic.h> | 7 | #include <asm/io_apic.h> |
8 | #include <asm/smp.h> | 8 | #include <asm/smp.h> |
9 | #include <asm/cpu.h> | ||
9 | #include <linux/intel-iommu.h> | 10 | #include <linux/intel-iommu.h> |
10 | #include "intr_remapping.h" | 11 | #include "intr_remapping.h" |
11 | 12 | ||
diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c index bf92802f2bbe..36e221beedcd 100644 --- a/drivers/watchdog/rdc321x_wdt.c +++ b/drivers/watchdog/rdc321x_wdt.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/io.h> | 37 | #include <linux/io.h> |
38 | #include <linux/uaccess.h> | 38 | #include <linux/uaccess.h> |
39 | 39 | ||
40 | #include <asm/mach-rdc321x/rdc321x_defs.h> | 40 | #include <asm/rdc321x_defs.h> |
41 | 41 | ||
42 | #define RDC_WDT_MASK 0x80000000 /* Mask */ | 42 | #define RDC_WDT_MASK 0x80000000 /* Mask */ |
43 | #define RDC_WDT_EN 0x00800000 /* Enable bit */ | 43 | #define RDC_WDT_EN 0x00800000 /* Enable bit */ |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index eb0dfdeaa949..3141e149d595 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/irq.h> | 26 | #include <linux/irq.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/string.h> | 28 | #include <linux/string.h> |
29 | #include <linux/bootmem.h> | ||
29 | 30 | ||
30 | #include <asm/ptrace.h> | 31 | #include <asm/ptrace.h> |
31 | #include <asm/irq.h> | 32 | #include <asm/irq.h> |
@@ -75,7 +76,14 @@ enum { | |||
75 | static int evtchn_to_irq[NR_EVENT_CHANNELS] = { | 76 | static int evtchn_to_irq[NR_EVENT_CHANNELS] = { |
76 | [0 ... NR_EVENT_CHANNELS-1] = -1 | 77 | [0 ... NR_EVENT_CHANNELS-1] = -1 |
77 | }; | 78 | }; |
78 | static unsigned long cpu_evtchn_mask[NR_CPUS][NR_EVENT_CHANNELS/BITS_PER_LONG]; | 79 | struct cpu_evtchn_s { |
80 | unsigned long bits[NR_EVENT_CHANNELS/BITS_PER_LONG]; | ||
81 | }; | ||
82 | static struct cpu_evtchn_s *cpu_evtchn_mask_p; | ||
83 | static inline unsigned long *cpu_evtchn_mask(int cpu) | ||
84 | { | ||
85 | return cpu_evtchn_mask_p[cpu].bits; | ||
86 | } | ||
79 | static u8 cpu_evtchn[NR_EVENT_CHANNELS]; | 87 | static u8 cpu_evtchn[NR_EVENT_CHANNELS]; |
80 | 88 | ||
81 | /* Reference counts for bindings to IRQs. */ | 89 | /* Reference counts for bindings to IRQs. */ |
@@ -115,7 +123,7 @@ static inline unsigned long active_evtchns(unsigned int cpu, | |||
115 | unsigned int idx) | 123 | unsigned int idx) |
116 | { | 124 | { |
117 | return (sh->evtchn_pending[idx] & | 125 | return (sh->evtchn_pending[idx] & |
118 | cpu_evtchn_mask[cpu][idx] & | 126 | cpu_evtchn_mask(cpu)[idx] & |
119 | ~sh->evtchn_mask[idx]); | 127 | ~sh->evtchn_mask[idx]); |
120 | } | 128 | } |
121 | 129 | ||
@@ -125,11 +133,11 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu) | |||
125 | 133 | ||
126 | BUG_ON(irq == -1); | 134 | BUG_ON(irq == -1); |
127 | #ifdef CONFIG_SMP | 135 | #ifdef CONFIG_SMP |
128 | irq_to_desc(irq)->affinity = cpumask_of_cpu(cpu); | 136 | cpumask_copy(irq_to_desc(irq)->affinity, cpumask_of(cpu)); |
129 | #endif | 137 | #endif |
130 | 138 | ||
131 | __clear_bit(chn, cpu_evtchn_mask[cpu_evtchn[chn]]); | 139 | __clear_bit(chn, cpu_evtchn_mask(cpu_evtchn[chn])); |
132 | __set_bit(chn, cpu_evtchn_mask[cpu]); | 140 | __set_bit(chn, cpu_evtchn_mask(cpu)); |
133 | 141 | ||
134 | cpu_evtchn[chn] = cpu; | 142 | cpu_evtchn[chn] = cpu; |
135 | } | 143 | } |
@@ -142,12 +150,12 @@ static void init_evtchn_cpu_bindings(void) | |||
142 | 150 | ||
143 | /* By default all event channels notify CPU#0. */ | 151 | /* By default all event channels notify CPU#0. */ |
144 | for_each_irq_desc(i, desc) { | 152 | for_each_irq_desc(i, desc) { |
145 | desc->affinity = cpumask_of_cpu(0); | 153 | cpumask_copy(desc->affinity, cpumask_of(0)); |
146 | } | 154 | } |
147 | #endif | 155 | #endif |
148 | 156 | ||
149 | memset(cpu_evtchn, 0, sizeof(cpu_evtchn)); | 157 | memset(cpu_evtchn, 0, sizeof(cpu_evtchn)); |
150 | memset(cpu_evtchn_mask[0], ~0, sizeof(cpu_evtchn_mask[0])); | 158 | memset(cpu_evtchn_mask(0), ~0, sizeof(cpu_evtchn_mask(0))); |
151 | } | 159 | } |
152 | 160 | ||
153 | static inline unsigned int cpu_from_evtchn(unsigned int evtchn) | 161 | static inline unsigned int cpu_from_evtchn(unsigned int evtchn) |
@@ -822,6 +830,10 @@ static struct irq_chip xen_dynamic_chip __read_mostly = { | |||
822 | void __init xen_init_IRQ(void) | 830 | void __init xen_init_IRQ(void) |
823 | { | 831 | { |
824 | int i; | 832 | int i; |
833 | size_t size = nr_cpu_ids * sizeof(struct cpu_evtchn_s); | ||
834 | |||
835 | cpu_evtchn_mask_p = alloc_bootmem(size); | ||
836 | BUG_ON(cpu_evtchn_mask_p == NULL); | ||
825 | 837 | ||
826 | init_evtchn_cpu_bindings(); | 838 | init_evtchn_cpu_bindings(); |
827 | 839 | ||
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 9b91617b9582..e7e83b65c18f 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -100,7 +100,7 @@ static void do_suspend(void) | |||
100 | /* XXX use normal device tree? */ | 100 | /* XXX use normal device tree? */ |
101 | xenbus_suspend(); | 101 | xenbus_suspend(); |
102 | 102 | ||
103 | err = stop_machine(xen_suspend, &cancelled, &cpumask_of_cpu(0)); | 103 | err = stop_machine(xen_suspend, &cancelled, cpumask_of(0)); |
104 | if (err) { | 104 | if (err) { |
105 | printk(KERN_ERR "failed to start xen_suspend: %d\n", err); | 105 | printk(KERN_ERR "failed to start xen_suspend: %d\n", err); |
106 | goto out; | 106 | goto out; |
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index b0e63c672ebd..00f45ff081a6 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h | |||
@@ -80,4 +80,56 @@ extern void setup_per_cpu_areas(void); | |||
80 | #define DECLARE_PER_CPU(type, name) extern PER_CPU_ATTRIBUTES \ | 80 | #define DECLARE_PER_CPU(type, name) extern PER_CPU_ATTRIBUTES \ |
81 | __typeof__(type) per_cpu_var(name) | 81 | __typeof__(type) per_cpu_var(name) |
82 | 82 | ||
83 | /* | ||
84 | * Optional methods for optimized non-lvalue per-cpu variable access. | ||
85 | * | ||
86 | * @var can be a percpu variable or a field of it and its size should | ||
87 | * equal char, int or long. percpu_read() evaluates to a lvalue and | ||
88 | * all others to void. | ||
89 | * | ||
90 | * These operations are guaranteed to be atomic w.r.t. preemption. | ||
91 | * The generic versions use plain get/put_cpu_var(). Archs are | ||
92 | * encouraged to implement single-instruction alternatives which don't | ||
93 | * require preemption protection. | ||
94 | */ | ||
95 | #ifndef percpu_read | ||
96 | # define percpu_read(var) \ | ||
97 | ({ \ | ||
98 | typeof(per_cpu_var(var)) __tmp_var__; \ | ||
99 | __tmp_var__ = get_cpu_var(var); \ | ||
100 | put_cpu_var(var); \ | ||
101 | __tmp_var__; \ | ||
102 | }) | ||
103 | #endif | ||
104 | |||
105 | #define __percpu_generic_to_op(var, val, op) \ | ||
106 | do { \ | ||
107 | get_cpu_var(var) op val; \ | ||
108 | put_cpu_var(var); \ | ||
109 | } while (0) | ||
110 | |||
111 | #ifndef percpu_write | ||
112 | # define percpu_write(var, val) __percpu_generic_to_op(var, (val), =) | ||
113 | #endif | ||
114 | |||
115 | #ifndef percpu_add | ||
116 | # define percpu_add(var, val) __percpu_generic_to_op(var, (val), +=) | ||
117 | #endif | ||
118 | |||
119 | #ifndef percpu_sub | ||
120 | # define percpu_sub(var, val) __percpu_generic_to_op(var, (val), -=) | ||
121 | #endif | ||
122 | |||
123 | #ifndef percpu_and | ||
124 | # define percpu_and(var, val) __percpu_generic_to_op(var, (val), &=) | ||
125 | #endif | ||
126 | |||
127 | #ifndef percpu_or | ||
128 | # define percpu_or(var, val) __percpu_generic_to_op(var, (val), |=) | ||
129 | #endif | ||
130 | |||
131 | #ifndef percpu_xor | ||
132 | # define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=) | ||
133 | #endif | ||
134 | |||
83 | #endif /* _ASM_GENERIC_PERCPU_H_ */ | 135 | #endif /* _ASM_GENERIC_PERCPU_H_ */ |
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 79a7ff925bf8..4ce48e878530 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h | |||
@@ -9,7 +9,7 @@ extern char __bss_start[], __bss_stop[]; | |||
9 | extern char __init_begin[], __init_end[]; | 9 | extern char __init_begin[], __init_end[]; |
10 | extern char _sinittext[], _einittext[]; | 10 | extern char _sinittext[], _einittext[]; |
11 | extern char _end[]; | 11 | extern char _end[]; |
12 | extern char __per_cpu_start[], __per_cpu_end[]; | 12 | extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[]; |
13 | extern char __kprobes_text_start[], __kprobes_text_end[]; | 13 | extern char __kprobes_text_start[], __kprobes_text_end[]; |
14 | extern char __initdata_begin[], __initdata_end[]; | 14 | extern char __initdata_begin[], __initdata_end[]; |
15 | extern char __start_rodata[], __end_rodata[]; | 15 | extern char __start_rodata[], __end_rodata[]; |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index c61fab1dd2f8..f3180a85c66a 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -430,12 +430,48 @@ | |||
430 | *(.initcall7.init) \ | 430 | *(.initcall7.init) \ |
431 | *(.initcall7s.init) | 431 | *(.initcall7s.init) |
432 | 432 | ||
433 | #define PERCPU(align) \ | 433 | /** |
434 | . = ALIGN(align); \ | 434 | * PERCPU_VADDR - define output section for percpu area |
435 | VMLINUX_SYMBOL(__per_cpu_start) = .; \ | 435 | * @vaddr: explicit base address (optional) |
436 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \ | 436 | * @phdr: destination PHDR (optional) |
437 | * | ||
438 | * Macro which expands to output section for percpu area. If @vaddr | ||
439 | * is not blank, it specifies explicit base address and all percpu | ||
440 | * symbols will be offset from the given address. If blank, @vaddr | ||
441 | * always equals @laddr + LOAD_OFFSET. | ||
442 | * | ||
443 | * @phdr defines the output PHDR to use if not blank. Be warned that | ||
444 | * output PHDR is sticky. If @phdr is specified, the next output | ||
445 | * section in the linker script will go there too. @phdr should have | ||
446 | * a leading colon. | ||
447 | * | ||
448 | * This macro defines three symbols, __per_cpu_load, __per_cpu_start | ||
449 | * and __per_cpu_end. The first one is the vaddr of loaded percpu | ||
450 | * init data. __per_cpu_start equals @vaddr and __per_cpu_end is the | ||
451 | * end offset. | ||
452 | */ | ||
453 | #define PERCPU_VADDR(vaddr, phdr) \ | ||
454 | VMLINUX_SYMBOL(__per_cpu_load_abs) = .; \ | ||
455 | .data.percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load_abs) \ | ||
456 | - LOAD_OFFSET) { \ | ||
457 | VMLINUX_SYMBOL(__per_cpu_start) = .; \ | ||
458 | VMLINUX_SYMBOL(__per_cpu_load) = LOADADDR(.data.percpu) + LOAD_OFFSET;\ | ||
459 | *(.data.percpu.first) \ | ||
437 | *(.data.percpu.page_aligned) \ | 460 | *(.data.percpu.page_aligned) \ |
438 | *(.data.percpu) \ | 461 | *(.data.percpu) \ |
439 | *(.data.percpu.shared_aligned) \ | 462 | *(.data.percpu.shared_aligned) \ |
440 | } \ | 463 | VMLINUX_SYMBOL(__per_cpu_end) = .; \ |
441 | VMLINUX_SYMBOL(__per_cpu_end) = .; | 464 | } phdr \ |
465 | . = VMLINUX_SYMBOL(__per_cpu_load_abs) + SIZEOF(.data.percpu); | ||
466 | |||
467 | /** | ||
468 | * PERCPU - define output section for percpu area, simple version | ||
469 | * @align: required alignment | ||
470 | * | ||
471 | * Align to @align and outputs output section for percpu area. This | ||
472 | * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and | ||
473 | * __per_cpu_start will be identical. | ||
474 | */ | ||
475 | #define PERCPU(align) \ | ||
476 | . = ALIGN(align); \ | ||
477 | PERCPU_VADDR( , ) | ||
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 9127f6b51a39..472f11765f60 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -467,6 +467,7 @@ int show_interrupts(struct seq_file *p, void *v); | |||
467 | struct irq_desc; | 467 | struct irq_desc; |
468 | 468 | ||
469 | extern int early_irq_init(void); | 469 | extern int early_irq_init(void); |
470 | extern int arch_probe_nr_irqs(void); | ||
470 | extern int arch_early_irq_init(void); | 471 | extern int arch_early_irq_init(void); |
471 | extern int arch_init_chip_data(struct irq_desc *desc, int cpu); | 472 | extern int arch_init_chip_data(struct irq_desc *desc, int cpu); |
472 | 473 | ||
diff --git a/include/linux/irq.h b/include/linux/irq.h index f899b502f186..27a67536511e 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -182,11 +182,11 @@ struct irq_desc { | |||
182 | unsigned int irqs_unhandled; | 182 | unsigned int irqs_unhandled; |
183 | spinlock_t lock; | 183 | spinlock_t lock; |
184 | #ifdef CONFIG_SMP | 184 | #ifdef CONFIG_SMP |
185 | cpumask_t affinity; | 185 | cpumask_var_t affinity; |
186 | unsigned int cpu; | 186 | unsigned int cpu; |
187 | #endif | ||
188 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 187 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
189 | cpumask_t pending_mask; | 188 | cpumask_var_t pending_mask; |
189 | #endif | ||
190 | #endif | 190 | #endif |
191 | #ifdef CONFIG_PROC_FS | 191 | #ifdef CONFIG_PROC_FS |
192 | struct proc_dir_entry *dir; | 192 | struct proc_dir_entry *dir; |
@@ -422,4 +422,84 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); | |||
422 | 422 | ||
423 | #endif /* !CONFIG_S390 */ | 423 | #endif /* !CONFIG_S390 */ |
424 | 424 | ||
425 | #ifdef CONFIG_SMP | ||
426 | /** | ||
427 | * init_alloc_desc_masks - allocate cpumasks for irq_desc | ||
428 | * @desc: pointer to irq_desc struct | ||
429 | * @cpu: cpu which will be handling the cpumasks | ||
430 | * @boot: true if need bootmem | ||
431 | * | ||
432 | * Allocates affinity and pending_mask cpumask if required. | ||
433 | * Returns true if successful (or not required). | ||
434 | * Side effect: affinity has all bits set, pending_mask has all bits clear. | ||
435 | */ | ||
436 | static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, | ||
437 | bool boot) | ||
438 | { | ||
439 | int node; | ||
440 | |||
441 | if (boot) { | ||
442 | alloc_bootmem_cpumask_var(&desc->affinity); | ||
443 | cpumask_setall(desc->affinity); | ||
444 | |||
445 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
446 | alloc_bootmem_cpumask_var(&desc->pending_mask); | ||
447 | cpumask_clear(desc->pending_mask); | ||
448 | #endif | ||
449 | return true; | ||
450 | } | ||
451 | |||
452 | node = cpu_to_node(cpu); | ||
453 | |||
454 | if (!alloc_cpumask_var_node(&desc->affinity, GFP_ATOMIC, node)) | ||
455 | return false; | ||
456 | cpumask_setall(desc->affinity); | ||
457 | |||
458 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
459 | if (!alloc_cpumask_var_node(&desc->pending_mask, GFP_ATOMIC, node)) { | ||
460 | free_cpumask_var(desc->affinity); | ||
461 | return false; | ||
462 | } | ||
463 | cpumask_clear(desc->pending_mask); | ||
464 | #endif | ||
465 | return true; | ||
466 | } | ||
467 | |||
468 | /** | ||
469 | * init_copy_desc_masks - copy cpumasks for irq_desc | ||
470 | * @old_desc: pointer to old irq_desc struct | ||
471 | * @new_desc: pointer to new irq_desc struct | ||
472 | * | ||
473 | * Insures affinity and pending_masks are copied to new irq_desc. | ||
474 | * If !CONFIG_CPUMASKS_OFFSTACK the cpumasks are embedded in the | ||
475 | * irq_desc struct so the copy is redundant. | ||
476 | */ | ||
477 | |||
478 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, | ||
479 | struct irq_desc *new_desc) | ||
480 | { | ||
481 | #ifdef CONFIG_CPUMASKS_OFFSTACK | ||
482 | cpumask_copy(new_desc->affinity, old_desc->affinity); | ||
483 | |||
484 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
485 | cpumask_copy(new_desc->pending_mask, old_desc->pending_mask); | ||
486 | #endif | ||
487 | #endif | ||
488 | } | ||
489 | |||
490 | #else /* !CONFIG_SMP */ | ||
491 | |||
492 | static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, | ||
493 | bool boot) | ||
494 | { | ||
495 | return true; | ||
496 | } | ||
497 | |||
498 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, | ||
499 | struct irq_desc *new_desc) | ||
500 | { | ||
501 | } | ||
502 | |||
503 | #endif /* CONFIG_SMP */ | ||
504 | |||
425 | #endif /* _LINUX_IRQ_H */ | 505 | #endif /* _LINUX_IRQ_H */ |
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h index 86af92e9e84c..887477bc2ab0 100644 --- a/include/linux/irqnr.h +++ b/include/linux/irqnr.h | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | # define for_each_irq_desc_reverse(irq, desc) \ | 21 | # define for_each_irq_desc_reverse(irq, desc) \ |
22 | for (irq = nr_irqs - 1; irq >= 0; irq--) | 22 | for (irq = nr_irqs - 1; irq >= 0; irq--) |
23 | |||
23 | #else /* CONFIG_GENERIC_HARDIRQS */ | 24 | #else /* CONFIG_GENERIC_HARDIRQS */ |
24 | 25 | ||
25 | extern int nr_irqs; | 26 | extern int nr_irqs; |
diff --git a/include/linux/magic.h b/include/linux/magic.h index 0b4df7eba852..5b4e28bcb788 100644 --- a/include/linux/magic.h +++ b/include/linux/magic.h | |||
@@ -49,4 +49,5 @@ | |||
49 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA | 49 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA |
50 | #define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA | 50 | #define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA |
51 | 51 | ||
52 | #define STACK_END_MAGIC 0x57AC6E9D | ||
52 | #endif /* __LINUX_MAGIC_H__ */ | 53 | #endif /* __LINUX_MAGIC_H__ */ |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 9f2a3751873a..0e24202b5a4e 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -9,34 +9,39 @@ | |||
9 | #include <asm/percpu.h> | 9 | #include <asm/percpu.h> |
10 | 10 | ||
11 | #ifdef CONFIG_SMP | 11 | #ifdef CONFIG_SMP |
12 | #define DEFINE_PER_CPU(type, name) \ | 12 | #define PER_CPU_BASE_SECTION ".data.percpu" |
13 | __attribute__((__section__(".data.percpu"))) \ | ||
14 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | ||
15 | 13 | ||
16 | #ifdef MODULE | 14 | #ifdef MODULE |
17 | #define SHARED_ALIGNED_SECTION ".data.percpu" | 15 | #define PER_CPU_SHARED_ALIGNED_SECTION "" |
18 | #else | 16 | #else |
19 | #define SHARED_ALIGNED_SECTION ".data.percpu.shared_aligned" | 17 | #define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned" |
20 | #endif | 18 | #endif |
19 | #define PER_CPU_FIRST_SECTION ".first" | ||
21 | 20 | ||
22 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ | 21 | #else |
23 | __attribute__((__section__(SHARED_ALIGNED_SECTION))) \ | 22 | |
24 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \ | 23 | #define PER_CPU_BASE_SECTION ".data" |
25 | ____cacheline_aligned_in_smp | 24 | #define PER_CPU_SHARED_ALIGNED_SECTION "" |
25 | #define PER_CPU_FIRST_SECTION "" | ||
26 | |||
27 | #endif | ||
26 | 28 | ||
27 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ | 29 | #define DEFINE_PER_CPU_SECTION(type, name, section) \ |
28 | __attribute__((__section__(".data.percpu.page_aligned"))) \ | 30 | __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ |
29 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | 31 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name |
30 | #else | 32 | |
31 | #define DEFINE_PER_CPU(type, name) \ | 33 | #define DEFINE_PER_CPU(type, name) \ |
32 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | 34 | DEFINE_PER_CPU_SECTION(type, name, "") |
33 | 35 | ||
34 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ | 36 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ |
35 | DEFINE_PER_CPU(type, name) | 37 | DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \ |
38 | ____cacheline_aligned_in_smp | ||
36 | 39 | ||
37 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ | 40 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ |
38 | DEFINE_PER_CPU(type, name) | 41 | DEFINE_PER_CPU_SECTION(type, name, ".page_aligned") |
39 | #endif | 42 | |
43 | #define DEFINE_PER_CPU_FIRST(type, name) \ | ||
44 | DEFINE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION) | ||
40 | 45 | ||
41 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) | 46 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) |
42 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) | 47 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 5a7c76388731..2225c207801c 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1160,10 +1160,9 @@ struct task_struct { | |||
1160 | pid_t pid; | 1160 | pid_t pid; |
1161 | pid_t tgid; | 1161 | pid_t tgid; |
1162 | 1162 | ||
1163 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
1164 | /* Canary value for the -fstack-protector gcc feature */ | 1163 | /* Canary value for the -fstack-protector gcc feature */ |
1165 | unsigned long stack_canary; | 1164 | unsigned long stack_canary; |
1166 | #endif | 1165 | |
1167 | /* | 1166 | /* |
1168 | * pointers to (original) parent process, youngest child, younger sibling, | 1167 | * pointers to (original) parent process, youngest child, younger sibling, |
1169 | * older sibling, respectively. (p->father can be replaced with | 1168 | * older sibling, respectively. (p->father can be replaced with |
@@ -2069,6 +2068,19 @@ static inline int object_is_on_stack(void *obj) | |||
2069 | 2068 | ||
2070 | extern void thread_info_cache_init(void); | 2069 | extern void thread_info_cache_init(void); |
2071 | 2070 | ||
2071 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
2072 | static inline unsigned long stack_not_used(struct task_struct *p) | ||
2073 | { | ||
2074 | unsigned long *n = end_of_stack(p); | ||
2075 | |||
2076 | do { /* Skip over canary */ | ||
2077 | n++; | ||
2078 | } while (!*n); | ||
2079 | |||
2080 | return (unsigned long)n - (unsigned long)end_of_stack(p); | ||
2081 | } | ||
2082 | #endif | ||
2083 | |||
2072 | /* set thread flags in other task's structures | 2084 | /* set thread flags in other task's structures |
2073 | * - see asm/thread_info.h for TIF_xxxx flags available | 2085 | * - see asm/thread_info.h for TIF_xxxx flags available |
2074 | */ | 2086 | */ |
diff --git a/include/linux/smp.h b/include/linux/smp.h index 715196b09d67..bbacb7baa446 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -176,6 +176,12 @@ static inline void init_call_single_data(void) | |||
176 | #define put_cpu() preempt_enable() | 176 | #define put_cpu() preempt_enable() |
177 | #define put_cpu_no_resched() preempt_enable_no_resched() | 177 | #define put_cpu_no_resched() preempt_enable_no_resched() |
178 | 178 | ||
179 | /* | ||
180 | * Callback to arch code if there's nosmp or maxcpus=0 on the | ||
181 | * boot command line: | ||
182 | */ | ||
183 | extern void arch_disable_smp_support(void); | ||
184 | |||
179 | void smp_setup_processor_id(void); | 185 | void smp_setup_processor_id(void); |
180 | 186 | ||
181 | #endif /* __LINUX_SMP_H */ | 187 | #endif /* __LINUX_SMP_H */ |
diff --git a/include/linux/stackprotector.h b/include/linux/stackprotector.h new file mode 100644 index 000000000000..6f3e54c704c0 --- /dev/null +++ b/include/linux/stackprotector.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _LINUX_STACKPROTECTOR_H | ||
2 | #define _LINUX_STACKPROTECTOR_H 1 | ||
3 | |||
4 | #include <linux/compiler.h> | ||
5 | #include <linux/sched.h> | ||
6 | #include <linux/random.h> | ||
7 | |||
8 | #ifdef CONFIG_CC_STACKPROTECTOR | ||
9 | # include <asm/stackprotector.h> | ||
10 | #else | ||
11 | static inline void boot_init_stack_canary(void) | ||
12 | { | ||
13 | } | ||
14 | #endif | ||
15 | |||
16 | #endif | ||
diff --git a/include/linux/topology.h b/include/linux/topology.h index e632d29f0544..a16b9e06f2e5 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
@@ -193,5 +193,11 @@ int arch_update_cpu_topology(void); | |||
193 | #ifndef topology_core_siblings | 193 | #ifndef topology_core_siblings |
194 | #define topology_core_siblings(cpu) cpumask_of_cpu(cpu) | 194 | #define topology_core_siblings(cpu) cpumask_of_cpu(cpu) |
195 | #endif | 195 | #endif |
196 | #ifndef topology_thread_cpumask | ||
197 | #define topology_thread_cpumask(cpu) cpumask_of(cpu) | ||
198 | #endif | ||
199 | #ifndef topology_core_cpumask | ||
200 | #define topology_core_cpumask(cpu) cpumask_of(cpu) | ||
201 | #endif | ||
196 | 202 | ||
197 | #endif /* _LINUX_TOPOLOGY_H */ | 203 | #endif /* _LINUX_TOPOLOGY_H */ |
diff --git a/init/main.c b/init/main.c index 844209453c02..6441083f8273 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/proc_fs.h> | 14 | #include <linux/proc_fs.h> |
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/syscalls.h> | 16 | #include <linux/syscalls.h> |
17 | #include <linux/stackprotector.h> | ||
17 | #include <linux/string.h> | 18 | #include <linux/string.h> |
18 | #include <linux/ctype.h> | 19 | #include <linux/ctype.h> |
19 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
@@ -135,14 +136,14 @@ unsigned int __initdata setup_max_cpus = NR_CPUS; | |||
135 | * greater than 0, limits the maximum number of CPUs activated in | 136 | * greater than 0, limits the maximum number of CPUs activated in |
136 | * SMP mode to <NUM>. | 137 | * SMP mode to <NUM>. |
137 | */ | 138 | */ |
138 | #ifndef CONFIG_X86_IO_APIC | 139 | |
139 | static inline void disable_ioapic_setup(void) {}; | 140 | void __weak arch_disable_smp_support(void) { } |
140 | #endif | ||
141 | 141 | ||
142 | static int __init nosmp(char *str) | 142 | static int __init nosmp(char *str) |
143 | { | 143 | { |
144 | setup_max_cpus = 0; | 144 | setup_max_cpus = 0; |
145 | disable_ioapic_setup(); | 145 | arch_disable_smp_support(); |
146 | |||
146 | return 0; | 147 | return 0; |
147 | } | 148 | } |
148 | 149 | ||
@@ -152,14 +153,14 @@ static int __init maxcpus(char *str) | |||
152 | { | 153 | { |
153 | get_option(&str, &setup_max_cpus); | 154 | get_option(&str, &setup_max_cpus); |
154 | if (setup_max_cpus == 0) | 155 | if (setup_max_cpus == 0) |
155 | disable_ioapic_setup(); | 156 | arch_disable_smp_support(); |
156 | 157 | ||
157 | return 0; | 158 | return 0; |
158 | } | 159 | } |
159 | 160 | ||
160 | early_param("maxcpus", maxcpus); | 161 | early_param("maxcpus", maxcpus); |
161 | #else | 162 | #else |
162 | #define setup_max_cpus NR_CPUS | 163 | const unsigned int setup_max_cpus = NR_CPUS; |
163 | #endif | 164 | #endif |
164 | 165 | ||
165 | /* | 166 | /* |
@@ -539,6 +540,12 @@ asmlinkage void __init start_kernel(void) | |||
539 | */ | 540 | */ |
540 | lockdep_init(); | 541 | lockdep_init(); |
541 | debug_objects_early_init(); | 542 | debug_objects_early_init(); |
543 | |||
544 | /* | ||
545 | * Set up the the initial canary ASAP: | ||
546 | */ | ||
547 | boot_init_stack_canary(); | ||
548 | |||
542 | cgroup_init_early(); | 549 | cgroup_init_early(); |
543 | 550 | ||
544 | local_irq_disable(); | 551 | local_irq_disable(); |
diff --git a/kernel/exit.c b/kernel/exit.c index f80dec3f1875..70612c19ac96 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -977,12 +977,9 @@ static void check_stack_usage(void) | |||
977 | { | 977 | { |
978 | static DEFINE_SPINLOCK(low_water_lock); | 978 | static DEFINE_SPINLOCK(low_water_lock); |
979 | static int lowest_to_date = THREAD_SIZE; | 979 | static int lowest_to_date = THREAD_SIZE; |
980 | unsigned long *n = end_of_stack(current); | ||
981 | unsigned long free; | 980 | unsigned long free; |
982 | 981 | ||
983 | while (*n == 0) | 982 | free = stack_not_used(current); |
984 | n++; | ||
985 | free = (unsigned long)n - (unsigned long)end_of_stack(current); | ||
986 | 983 | ||
987 | if (free >= lowest_to_date) | 984 | if (free >= lowest_to_date) |
988 | return; | 985 | return; |
diff --git a/kernel/fork.c b/kernel/fork.c index 242a706e7721..99309df985bf 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <linux/proc_fs.h> | 61 | #include <linux/proc_fs.h> |
62 | #include <linux/blkdev.h> | 62 | #include <linux/blkdev.h> |
63 | #include <trace/sched.h> | 63 | #include <trace/sched.h> |
64 | #include <linux/magic.h> | ||
64 | 65 | ||
65 | #include <asm/pgtable.h> | 66 | #include <asm/pgtable.h> |
66 | #include <asm/pgalloc.h> | 67 | #include <asm/pgalloc.h> |
@@ -212,6 +213,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) | |||
212 | { | 213 | { |
213 | struct task_struct *tsk; | 214 | struct task_struct *tsk; |
214 | struct thread_info *ti; | 215 | struct thread_info *ti; |
216 | unsigned long *stackend; | ||
217 | |||
215 | int err; | 218 | int err; |
216 | 219 | ||
217 | prepare_to_copy(orig); | 220 | prepare_to_copy(orig); |
@@ -237,6 +240,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) | |||
237 | goto out; | 240 | goto out; |
238 | 241 | ||
239 | setup_thread_stack(tsk, orig); | 242 | setup_thread_stack(tsk, orig); |
243 | stackend = end_of_stack(tsk); | ||
244 | *stackend = STACK_END_MAGIC; /* for overflow detection */ | ||
240 | 245 | ||
241 | #ifdef CONFIG_CC_STACKPROTECTOR | 246 | #ifdef CONFIG_CC_STACKPROTECTOR |
242 | tsk->stack_canary = get_random_int(); | 247 | tsk->stack_canary = get_random_int(); |
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 7de11bd64dfe..122fef4b0bd3 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
@@ -46,7 +46,10 @@ void dynamic_irq_init(unsigned int irq) | |||
46 | desc->irq_count = 0; | 46 | desc->irq_count = 0; |
47 | desc->irqs_unhandled = 0; | 47 | desc->irqs_unhandled = 0; |
48 | #ifdef CONFIG_SMP | 48 | #ifdef CONFIG_SMP |
49 | cpumask_setall(&desc->affinity); | 49 | cpumask_setall(desc->affinity); |
50 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
51 | cpumask_clear(desc->pending_mask); | ||
52 | #endif | ||
50 | #endif | 53 | #endif |
51 | spin_unlock_irqrestore(&desc->lock, flags); | 54 | spin_unlock_irqrestore(&desc->lock, flags); |
52 | } | 55 | } |
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 3aba8d12f328..f51eaee921b6 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/kernel_stat.h> | 17 | #include <linux/kernel_stat.h> |
18 | #include <linux/rculist.h> | 18 | #include <linux/rculist.h> |
19 | #include <linux/hash.h> | 19 | #include <linux/hash.h> |
20 | #include <linux/bootmem.h> | ||
20 | 21 | ||
21 | #include "internals.h" | 22 | #include "internals.h" |
22 | 23 | ||
@@ -69,6 +70,7 @@ int nr_irqs = NR_IRQS; | |||
69 | EXPORT_SYMBOL_GPL(nr_irqs); | 70 | EXPORT_SYMBOL_GPL(nr_irqs); |
70 | 71 | ||
71 | #ifdef CONFIG_SPARSE_IRQ | 72 | #ifdef CONFIG_SPARSE_IRQ |
73 | |||
72 | static struct irq_desc irq_desc_init = { | 74 | static struct irq_desc irq_desc_init = { |
73 | .irq = -1, | 75 | .irq = -1, |
74 | .status = IRQ_DISABLED, | 76 | .status = IRQ_DISABLED, |
@@ -76,9 +78,6 @@ static struct irq_desc irq_desc_init = { | |||
76 | .handle_irq = handle_bad_irq, | 78 | .handle_irq = handle_bad_irq, |
77 | .depth = 1, | 79 | .depth = 1, |
78 | .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), | 80 | .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), |
79 | #ifdef CONFIG_SMP | ||
80 | .affinity = CPU_MASK_ALL | ||
81 | #endif | ||
82 | }; | 81 | }; |
83 | 82 | ||
84 | void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr) | 83 | void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr) |
@@ -113,6 +112,10 @@ static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu) | |||
113 | printk(KERN_ERR "can not alloc kstat_irqs\n"); | 112 | printk(KERN_ERR "can not alloc kstat_irqs\n"); |
114 | BUG_ON(1); | 113 | BUG_ON(1); |
115 | } | 114 | } |
115 | if (!init_alloc_desc_masks(desc, cpu, false)) { | ||
116 | printk(KERN_ERR "can not alloc irq_desc cpumasks\n"); | ||
117 | BUG_ON(1); | ||
118 | } | ||
116 | arch_init_chip_data(desc, cpu); | 119 | arch_init_chip_data(desc, cpu); |
117 | } | 120 | } |
118 | 121 | ||
@@ -121,7 +124,7 @@ static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu) | |||
121 | */ | 124 | */ |
122 | DEFINE_SPINLOCK(sparse_irq_lock); | 125 | DEFINE_SPINLOCK(sparse_irq_lock); |
123 | 126 | ||
124 | struct irq_desc *irq_desc_ptrs[NR_IRQS] __read_mostly; | 127 | struct irq_desc **irq_desc_ptrs __read_mostly; |
125 | 128 | ||
126 | static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_smp = { | 129 | static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_smp = { |
127 | [0 ... NR_IRQS_LEGACY-1] = { | 130 | [0 ... NR_IRQS_LEGACY-1] = { |
@@ -131,14 +134,10 @@ static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_sm | |||
131 | .handle_irq = handle_bad_irq, | 134 | .handle_irq = handle_bad_irq, |
132 | .depth = 1, | 135 | .depth = 1, |
133 | .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), | 136 | .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), |
134 | #ifdef CONFIG_SMP | ||
135 | .affinity = CPU_MASK_ALL | ||
136 | #endif | ||
137 | } | 137 | } |
138 | }; | 138 | }; |
139 | 139 | ||
140 | /* FIXME: use bootmem alloc ...*/ | 140 | static unsigned int *kstat_irqs_legacy; |
141 | static unsigned int kstat_irqs_legacy[NR_IRQS_LEGACY][NR_CPUS]; | ||
142 | 141 | ||
143 | int __init early_irq_init(void) | 142 | int __init early_irq_init(void) |
144 | { | 143 | { |
@@ -148,18 +147,30 @@ int __init early_irq_init(void) | |||
148 | 147 | ||
149 | init_irq_default_affinity(); | 148 | init_irq_default_affinity(); |
150 | 149 | ||
150 | /* initialize nr_irqs based on nr_cpu_ids */ | ||
151 | arch_probe_nr_irqs(); | ||
152 | printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d\n", NR_IRQS, nr_irqs); | ||
153 | |||
151 | desc = irq_desc_legacy; | 154 | desc = irq_desc_legacy; |
152 | legacy_count = ARRAY_SIZE(irq_desc_legacy); | 155 | legacy_count = ARRAY_SIZE(irq_desc_legacy); |
153 | 156 | ||
157 | /* allocate irq_desc_ptrs array based on nr_irqs */ | ||
158 | irq_desc_ptrs = alloc_bootmem(nr_irqs * sizeof(void *)); | ||
159 | |||
160 | /* allocate based on nr_cpu_ids */ | ||
161 | /* FIXME: invert kstat_irgs, and it'd be a per_cpu_alloc'd thing */ | ||
162 | kstat_irqs_legacy = alloc_bootmem(NR_IRQS_LEGACY * nr_cpu_ids * | ||
163 | sizeof(int)); | ||
164 | |||
154 | for (i = 0; i < legacy_count; i++) { | 165 | for (i = 0; i < legacy_count; i++) { |
155 | desc[i].irq = i; | 166 | desc[i].irq = i; |
156 | desc[i].kstat_irqs = kstat_irqs_legacy[i]; | 167 | desc[i].kstat_irqs = kstat_irqs_legacy + i * nr_cpu_ids; |
157 | lockdep_set_class(&desc[i].lock, &irq_desc_lock_class); | 168 | lockdep_set_class(&desc[i].lock, &irq_desc_lock_class); |
158 | 169 | init_alloc_desc_masks(&desc[i], 0, true); | |
159 | irq_desc_ptrs[i] = desc + i; | 170 | irq_desc_ptrs[i] = desc + i; |
160 | } | 171 | } |
161 | 172 | ||
162 | for (i = legacy_count; i < NR_IRQS; i++) | 173 | for (i = legacy_count; i < nr_irqs; i++) |
163 | irq_desc_ptrs[i] = NULL; | 174 | irq_desc_ptrs[i] = NULL; |
164 | 175 | ||
165 | return arch_early_irq_init(); | 176 | return arch_early_irq_init(); |
@@ -167,7 +178,10 @@ int __init early_irq_init(void) | |||
167 | 178 | ||
168 | struct irq_desc *irq_to_desc(unsigned int irq) | 179 | struct irq_desc *irq_to_desc(unsigned int irq) |
169 | { | 180 | { |
170 | return (irq < NR_IRQS) ? irq_desc_ptrs[irq] : NULL; | 181 | if (irq_desc_ptrs && irq < nr_irqs) |
182 | return irq_desc_ptrs[irq]; | ||
183 | |||
184 | return NULL; | ||
171 | } | 185 | } |
172 | 186 | ||
173 | struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu) | 187 | struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu) |
@@ -176,10 +190,9 @@ struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu) | |||
176 | unsigned long flags; | 190 | unsigned long flags; |
177 | int node; | 191 | int node; |
178 | 192 | ||
179 | if (irq >= NR_IRQS) { | 193 | if (irq >= nr_irqs) { |
180 | printk(KERN_WARNING "irq >= NR_IRQS in irq_to_desc_alloc: %d %d\n", | 194 | WARN(1, "irq (%d) >= nr_irqs (%d) in irq_to_desc_alloc\n", |
181 | irq, NR_IRQS); | 195 | irq, nr_irqs); |
182 | WARN_ON(1); | ||
183 | return NULL; | 196 | return NULL; |
184 | } | 197 | } |
185 | 198 | ||
@@ -221,9 +234,6 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { | |||
221 | .handle_irq = handle_bad_irq, | 234 | .handle_irq = handle_bad_irq, |
222 | .depth = 1, | 235 | .depth = 1, |
223 | .lock = __SPIN_LOCK_UNLOCKED(irq_desc->lock), | 236 | .lock = __SPIN_LOCK_UNLOCKED(irq_desc->lock), |
224 | #ifdef CONFIG_SMP | ||
225 | .affinity = CPU_MASK_ALL | ||
226 | #endif | ||
227 | } | 237 | } |
228 | }; | 238 | }; |
229 | 239 | ||
@@ -235,12 +245,15 @@ int __init early_irq_init(void) | |||
235 | 245 | ||
236 | init_irq_default_affinity(); | 246 | init_irq_default_affinity(); |
237 | 247 | ||
248 | printk(KERN_INFO "NR_IRQS:%d\n", NR_IRQS); | ||
249 | |||
238 | desc = irq_desc; | 250 | desc = irq_desc; |
239 | count = ARRAY_SIZE(irq_desc); | 251 | count = ARRAY_SIZE(irq_desc); |
240 | 252 | ||
241 | for (i = 0; i < count; i++) | 253 | for (i = 0; i < count; i++) { |
242 | desc[i].irq = i; | 254 | desc[i].irq = i; |
243 | 255 | init_alloc_desc_masks(&desc[i], 0, true); | |
256 | } | ||
244 | return arch_early_irq_init(); | 257 | return arch_early_irq_init(); |
245 | } | 258 | } |
246 | 259 | ||
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index e6d0a43cc125..40416a81a0f5 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h | |||
@@ -16,7 +16,14 @@ extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq, | |||
16 | extern struct lock_class_key irq_desc_lock_class; | 16 | extern struct lock_class_key irq_desc_lock_class; |
17 | extern void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr); | 17 | extern void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr); |
18 | extern spinlock_t sparse_irq_lock; | 18 | extern spinlock_t sparse_irq_lock; |
19 | |||
20 | #ifdef CONFIG_SPARSE_IRQ | ||
21 | /* irq_desc_ptrs allocated at boot time */ | ||
22 | extern struct irq_desc **irq_desc_ptrs; | ||
23 | #else | ||
24 | /* irq_desc_ptrs is a fixed size array */ | ||
19 | extern struct irq_desc *irq_desc_ptrs[NR_IRQS]; | 25 | extern struct irq_desc *irq_desc_ptrs[NR_IRQS]; |
26 | #endif | ||
20 | 27 | ||
21 | #ifdef CONFIG_PROC_FS | 28 | #ifdef CONFIG_PROC_FS |
22 | extern void register_irq_proc(unsigned int irq, struct irq_desc *desc); | 29 | extern void register_irq_proc(unsigned int irq, struct irq_desc *desc); |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 291f03664552..a3a5dc9ef346 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -90,14 +90,14 @@ int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask) | |||
90 | 90 | ||
91 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 91 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
92 | if (desc->status & IRQ_MOVE_PCNTXT || desc->status & IRQ_DISABLED) { | 92 | if (desc->status & IRQ_MOVE_PCNTXT || desc->status & IRQ_DISABLED) { |
93 | cpumask_copy(&desc->affinity, cpumask); | 93 | cpumask_copy(desc->affinity, cpumask); |
94 | desc->chip->set_affinity(irq, cpumask); | 94 | desc->chip->set_affinity(irq, cpumask); |
95 | } else { | 95 | } else { |
96 | desc->status |= IRQ_MOVE_PENDING; | 96 | desc->status |= IRQ_MOVE_PENDING; |
97 | cpumask_copy(&desc->pending_mask, cpumask); | 97 | cpumask_copy(desc->pending_mask, cpumask); |
98 | } | 98 | } |
99 | #else | 99 | #else |
100 | cpumask_copy(&desc->affinity, cpumask); | 100 | cpumask_copy(desc->affinity, cpumask); |
101 | desc->chip->set_affinity(irq, cpumask); | 101 | desc->chip->set_affinity(irq, cpumask); |
102 | #endif | 102 | #endif |
103 | desc->status |= IRQ_AFFINITY_SET; | 103 | desc->status |= IRQ_AFFINITY_SET; |
@@ -119,16 +119,16 @@ int do_irq_select_affinity(unsigned int irq, struct irq_desc *desc) | |||
119 | * one of the targets is online. | 119 | * one of the targets is online. |
120 | */ | 120 | */ |
121 | if (desc->status & (IRQ_AFFINITY_SET | IRQ_NO_BALANCING)) { | 121 | if (desc->status & (IRQ_AFFINITY_SET | IRQ_NO_BALANCING)) { |
122 | if (cpumask_any_and(&desc->affinity, cpu_online_mask) | 122 | if (cpumask_any_and(desc->affinity, cpu_online_mask) |
123 | < nr_cpu_ids) | 123 | < nr_cpu_ids) |
124 | goto set_affinity; | 124 | goto set_affinity; |
125 | else | 125 | else |
126 | desc->status &= ~IRQ_AFFINITY_SET; | 126 | desc->status &= ~IRQ_AFFINITY_SET; |
127 | } | 127 | } |
128 | 128 | ||
129 | cpumask_and(&desc->affinity, cpu_online_mask, irq_default_affinity); | 129 | cpumask_and(desc->affinity, cpu_online_mask, irq_default_affinity); |
130 | set_affinity: | 130 | set_affinity: |
131 | desc->chip->set_affinity(irq, &desc->affinity); | 131 | desc->chip->set_affinity(irq, desc->affinity); |
132 | 132 | ||
133 | return 0; | 133 | return 0; |
134 | } | 134 | } |
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c index bd72329e630c..e05ad9be43b7 100644 --- a/kernel/irq/migration.c +++ b/kernel/irq/migration.c | |||
@@ -18,7 +18,7 @@ void move_masked_irq(int irq) | |||
18 | 18 | ||
19 | desc->status &= ~IRQ_MOVE_PENDING; | 19 | desc->status &= ~IRQ_MOVE_PENDING; |
20 | 20 | ||
21 | if (unlikely(cpumask_empty(&desc->pending_mask))) | 21 | if (unlikely(cpumask_empty(desc->pending_mask))) |
22 | return; | 22 | return; |
23 | 23 | ||
24 | if (!desc->chip->set_affinity) | 24 | if (!desc->chip->set_affinity) |
@@ -38,13 +38,13 @@ void move_masked_irq(int irq) | |||
38 | * For correct operation this depends on the caller | 38 | * For correct operation this depends on the caller |
39 | * masking the irqs. | 39 | * masking the irqs. |
40 | */ | 40 | */ |
41 | if (likely(cpumask_any_and(&desc->pending_mask, cpu_online_mask) | 41 | if (likely(cpumask_any_and(desc->pending_mask, cpu_online_mask) |
42 | < nr_cpu_ids)) { | 42 | < nr_cpu_ids)) { |
43 | cpumask_and(&desc->affinity, | 43 | cpumask_and(desc->affinity, |
44 | &desc->pending_mask, cpu_online_mask); | 44 | desc->pending_mask, cpu_online_mask); |
45 | desc->chip->set_affinity(irq, &desc->affinity); | 45 | desc->chip->set_affinity(irq, desc->affinity); |
46 | } | 46 | } |
47 | cpumask_clear(&desc->pending_mask); | 47 | cpumask_clear(desc->pending_mask); |
48 | } | 48 | } |
49 | 49 | ||
50 | void move_native_irq(int irq) | 50 | void move_native_irq(int irq) |
diff --git a/kernel/irq/numa_migrate.c b/kernel/irq/numa_migrate.c index acd88356ac76..7f9b80434e32 100644 --- a/kernel/irq/numa_migrate.c +++ b/kernel/irq/numa_migrate.c | |||
@@ -38,15 +38,22 @@ static void free_kstat_irqs(struct irq_desc *old_desc, struct irq_desc *desc) | |||
38 | old_desc->kstat_irqs = NULL; | 38 | old_desc->kstat_irqs = NULL; |
39 | } | 39 | } |
40 | 40 | ||
41 | static void init_copy_one_irq_desc(int irq, struct irq_desc *old_desc, | 41 | static bool init_copy_one_irq_desc(int irq, struct irq_desc *old_desc, |
42 | struct irq_desc *desc, int cpu) | 42 | struct irq_desc *desc, int cpu) |
43 | { | 43 | { |
44 | memcpy(desc, old_desc, sizeof(struct irq_desc)); | 44 | memcpy(desc, old_desc, sizeof(struct irq_desc)); |
45 | if (!init_alloc_desc_masks(desc, cpu, false)) { | ||
46 | printk(KERN_ERR "irq %d: can not get new irq_desc cpumask " | ||
47 | "for migration.\n", irq); | ||
48 | return false; | ||
49 | } | ||
45 | spin_lock_init(&desc->lock); | 50 | spin_lock_init(&desc->lock); |
46 | desc->cpu = cpu; | 51 | desc->cpu = cpu; |
47 | lockdep_set_class(&desc->lock, &irq_desc_lock_class); | 52 | lockdep_set_class(&desc->lock, &irq_desc_lock_class); |
48 | init_copy_kstat_irqs(old_desc, desc, cpu, nr_cpu_ids); | 53 | init_copy_kstat_irqs(old_desc, desc, cpu, nr_cpu_ids); |
54 | init_copy_desc_masks(old_desc, desc); | ||
49 | arch_init_copy_chip_data(old_desc, desc, cpu); | 55 | arch_init_copy_chip_data(old_desc, desc, cpu); |
56 | return true; | ||
50 | } | 57 | } |
51 | 58 | ||
52 | static void free_one_irq_desc(struct irq_desc *old_desc, struct irq_desc *desc) | 59 | static void free_one_irq_desc(struct irq_desc *old_desc, struct irq_desc *desc) |
@@ -76,12 +83,18 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc, | |||
76 | node = cpu_to_node(cpu); | 83 | node = cpu_to_node(cpu); |
77 | desc = kzalloc_node(sizeof(*desc), GFP_ATOMIC, node); | 84 | desc = kzalloc_node(sizeof(*desc), GFP_ATOMIC, node); |
78 | if (!desc) { | 85 | if (!desc) { |
79 | printk(KERN_ERR "irq %d: can not get new irq_desc for migration.\n", irq); | 86 | printk(KERN_ERR "irq %d: can not get new irq_desc " |
87 | "for migration.\n", irq); | ||
88 | /* still use old one */ | ||
89 | desc = old_desc; | ||
90 | goto out_unlock; | ||
91 | } | ||
92 | if (!init_copy_one_irq_desc(irq, old_desc, desc, cpu)) { | ||
80 | /* still use old one */ | 93 | /* still use old one */ |
94 | kfree(desc); | ||
81 | desc = old_desc; | 95 | desc = old_desc; |
82 | goto out_unlock; | 96 | goto out_unlock; |
83 | } | 97 | } |
84 | init_copy_one_irq_desc(irq, old_desc, desc, cpu); | ||
85 | 98 | ||
86 | irq_desc_ptrs[irq] = desc; | 99 | irq_desc_ptrs[irq] = desc; |
87 | spin_unlock_irqrestore(&sparse_irq_lock, flags); | 100 | spin_unlock_irqrestore(&sparse_irq_lock, flags); |
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index aae3f742bcec..692363dd591f 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c | |||
@@ -20,11 +20,11 @@ static struct proc_dir_entry *root_irq_dir; | |||
20 | static int irq_affinity_proc_show(struct seq_file *m, void *v) | 20 | static int irq_affinity_proc_show(struct seq_file *m, void *v) |
21 | { | 21 | { |
22 | struct irq_desc *desc = irq_to_desc((long)m->private); | 22 | struct irq_desc *desc = irq_to_desc((long)m->private); |
23 | const struct cpumask *mask = &desc->affinity; | 23 | const struct cpumask *mask = desc->affinity; |
24 | 24 | ||
25 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 25 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
26 | if (desc->status & IRQ_MOVE_PENDING) | 26 | if (desc->status & IRQ_MOVE_PENDING) |
27 | mask = &desc->pending_mask; | 27 | mask = desc->pending_mask; |
28 | #endif | 28 | #endif |
29 | seq_cpumask(m, mask); | 29 | seq_cpumask(m, mask); |
30 | seq_putc(m, '\n'); | 30 | seq_putc(m, '\n'); |
diff --git a/kernel/panic.c b/kernel/panic.c index 2a2ff36ff44d..33cab3de1763 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -74,6 +74,9 @@ NORET_TYPE void panic(const char * fmt, ...) | |||
74 | vsnprintf(buf, sizeof(buf), fmt, args); | 74 | vsnprintf(buf, sizeof(buf), fmt, args); |
75 | va_end(args); | 75 | va_end(args); |
76 | printk(KERN_EMERG "Kernel panic - not syncing: %s\n",buf); | 76 | printk(KERN_EMERG "Kernel panic - not syncing: %s\n",buf); |
77 | #ifdef CONFIG_DEBUG_BUGVERBOSE | ||
78 | dump_stack(); | ||
79 | #endif | ||
77 | bust_spinlocks(0); | 80 | bust_spinlocks(0); |
78 | 81 | ||
79 | /* | 82 | /* |
@@ -355,15 +358,22 @@ EXPORT_SYMBOL(warn_slowpath); | |||
355 | #endif | 358 | #endif |
356 | 359 | ||
357 | #ifdef CONFIG_CC_STACKPROTECTOR | 360 | #ifdef CONFIG_CC_STACKPROTECTOR |
361 | |||
362 | #ifndef GCC_HAS_SP | ||
363 | #warning You have selected the CONFIG_CC_STACKPROTECTOR option, but the gcc used does not support this. | ||
364 | #endif | ||
365 | |||
358 | /* | 366 | /* |
359 | * Called when gcc's -fstack-protector feature is used, and | 367 | * Called when gcc's -fstack-protector feature is used, and |
360 | * gcc detects corruption of the on-stack canary value | 368 | * gcc detects corruption of the on-stack canary value |
361 | */ | 369 | */ |
362 | void __stack_chk_fail(void) | 370 | void __stack_chk_fail(void) |
363 | { | 371 | { |
364 | panic("stack-protector: Kernel stack is corrupted"); | 372 | panic("stack-protector: Kernel stack is corrupted in: %p\n", |
373 | __builtin_return_address(0)); | ||
365 | } | 374 | } |
366 | EXPORT_SYMBOL(__stack_chk_fail); | 375 | EXPORT_SYMBOL(__stack_chk_fail); |
376 | |||
367 | #endif | 377 | #endif |
368 | 378 | ||
369 | core_param(panic, panic_timeout, int, 0644); | 379 | core_param(panic, panic_timeout, int, 0644); |
diff --git a/kernel/sched.c b/kernel/sched.c index 242d0d47a70d..400756169aa7 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -5949,12 +5949,7 @@ void sched_show_task(struct task_struct *p) | |||
5949 | printk(KERN_CONT " %016lx ", thread_saved_pc(p)); | 5949 | printk(KERN_CONT " %016lx ", thread_saved_pc(p)); |
5950 | #endif | 5950 | #endif |
5951 | #ifdef CONFIG_DEBUG_STACK_USAGE | 5951 | #ifdef CONFIG_DEBUG_STACK_USAGE |
5952 | { | 5952 | free = stack_not_used(p); |
5953 | unsigned long *n = end_of_stack(p); | ||
5954 | while (!*n) | ||
5955 | n++; | ||
5956 | free = (unsigned long)n - (unsigned long)end_of_stack(p); | ||
5957 | } | ||
5958 | #endif | 5953 | #endif |
5959 | printk(KERN_CONT "%5lu %5d %6d\n", free, | 5954 | printk(KERN_CONT "%5lu %5d %6d\n", free, |
5960 | task_pid_nr(p), task_pid_nr(p->real_parent)); | 5955 | task_pid_nr(p), task_pid_nr(p->real_parent)); |
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index bac1061cea2f..da932f4c8524 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c | |||
@@ -960,12 +960,13 @@ static struct task_struct *pick_next_highest_task_rt(struct rq *rq, int cpu) | |||
960 | 960 | ||
961 | static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask); | 961 | static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask); |
962 | 962 | ||
963 | static inline int pick_optimal_cpu(int this_cpu, cpumask_t *mask) | 963 | static inline int pick_optimal_cpu(int this_cpu, |
964 | const struct cpumask *mask) | ||
964 | { | 965 | { |
965 | int first; | 966 | int first; |
966 | 967 | ||
967 | /* "this_cpu" is cheaper to preempt than a remote processor */ | 968 | /* "this_cpu" is cheaper to preempt than a remote processor */ |
968 | if ((this_cpu != -1) && cpu_isset(this_cpu, *mask)) | 969 | if ((this_cpu != -1) && cpumask_test_cpu(this_cpu, mask)) |
969 | return this_cpu; | 970 | return this_cpu; |
970 | 971 | ||
971 | first = cpumask_first(mask); | 972 | first = cpumask_first(mask); |
@@ -981,6 +982,7 @@ static int find_lowest_rq(struct task_struct *task) | |||
981 | struct cpumask *lowest_mask = __get_cpu_var(local_cpu_mask); | 982 | struct cpumask *lowest_mask = __get_cpu_var(local_cpu_mask); |
982 | int this_cpu = smp_processor_id(); | 983 | int this_cpu = smp_processor_id(); |
983 | int cpu = task_cpu(task); | 984 | int cpu = task_cpu(task); |
985 | cpumask_var_t domain_mask; | ||
984 | 986 | ||
985 | if (task->rt.nr_cpus_allowed == 1) | 987 | if (task->rt.nr_cpus_allowed == 1) |
986 | return -1; /* No other targets possible */ | 988 | return -1; /* No other targets possible */ |
@@ -1013,19 +1015,25 @@ static int find_lowest_rq(struct task_struct *task) | |||
1013 | if (this_cpu == cpu) | 1015 | if (this_cpu == cpu) |
1014 | this_cpu = -1; /* Skip this_cpu opt if the same */ | 1016 | this_cpu = -1; /* Skip this_cpu opt if the same */ |
1015 | 1017 | ||
1016 | for_each_domain(cpu, sd) { | 1018 | if (alloc_cpumask_var(&domain_mask, GFP_ATOMIC)) { |
1017 | if (sd->flags & SD_WAKE_AFFINE) { | 1019 | for_each_domain(cpu, sd) { |
1018 | cpumask_t domain_mask; | 1020 | if (sd->flags & SD_WAKE_AFFINE) { |
1019 | int best_cpu; | 1021 | int best_cpu; |
1020 | 1022 | ||
1021 | cpumask_and(&domain_mask, sched_domain_span(sd), | 1023 | cpumask_and(domain_mask, |
1022 | lowest_mask); | 1024 | sched_domain_span(sd), |
1025 | lowest_mask); | ||
1023 | 1026 | ||
1024 | best_cpu = pick_optimal_cpu(this_cpu, | 1027 | best_cpu = pick_optimal_cpu(this_cpu, |
1025 | &domain_mask); | 1028 | domain_mask); |
1026 | if (best_cpu != -1) | 1029 | |
1027 | return best_cpu; | 1030 | if (best_cpu != -1) { |
1031 | free_cpumask_var(domain_mask); | ||
1032 | return best_cpu; | ||
1033 | } | ||
1034 | } | ||
1028 | } | 1035 | } |
1036 | free_cpumask_var(domain_mask); | ||
1029 | } | 1037 | } |
1030 | 1038 | ||
1031 | /* | 1039 | /* |
diff --git a/kernel/softirq.c b/kernel/softirq.c index bdbe9de9cd8d..0365b4899a3d 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c | |||
@@ -795,6 +795,11 @@ int __init __weak early_irq_init(void) | |||
795 | return 0; | 795 | return 0; |
796 | } | 796 | } |
797 | 797 | ||
798 | int __init __weak arch_probe_nr_irqs(void) | ||
799 | { | ||
800 | return 0; | ||
801 | } | ||
802 | |||
798 | int __init __weak arch_early_irq_init(void) | 803 | int __init __weak arch_early_irq_init(void) |
799 | { | 804 | { |
800 | return 0; | 805 | return 0; |
diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig index 0bcf14640fde..84714a65e5c8 100644 --- a/sound/drivers/Kconfig +++ b/sound/drivers/Kconfig | |||
@@ -33,7 +33,7 @@ if SND_DRIVERS | |||
33 | 33 | ||
34 | config SND_PCSP | 34 | config SND_PCSP |
35 | tristate "PC-Speaker support (READ HELP!)" | 35 | tristate "PC-Speaker support (READ HELP!)" |
36 | depends on PCSPKR_PLATFORM && X86_PC && HIGH_RES_TIMERS | 36 | depends on PCSPKR_PLATFORM && X86 && HIGH_RES_TIMERS |
37 | depends on INPUT | 37 | depends on INPUT |
38 | depends on EXPERIMENTAL | 38 | depends on EXPERIMENTAL |
39 | select SND_PCM | 39 | select SND_PCM |