]> xenbits.xensource.com Git - xen.git/commitdiff
x86/MCE: optional build of AMD/Intel MCE code
authorSergiy Kibrik <Sergiy_Kibrik@epam.com>
Wed, 29 May 2024 07:56:57 +0000 (09:56 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 29 May 2024 07:56:57 +0000 (09:56 +0200)
Separate Intel/AMD-specific MCE code using CONFIG_{INTEL,AMD} config options.
Now we can avoid build of mcheck code if support for specific platform is
intentionally disabled by configuration.

Also global variables lmce_support & cmci_support from Intel-specific
mce_intel.c have to moved to common mce.c, as they get checked in common code.

Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/cpu/mcheck/Makefile
xen/arch/x86/cpu/mcheck/mce.c
xen/arch/x86/cpu/mcheck/mce_intel.c
xen/arch/x86/cpu/mcheck/non-fatal.c

index f927f10b4d0fb64783b5915949dd6383bc552f5a..e6cb4dd503e22e53e108af3b01c252c87c46a853 100644 (file)
@@ -1,12 +1,12 @@
-obj-y += amd_nonfatal.o
-obj-y += mce_amd.o
+obj-$(CONFIG_AMD) += amd_nonfatal.o
+obj-$(CONFIG_AMD) += mce_amd.o
 obj-y += mcaction.o
 obj-y += barrier.o
-obj-y += intel-nonfatal.o
+obj-$(CONFIG_INTEL) += intel-nonfatal.o
 obj-y += mctelem.o
 obj-y += mce.o
 obj-y += mce-apei.o
-obj-y += mce_intel.o
+obj-$(CONFIG_INTEL) += mce_intel.o
 obj-y += non-fatal.o
 obj-y += util.o
 obj-y += vmce.o
index fb9dec5b89a9fb1baea4c9ea5d73ee42498da85d..1664ca6412ac4b52c1406dfb6a7f424c9aba2337 100644 (file)
@@ -38,6 +38,10 @@ DEFINE_PER_CPU_READ_MOSTLY(unsigned int, nr_mce_banks);
 unsigned int __read_mostly firstbank;
 unsigned int __read_mostly ppin_msr;
 uint8_t __read_mostly cmci_apic_vector;
+bool __ro_after_init cmci_support;
+
+/* If mce_force_broadcast == 1, lmce_support will be disabled forcibly. */
+bool __ro_after_init lmce_support;
 
 DEFINE_PER_CPU_READ_MOSTLY(struct mca_banks *, poll_bankmask);
 DEFINE_PER_CPU_READ_MOSTLY(struct mca_banks *, no_cmci_banks);
index af43281cc69c803b79176bd66789fbaab06fd0f1..dd812f4b8a4111c3195d1535436a7ea229bd5491 100644 (file)
 #include "mcaction.h"
 
 static DEFINE_PER_CPU_READ_MOSTLY(struct mca_banks *, mce_banks_owned);
-bool __read_mostly cmci_support;
 static bool __read_mostly ser_support;
 static bool __read_mostly mce_force_broadcast;
 boolean_param("mce_fb", mce_force_broadcast);
 
 static int __read_mostly nr_intel_ext_msrs;
 
-/* If mce_force_broadcast == 1, lmce_support will be disabled forcibly. */
-bool __read_mostly lmce_support;
-
 /* Intel SDM define bit15~bit0 of IA32_MCi_STATUS as the MC error code */
 #define INTEL_MCCOD_MASK 0xFFFF
 
index 5a53bcd0b713c9bcd4c1e9fe03908001bd3001c1..a9ee9bb94f9975897e78a47e94ef28ef8481d58b 100644 (file)
@@ -24,15 +24,19 @@ static int __init cf_check init_nonfatal_mce_checker(void)
         * Check for non-fatal errors every MCE_RATE s
         */
        switch (c->x86_vendor) {
+#ifdef CONFIG_AMD
        case X86_VENDOR_AMD:
        case X86_VENDOR_HYGON:
                /* Assume we are on K8 or newer AMD or Hygon CPU here */
                amd_nonfatal_mcheck_init(c);
                break;
+#endif
 
+#ifdef CONFIG_INTEL
        case X86_VENDOR_INTEL:
                intel_nonfatal_mcheck_init(c);
                break;
+#endif
 
        default:
                /* unhandled vendor isn't really an error */