| From b21a243936867135ab4744cdea7e070e2ed57839 Mon Sep 17 00:00:00 2001 | |
| From: Sasha Levin <sashal@kernel.org> | |
| Date: Wed, 16 Sep 2026 22:59:39 +0000 | |
| Subject: x86/microcode/intel: Reject problematic loading on Granite Rapids | |
| systems | |
| From: Chang S. Bae <chang.seok.bae@intel.com> | |
| [ Upstream commit e7d3e2f46dd5a69046e6d95a0f189155a5516b93 ] | |
| Microcode updates can usually jump revisions. However, there is an erratum on | |
| Granite Rapids systems. If they "jump over" revision 0x1000405, they result in | |
| an #MC. Avoid it. | |
| Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com> | |
| Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> | |
| Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com> | |
| Cc: stable@vger.kernel.org | |
| Link: https://patch.msgid.link/20260916225939.1144524-1-chang.seok.bae@intel.com | |
| [ sashal: Dropped the minrev-based context in parse_microcode_blobs() and placed the new check after the signature match, and added an include of asm/cpu_device_id.h so IFM() builds. ] | |
| Signed-off-by: Sasha Levin <sashal@kernel.org> | |
| --- | |
| arch/x86/kernel/cpu/microcode/intel.c | 27 +++++++++++++++++++++++++++ | |
| 1 file changed, 27 insertions(+) | |
| diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c | |
| index 4e5a71796fbdb..433b54f56ec29 100644 | |
| --- a/arch/x86/kernel/cpu/microcode/intel.c | |
| +++ b/arch/x86/kernel/cpu/microcode/intel.c | |
| @@ -21,6 +21,7 @@ | |
| #include <linux/uio.h> | |
| #include <linux/mm.h> | |
| +#include <asm/cpu_device_id.h> | |
| #include <asm/intel-family.h> | |
| #include <asm/processor.h> | |
| #include <asm/tlbflush.h> | |
| @@ -257,6 +258,26 @@ static void save_microcode_patch(struct microcode_intel *patch) | |
| pr_err("Unable to allocate microcode memory size: %u\n", size); | |
| } | |
| +static bool revision_is_safe(struct cpu_signature *sig, u32 rev) | |
| +{ | |
| + u32 vfm = IFM(x86_family(sig->sig), x86_model(sig->sig)); | |
| + | |
| + /* | |
| + * Erratum GNR98 can cause #MCs if "jumping over" revision 0x1000405. | |
| + * Avoid the jumps. | |
| + */ | |
| + if (vfm == INTEL_GRANITERAPIDS_X && | |
| + x86_stepping(sig->sig) == 1 && | |
| + sig->pf & 0x95 && | |
| + sig->rev < 0x1000405 && | |
| + rev > 0x1000405) { | |
| + pr_err_once("Erratum GNR98: skipping revision 0x%x.\n", rev); | |
| + return false; | |
| + } | |
| + | |
| + return true; | |
| +} | |
| + | |
| /* Scan blob for microcode matching the boot CPUs family, model, stepping */ | |
| static __init struct microcode_intel *scan_microcode(void *data, size_t size, | |
| struct ucode_cpu_info *uci, | |
| @@ -278,6 +299,9 @@ static __init struct microcode_intel *scan_microcode(void *data, size_t size, | |
| if (!intel_find_matching_signature(data, &uci->cpu_sig)) | |
| continue; | |
| + if (!revision_is_safe(&uci->cpu_sig, mc_header->rev)) | |
| + continue; | |
| + | |
| /* | |
| * For saving the early microcode, find the matching revision which | |
| * was loaded on the BSP. | |
| @@ -516,6 +540,9 @@ static enum ucode_state parse_microcode_blobs(int cpu, struct iov_iter *iter) | |
| if (!intel_find_matching_signature(mc, &uci->cpu_sig)) | |
| continue; | |
| + if (!revision_is_safe(&uci->cpu_sig, mc_header.rev)) | |
| + continue; | |
| + | |
| kvfree(new_mc); | |
| cur_rev = mc_header.rev; | |
| new_mc = mc; | |
| -- | |
| 2.53.0 | |