diff options
| author | Borislav Petkov <bp@suse.de> | 2017-01-20 15:29:53 -0500 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2017-01-23 04:02:50 -0500 |
| commit | 72edfe950b36308353e27cdc02f334431239938a (patch) | |
| tree | fedf6b9f519e1d1672ddaa388b224fb1fb19c696 /arch | |
| parent | e71bb4ec073901ad50bfa86fed74fce7ac3210fe (diff) | |
x86/microcode/AMD: Simplify saving from initrd
No need to use the previously stashed info in the container - simply go
ahead and parse the initrd once more. It simplifies and streamlines the
code a whole lot.
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170120202955.4091-15-bp@alien8.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/x86/kernel/cpu/microcode/amd.c | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index fe9e865480af..2a194e384207 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c | |||
| @@ -372,43 +372,26 @@ load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size); | |||
| 372 | 372 | ||
| 373 | int __init save_microcode_in_initrd_amd(unsigned int cpuid_1_eax) | 373 | int __init save_microcode_in_initrd_amd(unsigned int cpuid_1_eax) |
| 374 | { | 374 | { |
| 375 | struct cont_desc desc = { 0 }; | ||
| 375 | enum ucode_state ret; | 376 | enum ucode_state ret; |
| 376 | int retval = 0; | 377 | struct cpio_data cp; |
| 377 | |||
| 378 | if (!cont.data) { | ||
| 379 | if (IS_ENABLED(CONFIG_X86_32) && (cont.size != -1)) { | ||
| 380 | struct cpio_data cp; | ||
| 381 | |||
| 382 | cp = find_microcode_in_initrd(ucode_path, false); | ||
| 383 | if (!(cp.data && cp.size)) { | ||
| 384 | cont.size = -1; | ||
| 385 | return -EINVAL; | ||
| 386 | } | ||
| 387 | 378 | ||
| 388 | cont.cpuid_1_eax = cpuid_1_eax; | 379 | cp = find_microcode_in_initrd(ucode_path, false); |
| 380 | if (!(cp.data && cp.size)) | ||
| 381 | return -EINVAL; | ||
| 389 | 382 | ||
| 390 | scan_containers(cp.data, cp.size, &cont); | 383 | desc.cpuid_1_eax = cpuid_1_eax; |
| 391 | if (!cont.eq_id) { | ||
| 392 | cont.size = -1; | ||
| 393 | return -EINVAL; | ||
| 394 | } | ||
| 395 | 384 | ||
| 396 | } else | 385 | scan_containers(cp.data, cp.size, &desc); |
| 397 | return -EINVAL; | 386 | if (!desc.eq_id) |
| 398 | } | 387 | return -EINVAL; |
| 399 | 388 | ||
| 400 | ret = load_microcode_amd(smp_processor_id(), x86_family(cpuid_1_eax), cont.data, cont.size); | 389 | ret = load_microcode_amd(smp_processor_id(), x86_family(cpuid_1_eax), |
| 390 | desc.data, desc.size); | ||
| 401 | if (ret != UCODE_OK) | 391 | if (ret != UCODE_OK) |
| 402 | retval = -EINVAL; | 392 | return -EINVAL; |
| 403 | |||
| 404 | /* | ||
| 405 | * This will be freed any msec now, stash patches for the current | ||
| 406 | * family and switch to patch cache for cpu hotplug, etc later. | ||
| 407 | */ | ||
| 408 | cont.data = NULL; | ||
| 409 | cont.size = 0; | ||
| 410 | 393 | ||
| 411 | return retval; | 394 | return 0; |
| 412 | } | 395 | } |
| 413 | 396 | ||
| 414 | void reload_ucode_amd(void) | 397 | void reload_ucode_amd(void) |
