| .. | .. |
|---|
| 14 | 14 | |
|---|
| 15 | 15 | #include "cpu.h" |
|---|
| 16 | 16 | |
|---|
| 17 | +#undef pr_fmt |
|---|
| 18 | +#define pr_fmt(fmt) "tsx: " fmt |
|---|
| 19 | + |
|---|
| 17 | 20 | enum tsx_ctrl_states tsx_ctrl_state __ro_after_init = TSX_CTRL_NOT_SUPPORTED; |
|---|
| 18 | 21 | |
|---|
| 19 | 22 | void tsx_disable(void) |
|---|
| .. | .. |
|---|
| 55 | 58 | wrmsrl(MSR_IA32_TSX_CTRL, tsx); |
|---|
| 56 | 59 | } |
|---|
| 57 | 60 | |
|---|
| 58 | | -static bool __init tsx_ctrl_is_supported(void) |
|---|
| 59 | | -{ |
|---|
| 60 | | - u64 ia32_cap = x86_read_arch_cap_msr(); |
|---|
| 61 | | - |
|---|
| 62 | | - /* |
|---|
| 63 | | - * TSX is controlled via MSR_IA32_TSX_CTRL. However, support for this |
|---|
| 64 | | - * MSR is enumerated by ARCH_CAP_TSX_MSR bit in MSR_IA32_ARCH_CAPABILITIES. |
|---|
| 65 | | - * |
|---|
| 66 | | - * TSX control (aka MSR_IA32_TSX_CTRL) is only available after a |
|---|
| 67 | | - * microcode update on CPUs that have their MSR_IA32_ARCH_CAPABILITIES |
|---|
| 68 | | - * bit MDS_NO=1. CPUs with MDS_NO=0 are not planned to get |
|---|
| 69 | | - * MSR_IA32_TSX_CTRL support even after a microcode update. Thus, |
|---|
| 70 | | - * tsx= cmdline requests will do nothing on CPUs without |
|---|
| 71 | | - * MSR_IA32_TSX_CTRL support. |
|---|
| 72 | | - */ |
|---|
| 73 | | - return !!(ia32_cap & ARCH_CAP_TSX_CTRL_MSR); |
|---|
| 74 | | -} |
|---|
| 75 | | - |
|---|
| 76 | 61 | static enum tsx_ctrl_states x86_get_tsx_auto_mode(void) |
|---|
| 77 | 62 | { |
|---|
| 78 | 63 | if (boot_cpu_has_bug(X86_BUG_TAA)) |
|---|
| .. | .. |
|---|
| 86 | 71 | char arg[5] = {}; |
|---|
| 87 | 72 | int ret; |
|---|
| 88 | 73 | |
|---|
| 89 | | - if (!tsx_ctrl_is_supported()) |
|---|
| 74 | + /* |
|---|
| 75 | + * TSX is controlled via MSR_IA32_TSX_CTRL. However, support for this |
|---|
| 76 | + * MSR is enumerated by ARCH_CAP_TSX_MSR bit in MSR_IA32_ARCH_CAPABILITIES. |
|---|
| 77 | + * |
|---|
| 78 | + * TSX control (aka MSR_IA32_TSX_CTRL) is only available after a |
|---|
| 79 | + * microcode update on CPUs that have their MSR_IA32_ARCH_CAPABILITIES |
|---|
| 80 | + * bit MDS_NO=1. CPUs with MDS_NO=0 are not planned to get |
|---|
| 81 | + * MSR_IA32_TSX_CTRL support even after a microcode update. Thus, |
|---|
| 82 | + * tsx= cmdline requests will do nothing on CPUs without |
|---|
| 83 | + * MSR_IA32_TSX_CTRL support. |
|---|
| 84 | + */ |
|---|
| 85 | + if (!(x86_read_arch_cap_msr() & ARCH_CAP_TSX_CTRL_MSR)) |
|---|
| 90 | 86 | return; |
|---|
| 87 | + |
|---|
| 88 | + setup_force_cpu_cap(X86_FEATURE_MSR_TSX_CTRL); |
|---|
| 91 | 89 | |
|---|
| 92 | 90 | ret = cmdline_find_option(boot_command_line, "tsx", arg, sizeof(arg)); |
|---|
| 93 | 91 | if (ret >= 0) { |
|---|
| .. | .. |
|---|
| 99 | 97 | tsx_ctrl_state = x86_get_tsx_auto_mode(); |
|---|
| 100 | 98 | } else { |
|---|
| 101 | 99 | tsx_ctrl_state = TSX_CTRL_DISABLE; |
|---|
| 102 | | - pr_err("tsx: invalid option, defaulting to off\n"); |
|---|
| 100 | + pr_err("invalid option, defaulting to off\n"); |
|---|
| 103 | 101 | } |
|---|
| 104 | 102 | } else { |
|---|
| 105 | 103 | /* tsx= not provided */ |
|---|