[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging] x86/MCE: mcequirk stuff is AMD-specific



commit 4a8e684d2937a240b51922b64ed0a866ec4ba76d
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Mar 18 11:41:47 2019 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Mar 18 11:41:47 2019 +0100

    x86/MCE: mcequirk stuff is AMD-specific
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/cpu/mcheck/mce_amd.c    | 34 +++++++++++++++--------
 xen/arch/x86/cpu/mcheck/mce_quirks.h | 53 ------------------------------------
 2 files changed, 23 insertions(+), 64 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce_amd.c 
b/xen/arch/x86/cpu/mcheck/mce_amd.c
index d125bc1611..ed29fcc312 100644
--- a/xen/arch/x86/cpu/mcheck/mce_amd.c
+++ b/xen/arch/x86/cpu/mcheck/mce_amd.c
@@ -70,12 +70,22 @@
 #include "x86_mca.h"
 #include "mce_amd.h"
 #include "mcaction.h"
-#include "mce_quirks.h"
 #include "vmce.h"
 
-#define ANY -1
+#define ANY (~0U)
 
-static const struct mce_quirkdata mce_amd_quirks[] = {
+enum mcequirk_amd_flags {
+    MCEQUIRK_NONE,
+    MCEQUIRK_K8_GART,
+    MCEQUIRK_F10_GART,
+};
+
+static const struct mce_quirkdata {
+    unsigned int cpu_family;
+    unsigned int cpu_model;
+    unsigned int cpu_stepping;
+    enum mcequirk_amd_flags quirk;
+} mce_amd_quirks[] = {
     { 0xf /* cpu family */, ANY /* all models */, ANY /* all steppings */,
       MCEQUIRK_K8_GART },
     { 0x10 /* cpu family */, ANY /* all models */, ANY /* all steppings */,
@@ -157,10 +167,10 @@ bool mc_amd_addrcheck(uint64_t status, uint64_t misc, int 
addrtype)
 }
 
 /* MC quirks */
-enum mcequirk_amd_flags
-mcequirk_lookup_amd_quirkdata(struct cpuinfo_x86 *c)
+static enum mcequirk_amd_flags
+mcequirk_lookup_amd_quirkdata(const struct cpuinfo_x86 *c)
 {
-    int i;
+    unsigned int i;
 
     BUG_ON(c->x86_vendor != X86_VENDOR_AMD);
 
@@ -176,10 +186,11 @@ mcequirk_lookup_amd_quirkdata(struct cpuinfo_x86 *c)
                 continue;
         return mce_amd_quirks[i].quirk;
     }
-    return 0;
+
+    return MCEQUIRK_NONE;
 }
 
-int mcequirk_amd_apply(enum mcequirk_amd_flags flags)
+static void mcequirk_amd_apply(enum mcequirk_amd_flags flags)
 {
     uint64_t val;
 
@@ -197,11 +208,12 @@ int mcequirk_amd_apply(enum mcequirk_amd_flags flags)
 
     case MCEQUIRK_F10_GART:
         if ( rdmsr_safe(MSR_AMD64_MCx_MASK(4), val) == 0 )
-                wrmsr_safe(MSR_AMD64_MCx_MASK(4), val | (1 << 10));
+            wrmsr_safe(MSR_AMD64_MCx_MASK(4), val | (1 << 10));
         break;
-    }
 
-    return 0;
+    default:
+        ASSERT(flags == MCEQUIRK_NONE);
+    }
 }
 
 static struct mcinfo_extended *
diff --git a/xen/arch/x86/cpu/mcheck/mce_quirks.h 
b/xen/arch/x86/cpu/mcheck/mce_quirks.h
deleted file mode 100644
index 2c93a31d09..0000000000
--- a/xen/arch/x86/cpu/mcheck/mce_quirks.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* * MCA quirks
- * Copyright (c) 2009 Advanced Micro Devices, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _MCE_QUIRK_H
-#define _MCE_QUIRK_H
-
-#include <xen/types.h>
-
-struct mce_quirkdata {
-       int32_t cpu_family;
-       int16_t cpu_model;
-       int16_t cpu_stepping;
-       uint32_t quirk;
-};
-
-/* use a binary flag if multiple quirks apply
- * to one CPU family/model
- */
-
-enum mcequirk_amd_flags {
-       MCEQUIRK_K8_GART = 2,
-       MCEQUIRK_F10_GART
-};
-
-enum mcequirk_intel_flags {
-       MCEQUIRK_DUMMY = 0x1, /* nothing known yet */
-};
-
-enum mcequirk_amd_flags
-mcequirk_lookup_amd_quirkdata(struct cpuinfo_x86 *c);
-
-int mcequirk_amd_apply(enum mcequirk_amd_flags flags);
-
-enum mcequirk_intel_flags
-mcequirk_lookup_intel_quirkdata(struct cpuinfo_x86 *c);
-
-int mcequirk_intel_apply(enum mcequirk_intel_flags flags);
-
-#endif /* _MCE_QUIRK_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.