[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230612160453.GMZIdCJfmI2sCRxCFX@fat_crate.local>
Date: Mon, 12 Jun 2023 18:04:53 +0200
From: Borislav Petkov <bp@...en8.de>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] x86/microcode: Add a "microcode=" command line option
Diff ontop with the proposed changes so that they're easily reviewable:
---
diff --git a/Documentation/arch/x86/microcode.rst b/Documentation/arch/x86/microcode.rst
index b627c6f36bcf..767e3e36935e 100644
--- a/Documentation/arch/x86/microcode.rst
+++ b/Documentation/arch/x86/microcode.rst
@@ -238,3 +238,13 @@ the final kernel image. The early loader finds them and applies them.
Needless to say, this method is not the most flexible one because it
requires rebuilding the kernel each time updated microcode from the CPU
vendor is available.
+
+Loader control
+==============
+
+/sys/devices/system/cpu/microcode/control controls different aspects of
+the microcode loader's behavior and can be used to modify it by toggling
+bits in that file. Currently defined controls are:
+
+bit 0: Do not load on all SMT threads on AMD. Loading on all logical
+ threads is enabled by default.
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index 76b530697951..3755f4a3c820 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -703,7 +703,7 @@ static enum ucode_state apply_microcode_amd(int cpu)
/* need to apply patch? */
if ((rev > mc_amd->hdr.patch_id) ||
- (rev == mc_amd->hdr.patch_id && !(control & LATE_ALL_THREADS))) {
+ (rev == mc_amd->hdr.patch_id && !(microcode_control & LATE_ALL_THREADS))) {
ret = UCODE_OK;
goto out;
}
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 5f3185d2814c..7ec87872756b 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 = true;
-unsigned long control = LATE_ALL_THREADS;
+unsigned long microcode_control = LATE_ALL_THREADS;
bool initrd_gone;
@@ -529,7 +529,7 @@ static ssize_t processor_flags_show(struct device *dev,
static ssize_t control_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- return sprintf(buf, "0x%lx\n", control);
+ return sprintf(buf, "0x%lx\n", microcode_control);
}
static ssize_t control_store(struct device *dev,
@@ -544,7 +544,7 @@ static ssize_t control_store(struct device *dev,
if (val & CONTROL_FLAGS_MASK)
return -EINVAL;
- control = val;
+ microcode_control = val;
return count;
}
@@ -722,7 +722,7 @@ static int __init parse_cmdline_param(char *str)
str++;
if (!strcmp(str, "no_late_all"))
- control &= ~LATE_ALL_THREADS;
+ microcode_control &= ~LATE_ALL_THREADS;
return 1;
}
diff --git a/arch/x86/kernel/cpu/microcode/internal.h b/arch/x86/kernel/cpu/microcode/internal.h
index 5e3c5fc3851f..3823c8ec8f97 100644
--- a/arch/x86/kernel/cpu/microcode/internal.h
+++ b/arch/x86/kernel/cpu/microcode/internal.h
@@ -2,7 +2,7 @@
#ifndef __X86_MICROCODE_INTERNAL_H__
#define __X86_MICROCODE_INTERNAL_H__
-extern unsigned long control;
+extern unsigned long microcode_control;
/* Loader control flags. */
enum control_flags {
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists