Skip to content

Commit 5c20003

Browse files
bp3tk0vgregkh
authored andcommitted
x86/microcode/AMD: Get rid of the _load_microcode_amd() forward declaration
commit b39c387 upstream. Simply move save_microcode_in_initrd() down. No functional changes. Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20250211163648.30531-5-bp@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 12ccf71 commit 5c20003

File tree

1 file changed

+26
-28
lines changed
  • arch/x86/kernel/cpu/microcode

1 file changed

+26
-28
lines changed

arch/x86/kernel/cpu/microcode/amd.c

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -594,34 +594,6 @@ void __init load_ucode_amd_bsp(struct early_load_data *ed, unsigned int cpuid_1_
594594
native_rdmsr(MSR_AMD64_PATCH_LEVEL, ed->new_rev, dummy);
595595
}
596596

597-
static enum ucode_state _load_microcode_amd(u8 family, const u8 *data, size_t size);
598-
599-
static int __init save_microcode_in_initrd(void)
600-
{
601-
unsigned int cpuid_1_eax = native_cpuid_eax(1);
602-
struct cpuinfo_x86 *c = &boot_cpu_data;
603-
struct cont_desc desc = { 0 };
604-
enum ucode_state ret;
605-
struct cpio_data cp;
606-
607-
if (dis_ucode_ldr || c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10)
608-
return 0;
609-
610-
if (!find_blobs_in_containers(&cp))
611-
return -EINVAL;
612-
613-
scan_containers(cp.data, cp.size, &desc);
614-
if (!desc.mc)
615-
return -EINVAL;
616-
617-
ret = _load_microcode_amd(x86_family(cpuid_1_eax), desc.data, desc.size);
618-
if (ret > UCODE_UPDATED)
619-
return -EINVAL;
620-
621-
return 0;
622-
}
623-
early_initcall(save_microcode_in_initrd);
624-
625597
static inline bool patch_cpus_equivalent(struct ucode_patch *p,
626598
struct ucode_patch *n,
627599
bool ignore_stepping)
@@ -1005,6 +977,32 @@ static enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t siz
1005977
return ret;
1006978
}
1007979

980+
static int __init save_microcode_in_initrd(void)
981+
{
982+
unsigned int cpuid_1_eax = native_cpuid_eax(1);
983+
struct cpuinfo_x86 *c = &boot_cpu_data;
984+
struct cont_desc desc = { 0 };
985+
enum ucode_state ret;
986+
struct cpio_data cp;
987+
988+
if (dis_ucode_ldr || c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10)
989+
return 0;
990+
991+
if (!find_blobs_in_containers(&cp))
992+
return -EINVAL;
993+
994+
scan_containers(cp.data, cp.size, &desc);
995+
if (!desc.mc)
996+
return -EINVAL;
997+
998+
ret = _load_microcode_amd(x86_family(cpuid_1_eax), desc.data, desc.size);
999+
if (ret > UCODE_UPDATED)
1000+
return -EINVAL;
1001+
1002+
return 0;
1003+
}
1004+
early_initcall(save_microcode_in_initrd);
1005+
10081006
/*
10091007
* AMD microcode firmware naming convention, up to family 15h they are in
10101008
* the legacy file:

0 commit comments

Comments
 (0)