diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-03-04 00:05:42 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-03-04 00:05:42 -0500 |
commit | 2e22ea7cea0f7de86fd30df867fbf5b7e8eee0fd (patch) | |
tree | 8b8e5583fb2787ff7107a6f59b114ddcd2c2f691 /arch/x86/kernel | |
parent | 638bee71c83a2837b48062fdc5b222163cf53d79 (diff) | |
parent | 645af4e9e0e32481e3336dda813688732c7e5f0f (diff) |
Merge branch 'x86/core' into x86/mce2
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/alternative.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/apic/summit_32.c | 57 | ||||
-rw-r--r-- | arch/x86/kernel/e820.c | 3 |
3 files changed, 30 insertions, 36 deletions
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 5b8394a3a6b2..4c80f1557433 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c | |||
@@ -503,12 +503,12 @@ void *text_poke_early(void *addr, const void *opcode, size_t len) | |||
503 | */ | 503 | */ |
504 | void *__kprobes text_poke(void *addr, const void *opcode, size_t len) | 504 | void *__kprobes text_poke(void *addr, const void *opcode, size_t len) |
505 | { | 505 | { |
506 | unsigned long flags; | ||
507 | char *vaddr; | 506 | char *vaddr; |
508 | int nr_pages = 2; | 507 | int nr_pages = 2; |
509 | struct page *pages[2]; | 508 | struct page *pages[2]; |
510 | int i; | 509 | int i; |
511 | 510 | ||
511 | might_sleep(); | ||
512 | if (!core_kernel_text((unsigned long)addr)) { | 512 | if (!core_kernel_text((unsigned long)addr)) { |
513 | pages[0] = vmalloc_to_page(addr); | 513 | pages[0] = vmalloc_to_page(addr); |
514 | pages[1] = vmalloc_to_page(addr + PAGE_SIZE); | 514 | pages[1] = vmalloc_to_page(addr + PAGE_SIZE); |
@@ -522,9 +522,9 @@ void *__kprobes text_poke(void *addr, const void *opcode, size_t len) | |||
522 | nr_pages = 1; | 522 | nr_pages = 1; |
523 | vaddr = vmap(pages, nr_pages, VM_MAP, PAGE_KERNEL); | 523 | vaddr = vmap(pages, nr_pages, VM_MAP, PAGE_KERNEL); |
524 | BUG_ON(!vaddr); | 524 | BUG_ON(!vaddr); |
525 | local_irq_save(flags); | 525 | local_irq_disable(); |
526 | memcpy(&vaddr[(unsigned long)addr & ~PAGE_MASK], opcode, len); | 526 | memcpy(&vaddr[(unsigned long)addr & ~PAGE_MASK], opcode, len); |
527 | local_irq_restore(flags); | 527 | local_irq_enable(); |
528 | vunmap(vaddr); | 528 | vunmap(vaddr); |
529 | sync_core(); | 529 | sync_core(); |
530 | /* Could also do a CLFLUSH here to speed up CPU recovery; but | 530 | /* Could also do a CLFLUSH here to speed up CPU recovery; but |
diff --git a/arch/x86/kernel/apic/summit_32.c b/arch/x86/kernel/apic/summit_32.c index cfe7b09015d8..32838b57a945 100644 --- a/arch/x86/kernel/apic/summit_32.c +++ b/arch/x86/kernel/apic/summit_32.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include <linux/gfp.h> | 48 | #include <linux/gfp.h> |
49 | #include <linux/smp.h> | 49 | #include <linux/smp.h> |
50 | 50 | ||
51 | static inline unsigned summit_get_apic_id(unsigned long x) | 51 | static unsigned summit_get_apic_id(unsigned long x) |
52 | { | 52 | { |
53 | return (x >> 24) & 0xFF; | 53 | return (x >> 24) & 0xFF; |
54 | } | 54 | } |
@@ -58,7 +58,7 @@ static inline void summit_send_IPI_mask(const cpumask_t *mask, int vector) | |||
58 | default_send_IPI_mask_sequence_logical(mask, vector); | 58 | default_send_IPI_mask_sequence_logical(mask, vector); |
59 | } | 59 | } |
60 | 60 | ||
61 | static inline void summit_send_IPI_allbutself(int vector) | 61 | static void summit_send_IPI_allbutself(int vector) |
62 | { | 62 | { |
63 | cpumask_t mask = cpu_online_map; | 63 | cpumask_t mask = cpu_online_map; |
64 | cpu_clear(smp_processor_id(), mask); | 64 | cpu_clear(smp_processor_id(), mask); |
@@ -67,7 +67,7 @@ static inline void summit_send_IPI_allbutself(int vector) | |||
67 | summit_send_IPI_mask(&mask, vector); | 67 | summit_send_IPI_mask(&mask, vector); |
68 | } | 68 | } |
69 | 69 | ||
70 | static inline void summit_send_IPI_all(int vector) | 70 | static void summit_send_IPI_all(int vector) |
71 | { | 71 | { |
72 | summit_send_IPI_mask(&cpu_online_map, vector); | 72 | summit_send_IPI_mask(&cpu_online_map, vector); |
73 | } | 73 | } |
@@ -82,8 +82,8 @@ extern void setup_summit(void); | |||
82 | #define setup_summit() {} | 82 | #define setup_summit() {} |
83 | #endif | 83 | #endif |
84 | 84 | ||
85 | static inline int | 85 | static int summit_mps_oem_check(struct mpc_table *mpc, char *oem, |
86 | summit_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | 86 | char *productid) |
87 | { | 87 | { |
88 | if (!strncmp(oem, "IBM ENSW", 8) && | 88 | if (!strncmp(oem, "IBM ENSW", 8) && |
89 | (!strncmp(productid, "VIGIL SMP", 9) | 89 | (!strncmp(productid, "VIGIL SMP", 9) |
@@ -98,7 +98,7 @@ summit_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | |||
98 | } | 98 | } |
99 | 99 | ||
100 | /* Hook from generic ACPI tables.c */ | 100 | /* Hook from generic ACPI tables.c */ |
101 | static inline int summit_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | 101 | static int summit_acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
102 | { | 102 | { |
103 | if (!strncmp(oem_id, "IBM", 3) && | 103 | if (!strncmp(oem_id, "IBM", 3) && |
104 | (!strncmp(oem_table_id, "SERVIGIL", 8) | 104 | (!strncmp(oem_table_id, "SERVIGIL", 8) |
@@ -186,7 +186,7 @@ static inline int is_WPEG(struct rio_detail *rio){ | |||
186 | 186 | ||
187 | #define SUMMIT_APIC_DFR_VALUE (APIC_DFR_CLUSTER) | 187 | #define SUMMIT_APIC_DFR_VALUE (APIC_DFR_CLUSTER) |
188 | 188 | ||
189 | static inline const cpumask_t *summit_target_cpus(void) | 189 | static const cpumask_t *summit_target_cpus(void) |
190 | { | 190 | { |
191 | /* CPU_MASK_ALL (0xff) has undefined behaviour with | 191 | /* CPU_MASK_ALL (0xff) has undefined behaviour with |
192 | * dest_LowestPrio mode logical clustered apic interrupt routing | 192 | * dest_LowestPrio mode logical clustered apic interrupt routing |
@@ -195,19 +195,18 @@ static inline const cpumask_t *summit_target_cpus(void) | |||
195 | return &cpumask_of_cpu(0); | 195 | return &cpumask_of_cpu(0); |
196 | } | 196 | } |
197 | 197 | ||
198 | static inline unsigned long | 198 | static unsigned long summit_check_apicid_used(physid_mask_t bitmap, int apicid) |
199 | summit_check_apicid_used(physid_mask_t bitmap, int apicid) | ||
200 | { | 199 | { |
201 | return 0; | 200 | return 0; |
202 | } | 201 | } |
203 | 202 | ||
204 | /* we don't use the phys_cpu_present_map to indicate apicid presence */ | 203 | /* we don't use the phys_cpu_present_map to indicate apicid presence */ |
205 | static inline unsigned long summit_check_apicid_present(int bit) | 204 | static unsigned long summit_check_apicid_present(int bit) |
206 | { | 205 | { |
207 | return 1; | 206 | return 1; |
208 | } | 207 | } |
209 | 208 | ||
210 | static inline void summit_init_apic_ldr(void) | 209 | static void summit_init_apic_ldr(void) |
211 | { | 210 | { |
212 | unsigned long val, id; | 211 | unsigned long val, id; |
213 | int count = 0; | 212 | int count = 0; |
@@ -234,18 +233,18 @@ static inline void summit_init_apic_ldr(void) | |||
234 | apic_write(APIC_LDR, val); | 233 | apic_write(APIC_LDR, val); |
235 | } | 234 | } |
236 | 235 | ||
237 | static inline int summit_apic_id_registered(void) | 236 | static int summit_apic_id_registered(void) |
238 | { | 237 | { |
239 | return 1; | 238 | return 1; |
240 | } | 239 | } |
241 | 240 | ||
242 | static inline void summit_setup_apic_routing(void) | 241 | static void summit_setup_apic_routing(void) |
243 | { | 242 | { |
244 | printk("Enabling APIC mode: Summit. Using %d I/O APICs\n", | 243 | printk("Enabling APIC mode: Summit. Using %d I/O APICs\n", |
245 | nr_ioapics); | 244 | nr_ioapics); |
246 | } | 245 | } |
247 | 246 | ||
248 | static inline int summit_apicid_to_node(int logical_apicid) | 247 | static int summit_apicid_to_node(int logical_apicid) |
249 | { | 248 | { |
250 | #ifdef CONFIG_SMP | 249 | #ifdef CONFIG_SMP |
251 | return apicid_2_node[hard_smp_processor_id()]; | 250 | return apicid_2_node[hard_smp_processor_id()]; |
@@ -266,7 +265,7 @@ static inline int summit_cpu_to_logical_apicid(int cpu) | |||
266 | #endif | 265 | #endif |
267 | } | 266 | } |
268 | 267 | ||
269 | static inline int summit_cpu_present_to_apicid(int mps_cpu) | 268 | static int summit_cpu_present_to_apicid(int mps_cpu) |
270 | { | 269 | { |
271 | if (mps_cpu < nr_cpu_ids) | 270 | if (mps_cpu < nr_cpu_ids) |
272 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); | 271 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); |
@@ -274,28 +273,23 @@ static inline int summit_cpu_present_to_apicid(int mps_cpu) | |||
274 | return BAD_APICID; | 273 | return BAD_APICID; |
275 | } | 274 | } |
276 | 275 | ||
277 | static inline physid_mask_t | 276 | static physid_mask_t summit_ioapic_phys_id_map(physid_mask_t phys_id_map) |
278 | summit_ioapic_phys_id_map(physid_mask_t phys_id_map) | ||
279 | { | 277 | { |
280 | /* For clustered we don't have a good way to do this yet - hack */ | 278 | /* For clustered we don't have a good way to do this yet - hack */ |
281 | return physids_promote(0x0F); | 279 | return physids_promote(0x0F); |
282 | } | 280 | } |
283 | 281 | ||
284 | static inline physid_mask_t summit_apicid_to_cpu_present(int apicid) | 282 | static physid_mask_t summit_apicid_to_cpu_present(int apicid) |
285 | { | 283 | { |
286 | return physid_mask_of_physid(0); | 284 | return physid_mask_of_physid(0); |
287 | } | 285 | } |
288 | 286 | ||
289 | static inline void summit_setup_portio_remap(void) | 287 | static int summit_check_phys_apicid_present(int boot_cpu_physical_apicid) |
290 | { | ||
291 | } | ||
292 | |||
293 | static inline int summit_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
294 | { | 288 | { |
295 | return 1; | 289 | return 1; |
296 | } | 290 | } |
297 | 291 | ||
298 | static inline unsigned int summit_cpu_mask_to_apicid(const cpumask_t *cpumask) | 292 | static unsigned int summit_cpu_mask_to_apicid(const cpumask_t *cpumask) |
299 | { | 293 | { |
300 | int cpus_found = 0; | 294 | int cpus_found = 0; |
301 | int num_bits_set; | 295 | int num_bits_set; |
@@ -303,12 +297,10 @@ static inline unsigned int summit_cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
303 | int cpu; | 297 | int cpu; |
304 | 298 | ||
305 | num_bits_set = cpus_weight(*cpumask); | 299 | num_bits_set = cpus_weight(*cpumask); |
306 | /* Return id to all */ | ||
307 | if (num_bits_set >= nr_cpu_ids) | 300 | if (num_bits_set >= nr_cpu_ids) |
308 | return 0xFF; | 301 | return BAD_APICID; |
309 | /* | 302 | /* |
310 | * The cpus in the mask must all be on the apic cluster. If are not | 303 | * The cpus in the mask must all be on the apic cluster. |
311 | * on the same apicid cluster return default value of target_cpus(): | ||
312 | */ | 304 | */ |
313 | cpu = first_cpu(*cpumask); | 305 | cpu = first_cpu(*cpumask); |
314 | apicid = summit_cpu_to_logical_apicid(cpu); | 306 | apicid = summit_cpu_to_logical_apicid(cpu); |
@@ -318,9 +310,9 @@ static inline unsigned int summit_cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
318 | int new_apicid = summit_cpu_to_logical_apicid(cpu); | 310 | int new_apicid = summit_cpu_to_logical_apicid(cpu); |
319 | 311 | ||
320 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { | 312 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { |
321 | printk ("%s: Not a valid mask!\n", __func__); | 313 | printk("%s: Not a valid mask!\n", __func__); |
322 | 314 | ||
323 | return 0xFF; | 315 | return BAD_APICID; |
324 | } | 316 | } |
325 | apicid = apicid | new_apicid; | 317 | apicid = apicid | new_apicid; |
326 | cpus_found++; | 318 | cpus_found++; |
@@ -330,8 +322,7 @@ static inline unsigned int summit_cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
330 | return apicid; | 322 | return apicid; |
331 | } | 323 | } |
332 | 324 | ||
333 | static inline unsigned int | 325 | static unsigned int summit_cpu_mask_to_apicid_and(const struct cpumask *inmask, |
334 | summit_cpu_mask_to_apicid_and(const struct cpumask *inmask, | ||
335 | const struct cpumask *andmask) | 326 | const struct cpumask *andmask) |
336 | { | 327 | { |
337 | int apicid = summit_cpu_to_logical_apicid(0); | 328 | int apicid = summit_cpu_to_logical_apicid(0); |
@@ -356,7 +347,7 @@ summit_cpu_mask_to_apicid_and(const struct cpumask *inmask, | |||
356 | * | 347 | * |
357 | * See Intel's IA-32 SW Dev's Manual Vol2 under CPUID. | 348 | * See Intel's IA-32 SW Dev's Manual Vol2 under CPUID. |
358 | */ | 349 | */ |
359 | static inline int summit_phys_pkg_id(int cpuid_apic, int index_msb) | 350 | static int summit_phys_pkg_id(int cpuid_apic, int index_msb) |
360 | { | 351 | { |
361 | return hard_smp_processor_id() >> index_msb; | 352 | return hard_smp_processor_id() >> index_msb; |
362 | } | 353 | } |
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index e85826829cf2..508bec1cee27 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -858,6 +858,9 @@ void __init reserve_early_overlap_ok(u64 start, u64 end, char *name) | |||
858 | */ | 858 | */ |
859 | void __init reserve_early(u64 start, u64 end, char *name) | 859 | void __init reserve_early(u64 start, u64 end, char *name) |
860 | { | 860 | { |
861 | if (start >= end) | ||
862 | return; | ||
863 | |||
861 | drop_overlaps_that_are_ok(start, end); | 864 | drop_overlaps_that_are_ok(start, end); |
862 | __reserve_early(start, end, name, 0); | 865 | __reserve_early(start, end, name, 0); |
863 | } | 866 | } |