All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@kernel.org>
To: X86 ML <x86@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	"Borislav Petkov (AMD)" <bp@alien8.de>
Subject: [PATCH 4/5] x86/microcode/AMD: Get rid of the _load_microcode_amd() forward declaration
Date: Tue, 11 Feb 2025 17:36:47 +0100	[thread overview]
Message-ID: <20250211163648.30531-5-bp@kernel.org> (raw)
In-Reply-To: <20250211163648.30531-1-bp@kernel.org>

From: "Borislav Petkov (AMD)" <bp@alien8.de>

Simply move save_microcode_in_initrd() down.

No functional changes.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
---
 arch/x86/kernel/cpu/microcode/amd.c | 54 ++++++++++++++---------------
 1 file changed, 26 insertions(+), 28 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index 90f93b3ca9db..adfea4d0d129 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -593,34 +593,6 @@ void __init load_ucode_amd_bsp(struct early_load_data *ed, unsigned int cpuid_1_
 		native_rdmsr(MSR_AMD64_PATCH_LEVEL, ed->new_rev, dummy);
 }
 
-static enum ucode_state _load_microcode_amd(u8 family, const u8 *data, size_t size);
-
-static int __init save_microcode_in_initrd(void)
-{
-	unsigned int cpuid_1_eax = native_cpuid_eax(1);
-	struct cpuinfo_x86 *c = &boot_cpu_data;
-	struct cont_desc desc = { 0 };
-	enum ucode_state ret;
-	struct cpio_data cp;
-
-	if (dis_ucode_ldr || c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10)
-		return 0;
-
-	if (!find_blobs_in_containers(&cp))
-		return -EINVAL;
-
-	scan_containers(cp.data, cp.size, &desc);
-	if (!desc.mc)
-		return -EINVAL;
-
-	ret = _load_microcode_amd(x86_family(cpuid_1_eax), desc.data, desc.size);
-	if (ret > UCODE_UPDATED)
-		return -EINVAL;
-
-	return 0;
-}
-early_initcall(save_microcode_in_initrd);
-
 static inline bool patch_cpus_equivalent(struct ucode_patch *p,
 					 struct ucode_patch *n,
 					 bool ignore_stepping)
@@ -1004,6 +976,32 @@ static enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t siz
 	return ret;
 }
 
+static int __init save_microcode_in_initrd(void)
+{
+	unsigned int cpuid_1_eax = native_cpuid_eax(1);
+	struct cpuinfo_x86 *c = &boot_cpu_data;
+	struct cont_desc desc = { 0 };
+	enum ucode_state ret;
+	struct cpio_data cp;
+
+	if (dis_ucode_ldr || c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10)
+		return 0;
+
+	if (!find_blobs_in_containers(&cp))
+		return -EINVAL;
+
+	scan_containers(cp.data, cp.size, &desc);
+	if (!desc.mc)
+		return -EINVAL;
+
+	ret = _load_microcode_amd(x86_family(cpuid_1_eax), desc.data, desc.size);
+	if (ret > UCODE_UPDATED)
+		return -EINVAL;
+
+	return 0;
+}
+early_initcall(save_microcode_in_initrd);
+
 /*
  * AMD microcode firmware naming convention, up to family 15h they are in
  * the legacy file:
-- 
2.43.0


  parent reply	other threads:[~2025-02-11 16:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-11 16:36 [PATCH 0/5] x86/microcode/AMD: Some small cleanups Borislav Petkov
2025-02-11 16:36 ` [PATCH 1/5] x86/microcode/AMD: Remove ugly linebreak in __verify_patch_section() signature Borislav Petkov
2025-02-17  8:51   ` [tip: x86/microcode] " tip-bot2 for Borislav Petkov (AMD)
2025-02-11 16:36 ` [PATCH 2/5] x86/microcode/AMD: Remove unused save_microcode_in_initrd_amd() declarations Borislav Petkov
2025-02-17  8:51   ` [tip: x86/microcode] " tip-bot2 for Borislav Petkov (AMD)
2025-02-11 16:36 ` [PATCH 3/5] x86/microcode/AMD: Merge early_apply_microcode() into its single callsite Borislav Petkov
2025-02-17  8:51   ` [tip: x86/microcode] " tip-bot2 for Borislav Petkov (AMD)
2025-02-11 16:36 ` Borislav Petkov [this message]
2025-02-17  8:51   ` [tip: x86/microcode] x86/microcode/AMD: Get rid of the _load_microcode_amd() forward declaration tip-bot2 for Borislav Petkov (AMD)
2025-02-11 16:36 ` [PATCH 5/5] x86/microcode/AMD: Add get_patch_level() Borislav Petkov
2025-02-17  8:51   ` [tip: x86/microcode] " tip-bot2 for Borislav Petkov (AMD)
2025-02-13 11:10 ` [PATCH 0/5] x86/microcode/AMD: Some small cleanups Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250211163648.30531-5-bp@kernel.org \
    --to=bp@kernel.org \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.