diff options
-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) |