Patch "x86/cpufeature: Add facility to check for min microcode revisions" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    x86/cpufeature: Add facility to check for min microcode revisions

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-cpufeature-add-facility-to-check-for-min-microcode-revisions.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From stable-owner@xxxxxxxxxxxxxxx Thu Nov 17 10:20:22 2022
From: Suleiman Souhlal <suleiman@xxxxxxxxxx>
Date: Thu, 17 Nov 2022 18:19:21 +0900
Subject: x86/cpufeature: Add facility to check for min microcode revisions
To: stable@xxxxxxxxxxxxxxx
Cc: x86@xxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, bp@xxxxxxxxx, pbonzini@xxxxxxxxxx, peterz@xxxxxxxxxxxxx, jpoimboe@xxxxxxxxxx, cascardo@xxxxxxxxxxxxx, surajjs@xxxxxxxxxx, ssouhlal@xxxxxxxxxxx, suleiman@xxxxxxxxxx
Message-ID: <20221117091952.1940850-4-suleiman@xxxxxxxxxx>

From: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>

For bug workarounds or checks, it is useful to check for specific
microcode revisions.

Add a new generic function to match the CPU with stepping.
Add the other function to check the min microcode revisions for
the matched CPU.

A new table format is introduced to facilitate the quirk to
fill the related information.

This does not change the existing x86_cpu_id because it's an ABI
shared with modules, and also has quite different requirements,
as in no wildcards, but everything has to be matched exactly.

Originally-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Signed-off-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Acked-by: Borislav Petkov <bp@xxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: eranian@xxxxxxxxxx
Link: https://lkml.kernel.org/r/1549319013-4522-1-git-send-email-kan.liang@xxxxxxxxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
Signed-off-by: Suleiman Souhlal <suleiman@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 arch/x86/include/asm/cpu_device_id.h |   28 ++++++++++++++++++++++++++++
 arch/x86/kernel/cpu/match.c          |   31 +++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)

--- a/arch/x86/include/asm/cpu_device_id.h
+++ b/arch/x86/include/asm/cpu_device_id.h
@@ -11,4 +11,32 @@
 
 extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
 
+/*
+ * Match specific microcode revisions.
+ *
+ * vendor/family/model/stepping must be all set.
+ *
+ * Only checks against the boot CPU.  When mixed-stepping configs are
+ * valid for a CPU model, add a quirk for every valid stepping and
+ * do the fine-tuning in the quirk handler.
+ */
+
+struct x86_cpu_desc {
+	__u8	x86_family;
+	__u8	x86_vendor;
+	__u8	x86_model;
+	__u8	x86_stepping;
+	__u32	x86_microcode_rev;
+};
+
+#define INTEL_CPU_DESC(mod, step, rev) {			\
+	.x86_family = 6,					\
+	.x86_vendor = X86_VENDOR_INTEL,				\
+	.x86_model = mod,					\
+	.x86_stepping = step,					\
+	.x86_microcode_rev = rev,				\
+}
+
+extern bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table);
+
 #endif
--- a/arch/x86/kernel/cpu/match.c
+++ b/arch/x86/kernel/cpu/match.c
@@ -48,3 +48,34 @@ const struct x86_cpu_id *x86_match_cpu(c
 	return NULL;
 }
 EXPORT_SYMBOL(x86_match_cpu);
+
+static const struct x86_cpu_desc *
+x86_match_cpu_with_stepping(const struct x86_cpu_desc *match)
+{
+	struct cpuinfo_x86 *c = &boot_cpu_data;
+	const struct x86_cpu_desc *m;
+
+	for (m = match; m->x86_family | m->x86_model; m++) {
+		if (c->x86_vendor != m->x86_vendor)
+			continue;
+		if (c->x86 != m->x86_family)
+			continue;
+		if (c->x86_model != m->x86_model)
+			continue;
+		if (c->x86_stepping != m->x86_stepping)
+			continue;
+		return m;
+	}
+	return NULL;
+}
+
+bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table)
+{
+	const struct x86_cpu_desc *res = x86_match_cpu_with_stepping(table);
+
+	if (!res || res->x86_microcode_rev > boot_cpu_data.microcode)
+		return false;
+
+	return true;
+}
+EXPORT_SYMBOL_GPL(x86_cpu_has_min_microcode_rev);


Patches currently in stable-queue which might be from stable-owner@xxxxxxxxxxxxxxx are

queue-4.19/x86-speculation-disable-rrsba-behavior.patch
queue-4.19/revert-x86-speculation-add-rsb-vm-exit-protections.patch
queue-4.19/kvm-vmx-fix-ibrs-handling-after-vmexit.patch
queue-4.19/kvm-vmx-prevent-guest-rsb-poisoning-attacks-with-eibrs.patch
queue-4.19/x86-cpufeature-add-facility-to-check-for-min-microcode-revisions.patch
queue-4.19/x86-bugs-keep-a-per-cpu-ia32_spec_ctrl-value.patch
queue-4.19/x86-cpu-amd-enumerate-btc_no.patch
queue-4.19/x86-speculation-fix-firmware-entry-spec_ctrl-handling.patch
queue-4.19/x86-speculation-add-spectre_v2-ibrs-option-to-support-kernel-ibrs.patch
queue-4.19/x86-cpu-add-consistent-cpu-match-macros.patch
queue-4.19/x86-speculation-remove-x86_spec_ctrl_mask.patch
queue-4.19/x86-bugs-add-cannon-lake-to-retbleed-affected-cpu-list.patch
queue-4.19/x86-bugs-warn-when-ibrs-mitigation-is-selected-on-enhanced-ibrs-parts.patch
queue-4.19/x86-speculation-fill-rsb-on-vmexit-for-ibrs.patch
queue-4.19/x86-cpu-add-a-steppings-field-to-struct-x86_cpu_id.patch
queue-4.19/x86-common-stamp-out-the-stepping-madness.patch
queue-4.19/x86-bugs-split-spectre_v2_select_mitigation-and-spectre_v2_user_select_mitigation.patch
queue-4.19/x86-bugs-report-intel-retbleed-vulnerability.patch
queue-4.19/x86-speculation-change-fill_return_buffer-to-work-with-objtool.patch
queue-4.19/x86-cpufeatures-move-retpoline-flags-to-word-11.patch
queue-4.19/x86-speculation-fix-spec_ctrl-write-on-smt-state-change.patch
queue-4.19/x86-bugs-optimize-spec_ctrl-msr-writes.patch
queue-4.19/x86-bugs-report-amd-retbleed-vulnerability.patch
queue-4.19/x86-speculation-fix-rsb-filling-with-config_retpoline-n.patch
queue-4.19/x86-cpufeature-fix-various-quality-problems-in-the-asm-cpu_device_hd.h-header.patch
queue-4.19/intel_idle-disable-ibrs-during-long-idle.patch
queue-4.19/x86-speculation-use-declare_per_cpu-for-x86_spec_ctrl_current.patch
queue-4.19/x86-entry-remove-skip_r11rcx.patch
queue-4.19/x86-speculation-use-cached-host-spec_ctrl-value-for-guest-entry-exit.patch
queue-4.19/x86-devicetable-move-x86-specific-macro-out-of-generic-code.patch
queue-4.19/x86-bugs-add-amd-retbleed-boot-parameter.patch
queue-4.19/x86-entry-add-kernel-ibrs-implementation.patch
queue-4.19/revert-x86-cpu-add-a-steppings-field-to-struct-x86_cpu_id.patch
queue-4.19/x86-speculation-add-rsb-vm-exit-protections.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux