diff options
Diffstat (limited to 'arch/x86/kernel/cpu/bugs.c')
-rw-r--r-- | arch/x86/kernel/cpu/bugs.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 03b4cc0ec3a7..66ca906aa790 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c | |||
@@ -836,6 +836,16 @@ static enum ssb_mitigation __init __ssb_select_mitigation(void) | |||
836 | } | 836 | } |
837 | 837 | ||
838 | /* | 838 | /* |
839 | * If SSBD is controlled by the SPEC_CTRL MSR, then set the proper | ||
840 | * bit in the mask to allow guests to use the mitigation even in the | ||
841 | * case where the host does not enable it. | ||
842 | */ | ||
843 | if (static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) || | ||
844 | static_cpu_has(X86_FEATURE_AMD_SSBD)) { | ||
845 | x86_spec_ctrl_mask |= SPEC_CTRL_SSBD; | ||
846 | } | ||
847 | |||
848 | /* | ||
839 | * We have three CPU feature flags that are in play here: | 849 | * We have three CPU feature flags that are in play here: |
840 | * - X86_BUG_SPEC_STORE_BYPASS - CPU is susceptible. | 850 | * - X86_BUG_SPEC_STORE_BYPASS - CPU is susceptible. |
841 | * - X86_FEATURE_SSBD - CPU is able to turn off speculative store bypass | 851 | * - X86_FEATURE_SSBD - CPU is able to turn off speculative store bypass |
@@ -852,7 +862,6 @@ static enum ssb_mitigation __init __ssb_select_mitigation(void) | |||
852 | x86_amd_ssb_disable(); | 862 | x86_amd_ssb_disable(); |
853 | } else { | 863 | } else { |
854 | x86_spec_ctrl_base |= SPEC_CTRL_SSBD; | 864 | x86_spec_ctrl_base |= SPEC_CTRL_SSBD; |
855 | x86_spec_ctrl_mask |= SPEC_CTRL_SSBD; | ||
856 | wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base); | 865 | wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base); |
857 | } | 866 | } |
858 | } | 867 | } |