[PATCH v2 3/7] x86/mce: Add new "kflags" field to "struct mce"

From: Tony Luck
Date: Fri Feb 14 2020 - 17:28:25 EST


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.

Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
---
arch/x86/include/uapi/asm/mce.h | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/arch/x86/include/uapi/asm/mce.h b/arch/x86/include/uapi/asm/mce.h
index 955c2a2e1cf9..f8395812520b 100644
--- a/arch/x86/include/uapi/asm/mce.h
+++ b/arch/x86/include/uapi/asm/mce.h
@@ -35,8 +35,17 @@ struct mce {
__u64 ipid; /* MCA_IPID MSR: only valid on SMCA systems */
__u64 ppin; /* Protected Processor Inventory Number */
__u32 microcode; /* Microcode revision */
+ __u64 kflags; /* Internal kernel use. See below */
};

+/* kflags flag bits for logging etc. */
+#define MCE_HANDLED_CEC BIT(0)
+#define MCE_HANDLED_UC BIT(1)
+#define MCE_HANDLED_EXTLOG BIT(2)
+#define MCE_HANDLED_NFIT BIT(3)
+#define MCE_HANDLED_EDAC BIT(4)
+#define MCE_HANDLED_MCELOG BIT(5)
+
#define MCE_GET_RECORD_LEN _IOR('M', 1, int)
#define MCE_GET_LOG_LEN _IOR('M', 2, int)
#define MCE_GETCLEAR_FLAGS _IOR('M', 3, int)
--
2.21.1