diff options
author | Pawan Gupta <pawan.kumar.gupta@linux.intel.com> | 2019-10-23 06:28:57 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2019-10-28 03:37:00 -0400 |
commit | 7531a3596e3272d1f6841e0d601a614555dc6b65 (patch) | |
tree | b58244f08cec9c20ff369094032e2ceea595e335 | |
parent | e1d38b63acd843cfdd4222bf19a26700fd5c699e (diff) |
x86/tsx: Add "auto" option to the tsx= cmdline parameter
Platforms which are not affected by X86_BUG_TAA may want the TSX feature
enabled. Add "auto" option to the TSX cmdline parameter. When tsx=auto
disable TSX when X86_BUG_TAA is present, otherwise enable TSX.
More details on X86_BUG_TAA can be found here:
https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/tsx_async_abort.html
[ bp: Extend the arg buffer to accommodate "auto\0". ]
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
-rw-r--r-- | Documentation/admin-guide/kernel-parameters.txt | 3 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/tsx.c | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index af4b1d95b08f..6e548cddb6c3 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt | |||
@@ -4869,6 +4869,9 @@ | |||
4869 | update. This new MSR allows for the reliable | 4869 | update. This new MSR allows for the reliable |
4870 | deactivation of the TSX functionality.) | 4870 | deactivation of the TSX functionality.) |
4871 | 4871 | ||
4872 | auto - Disable TSX if X86_BUG_TAA is present, | ||
4873 | otherwise enable TSX on the system. | ||
4874 | |||
4872 | Not specifying this option is equivalent to tsx=off. | 4875 | Not specifying this option is equivalent to tsx=off. |
4873 | 4876 | ||
4874 | See Documentation/admin-guide/hw-vuln/tsx_async_abort.rst | 4877 | See Documentation/admin-guide/hw-vuln/tsx_async_abort.rst |
diff --git a/arch/x86/kernel/cpu/tsx.c b/arch/x86/kernel/cpu/tsx.c index 04471c4378d8..dda328ec2ba1 100644 --- a/arch/x86/kernel/cpu/tsx.c +++ b/arch/x86/kernel/cpu/tsx.c | |||
@@ -75,7 +75,7 @@ static bool __init tsx_ctrl_is_supported(void) | |||
75 | 75 | ||
76 | void __init tsx_init(void) | 76 | void __init tsx_init(void) |
77 | { | 77 | { |
78 | char arg[4] = {}; | 78 | char arg[5] = {}; |
79 | int ret; | 79 | int ret; |
80 | 80 | ||
81 | if (!tsx_ctrl_is_supported()) | 81 | if (!tsx_ctrl_is_supported()) |
@@ -87,6 +87,11 @@ void __init tsx_init(void) | |||
87 | tsx_ctrl_state = TSX_CTRL_ENABLE; | 87 | tsx_ctrl_state = TSX_CTRL_ENABLE; |
88 | } else if (!strcmp(arg, "off")) { | 88 | } else if (!strcmp(arg, "off")) { |
89 | tsx_ctrl_state = TSX_CTRL_DISABLE; | 89 | tsx_ctrl_state = TSX_CTRL_DISABLE; |
90 | } else if (!strcmp(arg, "auto")) { | ||
91 | if (boot_cpu_has_bug(X86_BUG_TAA)) | ||
92 | tsx_ctrl_state = TSX_CTRL_DISABLE; | ||
93 | else | ||
94 | tsx_ctrl_state = TSX_CTRL_ENABLE; | ||
90 | } else { | 95 | } else { |
91 | tsx_ctrl_state = TSX_CTRL_DISABLE; | 96 | tsx_ctrl_state = TSX_CTRL_DISABLE; |
92 | pr_err("tsx: invalid option, defaulting to off\n"); | 97 | pr_err("tsx: invalid option, defaulting to off\n"); |