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