Skip to content

Commit 4920776

Browse files
sean-jcIngo Molnar
authored andcommitted
x86/CPU/AMD: WARN when setting EFER.AUTOIBRS if and only if the WRMSR fails
When ensuring EFER.AUTOIBRS is set, WARN only on a negative return code from msr_set_bit(), as '1' is used to indicate the WRMSR was successful ('0' indicates the MSR bit was already set). Fixes: 8cc68c9 ("x86/CPU/AMD: Make sure EFER[AIBRSE] is set") Reported-by: Nathan Chancellor <[email protected]> Signed-off-by: Sean Christopherson <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Closes: https://lore.kernel.org/all/20241205220604.GA2054199@thelio-3990X
1 parent 9677be0 commit 4920776

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kernel/cpu/amd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ static void init_amd(struct cpuinfo_x86 *c)
10651065
*/
10661066
if (spectre_v2_in_eibrs_mode(spectre_v2_enabled) &&
10671067
cpu_has(c, X86_FEATURE_AUTOIBRS))
1068-
WARN_ON_ONCE(msr_set_bit(MSR_EFER, _EFER_AUTOIBRS));
1068+
WARN_ON_ONCE(msr_set_bit(MSR_EFER, _EFER_AUTOIBRS) < 0);
10691069

10701070
/* AMD CPUs don't need fencing after x2APIC/TSC_DEADLINE MSR writes. */
10711071
clear_cpu_cap(c, X86_FEATURE_APIC_MSRS_FENCE);

0 commit comments

Comments
 (0)