Skip to content

Commit c05bcf8

Browse files
mcarabasSomasundaram Krishnasamy
authored andcommitted
x86/bugs: TSX not disabled at late loading
When the microcode feature for disabling TSX is not available at boot time, taa_select_mitigation will not disable TSX to ensure proper mitigation for TAA. Call tsx_init before selecting TAA mitigation. Orabug: 30557078 Suggested-by: Jamie Iles <[email protected]> Suggested-by: Boris Ostrovsky <[email protected]> Signed-off-by: Mihai Carabas <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent afbc7db commit c05bcf8

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,14 @@ void __ref check_bugs(void)
285285

286286
/* Relies on the result of spectre_v2_select_mitigation. */
287287
ssb_init();
288+
289+
/*
290+
* If we are at late loading, we need to re-initialize
291+
* tsx becasue tsx control might be available.
292+
*/
293+
if (system_state == SYSTEM_RUNNING)
294+
tsx_init();
295+
288296
l1tf_select_mitigation();
289297
mds_select_mitigation();
290298
taa_select_mitigation();

arch/x86/kernel/cpu/cpu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ enum tsx_ctrl_states {
5252
TSX_CTRL_NOT_SUPPORTED,
5353
};
5454

55-
extern __ro_after_init enum tsx_ctrl_states tsx_ctrl_state;
55+
extern enum tsx_ctrl_states tsx_ctrl_state;
5656

57-
extern void __init tsx_init(void);
57+
extern void tsx_init(void);
5858
extern void tsx_enable(void);
5959
extern void tsx_disable(void);
6060
#else

arch/x86/kernel/cpu/tsx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include "cpu.h"
1616

17-
enum tsx_ctrl_states tsx_ctrl_state __ro_after_init = TSX_CTRL_NOT_SUPPORTED;
17+
enum tsx_ctrl_states tsx_ctrl_state = TSX_CTRL_NOT_SUPPORTED;
1818

1919
void tsx_disable(void)
2020
{
@@ -55,7 +55,7 @@ void tsx_enable(void)
5555
wrmsrl(MSR_IA32_TSX_CTRL, tsx);
5656
}
5757

58-
static bool __init tsx_ctrl_is_supported(void)
58+
static bool tsx_ctrl_is_supported(void)
5959
{
6060
u64 ia32_cap = x86_read_arch_cap_msr();
6161

@@ -81,15 +81,15 @@ static enum tsx_ctrl_states x86_get_tsx_auto_mode(void)
8181
return TSX_CTRL_ENABLE;
8282
}
8383

84-
void __init tsx_init(void)
84+
void tsx_init(void)
8585
{
8686
char arg[5] = {};
8787
int ret;
8888

8989
if (!tsx_ctrl_is_supported())
9090
return;
9191

92-
ret = cmdline_find_option(boot_command_line, "tsx", arg, sizeof(arg));
92+
ret = cmdline_find_option(saved_command_line, "tsx", arg, sizeof(arg));
9393
if (ret >= 0) {
9494
if (!strcmp(arg, "on")) {
9595
tsx_ctrl_state = TSX_CTRL_ENABLE;

0 commit comments

Comments
 (0)