x86/mce: add CMCI support for Centaur CPUs
Quoted 61 lines
-----Original Mail-----
Sender: Borislav Petkov [mailto:[email protected]]
Time: 2018年6月1日 17:38
Receiver: David Wang <[email protected]>
CC: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Topic : Re: [PATCH] x86/mce: add CMCI support for Centaur CPUsQuoted 1 line · David Wang
Newer Centaur support CMCI mechanism, which is compatible with INTEL
CMCI.
Quoted 14 lines
Signed-off-by David Wang <[email protected]>--- arch/x86/Kconfig | 12 ++++++++++++ arch/x86/kernel/cpu/mcheck/mce.c | 6 ++++++ 2 files changed, 18 insertions(+)arch/x86/Kconfig index renamed from arch/x86/Kconfig +0
-0dda87a3..1adff5f 100644
arch/x86/Kconfig +0
-0@@ -1130,6 +1130,18 @@ config X86_MCE_AMD Additional support for AMD specific MCE features such as the DRAM Error Threshold.arch/x86/Kconfig config X86_MCE_AMD · line 1141
Quoted 10 lines
arch/x86/Kconfig +9
-0+config X86_MCE_CENTAUR + def_bool y + prompt "CENTAUR MCE features" + depends on CPU_SUP_CENTAUR && X86_MCE_INTEL + help + Additional support for Centaur specific MCE features such as + MCE broadcasting and CMCI support. + New Centaur CPU support MCE broadcasting. + New Centaur CPU support CMCI which is fully compliant with IntelCMCI.
arch/x86/kernel/cpu/mcheck/mce.c static void __mcheck_cpu_init_early(struct
Quoted 12 lines
arch/x86/Kconfig +3
-0+ + If unsure, say N here. + config X86_ANCIENT_MCE bool "Support for old Pentium 5 / WinChip machine checks" depends on X86_32 && X86_MCEarch/x86/kernel/cpu/mcheck/mce.c +0
-0@@ -1727,6 +1727,7 @@ static void __mcheck_cpu_init_early(struct
cpuinfo_x86*c)arch/x86/kernel/cpu/mcheck/mce.c static void mce_centaur_feature_init(struct
Quoted 7 lines
arch/x86/kernel/cpu/mcheck/mce.c +1
-0} } +#ifdef CONFIG_X86_MCE_CENTAUR static void mce_centaur_feature_init (struct cpuinfo_x86 *c) {struct mca_config *cfg = &mca_cfg;@@ -1740,7 +1741,12 @@ static void mce_centaur_feature_init(struct
cpuinfo_x86*c)
Quoted 9 lines
arch/x86/kernel/cpu/mcheck/mce.c static void mce_centaur_feature_init(struct · line 1745
Quoted 5 lines
arch/x86/kernel/cpu/mcheck/mce.c +2
-0if (cfg->monarch_timeout <0 ) cfg->monarch_timeout =USEC_PER_SEC ; } +mce_intel_feature_init (c); + mce_adjust_timer = cmci_intel_adjust_timer;So far so good but above says "New Centaur CPU[s]" but you're calling
mce_intel_feature_init()unconditionally here, for *all* centaur CPUs. Ditto for setting the CMCI handler.
There is a check for CMCI support or not In cmci_supported() function which will be called by mce_intel_feature_init.
return !!(cap & MCG_CMCI_P);
So, I didn't add Family/Model/Stepping check.
But, I am sorry to add another patch just as following:
@@ -85,7 +85,8 @@ static int cmci_supported(int *banks)
* initialization is vendor keyed and this
* makes sure none of the backdoors are entered otherwise. */
- if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
+ if ((boot_cpu_data.x86_vendor != X86_VENDOR_INTEL &&
+ boot_cpu_data.x86_vendor != X86_VENDOR_CENTAUR))
return 0;
if (!boot_cpu_has(X86_FEATURE_APIC) || lapic_get_maxlvt() < 6)
return 0;
I will send patch v4 later to include this patch.
Thank you.Quoted 23 lines
Also
mce_intel_feature_init()does more things than init CMCI so I think you wanna limit that to onlyintel_init_cmci(). IOW, something like the hunk below.And frankly I'm not crazy about adding centaur code to
mce_intel.cbut since it is copying functionality, I think we should copy the sw support in the kernel too instead of adding amce_centaur.cduplicate. For now at least...Thx.
---
arch/x86/kernel/cpu/mcheck/mce_intel.c +2
-1@@ -506,8 +506,15 @@ static void intel_ppin_init(struct cpuinfo_x86 *c)void mce_intel_feature_init (struct cpuinfo_x86 *c) { -intel_init_thermal (c);intel_init_cmci (); + +/*
arch/x86/kernel/cpu/mcheck/mce_intel.c static void intel_ppin_init(struct cpuinfo_x86 *c) · line 520
Quoted 10 lines
arch/x86/kernel/cpu/mcheck/mce_intel.c +6
-0+* Some Centaur variants support CMCI. +*/ +if (c->x86_vendor ==X86_VENDOR_CENTAUR ) +return ; + +intel_init_thermal (c);intel_init_lmce ();intel_ppin_init (c); }
OK. I will send patch V4 to fix this problem, just like:
void mce_intel_feature_init(struct cpuinfo_x86 *c)
{
- intel_init_thermal(c);
- intel_init_cmci();
- intel_init_lmce();
- intel_ppin_init(c);
+
+ switch (c->x86_vendor) {
+ case X86_VENDOR_INTEL:
+ intel_init_thermal(c);
+ intel_init_cmci();
+ intel_init_lmce();
+ intel_ppin_init(c);
+ break;+ case X86_VENDOR_CENTAUR:
+ intel_init_cmci();
+ break;
+ default:
+ break;
+ }
}
Thank you.
Quoted 6 lines
--
Regards/Gruss,
Boris.ECO tip #101: Trim your mails when you reply.
--