diff options
Diffstat (limited to 'arch/x86')
33 files changed, 445 insertions, 366 deletions
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index e02a359d2aa5..02b47a603fc8 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h | |||
@@ -3,6 +3,9 @@ | |||
3 | 3 | ||
4 | /* | 4 | /* |
5 | * Copyright 1992, Linus Torvalds. | 5 | * Copyright 1992, Linus Torvalds. |
6 | * | ||
7 | * Note: inlines with more than a single statement should be marked | ||
8 | * __always_inline to avoid problems with older gcc's inlining heuristics. | ||
6 | */ | 9 | */ |
7 | 10 | ||
8 | #ifndef _LINUX_BITOPS_H | 11 | #ifndef _LINUX_BITOPS_H |
@@ -53,7 +56,8 @@ | |||
53 | * Note that @nr may be almost arbitrarily large; this function is not | 56 | * Note that @nr may be almost arbitrarily large; this function is not |
54 | * restricted to acting on a single-word quantity. | 57 | * restricted to acting on a single-word quantity. |
55 | */ | 58 | */ |
56 | static inline void set_bit(unsigned int nr, volatile unsigned long *addr) | 59 | static __always_inline void |
60 | set_bit(unsigned int nr, volatile unsigned long *addr) | ||
57 | { | 61 | { |
58 | if (IS_IMMEDIATE(nr)) { | 62 | if (IS_IMMEDIATE(nr)) { |
59 | asm volatile(LOCK_PREFIX "orb %1,%0" | 63 | asm volatile(LOCK_PREFIX "orb %1,%0" |
@@ -90,7 +94,8 @@ static inline void __set_bit(int nr, volatile unsigned long *addr) | |||
90 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() | 94 | * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() |
91 | * in order to ensure changes are visible on other processors. | 95 | * in order to ensure changes are visible on other processors. |
92 | */ | 96 | */ |
93 | static inline void clear_bit(int nr, volatile unsigned long *addr) | 97 | static __always_inline void |
98 | clear_bit(int nr, volatile unsigned long *addr) | ||
94 | { | 99 | { |
95 | if (IS_IMMEDIATE(nr)) { | 100 | if (IS_IMMEDIATE(nr)) { |
96 | asm volatile(LOCK_PREFIX "andb %1,%0" | 101 | asm volatile(LOCK_PREFIX "andb %1,%0" |
@@ -204,7 +209,8 @@ static inline int test_and_set_bit(int nr, volatile unsigned long *addr) | |||
204 | * | 209 | * |
205 | * This is the same as test_and_set_bit on x86. | 210 | * This is the same as test_and_set_bit on x86. |
206 | */ | 211 | */ |
207 | static inline int test_and_set_bit_lock(int nr, volatile unsigned long *addr) | 212 | static __always_inline int |
213 | test_and_set_bit_lock(int nr, volatile unsigned long *addr) | ||
208 | { | 214 | { |
209 | return test_and_set_bit(nr, addr); | 215 | return test_and_set_bit(nr, addr); |
210 | } | 216 | } |
@@ -300,7 +306,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr) | |||
300 | return oldbit; | 306 | return oldbit; |
301 | } | 307 | } |
302 | 308 | ||
303 | static inline int constant_test_bit(unsigned int nr, const volatile unsigned long *addr) | 309 | static __always_inline int constant_test_bit(unsigned int nr, const volatile unsigned long *addr) |
304 | { | 310 | { |
305 | return ((1UL << (nr % BITS_PER_LONG)) & | 311 | return ((1UL << (nr % BITS_PER_LONG)) & |
306 | (((unsigned long *)addr)[nr / BITS_PER_LONG])) != 0; | 312 | (((unsigned long *)addr)[nr / BITS_PER_LONG])) != 0; |
diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h index bae482df6039..f03b23e32864 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,11 @@ 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 | #ifdef CONFIG_X86_HAS_BOOT_CPU_ID | ||
36 | extern unsigned char boot_cpu_id; | ||
37 | #else | ||
38 | #define boot_cpu_id 0 | ||
39 | #endif | ||
40 | |||
20 | #endif /* _ASM_X86_CPU_H */ | 41 | #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..26c6dad90479 --- /dev/null +++ b/arch/x86/include/asm/cpumask.h | |||
@@ -0,0 +1,28 @@ | |||
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 | #else /* CONFIG_X86_32 */ | ||
14 | |||
15 | extern cpumask_t cpu_callin_map; | ||
16 | extern cpumask_t cpu_callout_map; | ||
17 | extern cpumask_t cpu_initialized; | ||
18 | extern cpumask_t cpu_sibling_setup_map; | ||
19 | |||
20 | #define cpu_callin_mask ((struct cpumask *)&cpu_callin_map) | ||
21 | #define cpu_callout_mask ((struct cpumask *)&cpu_callout_map) | ||
22 | #define cpu_initialized_mask ((struct cpumask *)&cpu_initialized) | ||
23 | #define cpu_sibling_setup_mask ((struct cpumask *)&cpu_sibling_setup_map) | ||
24 | |||
25 | #endif /* CONFIG_X86_32 */ | ||
26 | |||
27 | #endif /* __ASSEMBLY__ */ | ||
28 | #endif /* _ASM_X86_CPUMASK_H */ | ||
diff --git a/arch/x86/include/asm/hardirq_32.h b/arch/x86/include/asm/hardirq_32.h index cf7954d1405f..d4b5d731073f 100644 --- a/arch/x86/include/asm/hardirq_32.h +++ b/arch/x86/include/asm/hardirq_32.h | |||
@@ -19,6 +19,9 @@ typedef struct { | |||
19 | 19 | ||
20 | DECLARE_PER_CPU(irq_cpustat_t, irq_stat); | 20 | DECLARE_PER_CPU(irq_cpustat_t, irq_stat); |
21 | 21 | ||
22 | /* We can have at most NR_VECTORS irqs routed to a cpu at a time */ | ||
23 | #define MAX_HARDIRQS_PER_CPU NR_VECTORS | ||
24 | |||
22 | #define __ARCH_IRQ_STAT | 25 | #define __ARCH_IRQ_STAT |
23 | #define __IRQ_STAT(cpu, member) (per_cpu(irq_stat, cpu).member) | 26 | #define __IRQ_STAT(cpu, member) (per_cpu(irq_stat, cpu).member) |
24 | 27 | ||
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 7a1f44ac1f17..08ec793aa043 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; |
diff --git a/arch/x86/include/asm/mach-default/mach_wakecpu.h b/arch/x86/include/asm/mach-default/mach_wakecpu.h index ceb013660146..89897a6a65b9 100644 --- a/arch/x86/include/asm/mach-default/mach_wakecpu.h +++ b/arch/x86/include/asm/mach-default/mach_wakecpu.h | |||
@@ -24,7 +24,13 @@ static inline void restore_NMI_vector(unsigned short *high, unsigned short *low) | |||
24 | { | 24 | { |
25 | } | 25 | } |
26 | 26 | ||
27 | #ifdef CONFIG_SMP | ||
27 | extern void __inquire_remote_apic(int apicid); | 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 */ | ||
28 | 34 | ||
29 | static inline void inquire_remote_apic(int apicid) | 35 | static inline void inquire_remote_apic(int apicid) |
30 | { | 36 | { |
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/mtrr.h b/arch/x86/include/asm/mtrr.h index cb988aab716d..14080d22edb3 100644 --- a/arch/x86/include/asm/mtrr.h +++ b/arch/x86/include/asm/mtrr.h | |||
@@ -58,15 +58,15 @@ struct mtrr_gentry { | |||
58 | #endif /* !__i386__ */ | 58 | #endif /* !__i386__ */ |
59 | 59 | ||
60 | struct mtrr_var_range { | 60 | struct mtrr_var_range { |
61 | u32 base_lo; | 61 | __u32 base_lo; |
62 | u32 base_hi; | 62 | __u32 base_hi; |
63 | u32 mask_lo; | 63 | __u32 mask_lo; |
64 | u32 mask_hi; | 64 | __u32 mask_hi; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | /* In the Intel processor's MTRR interface, the MTRR type is always held in | 67 | /* In the Intel processor's MTRR interface, the MTRR type is always held in |
68 | an 8 bit field: */ | 68 | an 8 bit field: */ |
69 | typedef u8 mtrr_type; | 69 | typedef __u8 mtrr_type; |
70 | 70 | ||
71 | #define MTRR_NUM_FIXED_RANGES 88 | 71 | #define MTRR_NUM_FIXED_RANGES 88 |
72 | #define MTRR_MAX_VAR_RANGES 256 | 72 | #define MTRR_MAX_VAR_RANGES 256 |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 83e69f4a37f0..06bbcbd66e9c 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -341,6 +341,25 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot) | |||
341 | 341 | ||
342 | #define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask) | 342 | #define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask) |
343 | 343 | ||
344 | static inline int is_new_memtype_allowed(unsigned long flags, | ||
345 | unsigned long new_flags) | ||
346 | { | ||
347 | /* | ||
348 | * Certain new memtypes are not allowed with certain | ||
349 | * requested memtype: | ||
350 | * - request is uncached, return cannot be write-back | ||
351 | * - request is write-combine, return cannot be write-back | ||
352 | */ | ||
353 | if ((flags == _PAGE_CACHE_UC_MINUS && | ||
354 | new_flags == _PAGE_CACHE_WB) || | ||
355 | (flags == _PAGE_CACHE_WC && | ||
356 | new_flags == _PAGE_CACHE_WB)) { | ||
357 | return 0; | ||
358 | } | ||
359 | |||
360 | return 1; | ||
361 | } | ||
362 | |||
344 | #ifndef __ASSEMBLY__ | 363 | #ifndef __ASSEMBLY__ |
345 | /* Indicate that x86 has its own track and untrack pfn vma functions */ | 364 | /* Indicate that x86 has its own track and untrack pfn vma functions */ |
346 | #define __HAVE_PFNMAP_TRACKING | 365 | #define __HAVE_PFNMAP_TRACKING |
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 19953df61c52..a8cea7b09434 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h | |||
@@ -17,30 +17,7 @@ | |||
17 | #endif | 17 | #endif |
18 | #include <asm/pda.h> | 18 | #include <asm/pda.h> |
19 | #include <asm/thread_info.h> | 19 | #include <asm/thread_info.h> |
20 | 20 | #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 | 21 | ||
45 | extern int __cpuinit get_local_pda(int cpu); | 22 | extern int __cpuinit get_local_pda(int cpu); |
46 | 23 | ||
@@ -167,8 +144,6 @@ void play_dead_common(void); | |||
167 | void native_send_call_func_ipi(const struct cpumask *mask); | 144 | void native_send_call_func_ipi(const struct cpumask *mask); |
168 | void native_send_call_func_single_ipi(int cpu); | 145 | void native_send_call_func_single_ipi(int cpu); |
169 | 146 | ||
170 | extern void prefill_possible_map(void); | ||
171 | |||
172 | void smp_store_cpu_info(int id); | 147 | void smp_store_cpu_info(int id); |
173 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) | 148 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) |
174 | 149 | ||
@@ -177,10 +152,6 @@ static inline int num_booting_cpus(void) | |||
177 | { | 152 | { |
178 | return cpumask_weight(cpu_callout_mask); | 153 | return cpumask_weight(cpu_callout_mask); |
179 | } | 154 | } |
180 | #else | ||
181 | static inline void prefill_possible_map(void) | ||
182 | { | ||
183 | } | ||
184 | #endif /* CONFIG_SMP */ | 155 | #endif /* CONFIG_SMP */ |
185 | 156 | ||
186 | extern unsigned disabled_cpus __cpuinitdata; | 157 | extern unsigned disabled_cpus __cpuinitdata; |
@@ -205,10 +176,6 @@ extern int safe_smp_processor_id(void); | |||
205 | }) | 176 | }) |
206 | #define safe_smp_processor_id() smp_processor_id() | 177 | #define safe_smp_processor_id() smp_processor_id() |
207 | 178 | ||
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 | 179 | #endif |
213 | 180 | ||
214 | #ifdef CONFIG_X86_LOCAL_APIC | 181 | #ifdef CONFIG_X86_LOCAL_APIC |
@@ -251,11 +218,5 @@ static inline int hard_smp_processor_id(void) | |||
251 | 218 | ||
252 | #endif /* CONFIG_X86_LOCAL_APIC */ | 219 | #endif /* CONFIG_X86_LOCAL_APIC */ |
253 | 220 | ||
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__ */ | 221 | #endif /* __ASSEMBLY__ */ |
261 | #endif /* _ASM_X86_SMP_H */ | 222 | #endif /* _ASM_X86_SMP_H */ |
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index f4e1b550ce61..17feaa9c7e76 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h | |||
@@ -175,4 +175,6 @@ static inline void flush_tlb_kernel_range(unsigned long start, | |||
175 | flush_tlb_all(); | 175 | flush_tlb_all(); |
176 | } | 176 | } |
177 | 177 | ||
178 | extern void zap_low_mappings(void); | ||
179 | |||
178 | #endif /* _ASM_X86_TLBFLUSH_H */ | 180 | #endif /* _ASM_X86_TLBFLUSH_H */ |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index d37593c2f438..4cb5964f1499 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -912,8 +912,8 @@ static u8 __init uniq_ioapic_id(u8 id) | |||
912 | DECLARE_BITMAP(used, 256); | 912 | DECLARE_BITMAP(used, 256); |
913 | bitmap_zero(used, 256); | 913 | bitmap_zero(used, 256); |
914 | for (i = 0; i < nr_ioapics; i++) { | 914 | for (i = 0; i < nr_ioapics; i++) { |
915 | struct mp_config_ioapic *ia = &mp_ioapics[i]; | 915 | struct mpc_ioapic *ia = &mp_ioapics[i]; |
916 | __set_bit(ia->mp_apicid, used); | 916 | __set_bit(ia->apicid, used); |
917 | } | 917 | } |
918 | if (!test_bit(id, used)) | 918 | if (!test_bit(id, used)) |
919 | return id; | 919 | return id; |
@@ -945,47 +945,47 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) | |||
945 | 945 | ||
946 | idx = nr_ioapics; | 946 | idx = nr_ioapics; |
947 | 947 | ||
948 | mp_ioapics[idx].mp_type = MP_IOAPIC; | 948 | mp_ioapics[idx].type = MP_IOAPIC; |
949 | mp_ioapics[idx].mp_flags = MPC_APIC_USABLE; | 949 | mp_ioapics[idx].flags = MPC_APIC_USABLE; |
950 | mp_ioapics[idx].mp_apicaddr = address; | 950 | mp_ioapics[idx].apicaddr = address; |
951 | 951 | ||
952 | set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); | 952 | set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); |
953 | mp_ioapics[idx].mp_apicid = uniq_ioapic_id(id); | 953 | mp_ioapics[idx].apicid = uniq_ioapic_id(id); |
954 | #ifdef CONFIG_X86_32 | 954 | #ifdef CONFIG_X86_32 |
955 | mp_ioapics[idx].mp_apicver = io_apic_get_version(idx); | 955 | mp_ioapics[idx].apicver = io_apic_get_version(idx); |
956 | #else | 956 | #else |
957 | mp_ioapics[idx].mp_apicver = 0; | 957 | mp_ioapics[idx].apicver = 0; |
958 | #endif | 958 | #endif |
959 | /* | 959 | /* |
960 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups | 960 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups |
961 | * and to prevent reprogramming of IOAPIC pins (PCI GSIs). | 961 | * and to prevent reprogramming of IOAPIC pins (PCI GSIs). |
962 | */ | 962 | */ |
963 | mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].mp_apicid; | 963 | mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].apicid; |
964 | mp_ioapic_routing[idx].gsi_base = gsi_base; | 964 | mp_ioapic_routing[idx].gsi_base = gsi_base; |
965 | mp_ioapic_routing[idx].gsi_end = gsi_base + | 965 | mp_ioapic_routing[idx].gsi_end = gsi_base + |
966 | io_apic_get_redir_entries(idx); | 966 | io_apic_get_redir_entries(idx); |
967 | 967 | ||
968 | printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%lx, " | 968 | printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " |
969 | "GSI %d-%d\n", idx, mp_ioapics[idx].mp_apicid, | 969 | "GSI %d-%d\n", idx, mp_ioapics[idx].apicid, |
970 | mp_ioapics[idx].mp_apicver, mp_ioapics[idx].mp_apicaddr, | 970 | mp_ioapics[idx].apicver, mp_ioapics[idx].apicaddr, |
971 | mp_ioapic_routing[idx].gsi_base, mp_ioapic_routing[idx].gsi_end); | 971 | mp_ioapic_routing[idx].gsi_base, mp_ioapic_routing[idx].gsi_end); |
972 | 972 | ||
973 | nr_ioapics++; | 973 | nr_ioapics++; |
974 | } | 974 | } |
975 | 975 | ||
976 | static void assign_to_mp_irq(struct mp_config_intsrc *m, | 976 | static void assign_to_mp_irq(struct mpc_intsrc *m, |
977 | struct mp_config_intsrc *mp_irq) | 977 | struct mpc_intsrc *mp_irq) |
978 | { | 978 | { |
979 | memcpy(mp_irq, m, sizeof(struct mp_config_intsrc)); | 979 | memcpy(mp_irq, m, sizeof(struct mpc_intsrc)); |
980 | } | 980 | } |
981 | 981 | ||
982 | static int mp_irq_cmp(struct mp_config_intsrc *mp_irq, | 982 | static int mp_irq_cmp(struct mpc_intsrc *mp_irq, |
983 | struct mp_config_intsrc *m) | 983 | struct mpc_intsrc *m) |
984 | { | 984 | { |
985 | return memcmp(mp_irq, m, sizeof(struct mp_config_intsrc)); | 985 | return memcmp(mp_irq, m, sizeof(struct mpc_intsrc)); |
986 | } | 986 | } |
987 | 987 | ||
988 | static void save_mp_irq(struct mp_config_intsrc *m) | 988 | static void save_mp_irq(struct mpc_intsrc *m) |
989 | { | 989 | { |
990 | int i; | 990 | int i; |
991 | 991 | ||
@@ -1003,7 +1003,7 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) | |||
1003 | { | 1003 | { |
1004 | int ioapic; | 1004 | int ioapic; |
1005 | int pin; | 1005 | int pin; |
1006 | struct mp_config_intsrc mp_irq; | 1006 | struct mpc_intsrc mp_irq; |
1007 | 1007 | ||
1008 | /* | 1008 | /* |
1009 | * Convert 'gsi' to 'ioapic.pin'. | 1009 | * Convert 'gsi' to 'ioapic.pin'. |
@@ -1021,13 +1021,13 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) | |||
1021 | if ((bus_irq == 0) && (trigger == 3)) | 1021 | if ((bus_irq == 0) && (trigger == 3)) |
1022 | trigger = 1; | 1022 | trigger = 1; |
1023 | 1023 | ||
1024 | mp_irq.mp_type = MP_INTSRC; | 1024 | mp_irq.type = MP_INTSRC; |
1025 | mp_irq.mp_irqtype = mp_INT; | 1025 | mp_irq.irqtype = mp_INT; |
1026 | mp_irq.mp_irqflag = (trigger << 2) | polarity; | 1026 | mp_irq.irqflag = (trigger << 2) | polarity; |
1027 | mp_irq.mp_srcbus = MP_ISA_BUS; | 1027 | mp_irq.srcbus = MP_ISA_BUS; |
1028 | mp_irq.mp_srcbusirq = bus_irq; /* IRQ */ | 1028 | mp_irq.srcbusirq = bus_irq; /* IRQ */ |
1029 | mp_irq.mp_dstapic = mp_ioapics[ioapic].mp_apicid; /* APIC ID */ | 1029 | mp_irq.dstapic = mp_ioapics[ioapic].apicid; /* APIC ID */ |
1030 | mp_irq.mp_dstirq = pin; /* INTIN# */ | 1030 | mp_irq.dstirq = pin; /* INTIN# */ |
1031 | 1031 | ||
1032 | save_mp_irq(&mp_irq); | 1032 | save_mp_irq(&mp_irq); |
1033 | } | 1033 | } |
@@ -1037,7 +1037,7 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
1037 | int i; | 1037 | int i; |
1038 | int ioapic; | 1038 | int ioapic; |
1039 | unsigned int dstapic; | 1039 | unsigned int dstapic; |
1040 | struct mp_config_intsrc mp_irq; | 1040 | struct mpc_intsrc mp_irq; |
1041 | 1041 | ||
1042 | #if defined (CONFIG_MCA) || defined (CONFIG_EISA) | 1042 | #if defined (CONFIG_MCA) || defined (CONFIG_EISA) |
1043 | /* | 1043 | /* |
@@ -1062,7 +1062,7 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
1062 | ioapic = mp_find_ioapic(0); | 1062 | ioapic = mp_find_ioapic(0); |
1063 | if (ioapic < 0) | 1063 | if (ioapic < 0) |
1064 | return; | 1064 | return; |
1065 | dstapic = mp_ioapics[ioapic].mp_apicid; | 1065 | dstapic = mp_ioapics[ioapic].apicid; |
1066 | 1066 | ||
1067 | /* | 1067 | /* |
1068 | * Use the default configuration for the IRQs 0-15. Unless | 1068 | * Use the default configuration for the IRQs 0-15. Unless |
@@ -1072,16 +1072,14 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
1072 | int idx; | 1072 | int idx; |
1073 | 1073 | ||
1074 | for (idx = 0; idx < mp_irq_entries; idx++) { | 1074 | for (idx = 0; idx < mp_irq_entries; idx++) { |
1075 | struct mp_config_intsrc *irq = mp_irqs + idx; | 1075 | struct mpc_intsrc *irq = mp_irqs + idx; |
1076 | 1076 | ||
1077 | /* Do we already have a mapping for this ISA IRQ? */ | 1077 | /* Do we already have a mapping for this ISA IRQ? */ |
1078 | if (irq->mp_srcbus == MP_ISA_BUS | 1078 | if (irq->srcbus == MP_ISA_BUS && irq->srcbusirq == i) |
1079 | && irq->mp_srcbusirq == i) | ||
1080 | break; | 1079 | break; |
1081 | 1080 | ||
1082 | /* Do we already have a mapping for this IOAPIC pin */ | 1081 | /* Do we already have a mapping for this IOAPIC pin */ |
1083 | if (irq->mp_dstapic == dstapic && | 1082 | if (irq->dstapic == dstapic && irq->dstirq == i) |
1084 | irq->mp_dstirq == i) | ||
1085 | break; | 1083 | break; |
1086 | } | 1084 | } |
1087 | 1085 | ||
@@ -1090,13 +1088,13 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
1090 | continue; /* IRQ already used */ | 1088 | continue; /* IRQ already used */ |
1091 | } | 1089 | } |
1092 | 1090 | ||
1093 | mp_irq.mp_type = MP_INTSRC; | 1091 | mp_irq.type = MP_INTSRC; |
1094 | mp_irq.mp_irqflag = 0; /* Conforming */ | 1092 | mp_irq.irqflag = 0; /* Conforming */ |
1095 | mp_irq.mp_srcbus = MP_ISA_BUS; | 1093 | mp_irq.srcbus = MP_ISA_BUS; |
1096 | mp_irq.mp_dstapic = dstapic; | 1094 | mp_irq.dstapic = dstapic; |
1097 | mp_irq.mp_irqtype = mp_INT; | 1095 | mp_irq.irqtype = mp_INT; |
1098 | mp_irq.mp_srcbusirq = i; /* Identity mapped */ | 1096 | mp_irq.srcbusirq = i; /* Identity mapped */ |
1099 | mp_irq.mp_dstirq = i; | 1097 | mp_irq.dstirq = i; |
1100 | 1098 | ||
1101 | save_mp_irq(&mp_irq); | 1099 | save_mp_irq(&mp_irq); |
1102 | } | 1100 | } |
@@ -1207,22 +1205,22 @@ int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin, | |||
1207 | u32 gsi, int triggering, int polarity) | 1205 | u32 gsi, int triggering, int polarity) |
1208 | { | 1206 | { |
1209 | #ifdef CONFIG_X86_MPPARSE | 1207 | #ifdef CONFIG_X86_MPPARSE |
1210 | struct mp_config_intsrc mp_irq; | 1208 | struct mpc_intsrc mp_irq; |
1211 | int ioapic; | 1209 | int ioapic; |
1212 | 1210 | ||
1213 | if (!acpi_ioapic) | 1211 | if (!acpi_ioapic) |
1214 | return 0; | 1212 | return 0; |
1215 | 1213 | ||
1216 | /* print the entry should happen on mptable identically */ | 1214 | /* print the entry should happen on mptable identically */ |
1217 | mp_irq.mp_type = MP_INTSRC; | 1215 | mp_irq.type = MP_INTSRC; |
1218 | mp_irq.mp_irqtype = mp_INT; | 1216 | mp_irq.irqtype = mp_INT; |
1219 | mp_irq.mp_irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) | | 1217 | mp_irq.irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) | |
1220 | (polarity == ACPI_ACTIVE_HIGH ? 1 : 3); | 1218 | (polarity == ACPI_ACTIVE_HIGH ? 1 : 3); |
1221 | mp_irq.mp_srcbus = number; | 1219 | mp_irq.srcbus = number; |
1222 | mp_irq.mp_srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3); | 1220 | mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3); |
1223 | ioapic = mp_find_ioapic(gsi); | 1221 | ioapic = mp_find_ioapic(gsi); |
1224 | mp_irq.mp_dstapic = mp_ioapic_routing[ioapic].apic_id; | 1222 | mp_irq.dstapic = mp_ioapic_routing[ioapic].apic_id; |
1225 | mp_irq.mp_dstirq = gsi - mp_ioapic_routing[ioapic].gsi_base; | 1223 | mp_irq.dstirq = gsi - mp_ioapic_routing[ioapic].gsi_base; |
1226 | 1224 | ||
1227 | save_mp_irq(&mp_irq); | 1225 | save_mp_irq(&mp_irq); |
1228 | #endif | 1226 | #endif |
diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c index 566a08466b19..38d6aab2358d 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <asm/proto.h> | 47 | #include <asm/proto.h> |
48 | #include <asm/apic.h> | 48 | #include <asm/apic.h> |
49 | #include <asm/i8259.h> | 49 | #include <asm/i8259.h> |
50 | #include <asm/smp.h> | ||
50 | 51 | ||
51 | #include <mach_apic.h> | 52 | #include <mach_apic.h> |
52 | #include <mach_apicdef.h> | 53 | #include <mach_apicdef.h> |
@@ -894,6 +895,10 @@ void disable_local_APIC(void) | |||
894 | { | 895 | { |
895 | unsigned int value; | 896 | unsigned int value; |
896 | 897 | ||
898 | /* APIC hasn't been mapped yet */ | ||
899 | if (!apic_phys) | ||
900 | return; | ||
901 | |||
897 | clear_local_APIC(); | 902 | clear_local_APIC(); |
898 | 903 | ||
899 | /* | 904 | /* |
@@ -1125,6 +1130,11 @@ void __cpuinit setup_local_APIC(void) | |||
1125 | unsigned int value; | 1130 | unsigned int value; |
1126 | int i, j; | 1131 | int i, j; |
1127 | 1132 | ||
1133 | if (disable_apic) { | ||
1134 | disable_ioapic_setup(); | ||
1135 | return; | ||
1136 | } | ||
1137 | |||
1128 | #ifdef CONFIG_X86_32 | 1138 | #ifdef CONFIG_X86_32 |
1129 | /* Pound the ESR really hard over the head with a big hammer - mbligh */ | 1139 | /* Pound the ESR really hard over the head with a big hammer - mbligh */ |
1130 | if (lapic_is_integrated() && esr_disable) { | 1140 | if (lapic_is_integrated() && esr_disable) { |
@@ -1565,11 +1575,11 @@ int apic_version[MAX_APICS]; | |||
1565 | 1575 | ||
1566 | int __init APIC_init_uniprocessor(void) | 1576 | int __init APIC_init_uniprocessor(void) |
1567 | { | 1577 | { |
1568 | #ifdef CONFIG_X86_64 | ||
1569 | if (disable_apic) { | 1578 | if (disable_apic) { |
1570 | pr_info("Apic disabled\n"); | 1579 | pr_info("Apic disabled\n"); |
1571 | return -1; | 1580 | return -1; |
1572 | } | 1581 | } |
1582 | #ifdef CONFIG_X86_64 | ||
1573 | if (!cpu_has_apic) { | 1583 | if (!cpu_has_apic) { |
1574 | disable_apic = 1; | 1584 | disable_apic = 1; |
1575 | pr_info("Apic disabled by BIOS\n"); | 1585 | pr_info("Apic disabled by BIOS\n"); |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 83492b1f93b1..f00258462444 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -21,6 +21,8 @@ | |||
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> |
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index 06fcd8f9323c..8f3c95c7e61f 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -150,9 +150,8 @@ struct drv_cmd { | |||
150 | u32 val; | 150 | u32 val; |
151 | }; | 151 | }; |
152 | 152 | ||
153 | static long do_drv_read(void *_cmd) | 153 | static void do_drv_read(struct drv_cmd *cmd) |
154 | { | 154 | { |
155 | struct drv_cmd *cmd = _cmd; | ||
156 | u32 h; | 155 | u32 h; |
157 | 156 | ||
158 | switch (cmd->type) { | 157 | switch (cmd->type) { |
@@ -167,12 +166,10 @@ static long do_drv_read(void *_cmd) | |||
167 | default: | 166 | default: |
168 | break; | 167 | break; |
169 | } | 168 | } |
170 | return 0; | ||
171 | } | 169 | } |
172 | 170 | ||
173 | static long do_drv_write(void *_cmd) | 171 | static void do_drv_write(struct drv_cmd *cmd) |
174 | { | 172 | { |
175 | struct drv_cmd *cmd = _cmd; | ||
176 | u32 lo, hi; | 173 | u32 lo, hi; |
177 | 174 | ||
178 | switch (cmd->type) { | 175 | switch (cmd->type) { |
@@ -189,23 +186,30 @@ static long do_drv_write(void *_cmd) | |||
189 | default: | 186 | default: |
190 | break; | 187 | break; |
191 | } | 188 | } |
192 | return 0; | ||
193 | } | 189 | } |
194 | 190 | ||
195 | static void drv_read(struct drv_cmd *cmd) | 191 | static void drv_read(struct drv_cmd *cmd) |
196 | { | 192 | { |
193 | cpumask_t saved_mask = current->cpus_allowed; | ||
197 | cmd->val = 0; | 194 | cmd->val = 0; |
198 | 195 | ||
199 | work_on_cpu(cpumask_any(cmd->mask), do_drv_read, cmd); | 196 | set_cpus_allowed_ptr(current, cmd->mask); |
197 | do_drv_read(cmd); | ||
198 | set_cpus_allowed_ptr(current, &saved_mask); | ||
200 | } | 199 | } |
201 | 200 | ||
202 | static void drv_write(struct drv_cmd *cmd) | 201 | static void drv_write(struct drv_cmd *cmd) |
203 | { | 202 | { |
203 | cpumask_t saved_mask = current->cpus_allowed; | ||
204 | unsigned int i; | 204 | unsigned int i; |
205 | 205 | ||
206 | for_each_cpu(i, cmd->mask) { | 206 | for_each_cpu(i, cmd->mask) { |
207 | work_on_cpu(i, do_drv_write, cmd); | 207 | set_cpus_allowed_ptr(current, cpumask_of(i)); |
208 | do_drv_write(cmd); | ||
208 | } | 209 | } |
210 | |||
211 | set_cpus_allowed_ptr(current, &saved_mask); | ||
212 | return; | ||
209 | } | 213 | } |
210 | 214 | ||
211 | static u32 get_cur_val(const struct cpumask *mask) | 215 | static u32 get_cur_val(const struct cpumask *mask) |
@@ -231,15 +235,8 @@ static u32 get_cur_val(const struct cpumask *mask) | |||
231 | return 0; | 235 | return 0; |
232 | } | 236 | } |
233 | 237 | ||
234 | if (unlikely(!alloc_cpumask_var(&cmd.mask, GFP_KERNEL))) | ||
235 | return 0; | ||
236 | |||
237 | cpumask_copy(cmd.mask, mask); | ||
238 | |||
239 | drv_read(&cmd); | 238 | drv_read(&cmd); |
240 | 239 | ||
241 | free_cpumask_var(cmd.mask); | ||
242 | |||
243 | dprintk("get_cur_val = %u\n", cmd.val); | 240 | dprintk("get_cur_val = %u\n", cmd.val); |
244 | 241 | ||
245 | return cmd.val; | 242 | return cmd.val; |
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index c689d19e35ab..11b93cabdf78 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c | |||
@@ -24,7 +24,7 @@ | |||
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 | ||
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index d6f0490a7391..46469029e9d3 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -1203,7 +1203,6 @@ nmi_stack_correct: | |||
1203 | pushl %eax | 1203 | pushl %eax |
1204 | CFI_ADJUST_CFA_OFFSET 4 | 1204 | CFI_ADJUST_CFA_OFFSET 4 |
1205 | SAVE_ALL | 1205 | SAVE_ALL |
1206 | TRACE_IRQS_OFF | ||
1207 | xorl %edx,%edx # zero error code | 1206 | xorl %edx,%edx # zero error code |
1208 | movl %esp,%eax # pt_regs pointer | 1207 | movl %esp,%eax # pt_regs pointer |
1209 | call do_nmi | 1208 | call do_nmi |
@@ -1244,7 +1243,6 @@ nmi_espfix_stack: | |||
1244 | pushl %eax | 1243 | pushl %eax |
1245 | CFI_ADJUST_CFA_OFFSET 4 | 1244 | CFI_ADJUST_CFA_OFFSET 4 |
1246 | SAVE_ALL | 1245 | SAVE_ALL |
1247 | TRACE_IRQS_OFF | ||
1248 | FIXUP_ESPFIX_STACK # %eax == %esp | 1246 | FIXUP_ESPFIX_STACK # %eax == %esp |
1249 | xorl %edx,%edx # zero error code | 1247 | xorl %edx,%edx # zero error code |
1250 | call do_nmi | 1248 | call do_nmi |
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c index 157986916cd1..f79660390724 100644 --- a/arch/x86/kernel/io_apic.c +++ b/arch/x86/kernel/io_apic.c | |||
@@ -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> |
@@ -82,11 +83,11 @@ static DEFINE_SPINLOCK(vector_lock); | |||
82 | int nr_ioapic_registers[MAX_IO_APICS]; | 83 | int nr_ioapic_registers[MAX_IO_APICS]; |
83 | 84 | ||
84 | /* I/O APIC entries */ | 85 | /* I/O APIC entries */ |
85 | struct mp_config_ioapic mp_ioapics[MAX_IO_APICS]; | 86 | struct mpc_ioapic mp_ioapics[MAX_IO_APICS]; |
86 | int nr_ioapics; | 87 | int nr_ioapics; |
87 | 88 | ||
88 | /* MP IRQ source entries */ | 89 | /* MP IRQ source entries */ |
89 | struct mp_config_intsrc mp_irqs[MAX_IRQ_SOURCES]; | 90 | struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES]; |
90 | 91 | ||
91 | /* # of MP IRQ source entries */ | 92 | /* # of MP IRQ source entries */ |
92 | int mp_irq_entries; | 93 | int mp_irq_entries; |
@@ -386,7 +387,7 @@ struct io_apic { | |||
386 | static __attribute_const__ struct io_apic __iomem *io_apic_base(int idx) | 387 | static __attribute_const__ struct io_apic __iomem *io_apic_base(int idx) |
387 | { | 388 | { |
388 | return (void __iomem *) __fix_to_virt(FIX_IO_APIC_BASE_0 + idx) | 389 | return (void __iomem *) __fix_to_virt(FIX_IO_APIC_BASE_0 + idx) |
389 | + (mp_ioapics[idx].mp_apicaddr & ~PAGE_MASK); | 390 | + (mp_ioapics[idx].apicaddr & ~PAGE_MASK); |
390 | } | 391 | } |
391 | 392 | ||
392 | static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg) | 393 | static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg) |
@@ -944,10 +945,10 @@ static int find_irq_entry(int apic, int pin, int type) | |||
944 | int i; | 945 | int i; |
945 | 946 | ||
946 | for (i = 0; i < mp_irq_entries; i++) | 947 | for (i = 0; i < mp_irq_entries; i++) |
947 | if (mp_irqs[i].mp_irqtype == type && | 948 | if (mp_irqs[i].irqtype == type && |
948 | (mp_irqs[i].mp_dstapic == mp_ioapics[apic].mp_apicid || | 949 | (mp_irqs[i].dstapic == mp_ioapics[apic].apicid || |
949 | mp_irqs[i].mp_dstapic == MP_APIC_ALL) && | 950 | mp_irqs[i].dstapic == MP_APIC_ALL) && |
950 | mp_irqs[i].mp_dstirq == pin) | 951 | mp_irqs[i].dstirq == pin) |
951 | return i; | 952 | return i; |
952 | 953 | ||
953 | return -1; | 954 | return -1; |
@@ -961,13 +962,13 @@ static int __init find_isa_irq_pin(int irq, int type) | |||
961 | int i; | 962 | int i; |
962 | 963 | ||
963 | for (i = 0; i < mp_irq_entries; i++) { | 964 | for (i = 0; i < mp_irq_entries; i++) { |
964 | int lbus = mp_irqs[i].mp_srcbus; | 965 | int lbus = mp_irqs[i].srcbus; |
965 | 966 | ||
966 | if (test_bit(lbus, mp_bus_not_pci) && | 967 | if (test_bit(lbus, mp_bus_not_pci) && |
967 | (mp_irqs[i].mp_irqtype == type) && | 968 | (mp_irqs[i].irqtype == type) && |
968 | (mp_irqs[i].mp_srcbusirq == irq)) | 969 | (mp_irqs[i].srcbusirq == irq)) |
969 | 970 | ||
970 | return mp_irqs[i].mp_dstirq; | 971 | return mp_irqs[i].dstirq; |
971 | } | 972 | } |
972 | return -1; | 973 | return -1; |
973 | } | 974 | } |
@@ -977,17 +978,17 @@ static int __init find_isa_irq_apic(int irq, int type) | |||
977 | int i; | 978 | int i; |
978 | 979 | ||
979 | for (i = 0; i < mp_irq_entries; i++) { | 980 | for (i = 0; i < mp_irq_entries; i++) { |
980 | int lbus = mp_irqs[i].mp_srcbus; | 981 | int lbus = mp_irqs[i].srcbus; |
981 | 982 | ||
982 | if (test_bit(lbus, mp_bus_not_pci) && | 983 | if (test_bit(lbus, mp_bus_not_pci) && |
983 | (mp_irqs[i].mp_irqtype == type) && | 984 | (mp_irqs[i].irqtype == type) && |
984 | (mp_irqs[i].mp_srcbusirq == irq)) | 985 | (mp_irqs[i].srcbusirq == irq)) |
985 | break; | 986 | break; |
986 | } | 987 | } |
987 | if (i < mp_irq_entries) { | 988 | if (i < mp_irq_entries) { |
988 | int apic; | 989 | int apic; |
989 | for(apic = 0; apic < nr_ioapics; apic++) { | 990 | for(apic = 0; apic < nr_ioapics; apic++) { |
990 | if (mp_ioapics[apic].mp_apicid == mp_irqs[i].mp_dstapic) | 991 | if (mp_ioapics[apic].apicid == mp_irqs[i].dstapic) |
991 | return apic; | 992 | return apic; |
992 | } | 993 | } |
993 | } | 994 | } |
@@ -1012,23 +1013,23 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin) | |||
1012 | return -1; | 1013 | return -1; |
1013 | } | 1014 | } |
1014 | for (i = 0; i < mp_irq_entries; i++) { | 1015 | for (i = 0; i < mp_irq_entries; i++) { |
1015 | int lbus = mp_irqs[i].mp_srcbus; | 1016 | int lbus = mp_irqs[i].srcbus; |
1016 | 1017 | ||
1017 | for (apic = 0; apic < nr_ioapics; apic++) | 1018 | for (apic = 0; apic < nr_ioapics; apic++) |
1018 | if (mp_ioapics[apic].mp_apicid == mp_irqs[i].mp_dstapic || | 1019 | if (mp_ioapics[apic].apicid == mp_irqs[i].dstapic || |
1019 | mp_irqs[i].mp_dstapic == MP_APIC_ALL) | 1020 | mp_irqs[i].dstapic == MP_APIC_ALL) |
1020 | break; | 1021 | break; |
1021 | 1022 | ||
1022 | if (!test_bit(lbus, mp_bus_not_pci) && | 1023 | if (!test_bit(lbus, mp_bus_not_pci) && |
1023 | !mp_irqs[i].mp_irqtype && | 1024 | !mp_irqs[i].irqtype && |
1024 | (bus == lbus) && | 1025 | (bus == lbus) && |
1025 | (slot == ((mp_irqs[i].mp_srcbusirq >> 2) & 0x1f))) { | 1026 | (slot == ((mp_irqs[i].srcbusirq >> 2) & 0x1f))) { |
1026 | int irq = pin_2_irq(i,apic,mp_irqs[i].mp_dstirq); | 1027 | int irq = pin_2_irq(i, apic, mp_irqs[i].dstirq); |
1027 | 1028 | ||
1028 | if (!(apic || IO_APIC_IRQ(irq))) | 1029 | if (!(apic || IO_APIC_IRQ(irq))) |
1029 | continue; | 1030 | continue; |
1030 | 1031 | ||
1031 | if (pin == (mp_irqs[i].mp_srcbusirq & 3)) | 1032 | if (pin == (mp_irqs[i].srcbusirq & 3)) |
1032 | return irq; | 1033 | return irq; |
1033 | /* | 1034 | /* |
1034 | * Use the first all-but-pin matching entry as a | 1035 | * Use the first all-but-pin matching entry as a |
@@ -1071,7 +1072,7 @@ static int EISA_ELCR(unsigned int irq) | |||
1071 | * EISA conforming in the MP table, that means its trigger type must | 1072 | * EISA conforming in the MP table, that means its trigger type must |
1072 | * be read in from the ELCR */ | 1073 | * be read in from the ELCR */ |
1073 | 1074 | ||
1074 | #define default_EISA_trigger(idx) (EISA_ELCR(mp_irqs[idx].mp_srcbusirq)) | 1075 | #define default_EISA_trigger(idx) (EISA_ELCR(mp_irqs[idx].srcbusirq)) |
1075 | #define default_EISA_polarity(idx) default_ISA_polarity(idx) | 1076 | #define default_EISA_polarity(idx) default_ISA_polarity(idx) |
1076 | 1077 | ||
1077 | /* PCI interrupts are always polarity one level triggered, | 1078 | /* PCI interrupts are always polarity one level triggered, |
@@ -1088,13 +1089,13 @@ static int EISA_ELCR(unsigned int irq) | |||
1088 | 1089 | ||
1089 | static int MPBIOS_polarity(int idx) | 1090 | static int MPBIOS_polarity(int idx) |
1090 | { | 1091 | { |
1091 | int bus = mp_irqs[idx].mp_srcbus; | 1092 | int bus = mp_irqs[idx].srcbus; |
1092 | int polarity; | 1093 | int polarity; |
1093 | 1094 | ||
1094 | /* | 1095 | /* |
1095 | * Determine IRQ line polarity (high active or low active): | 1096 | * Determine IRQ line polarity (high active or low active): |
1096 | */ | 1097 | */ |
1097 | switch (mp_irqs[idx].mp_irqflag & 3) | 1098 | switch (mp_irqs[idx].irqflag & 3) |
1098 | { | 1099 | { |
1099 | case 0: /* conforms, ie. bus-type dependent polarity */ | 1100 | case 0: /* conforms, ie. bus-type dependent polarity */ |
1100 | if (test_bit(bus, mp_bus_not_pci)) | 1101 | if (test_bit(bus, mp_bus_not_pci)) |
@@ -1130,13 +1131,13 @@ static int MPBIOS_polarity(int idx) | |||
1130 | 1131 | ||
1131 | static int MPBIOS_trigger(int idx) | 1132 | static int MPBIOS_trigger(int idx) |
1132 | { | 1133 | { |
1133 | int bus = mp_irqs[idx].mp_srcbus; | 1134 | int bus = mp_irqs[idx].srcbus; |
1134 | int trigger; | 1135 | int trigger; |
1135 | 1136 | ||
1136 | /* | 1137 | /* |
1137 | * Determine IRQ trigger mode (edge or level sensitive): | 1138 | * Determine IRQ trigger mode (edge or level sensitive): |
1138 | */ | 1139 | */ |
1139 | switch ((mp_irqs[idx].mp_irqflag>>2) & 3) | 1140 | switch ((mp_irqs[idx].irqflag>>2) & 3) |
1140 | { | 1141 | { |
1141 | case 0: /* conforms, ie. bus-type dependent */ | 1142 | case 0: /* conforms, ie. bus-type dependent */ |
1142 | if (test_bit(bus, mp_bus_not_pci)) | 1143 | if (test_bit(bus, mp_bus_not_pci)) |
@@ -1214,16 +1215,16 @@ int (*ioapic_renumber_irq)(int ioapic, int irq); | |||
1214 | static int pin_2_irq(int idx, int apic, int pin) | 1215 | static int pin_2_irq(int idx, int apic, int pin) |
1215 | { | 1216 | { |
1216 | int irq, i; | 1217 | int irq, i; |
1217 | int bus = mp_irqs[idx].mp_srcbus; | 1218 | int bus = mp_irqs[idx].srcbus; |
1218 | 1219 | ||
1219 | /* | 1220 | /* |
1220 | * Debugging check, we are in big trouble if this message pops up! | 1221 | * Debugging check, we are in big trouble if this message pops up! |
1221 | */ | 1222 | */ |
1222 | if (mp_irqs[idx].mp_dstirq != pin) | 1223 | if (mp_irqs[idx].dstirq != pin) |
1223 | printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n"); | 1224 | printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n"); |
1224 | 1225 | ||
1225 | if (test_bit(bus, mp_bus_not_pci)) { | 1226 | if (test_bit(bus, mp_bus_not_pci)) { |
1226 | irq = mp_irqs[idx].mp_srcbusirq; | 1227 | irq = mp_irqs[idx].srcbusirq; |
1227 | } else { | 1228 | } else { |
1228 | /* | 1229 | /* |
1229 | * PCI IRQs are mapped in order | 1230 | * PCI IRQs are mapped in order |
@@ -1566,14 +1567,14 @@ static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq, struct irq_de | |||
1566 | apic_printk(APIC_VERBOSE,KERN_DEBUG | 1567 | apic_printk(APIC_VERBOSE,KERN_DEBUG |
1567 | "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> " | 1568 | "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> " |
1568 | "IRQ %d Mode:%i Active:%i)\n", | 1569 | "IRQ %d Mode:%i Active:%i)\n", |
1569 | apic, mp_ioapics[apic].mp_apicid, pin, cfg->vector, | 1570 | apic, mp_ioapics[apic].apicid, pin, cfg->vector, |
1570 | irq, trigger, polarity); | 1571 | irq, trigger, polarity); |
1571 | 1572 | ||
1572 | 1573 | ||
1573 | if (setup_ioapic_entry(mp_ioapics[apic].mp_apicid, irq, &entry, | 1574 | if (setup_ioapic_entry(mp_ioapics[apic].apicid, irq, &entry, |
1574 | dest, trigger, polarity, cfg->vector)) { | 1575 | dest, trigger, polarity, cfg->vector)) { |
1575 | printk("Failed to setup ioapic entry for ioapic %d, pin %d\n", | 1576 | printk("Failed to setup ioapic entry for ioapic %d, pin %d\n", |
1576 | mp_ioapics[apic].mp_apicid, pin); | 1577 | mp_ioapics[apic].apicid, pin); |
1577 | __clear_irq_vector(irq, cfg); | 1578 | __clear_irq_vector(irq, cfg); |
1578 | return; | 1579 | return; |
1579 | } | 1580 | } |
@@ -1604,12 +1605,10 @@ static void __init setup_IO_APIC_irqs(void) | |||
1604 | notcon = 1; | 1605 | notcon = 1; |
1605 | apic_printk(APIC_VERBOSE, | 1606 | apic_printk(APIC_VERBOSE, |
1606 | KERN_DEBUG " %d-%d", | 1607 | KERN_DEBUG " %d-%d", |
1607 | mp_ioapics[apic].mp_apicid, | 1608 | mp_ioapics[apic].apicid, pin); |
1608 | pin); | ||
1609 | } else | 1609 | } else |
1610 | apic_printk(APIC_VERBOSE, " %d-%d", | 1610 | apic_printk(APIC_VERBOSE, " %d-%d", |
1611 | mp_ioapics[apic].mp_apicid, | 1611 | mp_ioapics[apic].apicid, pin); |
1612 | pin); | ||
1613 | continue; | 1612 | continue; |
1614 | } | 1613 | } |
1615 | if (notcon) { | 1614 | if (notcon) { |
@@ -1699,7 +1698,7 @@ __apicdebuginit(void) print_IO_APIC(void) | |||
1699 | printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); | 1698 | printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); |
1700 | for (i = 0; i < nr_ioapics; i++) | 1699 | for (i = 0; i < nr_ioapics; i++) |
1701 | printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n", | 1700 | printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n", |
1702 | mp_ioapics[i].mp_apicid, nr_ioapic_registers[i]); | 1701 | mp_ioapics[i].apicid, nr_ioapic_registers[i]); |
1703 | 1702 | ||
1704 | /* | 1703 | /* |
1705 | * We are a bit conservative about what we expect. We have to | 1704 | * We are a bit conservative about what we expect. We have to |
@@ -1719,7 +1718,7 @@ __apicdebuginit(void) print_IO_APIC(void) | |||
1719 | spin_unlock_irqrestore(&ioapic_lock, flags); | 1718 | spin_unlock_irqrestore(&ioapic_lock, flags); |
1720 | 1719 | ||
1721 | printk("\n"); | 1720 | printk("\n"); |
1722 | printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].mp_apicid); | 1721 | printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].apicid); |
1723 | printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw); | 1722 | printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw); |
1724 | printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID); | 1723 | 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); | 1724 | printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.delivery_type); |
@@ -2121,14 +2120,14 @@ static void __init setup_ioapic_ids_from_mpc(void) | |||
2121 | reg_00.raw = io_apic_read(apic, 0); | 2120 | reg_00.raw = io_apic_read(apic, 0); |
2122 | spin_unlock_irqrestore(&ioapic_lock, flags); | 2121 | spin_unlock_irqrestore(&ioapic_lock, flags); |
2123 | 2122 | ||
2124 | old_id = mp_ioapics[apic].mp_apicid; | 2123 | old_id = mp_ioapics[apic].apicid; |
2125 | 2124 | ||
2126 | if (mp_ioapics[apic].mp_apicid >= get_physical_broadcast()) { | 2125 | if (mp_ioapics[apic].apicid >= get_physical_broadcast()) { |
2127 | printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", | 2126 | printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", |
2128 | apic, mp_ioapics[apic].mp_apicid); | 2127 | apic, mp_ioapics[apic].apicid); |
2129 | printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", | 2128 | printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", |
2130 | reg_00.bits.ID); | 2129 | reg_00.bits.ID); |
2131 | mp_ioapics[apic].mp_apicid = reg_00.bits.ID; | 2130 | mp_ioapics[apic].apicid = reg_00.bits.ID; |
2132 | } | 2131 | } |
2133 | 2132 | ||
2134 | /* | 2133 | /* |
@@ -2137,9 +2136,9 @@ static void __init setup_ioapic_ids_from_mpc(void) | |||
2137 | * 'stuck on smp_invalidate_needed IPI wait' messages. | 2136 | * 'stuck on smp_invalidate_needed IPI wait' messages. |
2138 | */ | 2137 | */ |
2139 | if (check_apicid_used(phys_id_present_map, | 2138 | if (check_apicid_used(phys_id_present_map, |
2140 | mp_ioapics[apic].mp_apicid)) { | 2139 | mp_ioapics[apic].apicid)) { |
2141 | printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n", | 2140 | printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n", |
2142 | apic, mp_ioapics[apic].mp_apicid); | 2141 | apic, mp_ioapics[apic].apicid); |
2143 | for (i = 0; i < get_physical_broadcast(); i++) | 2142 | for (i = 0; i < get_physical_broadcast(); i++) |
2144 | if (!physid_isset(i, phys_id_present_map)) | 2143 | if (!physid_isset(i, phys_id_present_map)) |
2145 | break; | 2144 | break; |
@@ -2148,13 +2147,13 @@ static void __init setup_ioapic_ids_from_mpc(void) | |||
2148 | printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", | 2147 | printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", |
2149 | i); | 2148 | i); |
2150 | physid_set(i, phys_id_present_map); | 2149 | physid_set(i, phys_id_present_map); |
2151 | mp_ioapics[apic].mp_apicid = i; | 2150 | mp_ioapics[apic].apicid = i; |
2152 | } else { | 2151 | } else { |
2153 | physid_mask_t tmp; | 2152 | physid_mask_t tmp; |
2154 | tmp = apicid_to_cpu_present(mp_ioapics[apic].mp_apicid); | 2153 | tmp = apicid_to_cpu_present(mp_ioapics[apic].apicid); |
2155 | apic_printk(APIC_VERBOSE, "Setting %d in the " | 2154 | apic_printk(APIC_VERBOSE, "Setting %d in the " |
2156 | "phys_id_present_map\n", | 2155 | "phys_id_present_map\n", |
2157 | mp_ioapics[apic].mp_apicid); | 2156 | mp_ioapics[apic].apicid); |
2158 | physids_or(phys_id_present_map, phys_id_present_map, tmp); | 2157 | physids_or(phys_id_present_map, phys_id_present_map, tmp); |
2159 | } | 2158 | } |
2160 | 2159 | ||
@@ -2163,11 +2162,11 @@ static void __init setup_ioapic_ids_from_mpc(void) | |||
2163 | * We need to adjust the IRQ routing table | 2162 | * We need to adjust the IRQ routing table |
2164 | * if the ID changed. | 2163 | * if the ID changed. |
2165 | */ | 2164 | */ |
2166 | if (old_id != mp_ioapics[apic].mp_apicid) | 2165 | if (old_id != mp_ioapics[apic].apicid) |
2167 | for (i = 0; i < mp_irq_entries; i++) | 2166 | for (i = 0; i < mp_irq_entries; i++) |
2168 | if (mp_irqs[i].mp_dstapic == old_id) | 2167 | if (mp_irqs[i].dstapic == old_id) |
2169 | mp_irqs[i].mp_dstapic | 2168 | mp_irqs[i].dstapic |
2170 | = mp_ioapics[apic].mp_apicid; | 2169 | = mp_ioapics[apic].apicid; |
2171 | 2170 | ||
2172 | /* | 2171 | /* |
2173 | * Read the right value from the MPC table and | 2172 | * Read the right value from the MPC table and |
@@ -2175,9 +2174,9 @@ static void __init setup_ioapic_ids_from_mpc(void) | |||
2175 | */ | 2174 | */ |
2176 | apic_printk(APIC_VERBOSE, KERN_INFO | 2175 | apic_printk(APIC_VERBOSE, KERN_INFO |
2177 | "...changing IO-APIC physical APIC ID to %d ...", | 2176 | "...changing IO-APIC physical APIC ID to %d ...", |
2178 | mp_ioapics[apic].mp_apicid); | 2177 | mp_ioapics[apic].apicid); |
2179 | 2178 | ||
2180 | reg_00.bits.ID = mp_ioapics[apic].mp_apicid; | 2179 | reg_00.bits.ID = mp_ioapics[apic].apicid; |
2181 | spin_lock_irqsave(&ioapic_lock, flags); | 2180 | spin_lock_irqsave(&ioapic_lock, flags); |
2182 | io_apic_write(apic, 0, reg_00.raw); | 2181 | io_apic_write(apic, 0, reg_00.raw); |
2183 | spin_unlock_irqrestore(&ioapic_lock, flags); | 2182 | spin_unlock_irqrestore(&ioapic_lock, flags); |
@@ -2188,7 +2187,7 @@ static void __init setup_ioapic_ids_from_mpc(void) | |||
2188 | spin_lock_irqsave(&ioapic_lock, flags); | 2187 | spin_lock_irqsave(&ioapic_lock, flags); |
2189 | reg_00.raw = io_apic_read(apic, 0); | 2188 | reg_00.raw = io_apic_read(apic, 0); |
2190 | spin_unlock_irqrestore(&ioapic_lock, flags); | 2189 | spin_unlock_irqrestore(&ioapic_lock, flags); |
2191 | if (reg_00.bits.ID != mp_ioapics[apic].mp_apicid) | 2190 | if (reg_00.bits.ID != mp_ioapics[apic].apicid) |
2192 | printk("could not set ID!\n"); | 2191 | printk("could not set ID!\n"); |
2193 | else | 2192 | else |
2194 | apic_printk(APIC_VERBOSE, " ok.\n"); | 2193 | apic_printk(APIC_VERBOSE, " ok.\n"); |
@@ -3117,8 +3116,8 @@ static int ioapic_resume(struct sys_device *dev) | |||
3117 | 3116 | ||
3118 | spin_lock_irqsave(&ioapic_lock, flags); | 3117 | spin_lock_irqsave(&ioapic_lock, flags); |
3119 | reg_00.raw = io_apic_read(dev->id, 0); | 3118 | reg_00.raw = io_apic_read(dev->id, 0); |
3120 | if (reg_00.bits.ID != mp_ioapics[dev->id].mp_apicid) { | 3119 | if (reg_00.bits.ID != mp_ioapics[dev->id].apicid) { |
3121 | reg_00.bits.ID = mp_ioapics[dev->id].mp_apicid; | 3120 | reg_00.bits.ID = mp_ioapics[dev->id].apicid; |
3122 | io_apic_write(dev->id, 0, reg_00.raw); | 3121 | io_apic_write(dev->id, 0, reg_00.raw); |
3123 | } | 3122 | } |
3124 | spin_unlock_irqrestore(&ioapic_lock, flags); | 3123 | spin_unlock_irqrestore(&ioapic_lock, flags); |
@@ -3258,6 +3257,9 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms | |||
3258 | int err; | 3257 | int err; |
3259 | unsigned dest; | 3258 | unsigned dest; |
3260 | 3259 | ||
3260 | if (disable_apic) | ||
3261 | return -ENXIO; | ||
3262 | |||
3261 | cfg = irq_cfg(irq); | 3263 | cfg = irq_cfg(irq); |
3262 | err = assign_irq_vector(irq, cfg, TARGET_CPUS); | 3264 | err = assign_irq_vector(irq, cfg, TARGET_CPUS); |
3263 | if (err) | 3265 | if (err) |
@@ -3726,6 +3728,9 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev) | |||
3726 | struct irq_cfg *cfg; | 3728 | struct irq_cfg *cfg; |
3727 | int err; | 3729 | int err; |
3728 | 3730 | ||
3731 | if (disable_apic) | ||
3732 | return -ENXIO; | ||
3733 | |||
3729 | cfg = irq_cfg(irq); | 3734 | cfg = irq_cfg(irq); |
3730 | err = assign_irq_vector(irq, cfg, TARGET_CPUS); | 3735 | err = assign_irq_vector(irq, cfg, TARGET_CPUS); |
3731 | if (!err) { | 3736 | if (!err) { |
@@ -4000,8 +4005,8 @@ int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity) | |||
4000 | return -1; | 4005 | return -1; |
4001 | 4006 | ||
4002 | for (i = 0; i < mp_irq_entries; i++) | 4007 | for (i = 0; i < mp_irq_entries; i++) |
4003 | if (mp_irqs[i].mp_irqtype == mp_INT && | 4008 | if (mp_irqs[i].irqtype == mp_INT && |
4004 | mp_irqs[i].mp_srcbusirq == bus_irq) | 4009 | mp_irqs[i].srcbusirq == bus_irq) |
4005 | break; | 4010 | break; |
4006 | if (i >= mp_irq_entries) | 4011 | if (i >= mp_irq_entries) |
4007 | return -1; | 4012 | return -1; |
@@ -4116,7 +4121,7 @@ void __init ioapic_init_mappings(void) | |||
4116 | ioapic_res = ioapic_setup_resources(); | 4121 | ioapic_res = ioapic_setup_resources(); |
4117 | for (i = 0; i < nr_ioapics; i++) { | 4122 | for (i = 0; i < nr_ioapics; i++) { |
4118 | if (smp_found_config) { | 4123 | if (smp_found_config) { |
4119 | ioapic_phys = mp_ioapics[i].mp_apicaddr; | 4124 | ioapic_phys = mp_ioapics[i].apicaddr; |
4120 | #ifdef CONFIG_X86_32 | 4125 | #ifdef CONFIG_X86_32 |
4121 | if (!ioapic_phys) { | 4126 | if (!ioapic_phys) { |
4122 | printk(KERN_ERR | 4127 | printk(KERN_ERR |
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 c0601c2848a1..fa6bb263892e 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <asm/e820.h> | 27 | #include <asm/e820.h> |
28 | #include <asm/trampoline.h> | 28 | #include <asm/trampoline.h> |
29 | #include <asm/setup.h> | 29 | #include <asm/setup.h> |
30 | #include <asm/smp.h> | ||
30 | 31 | ||
31 | #include <mach_apic.h> | 32 | #include <mach_apic.h> |
32 | #ifdef CONFIG_X86_32 | 33 | #ifdef CONFIG_X86_32 |
@@ -143,11 +144,11 @@ static void __init MP_ioapic_info(struct mpc_ioapic *m) | |||
143 | if (bad_ioapic(m->apicaddr)) | 144 | if (bad_ioapic(m->apicaddr)) |
144 | return; | 145 | return; |
145 | 146 | ||
146 | mp_ioapics[nr_ioapics].mp_apicaddr = m->apicaddr; | 147 | mp_ioapics[nr_ioapics].apicaddr = m->apicaddr; |
147 | mp_ioapics[nr_ioapics].mp_apicid = m->apicid; | 148 | mp_ioapics[nr_ioapics].apicid = m->apicid; |
148 | mp_ioapics[nr_ioapics].mp_type = m->type; | 149 | mp_ioapics[nr_ioapics].type = m->type; |
149 | mp_ioapics[nr_ioapics].mp_apicver = m->apicver; | 150 | mp_ioapics[nr_ioapics].apicver = m->apicver; |
150 | mp_ioapics[nr_ioapics].mp_flags = m->flags; | 151 | mp_ioapics[nr_ioapics].flags = m->flags; |
151 | nr_ioapics++; | 152 | nr_ioapics++; |
152 | } | 153 | } |
153 | 154 | ||
@@ -159,55 +160,55 @@ static void print_MP_intsrc_info(struct mpc_intsrc *m) | |||
159 | m->srcbusirq, m->dstapic, m->dstirq); | 160 | m->srcbusirq, m->dstapic, m->dstirq); |
160 | } | 161 | } |
161 | 162 | ||
162 | static void __init print_mp_irq_info(struct mp_config_intsrc *mp_irq) | 163 | static void __init print_mp_irq_info(struct mpc_intsrc *mp_irq) |
163 | { | 164 | { |
164 | apic_printk(APIC_VERBOSE, "Int: type %d, pol %d, trig %d, bus %02x," | 165 | apic_printk(APIC_VERBOSE, "Int: type %d, pol %d, trig %d, bus %02x," |
165 | " IRQ %02x, APIC ID %x, APIC INT %02x\n", | 166 | " IRQ %02x, APIC ID %x, APIC INT %02x\n", |
166 | mp_irq->mp_irqtype, mp_irq->mp_irqflag & 3, | 167 | mp_irq->irqtype, mp_irq->irqflag & 3, |
167 | (mp_irq->mp_irqflag >> 2) & 3, mp_irq->mp_srcbus, | 168 | (mp_irq->irqflag >> 2) & 3, mp_irq->srcbus, |
168 | mp_irq->mp_srcbusirq, mp_irq->mp_dstapic, mp_irq->mp_dstirq); | 169 | mp_irq->srcbusirq, mp_irq->dstapic, mp_irq->dstirq); |
169 | } | 170 | } |
170 | 171 | ||
171 | static void __init assign_to_mp_irq(struct mpc_intsrc *m, | 172 | static void __init assign_to_mp_irq(struct mpc_intsrc *m, |
172 | struct mp_config_intsrc *mp_irq) | 173 | struct mpc_intsrc *mp_irq) |
173 | { | 174 | { |
174 | mp_irq->mp_dstapic = m->dstapic; | 175 | mp_irq->dstapic = m->dstapic; |
175 | mp_irq->mp_type = m->type; | 176 | mp_irq->type = m->type; |
176 | mp_irq->mp_irqtype = m->irqtype; | 177 | mp_irq->irqtype = m->irqtype; |
177 | mp_irq->mp_irqflag = m->irqflag; | 178 | mp_irq->irqflag = m->irqflag; |
178 | mp_irq->mp_srcbus = m->srcbus; | 179 | mp_irq->srcbus = m->srcbus; |
179 | mp_irq->mp_srcbusirq = m->srcbusirq; | 180 | mp_irq->srcbusirq = m->srcbusirq; |
180 | mp_irq->mp_dstirq = m->dstirq; | 181 | mp_irq->dstirq = m->dstirq; |
181 | } | 182 | } |
182 | 183 | ||
183 | static void __init assign_to_mpc_intsrc(struct mp_config_intsrc *mp_irq, | 184 | static void __init assign_to_mpc_intsrc(struct mpc_intsrc *mp_irq, |
184 | struct mpc_intsrc *m) | 185 | struct mpc_intsrc *m) |
185 | { | 186 | { |
186 | m->dstapic = mp_irq->mp_dstapic; | 187 | m->dstapic = mp_irq->dstapic; |
187 | m->type = mp_irq->mp_type; | 188 | m->type = mp_irq->type; |
188 | m->irqtype = mp_irq->mp_irqtype; | 189 | m->irqtype = mp_irq->irqtype; |
189 | m->irqflag = mp_irq->mp_irqflag; | 190 | m->irqflag = mp_irq->irqflag; |
190 | m->srcbus = mp_irq->mp_srcbus; | 191 | m->srcbus = mp_irq->srcbus; |
191 | m->srcbusirq = mp_irq->mp_srcbusirq; | 192 | m->srcbusirq = mp_irq->srcbusirq; |
192 | m->dstirq = mp_irq->mp_dstirq; | 193 | m->dstirq = mp_irq->dstirq; |
193 | } | 194 | } |
194 | 195 | ||
195 | static int __init mp_irq_mpc_intsrc_cmp(struct mp_config_intsrc *mp_irq, | 196 | static int __init mp_irq_mpc_intsrc_cmp(struct mpc_intsrc *mp_irq, |
196 | struct mpc_intsrc *m) | 197 | struct mpc_intsrc *m) |
197 | { | 198 | { |
198 | if (mp_irq->mp_dstapic != m->dstapic) | 199 | if (mp_irq->dstapic != m->dstapic) |
199 | return 1; | 200 | return 1; |
200 | if (mp_irq->mp_type != m->type) | 201 | if (mp_irq->type != m->type) |
201 | return 2; | 202 | return 2; |
202 | if (mp_irq->mp_irqtype != m->irqtype) | 203 | if (mp_irq->irqtype != m->irqtype) |
203 | return 3; | 204 | return 3; |
204 | if (mp_irq->mp_irqflag != m->irqflag) | 205 | if (mp_irq->irqflag != m->irqflag) |
205 | return 4; | 206 | return 4; |
206 | if (mp_irq->mp_srcbus != m->srcbus) | 207 | if (mp_irq->srcbus != m->srcbus) |
207 | return 5; | 208 | return 5; |
208 | if (mp_irq->mp_srcbusirq != m->srcbusirq) | 209 | if (mp_irq->srcbusirq != m->srcbusirq) |
209 | return 6; | 210 | return 6; |
210 | if (mp_irq->mp_dstirq != m->dstirq) | 211 | if (mp_irq->dstirq != m->dstirq) |
211 | return 7; | 212 | return 7; |
212 | 213 | ||
213 | return 0; | 214 | return 0; |
@@ -416,7 +417,7 @@ static void __init construct_default_ioirq_mptable(int mpc_default_type) | |||
416 | intsrc.type = MP_INTSRC; | 417 | intsrc.type = MP_INTSRC; |
417 | intsrc.irqflag = 0; /* conforming */ | 418 | intsrc.irqflag = 0; /* conforming */ |
418 | intsrc.srcbus = 0; | 419 | intsrc.srcbus = 0; |
419 | intsrc.dstapic = mp_ioapics[0].mp_apicid; | 420 | intsrc.dstapic = mp_ioapics[0].apicid; |
420 | 421 | ||
421 | intsrc.irqtype = mp_INT; | 422 | intsrc.irqtype = mp_INT; |
422 | 423 | ||
@@ -569,14 +570,14 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type) | |||
569 | } | 570 | } |
570 | } | 571 | } |
571 | 572 | ||
572 | static struct intel_mp_floating *mpf_found; | 573 | static struct mpf_intel *mpf_found; |
573 | 574 | ||
574 | /* | 575 | /* |
575 | * Scan the memory blocks for an SMP configuration block. | 576 | * Scan the memory blocks for an SMP configuration block. |
576 | */ | 577 | */ |
577 | static void __init __get_smp_config(unsigned int early) | 578 | static void __init __get_smp_config(unsigned int early) |
578 | { | 579 | { |
579 | struct intel_mp_floating *mpf = mpf_found; | 580 | struct mpf_intel *mpf = mpf_found; |
580 | 581 | ||
581 | if (!mpf) | 582 | if (!mpf) |
582 | return; | 583 | return; |
@@ -597,9 +598,9 @@ static void __init __get_smp_config(unsigned int early) | |||
597 | } | 598 | } |
598 | 599 | ||
599 | printk(KERN_INFO "Intel MultiProcessor Specification v1.%d\n", | 600 | printk(KERN_INFO "Intel MultiProcessor Specification v1.%d\n", |
600 | mpf->mpf_specification); | 601 | mpf->specification); |
601 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32) | 602 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32) |
602 | if (mpf->mpf_feature2 & (1 << 7)) { | 603 | if (mpf->feature2 & (1 << 7)) { |
603 | printk(KERN_INFO " IMCR and PIC compatibility mode.\n"); | 604 | printk(KERN_INFO " IMCR and PIC compatibility mode.\n"); |
604 | pic_mode = 1; | 605 | pic_mode = 1; |
605 | } else { | 606 | } else { |
@@ -610,7 +611,7 @@ static void __init __get_smp_config(unsigned int early) | |||
610 | /* | 611 | /* |
611 | * Now see if we need to read further. | 612 | * Now see if we need to read further. |
612 | */ | 613 | */ |
613 | if (mpf->mpf_feature1 != 0) { | 614 | if (mpf->feature1 != 0) { |
614 | if (early) { | 615 | if (early) { |
615 | /* | 616 | /* |
616 | * local APIC has default address | 617 | * local APIC has default address |
@@ -620,16 +621,16 @@ static void __init __get_smp_config(unsigned int early) | |||
620 | } | 621 | } |
621 | 622 | ||
622 | printk(KERN_INFO "Default MP configuration #%d\n", | 623 | printk(KERN_INFO "Default MP configuration #%d\n", |
623 | mpf->mpf_feature1); | 624 | mpf->feature1); |
624 | construct_default_ISA_mptable(mpf->mpf_feature1); | 625 | construct_default_ISA_mptable(mpf->feature1); |
625 | 626 | ||
626 | } else if (mpf->mpf_physptr) { | 627 | } else if (mpf->physptr) { |
627 | 628 | ||
628 | /* | 629 | /* |
629 | * Read the physical hardware table. Anything here will | 630 | * Read the physical hardware table. Anything here will |
630 | * override the defaults. | 631 | * override the defaults. |
631 | */ | 632 | */ |
632 | if (!smp_read_mpc(phys_to_virt(mpf->mpf_physptr), early)) { | 633 | if (!smp_read_mpc(phys_to_virt(mpf->physptr), early)) { |
633 | #ifdef CONFIG_X86_LOCAL_APIC | 634 | #ifdef CONFIG_X86_LOCAL_APIC |
634 | smp_found_config = 0; | 635 | smp_found_config = 0; |
635 | #endif | 636 | #endif |
@@ -687,19 +688,19 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, | |||
687 | unsigned reserve) | 688 | unsigned reserve) |
688 | { | 689 | { |
689 | unsigned int *bp = phys_to_virt(base); | 690 | unsigned int *bp = phys_to_virt(base); |
690 | struct intel_mp_floating *mpf; | 691 | struct mpf_intel *mpf; |
691 | 692 | ||
692 | apic_printk(APIC_VERBOSE, "Scan SMP from %p for %ld bytes.\n", | 693 | apic_printk(APIC_VERBOSE, "Scan SMP from %p for %ld bytes.\n", |
693 | bp, length); | 694 | bp, length); |
694 | BUILD_BUG_ON(sizeof(*mpf) != 16); | 695 | BUILD_BUG_ON(sizeof(*mpf) != 16); |
695 | 696 | ||
696 | while (length > 0) { | 697 | while (length > 0) { |
697 | mpf = (struct intel_mp_floating *)bp; | 698 | mpf = (struct mpf_intel *)bp; |
698 | if ((*bp == SMP_MAGIC_IDENT) && | 699 | if ((*bp == SMP_MAGIC_IDENT) && |
699 | (mpf->mpf_length == 1) && | 700 | (mpf->length == 1) && |
700 | !mpf_checksum((unsigned char *)bp, 16) && | 701 | !mpf_checksum((unsigned char *)bp, 16) && |
701 | ((mpf->mpf_specification == 1) | 702 | ((mpf->specification == 1) |
702 | || (mpf->mpf_specification == 4))) { | 703 | || (mpf->specification == 4))) { |
703 | #ifdef CONFIG_X86_LOCAL_APIC | 704 | #ifdef CONFIG_X86_LOCAL_APIC |
704 | smp_found_config = 1; | 705 | smp_found_config = 1; |
705 | #endif | 706 | #endif |
@@ -712,7 +713,7 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, | |||
712 | return 1; | 713 | return 1; |
713 | reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE, | 714 | reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE, |
714 | BOOTMEM_DEFAULT); | 715 | BOOTMEM_DEFAULT); |
715 | if (mpf->mpf_physptr) { | 716 | if (mpf->physptr) { |
716 | unsigned long size = PAGE_SIZE; | 717 | unsigned long size = PAGE_SIZE; |
717 | #ifdef CONFIG_X86_32 | 718 | #ifdef CONFIG_X86_32 |
718 | /* | 719 | /* |
@@ -721,14 +722,14 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, | |||
721 | * the bottom is mapped now. | 722 | * the bottom is mapped now. |
722 | * PC-9800's MPC table places on the very last | 723 | * PC-9800's MPC table places on the very last |
723 | * of physical memory; so that simply reserving | 724 | * of physical memory; so that simply reserving |
724 | * PAGE_SIZE from mpg->mpf_physptr yields BUG() | 725 | * PAGE_SIZE from mpf->physptr yields BUG() |
725 | * in reserve_bootmem. | 726 | * in reserve_bootmem. |
726 | */ | 727 | */ |
727 | unsigned long end = max_low_pfn * PAGE_SIZE; | 728 | unsigned long end = max_low_pfn * PAGE_SIZE; |
728 | if (mpf->mpf_physptr + size > end) | 729 | if (mpf->physptr + size > end) |
729 | size = end - mpf->mpf_physptr; | 730 | size = end - mpf->physptr; |
730 | #endif | 731 | #endif |
731 | reserve_bootmem_generic(mpf->mpf_physptr, size, | 732 | reserve_bootmem_generic(mpf->physptr, size, |
732 | BOOTMEM_DEFAULT); | 733 | BOOTMEM_DEFAULT); |
733 | } | 734 | } |
734 | 735 | ||
@@ -808,15 +809,15 @@ static int __init get_MP_intsrc_index(struct mpc_intsrc *m) | |||
808 | /* not legacy */ | 809 | /* not legacy */ |
809 | 810 | ||
810 | for (i = 0; i < mp_irq_entries; i++) { | 811 | for (i = 0; i < mp_irq_entries; i++) { |
811 | if (mp_irqs[i].mp_irqtype != mp_INT) | 812 | if (mp_irqs[i].irqtype != mp_INT) |
812 | continue; | 813 | continue; |
813 | 814 | ||
814 | if (mp_irqs[i].mp_irqflag != 0x0f) | 815 | if (mp_irqs[i].irqflag != 0x0f) |
815 | continue; | 816 | continue; |
816 | 817 | ||
817 | if (mp_irqs[i].mp_srcbus != m->srcbus) | 818 | if (mp_irqs[i].srcbus != m->srcbus) |
818 | continue; | 819 | continue; |
819 | if (mp_irqs[i].mp_srcbusirq != m->srcbusirq) | 820 | if (mp_irqs[i].srcbusirq != m->srcbusirq) |
820 | continue; | 821 | continue; |
821 | if (irq_used[i]) { | 822 | if (irq_used[i]) { |
822 | /* already claimed */ | 823 | /* already claimed */ |
@@ -921,10 +922,10 @@ static int __init replace_intsrc_all(struct mpc_table *mpc, | |||
921 | if (irq_used[i]) | 922 | if (irq_used[i]) |
922 | continue; | 923 | continue; |
923 | 924 | ||
924 | if (mp_irqs[i].mp_irqtype != mp_INT) | 925 | if (mp_irqs[i].irqtype != mp_INT) |
925 | continue; | 926 | continue; |
926 | 927 | ||
927 | if (mp_irqs[i].mp_irqflag != 0x0f) | 928 | if (mp_irqs[i].irqflag != 0x0f) |
928 | continue; | 929 | continue; |
929 | 930 | ||
930 | if (nr_m_spare > 0) { | 931 | if (nr_m_spare > 0) { |
@@ -1000,7 +1001,7 @@ static int __init update_mp_table(void) | |||
1000 | { | 1001 | { |
1001 | char str[16]; | 1002 | char str[16]; |
1002 | char oem[10]; | 1003 | char oem[10]; |
1003 | struct intel_mp_floating *mpf; | 1004 | struct mpf_intel *mpf; |
1004 | struct mpc_table *mpc, *mpc_new; | 1005 | struct mpc_table *mpc, *mpc_new; |
1005 | 1006 | ||
1006 | if (!enable_update_mptable) | 1007 | if (!enable_update_mptable) |
@@ -1013,19 +1014,19 @@ static int __init update_mp_table(void) | |||
1013 | /* | 1014 | /* |
1014 | * Now see if we need to go further. | 1015 | * Now see if we need to go further. |
1015 | */ | 1016 | */ |
1016 | if (mpf->mpf_feature1 != 0) | 1017 | if (mpf->feature1 != 0) |
1017 | return 0; | 1018 | return 0; |
1018 | 1019 | ||
1019 | if (!mpf->mpf_physptr) | 1020 | if (!mpf->physptr) |
1020 | return 0; | 1021 | return 0; |
1021 | 1022 | ||
1022 | mpc = phys_to_virt(mpf->mpf_physptr); | 1023 | mpc = phys_to_virt(mpf->physptr); |
1023 | 1024 | ||
1024 | if (!smp_check_mpc(mpc, oem, str)) | 1025 | if (!smp_check_mpc(mpc, oem, str)) |
1025 | return 0; | 1026 | return 0; |
1026 | 1027 | ||
1027 | printk(KERN_INFO "mpf: %lx\n", virt_to_phys(mpf)); | 1028 | printk(KERN_INFO "mpf: %lx\n", virt_to_phys(mpf)); |
1028 | printk(KERN_INFO "mpf_physptr: %x\n", mpf->mpf_physptr); | 1029 | printk(KERN_INFO "physptr: %x\n", mpf->physptr); |
1029 | 1030 | ||
1030 | if (mpc_new_phys && mpc->length > mpc_new_length) { | 1031 | if (mpc_new_phys && mpc->length > mpc_new_length) { |
1031 | mpc_new_phys = 0; | 1032 | mpc_new_phys = 0; |
@@ -1046,23 +1047,23 @@ static int __init update_mp_table(void) | |||
1046 | } | 1047 | } |
1047 | printk(KERN_INFO "use in-positon replacing\n"); | 1048 | printk(KERN_INFO "use in-positon replacing\n"); |
1048 | } else { | 1049 | } else { |
1049 | mpf->mpf_physptr = mpc_new_phys; | 1050 | mpf->physptr = mpc_new_phys; |
1050 | mpc_new = phys_to_virt(mpc_new_phys); | 1051 | mpc_new = phys_to_virt(mpc_new_phys); |
1051 | memcpy(mpc_new, mpc, mpc->length); | 1052 | memcpy(mpc_new, mpc, mpc->length); |
1052 | mpc = mpc_new; | 1053 | mpc = mpc_new; |
1053 | /* check if we can modify that */ | 1054 | /* check if we can modify that */ |
1054 | if (mpc_new_phys - mpf->mpf_physptr) { | 1055 | if (mpc_new_phys - mpf->physptr) { |
1055 | struct intel_mp_floating *mpf_new; | 1056 | struct mpf_intel *mpf_new; |
1056 | /* steal 16 bytes from [0, 1k) */ | 1057 | /* steal 16 bytes from [0, 1k) */ |
1057 | printk(KERN_INFO "mpf new: %x\n", 0x400 - 16); | 1058 | printk(KERN_INFO "mpf new: %x\n", 0x400 - 16); |
1058 | mpf_new = phys_to_virt(0x400 - 16); | 1059 | mpf_new = phys_to_virt(0x400 - 16); |
1059 | memcpy(mpf_new, mpf, 16); | 1060 | memcpy(mpf_new, mpf, 16); |
1060 | mpf = mpf_new; | 1061 | mpf = mpf_new; |
1061 | mpf->mpf_physptr = mpc_new_phys; | 1062 | mpf->physptr = mpc_new_phys; |
1062 | } | 1063 | } |
1063 | mpf->mpf_checksum = 0; | 1064 | mpf->checksum = 0; |
1064 | mpf->mpf_checksum -= mpf_checksum((unsigned char *)mpf, 16); | 1065 | mpf->checksum -= mpf_checksum((unsigned char *)mpf, 16); |
1065 | printk(KERN_INFO "mpf_physptr new: %x\n", mpf->mpf_physptr); | 1066 | printk(KERN_INFO "physptr new: %x\n", mpf->physptr); |
1066 | } | 1067 | } |
1067 | 1068 | ||
1068 | /* | 1069 | /* |
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/reboot.c b/arch/x86/kernel/reboot.c index 2b46eb41643b..f8536fee5c12 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> |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index ae0d8042cf69..f41c4486c270 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -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> |
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c index 55c46074eba0..bf63de72b643 100644 --- a/arch/x86/kernel/setup_percpu.c +++ b/arch/x86/kernel/setup_percpu.c | |||
@@ -13,6 +13,7 @@ | |||
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/cpumask.h> | ||
16 | 17 | ||
17 | #ifdef CONFIG_X86_LOCAL_APIC | 18 | #ifdef CONFIG_X86_LOCAL_APIC |
18 | unsigned int num_processors; | 19 | unsigned int num_processors; |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index bb1a3b1fc87f..1a712da1dfa0 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -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> |
@@ -1125,6 +1124,7 @@ static int __init smp_sanity_check(unsigned max_cpus) | |||
1125 | printk(KERN_ERR "... forcing use of dummy APIC emulation." | 1124 | printk(KERN_ERR "... forcing use of dummy APIC emulation." |
1126 | "(tell your hw vendor)\n"); | 1125 | "(tell your hw vendor)\n"); |
1127 | smpboot_clear_io_apic(); | 1126 | smpboot_clear_io_apic(); |
1127 | disable_ioapic_setup(); | ||
1128 | return -1; | 1128 | return -1; |
1129 | } | 1129 | } |
1130 | 1130 | ||
diff --git a/arch/x86/mach-voyager/setup.c b/arch/x86/mach-voyager/setup.c index a580b9562e76..0ade62555ff3 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/mm/fault.c b/arch/x86/mm/fault.c index 9e268b6b204e..90dfae511a41 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -534,7 +534,7 @@ static int vmalloc_fault(unsigned long address) | |||
534 | happen within a race in page table update. In the later | 534 | happen within a race in page table update. In the later |
535 | case just flush. */ | 535 | case just flush. */ |
536 | 536 | ||
537 | pgd = pgd_offset(current->mm ?: &init_mm, address); | 537 | pgd = pgd_offset(current->active_mm, address); |
538 | pgd_ref = pgd_offset_k(address); | 538 | pgd_ref = pgd_offset_k(address); |
539 | if (pgd_none(*pgd_ref)) | 539 | if (pgd_none(*pgd_ref)) |
540 | return -1; | 540 | return -1; |
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 88f1b10de3be..4a6989e47a53 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/pageattr.c b/arch/x86/mm/pageattr.c index e89d24815f26..4cf30dee8161 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -555,10 +555,12 @@ repeat: | |||
555 | if (!pte_val(old_pte)) { | 555 | if (!pte_val(old_pte)) { |
556 | if (!primary) | 556 | if (!primary) |
557 | return 0; | 557 | return 0; |
558 | WARN(1, KERN_WARNING "CPA: called for zero pte. " | 558 | |
559 | "vaddr = %lx cpa->vaddr = %lx\n", address, | 559 | /* |
560 | *cpa->vaddr); | 560 | * Special error value returned, indicating that the mapping |
561 | return -EINVAL; | 561 | * did not exist at this address. |
562 | */ | ||
563 | return -EFAULT; | ||
562 | } | 564 | } |
563 | 565 | ||
564 | if (level == PG_LEVEL_4K) { | 566 | if (level == PG_LEVEL_4K) { |
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 85cbd3cd3723..3be399013de6 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -333,11 +333,20 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, | |||
333 | req_type & _PAGE_CACHE_MASK); | 333 | req_type & _PAGE_CACHE_MASK); |
334 | } | 334 | } |
335 | 335 | ||
336 | is_range_ram = pagerange_is_ram(start, end); | 336 | /* |
337 | if (is_range_ram == 1) | 337 | * For legacy reasons, some parts of the physical address range in the |
338 | return reserve_ram_pages_type(start, end, req_type, new_type); | 338 | * legacy 1MB region is treated as non-RAM (even when listed as RAM in |
339 | else if (is_range_ram < 0) | 339 | * the e820 tables). So we will track the memory attributes of this |
340 | return -EINVAL; | 340 | * legacy 1MB region using the linear memtype_list always. |
341 | */ | ||
342 | if (end >= ISA_END_ADDRESS) { | ||
343 | is_range_ram = pagerange_is_ram(start, end); | ||
344 | if (is_range_ram == 1) | ||
345 | return reserve_ram_pages_type(start, end, req_type, | ||
346 | new_type); | ||
347 | else if (is_range_ram < 0) | ||
348 | return -EINVAL; | ||
349 | } | ||
341 | 350 | ||
342 | new = kmalloc(sizeof(struct memtype), GFP_KERNEL); | 351 | new = kmalloc(sizeof(struct memtype), GFP_KERNEL); |
343 | if (!new) | 352 | if (!new) |
@@ -437,11 +446,19 @@ int free_memtype(u64 start, u64 end) | |||
437 | if (is_ISA_range(start, end - 1)) | 446 | if (is_ISA_range(start, end - 1)) |
438 | return 0; | 447 | return 0; |
439 | 448 | ||
440 | is_range_ram = pagerange_is_ram(start, end); | 449 | /* |
441 | if (is_range_ram == 1) | 450 | * For legacy reasons, some parts of the physical address range in the |
442 | return free_ram_pages_type(start, end); | 451 | * legacy 1MB region is treated as non-RAM (even when listed as RAM in |
443 | else if (is_range_ram < 0) | 452 | * the e820 tables). So we will track the memory attributes of this |
444 | return -EINVAL; | 453 | * legacy 1MB region using the linear memtype_list always. |
454 | */ | ||
455 | if (end >= ISA_END_ADDRESS) { | ||
456 | is_range_ram = pagerange_is_ram(start, end); | ||
457 | if (is_range_ram == 1) | ||
458 | return free_ram_pages_type(start, end); | ||
459 | else if (is_range_ram < 0) | ||
460 | return -EINVAL; | ||
461 | } | ||
445 | 462 | ||
446 | spin_lock(&memtype_lock); | 463 | spin_lock(&memtype_lock); |
447 | list_for_each_entry(entry, &memtype_list, nd) { | 464 | list_for_each_entry(entry, &memtype_list, nd) { |
@@ -505,6 +522,35 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size) | |||
505 | } | 522 | } |
506 | #endif /* CONFIG_STRICT_DEVMEM */ | 523 | #endif /* CONFIG_STRICT_DEVMEM */ |
507 | 524 | ||
525 | /* | ||
526 | * Change the memory type for the physial address range in kernel identity | ||
527 | * mapping space if that range is a part of identity map. | ||
528 | */ | ||
529 | static int kernel_map_sync_memtype(u64 base, unsigned long size, | ||
530 | unsigned long flags) | ||
531 | { | ||
532 | unsigned long id_sz; | ||
533 | int ret; | ||
534 | |||
535 | if (!pat_enabled || base >= __pa(high_memory)) | ||
536 | return 0; | ||
537 | |||
538 | id_sz = (__pa(high_memory) < base + size) ? | ||
539 | __pa(high_memory) - base : | ||
540 | size; | ||
541 | |||
542 | ret = ioremap_change_attr((unsigned long)__va(base), id_sz, flags); | ||
543 | /* | ||
544 | * -EFAULT return means that the addr was not valid and did not have | ||
545 | * any identity mapping. That case is a success for | ||
546 | * kernel_map_sync_memtype. | ||
547 | */ | ||
548 | if (ret == -EFAULT) | ||
549 | ret = 0; | ||
550 | |||
551 | return ret; | ||
552 | } | ||
553 | |||
508 | int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, | 554 | int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, |
509 | unsigned long size, pgprot_t *vma_prot) | 555 | unsigned long size, pgprot_t *vma_prot) |
510 | { | 556 | { |
@@ -555,9 +601,7 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, | |||
555 | if (retval < 0) | 601 | if (retval < 0) |
556 | return 0; | 602 | return 0; |
557 | 603 | ||
558 | if (((pfn < max_low_pfn_mapped) || | 604 | if (kernel_map_sync_memtype(offset, size, flags)) { |
559 | (pfn >= (1UL<<(32 - PAGE_SHIFT)) && pfn < max_pfn_mapped)) && | ||
560 | ioremap_change_attr((unsigned long)__va(offset), size, flags) < 0) { | ||
561 | free_memtype(offset, offset + size); | 605 | free_memtype(offset, offset + size); |
562 | printk(KERN_INFO | 606 | printk(KERN_INFO |
563 | "%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n", | 607 | "%s:%d /dev/mem ioremap_change_attr failed %s for %Lx-%Lx\n", |
@@ -601,12 +645,13 @@ void unmap_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot) | |||
601 | * Reserved non RAM regions only and after successful reserve_memtype, | 645 | * Reserved non RAM regions only and after successful reserve_memtype, |
602 | * this func also keeps identity mapping (if any) in sync with this new prot. | 646 | * this func also keeps identity mapping (if any) in sync with this new prot. |
603 | */ | 647 | */ |
604 | static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t vma_prot) | 648 | static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot, |
649 | int strict_prot) | ||
605 | { | 650 | { |
606 | int is_ram = 0; | 651 | int is_ram = 0; |
607 | int id_sz, ret; | 652 | int ret; |
608 | unsigned long flags; | 653 | unsigned long flags; |
609 | unsigned long want_flags = (pgprot_val(vma_prot) & _PAGE_CACHE_MASK); | 654 | unsigned long want_flags = (pgprot_val(*vma_prot) & _PAGE_CACHE_MASK); |
610 | 655 | ||
611 | is_ram = pagerange_is_ram(paddr, paddr + size); | 656 | is_ram = pagerange_is_ram(paddr, paddr + size); |
612 | 657 | ||
@@ -625,26 +670,27 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t vma_prot) | |||
625 | return ret; | 670 | return ret; |
626 | 671 | ||
627 | if (flags != want_flags) { | 672 | if (flags != want_flags) { |
628 | free_memtype(paddr, paddr + size); | 673 | if (strict_prot || !is_new_memtype_allowed(want_flags, flags)) { |
629 | printk(KERN_ERR | 674 | free_memtype(paddr, paddr + size); |
630 | "%s:%d map pfn expected mapping type %s for %Lx-%Lx, got %s\n", | 675 | printk(KERN_ERR "%s:%d map pfn expected mapping type %s" |
631 | current->comm, current->pid, | 676 | " for %Lx-%Lx, got %s\n", |
632 | cattr_name(want_flags), | 677 | current->comm, current->pid, |
633 | (unsigned long long)paddr, | 678 | cattr_name(want_flags), |
634 | (unsigned long long)(paddr + size), | 679 | (unsigned long long)paddr, |
635 | cattr_name(flags)); | 680 | (unsigned long long)(paddr + size), |
636 | return -EINVAL; | 681 | cattr_name(flags)); |
682 | return -EINVAL; | ||
683 | } | ||
684 | /* | ||
685 | * We allow returning different type than the one requested in | ||
686 | * non strict case. | ||
687 | */ | ||
688 | *vma_prot = __pgprot((pgprot_val(*vma_prot) & | ||
689 | (~_PAGE_CACHE_MASK)) | | ||
690 | flags); | ||
637 | } | 691 | } |
638 | 692 | ||
639 | /* Need to keep identity mapping in sync */ | 693 | if (kernel_map_sync_memtype(paddr, size, flags)) { |
640 | if (paddr >= __pa(high_memory)) | ||
641 | return 0; | ||
642 | |||
643 | id_sz = (__pa(high_memory) < paddr + size) ? | ||
644 | __pa(high_memory) - paddr : | ||
645 | size; | ||
646 | |||
647 | if (ioremap_change_attr((unsigned long)__va(paddr), id_sz, flags) < 0) { | ||
648 | free_memtype(paddr, paddr + size); | 694 | free_memtype(paddr, paddr + size); |
649 | printk(KERN_ERR | 695 | printk(KERN_ERR |
650 | "%s:%d reserve_pfn_range ioremap_change_attr failed %s " | 696 | "%s:%d reserve_pfn_range ioremap_change_attr failed %s " |
@@ -689,6 +735,7 @@ int track_pfn_vma_copy(struct vm_area_struct *vma) | |||
689 | unsigned long vma_start = vma->vm_start; | 735 | unsigned long vma_start = vma->vm_start; |
690 | unsigned long vma_end = vma->vm_end; | 736 | unsigned long vma_end = vma->vm_end; |
691 | unsigned long vma_size = vma_end - vma_start; | 737 | unsigned long vma_size = vma_end - vma_start; |
738 | pgprot_t pgprot; | ||
692 | 739 | ||
693 | if (!pat_enabled) | 740 | if (!pat_enabled) |
694 | return 0; | 741 | return 0; |
@@ -702,7 +749,8 @@ int track_pfn_vma_copy(struct vm_area_struct *vma) | |||
702 | WARN_ON_ONCE(1); | 749 | WARN_ON_ONCE(1); |
703 | return -EINVAL; | 750 | return -EINVAL; |
704 | } | 751 | } |
705 | return reserve_pfn_range(paddr, vma_size, __pgprot(prot)); | 752 | pgprot = __pgprot(prot); |
753 | return reserve_pfn_range(paddr, vma_size, &pgprot, 1); | ||
706 | } | 754 | } |
707 | 755 | ||
708 | /* reserve entire vma page by page, using pfn and prot from pte */ | 756 | /* reserve entire vma page by page, using pfn and prot from pte */ |
@@ -710,7 +758,8 @@ int track_pfn_vma_copy(struct vm_area_struct *vma) | |||
710 | if (follow_phys(vma, vma_start + i, 0, &prot, &paddr)) | 758 | if (follow_phys(vma, vma_start + i, 0, &prot, &paddr)) |
711 | continue; | 759 | continue; |
712 | 760 | ||
713 | retval = reserve_pfn_range(paddr, PAGE_SIZE, __pgprot(prot)); | 761 | pgprot = __pgprot(prot); |
762 | retval = reserve_pfn_range(paddr, PAGE_SIZE, &pgprot, 1); | ||
714 | if (retval) | 763 | if (retval) |
715 | goto cleanup_ret; | 764 | goto cleanup_ret; |
716 | } | 765 | } |
@@ -741,7 +790,7 @@ cleanup_ret: | |||
741 | * Note that this function can be called with caller trying to map only a | 790 | * Note that this function can be called with caller trying to map only a |
742 | * subrange/page inside the vma. | 791 | * subrange/page inside the vma. |
743 | */ | 792 | */ |
744 | int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot, | 793 | int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot, |
745 | unsigned long pfn, unsigned long size) | 794 | unsigned long pfn, unsigned long size) |
746 | { | 795 | { |
747 | int retval = 0; | 796 | int retval = 0; |
@@ -758,14 +807,14 @@ int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot, | |||
758 | if (is_linear_pfn_mapping(vma)) { | 807 | if (is_linear_pfn_mapping(vma)) { |
759 | /* reserve the whole chunk starting from vm_pgoff */ | 808 | /* reserve the whole chunk starting from vm_pgoff */ |
760 | paddr = (resource_size_t)vma->vm_pgoff << PAGE_SHIFT; | 809 | paddr = (resource_size_t)vma->vm_pgoff << PAGE_SHIFT; |
761 | return reserve_pfn_range(paddr, vma_size, prot); | 810 | return reserve_pfn_range(paddr, vma_size, prot, 0); |
762 | } | 811 | } |
763 | 812 | ||
764 | /* reserve page by page using pfn and size */ | 813 | /* reserve page by page using pfn and size */ |
765 | base_paddr = (resource_size_t)pfn << PAGE_SHIFT; | 814 | base_paddr = (resource_size_t)pfn << PAGE_SHIFT; |
766 | for (i = 0; i < size; i += PAGE_SIZE) { | 815 | for (i = 0; i < size; i += PAGE_SIZE) { |
767 | paddr = base_paddr + i; | 816 | paddr = base_paddr + i; |
768 | retval = reserve_pfn_range(paddr, PAGE_SIZE, prot); | 817 | retval = reserve_pfn_range(paddr, PAGE_SIZE, prot, 0); |
769 | if (retval) | 818 | if (retval) |
770 | goto cleanup_ret; | 819 | goto cleanup_ret; |
771 | } | 820 | } |
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c index f884740da318..5ead808dd70c 100644 --- a/arch/x86/pci/i386.c +++ b/arch/x86/pci/i386.c | |||
@@ -314,17 +314,7 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
314 | return retval; | 314 | return retval; |
315 | 315 | ||
316 | if (flags != new_flags) { | 316 | if (flags != new_flags) { |
317 | /* | 317 | if (!is_new_memtype_allowed(flags, new_flags)) { |
318 | * Do not fallback to certain memory types with certain | ||
319 | * requested type: | ||
320 | * - request is uncached, return cannot be write-back | ||
321 | * - request is uncached, return cannot be write-combine | ||
322 | * - request is write-combine, return cannot be write-back | ||
323 | */ | ||
324 | if ((flags == _PAGE_CACHE_UC_MINUS && | ||
325 | (new_flags == _PAGE_CACHE_WB)) || | ||
326 | (flags == _PAGE_CACHE_WC && | ||
327 | new_flags == _PAGE_CACHE_WB)) { | ||
328 | free_memtype(addr, addr+len); | 318 | free_memtype(addr, addr+len); |
329 | return -EINVAL; | 319 | return -EINVAL; |
330 | } | 320 | } |