Commit cef12ee5 authored by Liu, Jinsong's avatar Liu, Jinsong Committed by Konrad Rzeszutek Wilk

xen/mce: Add mcelog support for Xen platform

When MCA error occurs, it would be handled by Xen hypervisor first,
and then the error information would be sent to initial domain for logging.

This patch gets error information from Xen hypervisor and convert
Xen format error into Linux format mcelog. This logic is basically
self-contained, not touching other kernel components.

By using tools like mcelog tool users could read specific error information,
like what they did under native Linux.

To test follow directions outlined in Documentation/acpi/apei/einj.txt
Acked-and-tested-by: default avatarBorislav Petkov <borislav.petkov@amd.com>
Signed-off-by: default avatarKe, Liping <liping.ke@intel.com>
Signed-off-by: default avatarJiang, Yunhong <yunhong.jiang@intel.com>
Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: default avatarLiu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 485802a6
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include <xen/interface/sched.h> #include <xen/interface/sched.h>
#include <xen/interface/physdev.h> #include <xen/interface/physdev.h>
#include <xen/interface/platform.h> #include <xen/interface/platform.h>
#include <xen/interface/xen-mca.h>
/* /*
* The hypercall asms have to meet several constraints: * The hypercall asms have to meet several constraints:
...@@ -301,6 +302,13 @@ HYPERVISOR_set_timer_op(u64 timeout) ...@@ -301,6 +302,13 @@ HYPERVISOR_set_timer_op(u64 timeout)
return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi); return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
} }
static inline int
HYPERVISOR_mca(struct xen_mc *mc_op)
{
mc_op->interface_version = XEN_MCA_INTERFACE_VERSION;
return _hypercall1(int, mca, mc_op);
}
static inline int static inline int
HYPERVISOR_dom0_op(struct xen_platform_op *platform_op) HYPERVISOR_dom0_op(struct xen_platform_op *platform_op)
{ {
......
...@@ -57,8 +57,6 @@ static DEFINE_MUTEX(mce_chrdev_read_mutex); ...@@ -57,8 +57,6 @@ static DEFINE_MUTEX(mce_chrdev_read_mutex);
int mce_disabled __read_mostly; int mce_disabled __read_mostly;
#define MISC_MCELOG_MINOR 227
#define SPINUNIT 100 /* 100ns */ #define SPINUNIT 100 /* 100ns */
atomic_t mce_entry; atomic_t mce_entry;
...@@ -2342,7 +2340,7 @@ static __init int mcheck_init_device(void) ...@@ -2342,7 +2340,7 @@ static __init int mcheck_init_device(void)
return err; return err;
} }
device_initcall(mcheck_init_device); device_initcall_sync(mcheck_init_device);
/* /*
* Old style boot options parsing. Only for compatibility. * Old style boot options parsing. Only for compatibility.
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <xen/interface/physdev.h> #include <xen/interface/physdev.h>
#include <xen/interface/vcpu.h> #include <xen/interface/vcpu.h>
#include <xen/interface/memory.h> #include <xen/interface/memory.h>
#include <xen/interface/xen-mca.h>
#include <xen/features.h> #include <xen/features.h>
#include <xen/page.h> #include <xen/page.h>
#include <xen/hvm.h> #include <xen/hvm.h>
...@@ -341,9 +342,7 @@ static void __init xen_init_cpuid_mask(void) ...@@ -341,9 +342,7 @@ static void __init xen_init_cpuid_mask(void)
unsigned int xsave_mask; unsigned int xsave_mask;
cpuid_leaf1_edx_mask = cpuid_leaf1_edx_mask =
~((1 << X86_FEATURE_MCE) | /* disable MCE */ ~((1 << X86_FEATURE_MTRR) | /* disable MTRR */
(1 << X86_FEATURE_MCA) | /* disable MCA */
(1 << X86_FEATURE_MTRR) | /* disable MTRR */
(1 << X86_FEATURE_ACC)); /* thermal monitoring */ (1 << X86_FEATURE_ACC)); /* thermal monitoring */
if (!xen_initial_domain()) if (!xen_initial_domain())
......
...@@ -196,4 +196,12 @@ config XEN_ACPI_PROCESSOR ...@@ -196,4 +196,12 @@ config XEN_ACPI_PROCESSOR
called xen_acpi_processor If you do not know what to choose, select called xen_acpi_processor If you do not know what to choose, select
M here. If the CPUFREQ drivers are built in, select Y here. M here. If the CPUFREQ drivers are built in, select Y here.
config XEN_MCE_LOG
bool "Xen platform mcelog"
depends on XEN_DOM0 && X86_64 && X86_MCE
default n
help
Allow kernel fetching MCE error from Xen platform and
converting it into Linux mcelog format for mcelog tools
endmenu endmenu
...@@ -18,6 +18,7 @@ obj-$(CONFIG_XEN_PVHVM) += platform-pci.o ...@@ -18,6 +18,7 @@ obj-$(CONFIG_XEN_PVHVM) += platform-pci.o
obj-$(CONFIG_XEN_TMEM) += tmem.o obj-$(CONFIG_XEN_TMEM) += tmem.o
obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o
obj-$(CONFIG_XEN_DOM0) += pci.o acpi.o obj-$(CONFIG_XEN_DOM0) += pci.o acpi.o
obj-$(CONFIG_XEN_MCE_LOG) += mcelog.o
obj-$(CONFIG_XEN_PCIDEV_BACKEND) += xen-pciback/ obj-$(CONFIG_XEN_PCIDEV_BACKEND) += xen-pciback/
obj-$(CONFIG_XEN_PRIVCMD) += xen-privcmd.o obj-$(CONFIG_XEN_PRIVCMD) += xen-privcmd.o
obj-$(CONFIG_XEN_ACPI_PROCESSOR) += xen-acpi-processor.o obj-$(CONFIG_XEN_ACPI_PROCESSOR) += xen-acpi-processor.o
......
This diff is collapsed.
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#define MPT_MINOR 220 #define MPT_MINOR 220
#define MPT2SAS_MINOR 221 #define MPT2SAS_MINOR 221
#define UINPUT_MINOR 223 #define UINPUT_MINOR 223
#define MISC_MCELOG_MINOR 227
#define HPET_MINOR 228 #define HPET_MINOR 228
#define FUSE_MINOR 229 #define FUSE_MINOR 229
#define KVM_MINOR 232 #define KVM_MINOR 232
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment