From: "Ricardo Cañuelo" <ricardo.canuelo@collabora.com>
To: linux-kernel@vger.kernel.org
Cc: "Ricardo Cañuelo" <ricardo.canuelo@collabora.com>,
"Borislav Petkov" <bp@alien8.de>,
"Thadeu Lima de Souza Cascardo" <cascardo@canonical.com>,
"Mark Gross" <mgross@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
"Ingo Molnar" <mingo@redhat.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"John Johansen" <john.johansen@canonical.com>,
"Steve Beattie" <sbeattie@ubuntu.com>,
kernel@collabora.com
Subject: [PATCH v3] x86/speculation/srbds: do not try to turn mitigation off when not supported
Date: Fri, 1 Apr 2022 09:45:17 +0200 [thread overview]
Message-ID: <20220401074517.1848264-1-ricardo.canuelo@collabora.com> (raw)
When SRBDS is mitigated by TSX OFF, update_srbds_msr will still read and
write to MSR_IA32_MCU_OPT_CTRL even when that is not supported by the
microcode.
Checking for X86_FEATURE_SRBDS_CTRL as a CPU feature available makes
more sense than checking for SRBDS_MITIGATION_UCODE_NEEDED as the found
"mitigation".
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
Tested-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
---
Changes in v3:
- Simplified and more explicit solution proposed by Boris
arch/x86/kernel/cpu/bugs.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 6296e1ebed1d..d879a6c93609 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -446,6 +446,13 @@ void update_srbds_msr(void)
if (srbds_mitigation == SRBDS_MITIGATION_UCODE_NEEDED)
return;
+ /*
+ * A MDS_NO CPU for which SRBDS mitigation is not needed due to TSX
+ * being disabled and it hasn't received the SRBDS MSR microcode.
+ */
+ if (!boot_cpu_has(X86_FEATURE_SRBDS_CTRL))
+ return;
+
rdmsrl(MSR_IA32_MCU_OPT_CTRL, mcu_ctrl);
switch (srbds_mitigation) {
--
2.25.1
next reply other threads:[~2022-04-01 7:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-01 7:45 Ricardo Cañuelo [this message]
2022-04-05 20:57 ` [tip: x86/cpu] x86/speculation/srbds: Do " tip-bot2 for Ricardo Cañuelo
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=20220401074517.1848264-1-ricardo.canuelo@collabora.com \
--to=ricardo.canuelo@collabora.com \
--cc=bp@alien8.de \
--cc=cascardo@canonical.com \
--cc=hpa@zytor.com \
--cc=john.johansen@canonical.com \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgross@linux.intel.com \
--cc=mingo@redhat.com \
--cc=sbeattie@ubuntu.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®