@@ -512,39 +512,6 @@ static bool __apply_microcode_amd(struct microcode_amd *mc, unsigned int psize)
512
512
return true;
513
513
}
514
514
515
- /*
516
- * Early load occurs before we can vmalloc(). So we look for the microcode
517
- * patch container file in initrd, traverse equivalent cpu table, look for a
518
- * matching microcode patch, and update, all in initrd memory in place.
519
- * When vmalloc() is available for use later -- on 64-bit during first AP load,
520
- * and on 32-bit during save_microcode_in_initrd() -- we can call
521
- * load_microcode_amd() to save equivalent cpu table and microcode patches in
522
- * kernel heap memory.
523
- *
524
- * Returns true if container found (sets @desc), false otherwise.
525
- */
526
- static bool early_apply_microcode (u32 old_rev , void * ucode , size_t size )
527
- {
528
- struct cont_desc desc = { 0 };
529
- struct microcode_amd * mc ;
530
-
531
- scan_containers (ucode , size , & desc );
532
-
533
- mc = desc .mc ;
534
- if (!mc )
535
- return false;
536
-
537
- /*
538
- * Allow application of the same revision to pick up SMT-specific
539
- * changes even if the revision of the other SMT thread is already
540
- * up-to-date.
541
- */
542
- if (old_rev > mc -> hdr .patch_id )
543
- return false;
544
-
545
- return __apply_microcode_amd (mc , desc .psize );
546
- }
547
-
548
515
static bool get_builtin_microcode (struct cpio_data * cp )
549
516
{
550
517
char fw_name [36 ] = "amd-ucode/microcode_amd.bin" ;
@@ -582,8 +549,19 @@ static bool __init find_blobs_in_containers(struct cpio_data *ret)
582
549
return found ;
583
550
}
584
551
552
+ /*
553
+ * Early load occurs before we can vmalloc(). So we look for the microcode
554
+ * patch container file in initrd, traverse equivalent cpu table, look for a
555
+ * matching microcode patch, and update, all in initrd memory in place.
556
+ * When vmalloc() is available for use later -- on 64-bit during first AP load,
557
+ * and on 32-bit during save_microcode_in_initrd() -- we can call
558
+ * load_microcode_amd() to save equivalent cpu table and microcode patches in
559
+ * kernel heap memory.
560
+ */
585
561
void __init load_ucode_amd_bsp (struct early_load_data * ed , unsigned int cpuid_1_eax )
586
562
{
563
+ struct cont_desc desc = { };
564
+ struct microcode_amd * mc ;
587
565
struct cpio_data cp = { };
588
566
u32 dummy ;
589
567
@@ -597,7 +575,21 @@ void __init load_ucode_amd_bsp(struct early_load_data *ed, unsigned int cpuid_1_
597
575
if (!find_blobs_in_containers (& cp ))
598
576
return ;
599
577
600
- if (early_apply_microcode (ed -> old_rev , cp .data , cp .size ))
578
+ scan_containers (cp .data , cp .size , & desc );
579
+
580
+ mc = desc .mc ;
581
+ if (!mc )
582
+ return ;
583
+
584
+ /*
585
+ * Allow application of the same revision to pick up SMT-specific
586
+ * changes even if the revision of the other SMT thread is already
587
+ * up-to-date.
588
+ */
589
+ if (ed -> old_rev > mc -> hdr .patch_id )
590
+ return ;
591
+
592
+ if (__apply_microcode_amd (mc , desc .psize ))
601
593
native_rdmsr (MSR_AMD64_PATCH_LEVEL , ed -> new_rev , dummy );
602
594
}
603
595
0 commit comments