Skip to content

Commit 59b5809

Browse files
aeglsuryasaimadhu
authored andcommitted
x86/mce: Fix logic and comments around MSR_PPIN_CTL
There are two implemented bits in the PPIN_CTL MSR: Bit 0: LockOut (R/WO) Set 1 to prevent further writes to MSR_PPIN_CTL. Bit 1: Enable_PPIN (R/W) If 1, enables MSR_PPIN to be accessible using RDMSR. If 0, an attempt to read MSR_PPIN will cause #GP. So there are four defined values: 0: PPIN is disabled, PPIN_CTL may be updated 1: PPIN is disabled. PPIN_CTL is locked against updates 2: PPIN is enabled. PPIN_CTL may be updated 3: PPIN is enabled. PPIN_CTL is locked against updates Code would only enable the X86_FEATURE_INTEL_PPIN feature for case "2". When it should have done so for both case "2" and case "3". Fix the final test to just check for the enable bit. Also fix some of the other comments in this function. Fixes: 3f5a789 ("x86/mce: Include the PPIN in MCE records when available") Signed-off-by: Tony Luck <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Cc: <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent d364847 commit 59b5809

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

arch/x86/kernel/cpu/mce/intel.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,17 +493,18 @@ static void intel_ppin_init(struct cpuinfo_x86 *c)
493493
return;
494494

495495
if ((val & 3UL) == 1UL) {
496-
/* PPIN available but disabled: */
496+
/* PPIN locked in disabled mode */
497497
return;
498498
}
499499

500-
/* If PPIN is disabled, but not locked, try to enable: */
501-
if (!(val & 3UL)) {
500+
/* If PPIN is disabled, try to enable */
501+
if (!(val & 2UL)) {
502502
wrmsrl_safe(MSR_PPIN_CTL, val | 2UL);
503503
rdmsrl_safe(MSR_PPIN_CTL, &val);
504504
}
505505

506-
if ((val & 3UL) == 2UL)
506+
/* Is the enable bit set? */
507+
if (val & 2UL)
507508
set_cpu_cap(c, X86_FEATURE_INTEL_PPIN);
508509
}
509510
}

0 commit comments

Comments
 (0)