diff options
Diffstat (limited to 'arch/x86/kernel')
| -rw-r--r-- | arch/x86/kernel/microcode_intel.c | 16 | ||||
| -rw-r--r-- | arch/x86/kernel/setup.c | 17 |
2 files changed, 19 insertions, 14 deletions
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c index dcb65cc0a05..1a1b606d3e9 100644 --- a/arch/x86/kernel/microcode_intel.c +++ b/arch/x86/kernel/microcode_intel.c | |||
| @@ -364,8 +364,7 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
| 364 | 364 | ||
| 365 | /* For performance reasons, reuse mc area when possible */ | 365 | /* For performance reasons, reuse mc area when possible */ |
| 366 | if (!mc || mc_size > curr_mc_size) { | 366 | if (!mc || mc_size > curr_mc_size) { |
| 367 | if (mc) | 367 | vfree(mc); |
| 368 | vfree(mc); | ||
| 369 | mc = vmalloc(mc_size); | 368 | mc = vmalloc(mc_size); |
| 370 | if (!mc) | 369 | if (!mc) |
| 371 | break; | 370 | break; |
| @@ -374,13 +373,11 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
| 374 | 373 | ||
| 375 | if (get_ucode_data(mc, ucode_ptr, mc_size) || | 374 | if (get_ucode_data(mc, ucode_ptr, mc_size) || |
| 376 | microcode_sanity_check(mc) < 0) { | 375 | microcode_sanity_check(mc) < 0) { |
| 377 | vfree(mc); | ||
| 378 | break; | 376 | break; |
| 379 | } | 377 | } |
| 380 | 378 | ||
| 381 | if (get_matching_microcode(&uci->cpu_sig, mc, new_rev)) { | 379 | if (get_matching_microcode(&uci->cpu_sig, mc, new_rev)) { |
| 382 | if (new_mc) | 380 | vfree(new_mc); |
| 383 | vfree(new_mc); | ||
| 384 | new_rev = mc_header.rev; | 381 | new_rev = mc_header.rev; |
| 385 | new_mc = mc; | 382 | new_mc = mc; |
| 386 | mc = NULL; /* trigger new vmalloc */ | 383 | mc = NULL; /* trigger new vmalloc */ |
| @@ -390,12 +387,10 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
| 390 | leftover -= mc_size; | 387 | leftover -= mc_size; |
| 391 | } | 388 | } |
| 392 | 389 | ||
| 393 | if (mc) | 390 | vfree(mc); |
| 394 | vfree(mc); | ||
| 395 | 391 | ||
| 396 | if (leftover) { | 392 | if (leftover) { |
| 397 | if (new_mc) | 393 | vfree(new_mc); |
| 398 | vfree(new_mc); | ||
| 399 | state = UCODE_ERROR; | 394 | state = UCODE_ERROR; |
| 400 | goto out; | 395 | goto out; |
| 401 | } | 396 | } |
| @@ -405,8 +400,7 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
| 405 | goto out; | 400 | goto out; |
| 406 | } | 401 | } |
| 407 | 402 | ||
| 408 | if (uci->mc) | 403 | vfree(uci->mc); |
| 409 | vfree(uci->mc); | ||
| 410 | uci->mc = (struct microcode_intel *)new_mc; | 404 | uci->mc = (struct microcode_intel *)new_mc; |
| 411 | 405 | ||
| 412 | pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n", | 406 | pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n", |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 85268f8eadf..a0f52af256a 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
| @@ -501,7 +501,18 @@ static inline unsigned long long get_total_mem(void) | |||
| 501 | return total << PAGE_SHIFT; | 501 | return total << PAGE_SHIFT; |
| 502 | } | 502 | } |
| 503 | 503 | ||
| 504 | #define DEFAULT_BZIMAGE_ADDR_MAX 0x37FFFFFF | 504 | /* |
| 505 | * Keep the crash kernel below this limit. On 32 bits earlier kernels | ||
| 506 | * would limit the kernel to the low 512 MiB due to mapping restrictions. | ||
| 507 | * On 64 bits, kexec-tools currently limits us to 896 MiB; increase this | ||
| 508 | * limit once kexec-tools are fixed. | ||
| 509 | */ | ||
| 510 | #ifdef CONFIG_X86_32 | ||
| 511 | # define CRASH_KERNEL_ADDR_MAX (512 << 20) | ||
| 512 | #else | ||
| 513 | # define CRASH_KERNEL_ADDR_MAX (896 << 20) | ||
| 514 | #endif | ||
| 515 | |||
| 505 | static void __init reserve_crashkernel(void) | 516 | static void __init reserve_crashkernel(void) |
| 506 | { | 517 | { |
| 507 | unsigned long long total_mem; | 518 | unsigned long long total_mem; |
| @@ -520,10 +531,10 @@ static void __init reserve_crashkernel(void) | |||
| 520 | const unsigned long long alignment = 16<<20; /* 16M */ | 531 | const unsigned long long alignment = 16<<20; /* 16M */ |
| 521 | 532 | ||
| 522 | /* | 533 | /* |
| 523 | * kexec want bzImage is below DEFAULT_BZIMAGE_ADDR_MAX | 534 | * kexec want bzImage is below CRASH_KERNEL_ADDR_MAX |
| 524 | */ | 535 | */ |
| 525 | crash_base = memblock_find_in_range(alignment, | 536 | crash_base = memblock_find_in_range(alignment, |
| 526 | DEFAULT_BZIMAGE_ADDR_MAX, crash_size, alignment); | 537 | CRASH_KERNEL_ADDR_MAX, crash_size, alignment); |
| 527 | 538 | ||
| 528 | if (crash_base == MEMBLOCK_ERROR) { | 539 | if (crash_base == MEMBLOCK_ERROR) { |
| 529 | pr_info("crashkernel reservation failed - No suitable area found.\n"); | 540 | pr_info("crashkernel reservation failed - No suitable area found.\n"); |
