* [PATCH v2 1/7] x86/microcode: Avoid spurious base_rev= match
2026-11-16 16:45 [PATCH v2 0/7] x86/microcode: Incremental Loading and Early Minimum Revision Check Chang S. Bae
@ 2026-11-16 16:45 ` Chang S. Bae
2026-11-16 16:45 ` [PATCH v2 2/7] x86/microcode: Accept a boolean for force_minrev parameter Chang S. Bae
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Chang S. Bae @ 2026-11-16 16:45 UTC (permalink / raw)
To: linux-kernel
Cc: x86, tglx, mingo, bp, dave.hansen, hpa, andrew.cooper3,
arjan.van.de.ven, chang.seok.bae, stable
After base_rev= has been parsed, the remainder of the token is still
compared against the other option names. Along with this, the substring
check strstr() may also produce a spurious match.
Move on to the next token once the option has been parsed, and use
str_has_prefix() instead.
Fixes: 43181a47263d ("x86/microcode: Add microcode loader debugging functionality")
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Cc: <stable@vger.kernel.org>
---
V1 -> V2: Clarify the subject
---
arch/x86/kernel/cpu/microcode/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 0dd0c7241c57..303b0d0b4573 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -146,10 +146,11 @@ static void __init early_parse_cmdline(void)
if (cmdline_find_option(boot_command_line, "microcode", cmd_buf, sizeof(cmd_buf)) > 0) {
while ((s = strsep(&p, ","))) {
if (IS_ENABLED(CONFIG_MICROCODE_DBG)) {
- if (strstr(s, "base_rev=")) {
+ if (str_has_prefix(s, "base_rev=")) {
/* advance to the option arg */
strsep(&s, "=");
if (kstrtouint(s, 16, &base_rev)) { ; }
+ continue;
}
}
--
2.53.0
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v2 2/7] x86/microcode: Accept a boolean for force_minrev parameter
2026-11-16 16:45 [PATCH v2 0/7] x86/microcode: Incremental Loading and Early Minimum Revision Check Chang S. Bae
2026-11-16 16:45 ` [PATCH v2 1/7] x86/microcode: Avoid spurious base_rev= match Chang S. Bae
@ 2026-11-16 16:45 ` Chang S. Bae
2026-11-16 16:45 ` [PATCH v2 3/7] x86/microcode: Mark early_data __initdata Chang S. Bae
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Chang S. Bae @ 2026-11-16 16:45 UTC (permalink / raw)
To: linux-kernel
Cc: x86, tglx, mingo, bp, dave.hansen, hpa, andrew.cooper3,
arjan.van.de.ven, chang.seok.bae, Sohil Mehta, stable
The microcode= command-line option allows controlling all microcode
loading options. However, force_minrev can only enable minimum revision
enforcement, not disable it.
The previous microcode.force_minrev= option accepted both boolean values,
and the current behavior differs from the documentation in
kernel-parameters.txt.
Add `force_minrev=` as a sub-option to explicitly enable or disable the
minimum revision enforcement. Update the documentation accordingly.
While doing so, wrap strsep() in a descriptively named helper.
Fixes: 632ff6170647 ("x86/microcode: Add microcode= cmdline parsing")
Reported-by: Sohil Mehta <sohil.mehta@intel.com>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Cc: <stable@vger.kernel.org>
---
Documentation/admin-guide/kernel-parameters.txt | 7 ++++---
arch/x86/kernel/cpu/microcode/core.c | 15 ++++++++++++---
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 0b3c140babd9..a6d50cf6435c 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -4086,9 +4086,10 @@ Kernel parameters
dis_ucode_ldr: disable the microcode loader
- force_minrev:
- Enable or disable the microcode minimal revision
- enforcement for the runtime microcode loader.
+ force_minrev[=<bool>]:
+ Enable or disable microcode minimal revision enforcement
+ for the runtime microcode loader according to <bool>. If
+ <bool> is not given, enable the enforcement.
mitigations=
[X86,PPC,S390,ARM64,EARLY] Control optional mitigations for
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 303b0d0b4573..af7196d94540 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -138,6 +138,11 @@ bool __init microcode_loader_disabled(void)
return dis_ucode_ldr;
}
+static inline void advance_option_argument(char **s)
+{
+ strsep(s, "=");
+}
+
static void __init early_parse_cmdline(void)
{
char cmd_buf[64] = {};
@@ -147,15 +152,19 @@ static void __init early_parse_cmdline(void)
while ((s = strsep(&p, ","))) {
if (IS_ENABLED(CONFIG_MICROCODE_DBG)) {
if (str_has_prefix(s, "base_rev=")) {
- /* advance to the option arg */
- strsep(&s, "=");
+ advance_option_argument(&s);
if (kstrtouint(s, 16, &base_rev)) { ; }
continue;
}
}
- if (!strcmp("force_minrev", s))
+ if (!strcmp("force_minrev", s)) {
force_minrev = true;
+ } else if (str_has_prefix(s, "force_minrev=")) {
+ advance_option_argument(&s);
+ if (kstrtobool(s, &force_minrev)) { ; }
+ continue;
+ }
if (!strcmp(s, "dis_ucode_ldr"))
dis_ucode_ldr = true;
--
2.53.0
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v2 3/7] x86/microcode: Mark early_data __initdata
2026-11-16 16:45 [PATCH v2 0/7] x86/microcode: Incremental Loading and Early Minimum Revision Check Chang S. Bae
2026-11-16 16:45 ` [PATCH v2 1/7] x86/microcode: Avoid spurious base_rev= match Chang S. Bae
2026-11-16 16:45 ` [PATCH v2 2/7] x86/microcode: Accept a boolean for force_minrev parameter Chang S. Bae
@ 2026-11-16 16:45 ` Chang S. Bae
2026-11-16 16:45 ` [PATCH v2 4/7] x86/microcode: Introduce incremental late loading Chang S. Bae
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Chang S. Bae @ 2026-11-16 16:45 UTC (permalink / raw)
To: linux-kernel
Cc: x86, tglx, mingo, bp, dave.hansen, hpa, andrew.cooper3,
arjan.van.de.ven, chang.seok.bae
early_data records the revisions seen during early loading, and
microcode_init() is its last reader.
Mark the storage reclaimable afterwards.
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
---
arch/x86/kernel/cpu/microcode/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index af7196d94540..ed1eb6b753d6 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -83,7 +83,7 @@ static u32 final_levels[] = {
0, /* T-101 terminator */
};
-struct early_load_data early_data;
+struct early_load_data early_data __initdata;
/*
* Check the current patch level on this CPU.
--
2.53.0
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v2 4/7] x86/microcode: Introduce incremental late loading
2026-11-16 16:45 [PATCH v2 0/7] x86/microcode: Incremental Loading and Early Minimum Revision Check Chang S. Bae
` (2 preceding siblings ...)
2026-11-16 16:45 ` [PATCH v2 3/7] x86/microcode: Mark early_data __initdata Chang S. Bae
@ 2026-11-16 16:45 ` Chang S. Bae
2026-11-16 16:45 ` [PATCH v2 5/7] x86/microcode/intel: Select the lowest revision for incremental loading Chang S. Bae
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Chang S. Bae @ 2026-11-16 16:45 UTC (permalink / raw)
To: linux-kernel
Cc: x86, tglx, mingo, bp, dave.hansen, hpa, andrew.cooper3,
arjan.van.de.ven, chang.seok.bae
The minimum revision requirement was introduced to handle dependencies
between microcode revisions. On the other hand, Intel has traditionally
distributed only the latest microcode blob in the repository [1].
Concatenating the dependent blobs into a single image may allow loading
the prerequisite revisions in sequence. The loader, however, currently
picks the highest revision from a multi-blob image, so it may skip the
minimum revision requirement.
If enforced, it skips revisions whose prerequisites have not been loaded,
possibly leaving the loading process at an intermediate revision. Then,
admins have to manually trigger another load to apply the remaining
higher revisions.
To avoid this manual step, introduce incremental late loading. After each
successful update, let the vendor-specific parser select the next blob.
If the parser selects the lowest loadable revision on each pass, the
loader can apply the blobs incrementally until no more blobs are
available.
For now, rejects this loading as the vendor-side blob parser is not ready
yet to support incremental blob selection.
To retain the existing behavior by default, provide a Kconfig option and
a kernel command-line option.
[1] https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files.git
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
---
V1 -> V2:
* Rename to incremental loading
* Reset incremental_loading=false if not supported
---
.../admin-guide/kernel-parameters.txt | 4 ++
arch/x86/Kconfig | 13 +++++
arch/x86/kernel/cpu/microcode/core.c | 58 ++++++++++++++++++-
arch/x86/kernel/cpu/microcode/internal.h | 7 ++-
4 files changed, 76 insertions(+), 6 deletions(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index a6d50cf6435c..af0630466dcc 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -4091,6 +4091,10 @@ Kernel parameters
for the runtime microcode loader according to <bool>. If
<bool> is not given, enable the enforcement.
+ incremental_loading=<bool>:
+ Enable or disable incremental microcode late loading
+ according to <bool>.
+
mitigations=
[X86,PPC,S390,ARM64,EARLY] Control optional mitigations for
CPU vulnerabilities. This is a set of curated,
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 58dce0b66179..3ead806c9de2 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1353,6 +1353,19 @@ config MICROCODE_LATE_FORCE_MINREV
If unsure say Y.
+config MICROCODE_LATE_INCREMENTAL_LOADING
+ bool "Incremental microcode late loading"
+ default n
+ depends on MICROCODE_LATE_LOADING
+ depends on CPU_SUP_INTEL
+ help
+ Apply the microcode blobs in a concatenated image one at a time, in
+ ascending revision order, so that revisions with prerequisites can be
+ applied in a single load.
+
+ This loading option can also be controlled via the
+ "microcode=incremental_loading=" parameter on the kernel command line.
+
config MICROCODE_DBG
bool "Enable microcode loader debugging"
default n
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index ed1eb6b753d6..a5f6949e0d53 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -47,6 +47,7 @@ static struct microcode_ops *microcode_ops;
static bool dis_ucode_ldr;
bool force_minrev = IS_ENABLED(CONFIG_MICROCODE_LATE_FORCE_MINREV);
+static bool incremental_loading = IS_ENABLED(CONFIG_MICROCODE_LATE_INCREMENTAL_LOADING);
/*
* Those below should be behind CONFIG_MICROCODE_DBG ifdeffery but in
@@ -166,6 +167,12 @@ static void __init early_parse_cmdline(void)
continue;
}
+ if (str_has_prefix(s, "incremental_loading=")) {
+ advance_option_argument(&s);
+ if (kstrtobool(s, &incremental_loading)) { ; }
+ continue;
+ }
+
if (!strcmp(s, "dis_ucode_ldr"))
dis_ucode_ldr = true;
}
@@ -750,16 +757,34 @@ static bool setup_cpus(void)
return true;
}
+static void reset_ucode_ctrl(void)
+{
+ struct microcode_ctrl ctrl = { .ctrl = SCTRL_WAIT, .result = -1, };
+ unsigned int cpu;
+
+ for_each_cpu_and(cpu, cpu_present_mask, &cpus_booted_once_mask) {
+ ctrl.ctrl_cpu = per_cpu(ucode_ctrl.ctrl_cpu, cpu);
+ per_cpu(ucode_ctrl, cpu) = ctrl;
+ }
+}
+
static int load_late_locked(void)
{
+ enum ucode_state state;
+ int err;
+
if (!setup_cpus())
return -EBUSY;
- switch (microcode_ops->request_microcode_fw(0, µcode_fdev->dev)) {
+ state = microcode_ops->request_microcode_fw(0, µcode_fdev->dev);
+next:
+ switch (state) {
case UCODE_NEW:
- return load_late_stop_cpus(false);
+ err = load_late_stop_cpus(false);
+ break;
case UCODE_NEW_SAFE:
- return load_late_stop_cpus(true);
+ err = load_late_stop_cpus(true);
+ break;
case UCODE_NFOUND:
return -ENOENT;
case UCODE_OK:
@@ -767,6 +792,28 @@ static int load_late_locked(void)
default:
return -EBADFD;
}
+
+ if (err)
+ return err;
+
+ /*
+ * A multi-blob image is traditionally handled by selecting the highest
+ * revision to load it in one shot. With incremental loading, the
+ * vendor-specific parser instead selects the lowest loadable revision.
+ *
+ * After each successful update, find the next loadable blob to continue
+ * the iteration. Stop if no more blobs are found.
+ */
+ if (incremental_loading) {
+ state = microcode_ops->request_microcode_fw(0, µcode_fdev->dev);
+ if (state == UCODE_NFOUND)
+ return 0;
+
+ reset_ucode_ctrl();
+ goto next;
+ }
+
+ return 0;
}
static ssize_t reload_store(struct device *dev,
@@ -915,6 +962,11 @@ static int __init microcode_init(void)
if (early_data.new_rev)
pr_info_once("Updated early from: 0x%08x\n", early_data.old_rev);
+ if (incremental_loading && !microcode_ops->support_incremental) {
+ pr_warn("Incremental late loading not supported, disabling\n");
+ incremental_loading = false;
+ }
+
microcode_fdev = faux_device_create("microcode", NULL, NULL);
if (!microcode_fdev)
return -ENODEV;
diff --git a/arch/x86/kernel/cpu/microcode/internal.h b/arch/x86/kernel/cpu/microcode/internal.h
index a10b547eda1e..ebf079e60c33 100644
--- a/arch/x86/kernel/cpu/microcode/internal.h
+++ b/arch/x86/kernel/cpu/microcode/internal.h
@@ -34,9 +34,10 @@ struct microcode_ops {
void (*stage_microcode)(void);
int (*collect_cpu_info)(int cpu, struct cpu_signature *csig);
void (*finalize_late_load)(int result);
- unsigned int nmi_safe : 1,
- use_nmi : 1,
- use_staging : 1;
+ unsigned int nmi_safe : 1,
+ use_nmi : 1,
+ use_staging : 1,
+ support_incremental : 1;
};
struct early_load_data {
--
2.53.0
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v2 5/7] x86/microcode/intel: Select the lowest revision for incremental loading
2026-11-16 16:45 [PATCH v2 0/7] x86/microcode: Incremental Loading and Early Minimum Revision Check Chang S. Bae
` (3 preceding siblings ...)
2026-11-16 16:45 ` [PATCH v2 4/7] x86/microcode: Introduce incremental late loading Chang S. Bae
@ 2026-11-16 16:45 ` Chang S. Bae
2026-11-16 16:45 ` [PATCH RFC v2 6/7] x86/microcode: Decouple minimum revision check from late loading Chang S. Bae
2026-11-16 16:45 ` [PATCH RFC v2 7/7] x86/microcode/intel: Apply minimum revision check to early loading Chang S. Bae
6 siblings, 0 replies; 8+ messages in thread
From: Chang S. Bae @ 2026-11-16 16:45 UTC (permalink / raw)
To: linux-kernel
Cc: x86, tglx, mingo, bp, dave.hansen, hpa, andrew.cooper3,
arjan.van.de.ven, chang.seok.bae
The incremental loading logic in the core can repeatedly request a
microcode patch. The vendor parser currently selects the highest loadable
revision, which means no further patch can be selected after the first
update.
To load a concatenated multi-blob image incrementally, adjust the blob
parser to select the lowest loadable revision. This allows patches to be
applied in ascending revision order.
The legacy selection logic stays the same if incremental-loading isn't
configured.
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
---
V1 -> V2: Simplify the code a bit and massage code comment
---
arch/x86/kernel/cpu/microcode/core.c | 2 +-
arch/x86/kernel/cpu/microcode/intel.c | 25 +++++++++++++++++++++---
arch/x86/kernel/cpu/microcode/internal.h | 1 +
3 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index a5f6949e0d53..5c4922031d91 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -47,7 +47,7 @@ static struct microcode_ops *microcode_ops;
static bool dis_ucode_ldr;
bool force_minrev = IS_ENABLED(CONFIG_MICROCODE_LATE_FORCE_MINREV);
-static bool incremental_loading = IS_ENABLED(CONFIG_MICROCODE_LATE_INCREMENTAL_LOADING);
+bool incremental_loading = IS_ENABLED(CONFIG_MICROCODE_LATE_INCREMENTAL_LOADING);
/*
* Those below should be behind CONFIG_MICROCODE_DBG ifdeffery but in
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index 9f09d388ed20..74c2d014efa0 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -851,14 +851,32 @@ static bool ucode_validate_minrev(struct microcode_header_intel *mc_header)
return true;
}
+static bool is_revision_candidate(unsigned int cur_rev, unsigned int rev)
+{
+ /*
+ * A revision must be newer than the active microcode revision to be
+ * loadable.
+ */
+ if (rev <= boot_cpu_data.microcode)
+ return false;
+
+ return incremental_loading ? rev < cur_rev : rev > cur_rev;
+}
+
static enum ucode_state parse_microcode_blobs(int cpu, struct iov_iter *iter)
{
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+ unsigned int cur_rev, curr_mc_size = 0;
bool is_safe, new_is_safe = false;
- int cur_rev = uci->cpu_sig.rev;
- unsigned int curr_mc_size = 0;
u8 *new_mc = NULL, *mc = NULL;
+ /*
+ * Start from the boundary value for the revision search. With
+ * incremental loading, the search walks downward, while the legacy
+ * search walks upward.
+ */
+ cur_rev = incremental_loading ? UINT_MAX : 0;
+
while (iov_iter_count(iter)) {
struct microcode_header_intel mc_header;
unsigned int mc_size, data_size;
@@ -895,7 +913,7 @@ static enum ucode_state parse_microcode_blobs(int cpu, struct iov_iter *iter)
intel_microcode_sanity_check(mc, true, MC_HEADER_TYPE_MICROCODE) < 0)
goto fail;
- if (cur_rev >= mc_header.rev)
+ if (!is_revision_candidate(cur_rev, mc_header.rev))
continue;
if (!intel_find_matching_signature(mc, &uci->cpu_sig))
@@ -999,6 +1017,7 @@ static struct microcode_ops microcode_intel_ops = {
.finalize_late_load = finalize_late_load,
.stage_microcode = stage_microcode,
.use_nmi = IS_ENABLED(CONFIG_X86_64),
+ .support_incremental = true,
};
static __init void calc_llc_size_per_core(struct cpuinfo_x86 *c)
diff --git a/arch/x86/kernel/cpu/microcode/internal.h b/arch/x86/kernel/cpu/microcode/internal.h
index ebf079e60c33..246aac4a11bc 100644
--- a/arch/x86/kernel/cpu/microcode/internal.h
+++ b/arch/x86/kernel/cpu/microcode/internal.h
@@ -101,6 +101,7 @@ static inline unsigned int x86_cpuid_family(void)
}
extern bool force_minrev;
+extern bool incremental_loading;
#ifdef CONFIG_CPU_SUP_AMD
void load_ucode_amd_bsp(struct early_load_data *ed, unsigned int family);
--
2.53.0
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH RFC v2 6/7] x86/microcode: Decouple minimum revision check from late loading
2026-11-16 16:45 [PATCH v2 0/7] x86/microcode: Incremental Loading and Early Minimum Revision Check Chang S. Bae
` (4 preceding siblings ...)
2026-11-16 16:45 ` [PATCH v2 5/7] x86/microcode/intel: Select the lowest revision for incremental loading Chang S. Bae
@ 2026-11-16 16:45 ` Chang S. Bae
2026-11-16 16:45 ` [PATCH RFC v2 7/7] x86/microcode/intel: Apply minimum revision check to early loading Chang S. Bae
6 siblings, 0 replies; 8+ messages in thread
From: Chang S. Bae @ 2026-11-16 16:45 UTC (permalink / raw)
To: linux-kernel
Cc: x86, tglx, mingo, bp, dave.hansen, hpa, andrew.cooper3,
arjan.van.de.ven, chang.seok.bae
The microcode minimum revision check was originally introduced to express
dependencies involving OS-visible changes, thus it has been limited to
the late-load path.
In fact this can serve as a general guard against unsafe microcode
loading. Make the check independent of the loading path in preparation
for applying it to the early path as well.
For early-loading, establish a tracker to check whether an update
satisfies the minimum revision requirement and taint the kernel if not.
Right now, no vendor code implements the check, so every early load
taints the kernel.
Then, adjust the failure messages to suggest incremental updates, rather
than early-loading, as a solution to address revision dependencies.
Keep the existing force_minrev semantics unchanged; it continues to apply
only to late-loading.
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
---
V1 -> V2:
* Do not apply force_minrev to early loading; keep the current semantics
* Move after incremental-loading support
* Massage changelog
---
arch/x86/kernel/cpu/microcode/core.c | 13 ++++++++++---
arch/x86/kernel/cpu/microcode/intel.c | 7 +++----
arch/x86/kernel/cpu/microcode/internal.h | 1 +
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 5c4922031d91..b784d7df9906 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -609,8 +609,8 @@ static int load_late_stop_cpus(bool is_safe)
struct cpuinfo_x86 prev_info;
if (!is_safe) {
- pr_err("Late microcode loading without minimal revision check.\n");
- pr_err("You should switch to early loading, if possible.\n");
+ pr_err("Late microcode loading without minimum revision check.\n");
+ pr_err("You should update microcode incrementally.\n");
}
/*
@@ -959,9 +959,16 @@ static int __init microcode_init(void)
pr_info_once("Current revision: 0x%08x\n", (early_data.new_rev ?: early_data.old_rev));
- if (early_data.new_rev)
+ if (early_data.new_rev) {
pr_info_once("Updated early from: 0x%08x\n", early_data.old_rev);
+ if (!early_data.is_safe) {
+ pr_err("Early microcode loading without minimum revision check.\n");
+ pr_err("You should update microcode incrementally.\n");
+ add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);
+ }
+ }
+
if (incremental_loading && !microcode_ops->support_incremental) {
pr_warn("Incremental late loading not supported, disabling\n");
incremental_loading = false;
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index 74c2d014efa0..eec8a45b283c 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -830,9 +830,8 @@ static bool ucode_validate_minrev(struct microcode_header_intel *mc_header)
int cur_rev = boot_cpu_data.microcode;
/*
- * When late-loading, ensure the header declares a minimum revision
- * required to perform a late-load. The previously reserved field
- * is 0 in older microcode blobs.
+ * Ensure the header declares a minimum revision required to perform a
+ * load. The previously reserved field is 0 in older microcode blobs.
*/
if (!mc_header->min_req_ver) {
pr_info("Unsafe microcode update: Microcode header does not specify a required min version\n");
@@ -845,7 +844,7 @@ static bool ucode_validate_minrev(struct microcode_header_intel *mc_header)
*/
if (cur_rev < mc_header->min_req_ver) {
pr_info("Unsafe microcode update: Current revision 0x%x too old\n", cur_rev);
- pr_info("Current should be at 0x%x or higher. Use early loading instead\n", mc_header->min_req_ver);
+ pr_info("Current should be at 0x%x or higher. Update incrementally.\n", mc_header->min_req_ver);
return false;
}
return true;
diff --git a/arch/x86/kernel/cpu/microcode/internal.h b/arch/x86/kernel/cpu/microcode/internal.h
index 246aac4a11bc..e60febbdf964 100644
--- a/arch/x86/kernel/cpu/microcode/internal.h
+++ b/arch/x86/kernel/cpu/microcode/internal.h
@@ -43,6 +43,7 @@ struct microcode_ops {
struct early_load_data {
u32 old_rev;
u32 new_rev;
+ bool is_safe;
};
extern struct early_load_data early_data;
--
2.53.0
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH RFC v2 7/7] x86/microcode/intel: Apply minimum revision check to early loading
2026-11-16 16:45 [PATCH v2 0/7] x86/microcode: Incremental Loading and Early Minimum Revision Check Chang S. Bae
` (5 preceding siblings ...)
2026-11-16 16:45 ` [PATCH RFC v2 6/7] x86/microcode: Decouple minimum revision check from late loading Chang S. Bae
@ 2026-11-16 16:45 ` Chang S. Bae
6 siblings, 0 replies; 8+ messages in thread
From: Chang S. Bae @ 2026-11-16 16:45 UTC (permalink / raw)
To: linux-kernel
Cc: x86, tglx, mingo, bp, dave.hansen, hpa, andrew.cooper3,
arjan.van.de.ven, chang.seok.bae
The minimum revision check is now generally applicable. Establish the
minimum revision check on early loading. Load the patch but taint the
kernel when the check fails.
Adjust the check function so that the early path can pass the current
revision.
Suggested-by: Arjan van de Ven <arjan.van.de.ven@intel.com>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
---
V1 -> V2: Drop force_minrev support
---
arch/x86/kernel/cpu/microcode/intel.c | 51 +++++++++++++--------------
1 file changed, 25 insertions(+), 26 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index eec8a45b283c..8d598c7ac2c4 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -766,6 +766,29 @@ static int __init save_builtin_microcode(void)
}
early_initcall(save_builtin_microcode);
+static bool ucode_validate_minrev(u32 cur_rev, struct microcode_header_intel *mc_header)
+{
+ /*
+ * Ensure the header declares a minimum revision required to perform a
+ * load. The previously reserved field is 0 in older microcode blobs.
+ */
+ if (!mc_header->min_req_ver) {
+ pr_info("Unsafe microcode update: Microcode header does not specify a required min version\n");
+ return false;
+ }
+
+ /*
+ * Check whether the current revision is either greater or equal to
+ * the minimum revision specified in the header.
+ */
+ if (cur_rev < mc_header->min_req_ver) {
+ pr_info("Unsafe microcode update: Current revision 0x%x too old.\n", cur_rev);
+ pr_info("Current should be at 0x%x or higher. Update incrementally.\n", mc_header->min_req_ver);
+ return false;
+ }
+ return true;
+}
+
/* Load microcode on BSP from initrd or builtin blobs */
void __init load_ucode_intel_bsp(struct early_load_data *ed)
{
@@ -777,6 +800,7 @@ void __init load_ucode_intel_bsp(struct early_load_data *ed)
if (uci.mc && apply_microcode_early(&uci) == UCODE_UPDATED) {
ucode_patch_va = UCODE_BSP_LOADED;
ed->new_rev = uci.cpu_sig.rev;
+ ed->is_safe = ucode_validate_minrev(ed->old_rev, uci.mc);
}
}
@@ -825,31 +849,6 @@ static enum ucode_state apply_microcode_late(int cpu)
return ret;
}
-static bool ucode_validate_minrev(struct microcode_header_intel *mc_header)
-{
- int cur_rev = boot_cpu_data.microcode;
-
- /*
- * Ensure the header declares a minimum revision required to perform a
- * load. The previously reserved field is 0 in older microcode blobs.
- */
- if (!mc_header->min_req_ver) {
- pr_info("Unsafe microcode update: Microcode header does not specify a required min version\n");
- return false;
- }
-
- /*
- * Check whether the current revision is either greater or equal to
- * to the minimum revision specified in the header.
- */
- if (cur_rev < mc_header->min_req_ver) {
- pr_info("Unsafe microcode update: Current revision 0x%x too old\n", cur_rev);
- pr_info("Current should be at 0x%x or higher. Update incrementally.\n", mc_header->min_req_ver);
- return false;
- }
- return true;
-}
-
static bool is_revision_candidate(unsigned int cur_rev, unsigned int rev)
{
/*
@@ -921,7 +920,7 @@ static enum ucode_state parse_microcode_blobs(int cpu, struct iov_iter *iter)
if (!revision_is_safe(&uci->cpu_sig, mc_header.rev))
continue;
- is_safe = ucode_validate_minrev(&mc_header);
+ is_safe = ucode_validate_minrev(uci->cpu_sig.rev, &mc_header);
if (force_minrev && !is_safe)
continue;
--
2.53.0
^ permalink raw reply [flat|nested] 8+ messages in thread