Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@
#include <xen/interface/sched.h>
#include <xen/interface/physdev.h>
#include <xen/interface/platform.h>
#include <xen/interface/xen-mca.h>

/*
 * The hypercall asms have to meet several constraints:
@@ -301,6 +302,13 @@ HYPERVISOR_set_timer_op(u64 timeout)
	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
HYPERVISOR_dom0_op(struct xen_platform_op *platform_op)
{
+1 −3
Original line number Diff line number Diff line
@@ -57,8 +57,6 @@ static DEFINE_MUTEX(mce_chrdev_read_mutex);

int mce_disabled __read_mostly;

#define MISC_MCELOG_MINOR	227

#define SPINUNIT 100	/* 100ns */

atomic_t mce_entry;
@@ -2342,7 +2340,7 @@ static __init int mcheck_init_device(void)

	return err;
}
device_initcall(mcheck_init_device);
device_initcall_sync(mcheck_init_device);

/*
 * Old style boot options parsing. Only for compatibility.
+2 −3
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#include <xen/interface/physdev.h>
#include <xen/interface/vcpu.h>
#include <xen/interface/memory.h>
#include <xen/interface/xen-mca.h>
#include <xen/features.h>
#include <xen/page.h>
#include <xen/hvm.h>
@@ -341,9 +342,7 @@ static void __init xen_init_cpuid_mask(void)
	unsigned int xsave_mask;

	cpuid_leaf1_edx_mask =
		~((1 << X86_FEATURE_MCE)  |  /* disable MCE */
		  (1 << X86_FEATURE_MCA)  |  /* disable MCA */
		  (1 << X86_FEATURE_MTRR) |  /* disable MTRR */
		~((1 << X86_FEATURE_MTRR) |  /* disable MTRR */
		  (1 << X86_FEATURE_ACC));   /* thermal monitoring */

	if (!xen_initial_domain())
+8 −0
Original line number Diff line number Diff line
@@ -196,4 +196,12 @@ config XEN_ACPI_PROCESSOR
	  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.

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
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ obj-$(CONFIG_XEN_PVHVM) += platform-pci.o
obj-$(CONFIG_XEN_TMEM)			+= tmem.o
obj-$(CONFIG_SWIOTLB_XEN)		+= swiotlb-xen.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_PRIVCMD)		+= xen-privcmd.o
obj-$(CONFIG_XEN_ACPI_PROCESSOR)	+= xen-acpi-processor.o
Loading