[MODERATED] [PATCH v5 08/11] TAAv5 8
Pawan Gupta <[email protected]>
| Newsgroups | org.kernel.lore.historical-speck |
|---|---|
| Message-ID | <fe5ff90a8b62d19d7c37b5b5f4259a085804203c.157025 [email protected]> |
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 Signed-off-by: Pawan Gupta <[email protected]> Reviewed-by: Tony Luck <[email protected]> Tested-by: Neelima Krishnan <[email protected]> --- Documentation/admin-guide/kernel-parameters.txt | 5 +++++ arch/x86/kernel/cpu/tsx.c | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 832537d59562..d7b48c38c6e5 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4821,6 +4821,11 @@ on - Enable TSX on the system. off - Disable TSX on the system. + auto - Disable TSX if X86_BUG_TAA is present, + otherwise enable TSX on the system. + + More details on X86_BUG_TAA are here: + Documentation/admin-guide/hw-vuln/tsx_async_abort.rst Not specifying this option is equivalent to tsx=off. diff --git a/arch/x86/kernel/cpu/tsx.c b/arch/x86/kernel/cpu/tsx.c index 1c0cee7a7d46..73a0e5af3720 100644 --- a/arch/x86/kernel/cpu/tsx.c +++ b/arch/x86/kernel/cpu/tsx.c @@ -23,6 +23,7 @@ static enum tsx_user_cmds { TSX_USER_CMD_NONE, TSX_USER_CMD_ON, TSX_USER_CMD_OFF, + TSX_USER_CMD_AUTO, } tsx_user_cmd = TSX_USER_CMD_NONE; static int __init tsx_cmdline(char *str) @@ -38,6 +39,8 @@ static int __init tsx_cmdline(char *str) tsx_user_cmd = TSX_USER_CMD_ON; else if (!strcmp(str, "off")) tsx_user_cmd = TSX_USER_CMD_OFF; + else if (!strcmp(str, "auto")) + tsx_user_cmd = TSX_USER_CMD_AUTO; return 0; } @@ -104,6 +107,12 @@ void tsx_init(struct cpuinfo_x86 *c) case TSX_USER_CMD_OFF: tsx_ctrl_state = TSX_CTRL_DISABLE; break; + case TSX_USER_CMD_AUTO: + if (boot_cpu_has_bug(X86_BUG_TAA)) + tsx_ctrl_state = TSX_CTRL_DISABLE; + else + tsx_ctrl_state = TSX_CTRL_ENABLE; + break; case TSX_USER_CMD_NONE: default: /* -- 2.20.1