]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86/tsx: Add "auto" option to the tsx= cmdline parameter
authorPawan Gupta <pawan.kumar.gupta@linux.intel.com>
Wed, 23 Oct 2019 10:28:57 +0000 (12:28 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 15 Nov 2019 00:56:50 +0000 (00:56 +0000)
commit 7531a3596e3272d1f6841e0d601a614555dc6b65 upstream.

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>
[bwh: Backported to 4.4: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Documentation/kernel-parameters.txt
arch/x86/kernel/cpu/tsx.c

index 8ae1c6d85a4e85f810765ae0a514babefed06334..9f40e104aec45def2f264a7dc79bc26e06d53978 100644 (file)
@@ -3602,6 +3602,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
                                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/hw-vuln/tsx_async_abort.rst
index 0f8a60f43206ba6ba03a4b5662d5be84959226b9..d73bc1ae932ba62f5a73d97e488f61f16f0efd98 100644 (file)
@@ -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())
@@ -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");