Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/mce: Add a struct mce.kflags field

There can be many different subsystems register on the mce handler
chain. Add a new bitmask field and define values so that handlers can
indicate whether they took any action to log or otherwise handle an
error.

The default handler at the end of the chain can use this information to
decide whether to print to the console log.

Boris suggested a generic name and leaving plenty of spare bits for
possible future use.

[ bp: Move flag bits to the internal mce.h header and use BIT_ULL(). ]

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Tested-by: Tony Luck <tony.luck@intel.com>
Link: https://lkml.kernel.org/r/20200214222720.13168-4-tony.luck@intel.com

authored by

Tony Luck and committed by
Borislav Petkov
1de08dcc 9554bfe4

+9
+8
arch/x86/include/asm/mce.h
··· 129 129 130 130 #define XEC(x, mask) (((x) >> 16) & mask) 131 131 132 + /* mce.kflags flag bits for logging etc. */ 133 + #define MCE_HANDLED_CEC BIT_ULL(0) 134 + #define MCE_HANDLED_UC BIT_ULL(1) 135 + #define MCE_HANDLED_EXTLOG BIT_ULL(2) 136 + #define MCE_HANDLED_NFIT BIT_ULL(3) 137 + #define MCE_HANDLED_EDAC BIT_ULL(4) 138 + #define MCE_HANDLED_MCELOG BIT_ULL(5) 139 + 132 140 /* 133 141 * This structure contains all data related to the MCE log. Also 134 142 * carries a signature to make it easier to find from external
+1
arch/x86/include/uapi/asm/mce.h
··· 35 35 __u64 ipid; /* MCA_IPID MSR: only valid on SMCA systems */ 36 36 __u64 ppin; /* Protected Processor Inventory Number */ 37 37 __u32 microcode; /* Microcode revision */ 38 + __u64 kflags; /* Internal kernel use. See below */ 38 39 }; 39 40 40 41 #define MCE_GET_RECORD_LEN _IOR('M', 1, int)