Skip to content

Commit 530e806

Browse files
pa1guptabp3tk0v
authored andcommitted
x86/bugs: Simplify the retbleed=stuff checks
Simplify the nested checks, remove redundant print and comment. Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Nikolay Borisov <nik.borisov@suse.com> Acked-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/20250611-eibrs-fix-v4-2-5ff86cac6c61@linux.intel.com
1 parent 98ff5c0 commit 530e806

1 file changed

Lines changed: 8 additions & 16 deletions

File tree

arch/x86/kernel/cpu/bugs.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,24 +1263,16 @@ static void __init retbleed_update_mitigation(void)
12631263
if (!boot_cpu_has_bug(X86_BUG_RETBLEED) || cpu_mitigations_off())
12641264
return;
12651265

1266-
/*
1267-
* retbleed=stuff is only allowed on Intel. If stuffing can't be used
1268-
* then a different mitigation will be selected below.
1269-
*
1270-
* its=stuff will also attempt to enable stuffing.
1271-
*/
1272-
if (retbleed_mitigation == RETBLEED_MITIGATION_STUFF ||
1273-
its_mitigation == ITS_MITIGATION_RETPOLINE_STUFF) {
1274-
if (spectre_v2_enabled != SPECTRE_V2_RETPOLINE) {
1275-
pr_err("WARNING: retbleed=stuff depends on spectre_v2=retpoline\n");
1276-
retbleed_mitigation = RETBLEED_MITIGATION_NONE;
1277-
} else {
1278-
if (retbleed_mitigation != RETBLEED_MITIGATION_STUFF)
1279-
pr_info("Retbleed mitigation updated to stuffing\n");
1266+
/* ITS can also enable stuffing */
1267+
if (its_mitigation == ITS_MITIGATION_RETPOLINE_STUFF)
1268+
retbleed_mitigation = RETBLEED_MITIGATION_STUFF;
12801269

1281-
retbleed_mitigation = RETBLEED_MITIGATION_STUFF;
1282-
}
1270+
if (retbleed_mitigation == RETBLEED_MITIGATION_STUFF &&
1271+
spectre_v2_enabled != SPECTRE_V2_RETPOLINE) {
1272+
pr_err("WARNING: retbleed=stuff depends on spectre_v2=retpoline\n");
1273+
retbleed_mitigation = RETBLEED_MITIGATION_NONE;
12831274
}
1275+
12841276
/*
12851277
* Let IBRS trump all on Intel without affecting the effects of the
12861278
* retbleed= cmdline option except for call depth based stuffing

0 commit comments

Comments
 (0)