[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251013143444.3999-7-david.kaplan@amd.com>
Date: Mon, 13 Oct 2025 09:33:54 -0500
From: David Kaplan <david.kaplan@....com>
To: Thomas Gleixner <tglx@...utronix.de>, Borislav Petkov <bp@...en8.de>,
Peter Zijlstra <peterz@...radead.org>, Josh Poimboeuf <jpoimboe@...nel.org>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>, Ingo Molnar
<mingo@...hat.com>, Dave Hansen <dave.hansen@...ux.intel.com>,
<x86@...nel.org>, "H . Peter Anvin" <hpa@...or.com>
CC: Alexander Graf <graf@...zon.com>, Boris Ostrovsky
<boris.ostrovsky@...cle.com>, <linux-kernel@...r.kernel.org>
Subject: [RFC PATCH 06/56] x86/bugs: Reset retbleed mitigations
Add function to reset retbleed mitigations back to their boot-time
defaults.
Signed-off-by: David Kaplan <david.kaplan@....com>
---
arch/x86/kernel/cpu/bugs.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 0430635bb17d..1f56ccb5f641 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -1542,6 +1542,20 @@ static void __init retbleed_apply_mitigation(void)
cpu_smt_disable(false);
}
+#ifdef CONFIG_DYNAMIC_MITIGATIONS
+static void retbleed_reset_mitigation(void)
+{
+ setup_clear_cpu_cap(X86_FEATURE_RETHUNK);
+ setup_clear_cpu_cap(X86_FEATURE_UNRET);
+ setup_clear_cpu_cap(X86_FEATURE_ENTRY_IBPB);
+ setup_clear_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
+ setup_clear_cpu_cap(X86_FEATURE_CALL_DEPTH);
+ x86_return_thunk = __x86_return_thunk;
+ retbleed_mitigation = IS_ENABLED(CONFIG_MITIGATION_RETBLEED) ?
+ RETBLEED_MITIGATION_AUTO : RETBLEED_MITIGATION_NONE;
+}
+#endif
+
#undef pr_fmt
#define pr_fmt(fmt) "ITS: " fmt
@@ -3829,5 +3843,6 @@ void arch_cpu_reset_mitigations(void)
{
spectre_v1_reset_mitigation();
spectre_v2_reset_mitigation();
+ retbleed_reset_mitigation();
}
#endif
--
2.34.1
Powered by blists - more mailing lists