[Xen-devel] [PATCH] x86/mce: Correct the machine check vendor for Hygon

Pu Wen posted 1 patch 4 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/xen tags/patchew/20200324045131.2060-1-puwen@hygon.cn
Maintainers: Jan Beulich <jbeulich@suse.com>, Wei Liu <wl@xen.org>, Andrew Cooper <andrew.cooper3@citrix.com>, "Roger Pau Monné" <roger.pau@citrix.com>
xen/arch/x86/cpu/mcheck/mce.c     | 4 +++-
xen/arch/x86/cpu/mcheck/mce.h     | 3 ++-
xen/arch/x86/cpu/mcheck/mce_amd.c | 3 ++-
3 files changed, 7 insertions(+), 3 deletions(-)
[Xen-devel] [PATCH] x86/mce: Correct the machine check vendor for Hygon
Posted by Pu Wen 4 years ago
Currently the xl dmesg output on Hygon platforms will be
"(XEN) CPU0: AMD Fam18h machine check reporting enabled",
which is misleading as AMD does not have family 18h (Hygon
negotiated with AMD to confirm that only Hygon has family 18h).

To correct this, add Hygon machine check type and vendor string.

Signed-off-by: Pu Wen <puwen@hygon.cn>
---
 xen/arch/x86/cpu/mcheck/mce.c     | 4 +++-
 xen/arch/x86/cpu/mcheck/mce.h     | 3 ++-
 xen/arch/x86/cpu/mcheck/mce_amd.c | 3 ++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index e5bd4f542c..fe9667e0c3 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -610,7 +610,8 @@ int show_mca_info(int inited, struct cpuinfo_x86 *c)
         static const char *const type_str[] = {
             [mcheck_amd_famXX] = "AMD",
             [mcheck_amd_k8] = "AMD K8",
-            [mcheck_intel] = "Intel"
+            [mcheck_intel] = "Intel",
+            [mcheck_hygon] = "Hygon"
         };
 
         snprintf(prefix, ARRAY_SIZE(prefix), "%sCPU%u: ",
@@ -625,6 +626,7 @@ int show_mca_info(int inited, struct cpuinfo_x86 *c)
             break;
 
         case mcheck_amd_famXX:
+        case mcheck_hygon:
             printk("%s%s Fam%xh machine check reporting enabled\n",
                    prefix, type_str[inited], c->x86);
             break;
diff --git a/xen/arch/x86/cpu/mcheck/mce.h b/xen/arch/x86/cpu/mcheck/mce.h
index 7137c2f763..1953626919 100644
--- a/xen/arch/x86/cpu/mcheck/mce.h
+++ b/xen/arch/x86/cpu/mcheck/mce.h
@@ -36,7 +36,8 @@ enum mcheck_type {
     mcheck_none,
     mcheck_amd_famXX,
     mcheck_amd_k8,
-    mcheck_intel
+    mcheck_intel,
+    mcheck_hygon
 };
 
 extern uint8_t cmci_apic_vector;
diff --git a/xen/arch/x86/cpu/mcheck/mce_amd.c b/xen/arch/x86/cpu/mcheck/mce_amd.c
index 787ce961b6..279a8e6f12 100644
--- a/xen/arch/x86/cpu/mcheck/mce_amd.c
+++ b/xen/arch/x86/cpu/mcheck/mce_amd.c
@@ -339,5 +339,6 @@ amd_mcheck_init(struct cpuinfo_x86 *ci)
     mce_recoverable_register(mc_amd_recoverable_scan);
     mce_register_addrcheck(mc_amd_addrcheck);
 
-    return mcheck_amd_famXX;
+    return ci->x86_vendor == X86_VENDOR_HYGON ?
+            mcheck_hygon : mcheck_amd_famXX;
 }
-- 
2.23.0


Re: [Xen-devel] [PATCH] x86/mce: Correct the machine check vendor for Hygon
Posted by Jan Beulich 4 years ago
On 24.03.2020 05:51, Pu Wen wrote:
> Currently the xl dmesg output on Hygon platforms will be
> "(XEN) CPU0: AMD Fam18h machine check reporting enabled",
> which is misleading as AMD does not have family 18h (Hygon
> negotiated with AMD to confirm that only Hygon has family 18h).
> 
> To correct this, add Hygon machine check type and vendor string.
> 
> Signed-off-by: Pu Wen <puwen@hygon.cn>

Reviewed-by: Jan Beulich <jbeulich@suse.com>