Messages in this thread | | | Subject | Re: [PATCH 1/1] x86/mce/amd: Add PPIN support for AMD MCE | From | Wei Huang <> | Date | Thu, 19 Mar 2020 15:14:53 -0500 |
| |
On 3/16/20 1:08 PM, Borislav Petkov wrote: > On Tue, Mar 10, 2020 at 11:44:09PM -0500, Wei Huang wrote: >> Newer AMD CPUs support the feature of protected processor identification >> number (PPIN). This patch detects and enables PPIN support on AMD platforms > > Avoid having "This patch" or "This commit" in the commit message. It is > tautologically useless. > > Also, do > > $ git grep 'This patch' Documentation/process > > for more details. > >> and includes PPIN info in MCE records if available. Because this feature is >> almost identical on both Intel and AMD, it re-uses X86_FEATURE_INTEL_PPIN >> feature bit and renames it to X86_FEATURE_PPIN. > > Strictly speaking, you can't rename it anymore because it is visible in > /proc/cpuinfo and thus ABI. > > Besides, we have already a cpufeatures.h leaf for exactly that word: > > /* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */ > > which means you can call the AMD define > > #define X86_FEATURE_AMD_PPIN ( 13*32+23) /* AMD Protected Processor Inventory Number */ > > and /proc/cpuinfo will have "amd_ppin" and the code will use the > respective vendor flag to test.
BTW Intel PPIN doesn't have a respective CPUID feature bit. So it relies on intel_ppin_init() to turn it on. After that, mce_setup() can use this_cpu_has(X86_FEATURE_INTEL_PPIN) to read MSR_PPIN. This is fine.
In contrast, AMD has 0x80000008_EBX[23] defined for PPIN feature. When this CPUID bit is set, X86_FEATURE_AMD_PPIN is ON. But there are cases where MSR_AMD_PPIN_CTL is locked. Under such circumstance I think X86_FEATURE_AMD_PPIN should be cleared.
My proposal is to move mce_amd_ppin_init() function to ./arch/x86/kernel/cpu/amd.c and probe X86_FEATURE_AMD_PPIN there. This is similar to what early_detect_mem_encrypt() does. Later, mce_setup() can use X86_FEATURE_AMD_PPIN directly. Is this approach acceptable?
> >> Signed-off-by: Wei Huang <wei.huang2@amd.com> >> Signed-off-by: Smita Koralahalli Channabasappa <smita.koralahallichannabasappa@amd.com> > > What does this SOB mean? Grep Documentation/ for "Co-developed-by" in > case this is what you're trying to express. >
| |