Skip to content

Commit

Permalink
x86/tsx: Add "auto" option to the tsx= cmdline parameter
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pawan Gupta authored and Thomas Gleixner committed Oct 28, 2019
1 parent e1d38b6 commit 7531a35
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Documentation/admin-guide/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4869,6 +4869,9 @@
update. This new MSR allows for the reliable
deactivation of the TSX functionality.)

auto - Disable TSX if X86_BUG_TAA is present,
otherwise enable TSX on the system.

Not specifying this option is equivalent to tsx=off.

See Documentation/admin-guide/hw-vuln/tsx_async_abort.rst
Expand Down
7 changes: 6 additions & 1 deletion arch/x86/kernel/cpu/tsx.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static bool __init tsx_ctrl_is_supported(void)

void __init tsx_init(void)
{
char arg[4] = {};
char arg[5] = {};
int ret;

if (!tsx_ctrl_is_supported())
Expand All @@ -87,6 +87,11 @@ void __init tsx_init(void)
tsx_ctrl_state = TSX_CTRL_ENABLE;
} else if (!strcmp(arg, "off")) {
tsx_ctrl_state = TSX_CTRL_DISABLE;
} else if (!strcmp(arg, "auto")) {
if (boot_cpu_has_bug(X86_BUG_TAA))
tsx_ctrl_state = TSX_CTRL_DISABLE;
else
tsx_ctrl_state = TSX_CTRL_ENABLE;
} else {
tsx_ctrl_state = TSX_CTRL_DISABLE;
pr_err("tsx: invalid option, defaulting to off\n");
Expand Down

0 comments on commit 7531a35

Please sign in to comment.