[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <175075954773.406.6201068420364124322.tip-bot2@tip-bot2>
Date: Tue, 24 Jun 2025 10:05:47 -0000
From: "tip-bot2 for Pawan Gupta" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
"Borislav Petkov (AMD)" <bp@...en8.de>,
Nikolay Borisov <nik.borisov@...e.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: x86/bugs] x86/bugs: Use switch/case in its_apply_mitigation()
The following commit has been merged into the x86/bugs branch of tip:
Commit-ID: 7e44909e0ea8346ba08b244ecc275fc3394e2b8e
Gitweb: https://git.kernel.org/tip/7e44909e0ea8346ba08b244ecc275fc3394e2b8e
Author: Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>
AuthorDate: Wed, 11 Jun 2025 10:29:47 -07:00
Committer: Borislav Petkov (AMD) <bp@...en8.de>
CommitterDate: Mon, 23 Jun 2025 12:22:44 +02:00
x86/bugs: Use switch/case in its_apply_mitigation()
Prepare to apply stuffing mitigation in its_apply_mitigation(). This is
currently only done via retbleed mitigation. Also using switch/case
makes it evident that mitigation mode like VMEXIT_ONLY doesn't need any
special handling.
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Reviewed-by: Nikolay Borisov <nik.borisov@...e.com>
Link: https://lore.kernel.org/20250611-eibrs-fix-v4-4-5ff86cac6c61@linux.intel.com
---
arch/x86/kernel/cpu/bugs.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 20696ab..e861e88 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -1468,15 +1468,21 @@ static void __init its_update_mitigation(void)
static void __init its_apply_mitigation(void)
{
+ switch (its_mitigation) {
+ case ITS_MITIGATION_OFF:
+ case ITS_MITIGATION_AUTO:
+ case ITS_MITIGATION_VMEXIT_ONLY:
/* its=stuff forces retbleed stuffing and is enabled there. */
- if (its_mitigation != ITS_MITIGATION_ALIGNED_THUNKS)
- return;
-
- if (!boot_cpu_has(X86_FEATURE_RETPOLINE))
- setup_force_cpu_cap(X86_FEATURE_INDIRECT_THUNK_ITS);
+ case ITS_MITIGATION_RETPOLINE_STUFF:
+ break;
+ case ITS_MITIGATION_ALIGNED_THUNKS:
+ if (!boot_cpu_has(X86_FEATURE_RETPOLINE))
+ setup_force_cpu_cap(X86_FEATURE_INDIRECT_THUNK_ITS);
- setup_force_cpu_cap(X86_FEATURE_RETHUNK);
- set_return_thunk(its_return_thunk);
+ setup_force_cpu_cap(X86_FEATURE_RETHUNK);
+ set_return_thunk(its_return_thunk);
+ break;
+ }
}
#undef pr_fmt
Powered by blists - more mailing lists