mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] x86/speculation/srbds: do not try to turn mitigation off when not supported
@ 2022-04-01  7:45 Ricardo Cañuelo
  2022-04-05 20:57 ` [tip: x86/cpu] x86/speculation/srbds: Do " tip-bot2 for Ricardo Cañuelo
  0 siblings, 1 reply; 2+ messages in thread
From: Ricardo Cañuelo @ 2022-04-01  7:45 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ricardo Cañuelo, Borislav Petkov,
	Thadeu Lima de Souza Cascardo, Mark Gross, x86, H. Peter Anvin,
	Ingo Molnar, Thomas Gleixner, John Johansen, Steve Beattie,
	kernel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-06  2:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01  7:45 [PATCH v3] x86/speculation/srbds: do not try to turn mitigation off when not supported Ricardo Cañuelo
2022-04-05 20:57 ` [tip: x86/cpu] x86/speculation/srbds: Do " tip-bot2 for Ricardo Cañuelo

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®