xref: /OK3568_Linux_fs/kernel/arch/x86/include/uapi/asm/mce.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2*4882a593Smuzhiyun #ifndef _UAPI_ASM_X86_MCE_H
3*4882a593Smuzhiyun #define _UAPI_ASM_X86_MCE_H
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun #include <linux/types.h>
6*4882a593Smuzhiyun #include <linux/ioctl.h>
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun /*
9*4882a593Smuzhiyun  * Fields are zero when not available. Also, this struct is shared with
10*4882a593Smuzhiyun  * userspace mcelog and thus must keep existing fields at current offsets.
11*4882a593Smuzhiyun  * Only add new fields to the end of the structure
12*4882a593Smuzhiyun  */
13*4882a593Smuzhiyun struct mce {
14*4882a593Smuzhiyun 	__u64 status;		/* Bank's MCi_STATUS MSR */
15*4882a593Smuzhiyun 	__u64 misc;		/* Bank's MCi_MISC MSR */
16*4882a593Smuzhiyun 	__u64 addr;		/* Bank's MCi_ADDR MSR */
17*4882a593Smuzhiyun 	__u64 mcgstatus;	/* Machine Check Global Status MSR */
18*4882a593Smuzhiyun 	__u64 ip;		/* Instruction Pointer when the error happened */
19*4882a593Smuzhiyun 	__u64 tsc;		/* CPU time stamp counter */
20*4882a593Smuzhiyun 	__u64 time;		/* Wall time_t when error was detected */
21*4882a593Smuzhiyun 	__u8  cpuvendor;	/* Kernel's X86_VENDOR enum */
22*4882a593Smuzhiyun 	__u8  inject_flags;	/* Software inject flags */
23*4882a593Smuzhiyun 	__u8  severity;		/* Error severity */
24*4882a593Smuzhiyun 	__u8  pad;
25*4882a593Smuzhiyun 	__u32 cpuid;		/* CPUID 1 EAX */
26*4882a593Smuzhiyun 	__u8  cs;		/* Code segment */
27*4882a593Smuzhiyun 	__u8  bank;		/* Machine check bank reporting the error */
28*4882a593Smuzhiyun 	__u8  cpu;		/* CPU number; obsoleted by extcpu */
29*4882a593Smuzhiyun 	__u8  finished;		/* Entry is valid */
30*4882a593Smuzhiyun 	__u32 extcpu;		/* Linux CPU number that detected the error */
31*4882a593Smuzhiyun 	__u32 socketid;		/* CPU socket ID */
32*4882a593Smuzhiyun 	__u32 apicid;		/* CPU initial APIC ID */
33*4882a593Smuzhiyun 	__u64 mcgcap;		/* MCGCAP MSR: machine check capabilities of CPU */
34*4882a593Smuzhiyun 	__u64 synd;		/* MCA_SYND MSR: only valid on SMCA systems */
35*4882a593Smuzhiyun 	__u64 ipid;		/* MCA_IPID MSR: only valid on SMCA systems */
36*4882a593Smuzhiyun 	__u64 ppin;		/* Protected Processor Inventory Number */
37*4882a593Smuzhiyun 	__u32 microcode;	/* Microcode revision */
38*4882a593Smuzhiyun 	__u64 kflags;		/* Internal kernel use */
39*4882a593Smuzhiyun };
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun #define MCE_GET_RECORD_LEN   _IOR('M', 1, int)
42*4882a593Smuzhiyun #define MCE_GET_LOG_LEN      _IOR('M', 2, int)
43*4882a593Smuzhiyun #define MCE_GETCLEAR_FLAGS   _IOR('M', 3, int)
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun #endif /* _UAPI_ASM_X86_MCE_H */
46