Skip to contentSkip to conversation

x86/mce: PPIN adjustments coming from Linux

PATCH In review Jan Beulich 2 participants 5 messages Mar 2, 2020

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 x86/mce: add Xeon Icelake to list of CPUs that support PPIN

From: Tony Luck <[email protected]>

New CPU model, same MSRs to control and read the inventory number.

[Linux commit dc6b025de95bcd22ff37c4fabb022ec8a027abf1]
xen/arch/x86/cpu/mcheck/mce_intel.c +1 -0
@@ -871,6 +871,7 @@ static void intel_init_ppin(const struct
     case 0x55: /* Skylake X */
     case 0x56: /* Broadwell Xeon D */
     case 0x57: /* Knights Landing */
+    case 0x6a: /* Icelake X */
     case 0x85: /* Knights Mill */
 
         if ( (c != &boot_cpu_data && !ppin_msr) ||

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 1/2
#2 lore raw

Re: [Xen-devel] [PATCH 1/2] x86/mce: add Xeon Icelake to list of CPUs that support PPIN

Quoted 7 lines · Jan Beulich

From: Tony Luck <[email protected]>

New CPU model, same MSRs to control and read the inventory number.

[Linux commit dc6b025de95bcd22ff37c4fabb022ec8a027abf1]

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw

PATCH 2/2 x86/mce: fix logic and comments around MSR_PPIN_CTL

In reply to Jan Beulich

From: Tony Luck <[email protected]>

There are two implemented bits in the PPIN_CTL MSR:

Bit0: 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.

[Linux commit ???]

One of the adjusted comments doesn't exist in our code, and I disagree with the adjustment to the other one and its associate code change: I don't think there's a point trying to enable PPIN if the locked bit is set. Hence it's just the main code change that gets pulled in, plus it gets cloned to the AMD side.

---
Note: If available by the time of committing I mean to insert the Linux
commit hash.

xen/arch/x86/cpu/mcheck/mce_intel.c +1 -1
@@ -885,7 +885,7 @@ static void intel_init_ppin(const struct
             rdmsr_safe(MSR_PPIN_CTL, val);
         }
 
-        if ( (val & (PPIN_ENABLE | PPIN_LOCKOUT)) != PPIN_ENABLE )
+        if ( !(val & PPIN_ENABLE) )
             ppin_msr = 0;
         else if ( c == &boot_cpu_data )
             ppin_msr = MSR_PPIN;
xen/arch/x86/cpu/mcheck/mce_amd.c +1 -1
@@ -329,7 +329,7 @@ amd_mcheck_init(struct cpuinfo_x86 *ci)
             rdmsrl(MSR_AMD_PPIN_CTL, val);
         }
 
-        if ( (val & (PPIN_ENABLE | PPIN_LOCKOUT)) != PPIN_ENABLE )
+        if ( !(val & PPIN_ENABLE) )
             ppin_msr = 0;
         else if ( ci == &boot_cpu_data )
             ppin_msr = MSR_AMD_PPIN;

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 2/2
#4 lore raw

Re: [Xen-devel] [PATCH 2/2] x86/mce: fix logic and comments around MSR_PPIN_CTL

Quoted 26 lines · Jan Beulich

From: Tony Luck <[email protected]>

There are two implemented bits in the PPIN_CTL MSR:

Bit0: 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.

[Linux commit ???]
Quoted 8 lines

One of the adjusted comments doesn't exist in our code, and I disagree with the adjustment to the other one and its associate code change: I don't think there's a point trying to enable PPIN if the locked bit is set. Hence it's just the main code change that gets pulled in, plus it gets cloned to the AMD side.

I agree.  If it is locked, there is no point trying to change it.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel