From: Ramakrishna Saripalli <rsaripal@amd.com>
To: <linux-kernel@vger.kernel.org>, <x86@kernel.org>,
<tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>
Cc: <bsd@redhat.com>, <rsaripal@amd.com>
Subject: [PATCH 3/4] x86/speculation: Implement PSF mitigation support
Date: Wed, 21 Apr 2021 04:01:16 -0500 [thread overview]
Message-ID: <20210421090117.22315-4-rsaripal@amd.com> (raw)
In-Reply-To: <20210421090117.22315-1-rsaripal@amd.com>
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
next prev parent reply other threads:[~2021-04-21 9:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-21 9:01 [PATCH 0/4] Introduce support for PSF mitigation Ramakrishna Saripalli
2021-04-21 9:01 ` [PATCH 1/4] x86/cpufeatures: Define feature bits to support mitigation of PSF Ramakrishna Saripalli
2021-04-21 9:01 ` [PATCH 2/4] x86/speculation: Introduce SPEC_CTRL_MSR bit for PSFD Ramakrishna Saripalli
2021-04-21 9:01 ` Ramakrishna Saripalli [this message]
2021-04-21 9:01 ` [PATCH 4/4] x86/speculation: Add PSF mitigation kernel parameters Ramakrishna Saripalli
2021-04-21 16:04 ` Randy Dunlap
2021-04-21 18:32 ` Bandan Das
2021-04-21 18:36 ` Saripalli, RK
2021-04-21 18:48 ` Borislav Petkov
2021-04-21 18:55 ` Saripalli, RK
2021-04-21 18:57 ` Borislav Petkov
2021-04-21 19:05 ` Saripalli, RK
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210421090117.22315-4-rsaripal@amd.com \
--to=rsaripal@amd.com \
--cc=bp@alien8.de \
--cc=bsd@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®