Messages in this thread Patch in this message | | | From | Ramakrishna Saripalli <> | Subject | [PATCH 3/4] x86/speculation: Implement PSF mitigation support | Date | Wed, 21 Apr 2021 04:01:16 -0500 |
| |
From: Ramakrishna Saripalli <rk.saripalli@amd.com>
Implement support for PSF mitigation via a kernel parameter.
Kernel parameter predict_store_fwd has the following values
- off. PSF mitigation is enabled which means the feature is disabled.
- on. PSF mitigation is not enabled. This is also the default behavior.
Signed-off-by: Ramakrishna Saripalli<rk.saripalli@amd.com> --- arch/x86/kernel/cpu/amd.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 347a956f71ca..88aac52eeb1b 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -1170,3 +1170,22 @@ void set_dr_addr_mask(unsigned long mask, int dr) break; } } + +static int __init psf_cmdline(char *str) +{ + if (!boot_cpu_has(X86_FEATURE_PSFD)) + return 0; + + if (!str) + return -EINVAL; + + if (!strcmp(str, "off")) { + x86_spec_ctrl_base |= SPEC_CTRL_PSFD; + wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base); + setup_clear_cpu_cap(X86_FEATURE_PSFD); + } + + return 0; +} + +early_param("predict_store_fwd", psf_cmdline); -- 2.25.1
| |