mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Erwan Velu <erwanaliasr1@gmail.com>
To: Borislav Petkov <bp@alien8.de>, x86@kernel.org
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org, Erwan Velu <e.velu@criteo.com>
Subject: [PATCH] x86/microcode/AMD: Warn when a patch is skipped because of the Entrysign cutoff
Date: Wed, 25 Nov 2026 18:52:03 +0100	[thread overview]
Message-ID: <20261125175203.1003294-1-e.velu@criteo.com> (raw)

Since commit 8d171045069c ("x86/microcode/AMD: Select which microcode
patch to load"), verify_patch() only considers patches which are on the
same side of the Entrysign cutoff revision as the microcode currently
running on the CPU. On a machine whose BIOS still ships pre-Entrysign
microcode, every post-Entrysign patch for that CPU, be it in the initrd
or in /lib/firmware, is skipped.

This choice is made silently: nothing is printed, neither at early load
nor on late load, where the write to the reload file in
/sys/devices/system/cpu/microcode/ even succeeds. The microcode shipped
by the distribution is simply never applied and the CPU stays at the
BIOS revision, or at the pre-Entrysign fallback patch. Because nothing
explains this, it is very hard to understand why the microcode is not
loaded: one has to read the loader source to find out that a BIOS update
is what is actually needed.

Print a one-time warning when a patch for the running CPU is skipped
because the current revision is at or below the cutoff, naming the
patch, the current revision and the cutoff, and pointing at the BIOS
update.

Patches below the cutoff are still skipped silently on CPUs which are
already past it, as they are older than the running revision anyway.

Tested in a KVM guest with CONFIG_MICROCODE_DBG=y, a guest CPUID of
family 0x19, model 0xa0, stepping 2 (EPYC 8004 "Siena", cutoff
0xaa00218), linux-firmware's microcode_amd_fam19h.bin in the early
initrd (it carries both 0xaa00215 and 0xaa0021c for that CPU) and the
running revision faked with microcode=base_rev=:

 - base_rev=0xaa00216: without this patch, only "Current revision:
   0x0aa00216" is printed and a late reload succeeds without changing
   anything. With it, the warning about 0x0aa0021c is printed once.
 - base_rev=0xaa00212: 0xaa00215 is applied early and the warning about
   0x0aa0021c is printed.
 - base_rev=0xaa0021b: 0xaa0021c is applied early and nothing new is
   printed.

Fixes: 8d171045069c ("x86/microcode/AMD: Select which microcode patch to load")
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Erwan Velu <e.velu@criteo.com>
---
 arch/x86/kernel/cpu/microcode/amd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index 6cdc410e7547..ea7a8853d509 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -568,6 +568,11 @@ static int verify_patch(const u8 *buf, size_t buf_size, u32 *patch_size)
 	if (cur_rev > cutoff && patch_rev > cutoff)
 		goto ok;
 
+	if (cur_rev <= cutoff &&
+	    ucode_rev_to_cpuid(patch_rev).full == bsp_cpuid_1_eax)
+		pr_warn_once("Patch 0x%08x skipped: current revision 0x%08x is at or below the Entrysign cutoff 0x%08x, a BIOS update is required\n",
+			     patch_rev, cur_rev, cutoff);
+
 	return 1;
 
 ok:
-- 
2.55.0


                 reply	other threads:[~2026-11-25 17:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261125175203.1003294-1-e.velu@criteo.com \
    --to=erwanaliasr1@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=e.velu@criteo.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®