Skip to contentSkip to conversation

x86/mce: Add macors for corrected error count bit field

PATCH Superseded Borislav Petkov 1 participant 1 message Sep 24, 2018 EDAC-core

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Borislav Petkov

author maintainer
#0 lore raw

PATCH 2/5 x86/mce: Add macors for corrected error count bit field

Quoted 30 lines · Tony Luck

From: Qiuxu Zhuo <[email protected]>

The bit field 52:38 of MCi_STATUS is for corrected error count. Add {*_SHIFT|*_MASK|*_CEC(c)} macros for the bit field.

---
 arch/x86/include/asm/mce.h | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
arch/x86/include/asm/mce.h +2 -9
index d53e5dd7471a..a81a22e3592c 100644
@@ -30,15 +30,18 @@
 #define MCG_EXT_CTL_LMCE_EN BIT_ULL(0) /* Enable LMCE */
 
 /* MCi_STATUS register defines */
-#define MCI_STATUS_VAL   BIT_ULL(63)  /* valid error */
-#define MCI_STATUS_OVER  BIT_ULL(62)  /* previous errors lost */
-#define MCI_STATUS_UC    BIT_ULL(61)  /* uncorrected error */
-#define MCI_STATUS_EN    BIT_ULL(60)  /* error enabled */
-#define MCI_STATUS_MISCV BIT_ULL(59)  /* misc error reg. valid */
-#define MCI_STATUS_ADDRV BIT_ULL(58)  /* addr reg. valid */
-#define MCI_STATUS_PCC   BIT_ULL(57)  /* processor context corrupt */
-#define MCI_STATUS_S	 BIT_ULL(56)  /* Signaled machine check */
-#define MCI_STATUS_AR	 BIT_ULL(55)  /* Action required */
+#define MCI_STATUS_VAL		BIT_ULL(63)  /* valid error */
+#define MCI_STATUS_OVER		BIT_ULL(62)  /* previous errors lost */

arch/x86/include/asm/mce.h line 44

Quoted 10 lines
arch/x86/include/asm/mce.h +10 -0
+#define MCI_STATUS_UC		BIT_ULL(61)  /* uncorrected error */
+#define MCI_STATUS_EN		BIT_ULL(60)  /* error enabled */
+#define MCI_STATUS_MISCV	BIT_ULL(59)  /* misc error reg. valid */
+#define MCI_STATUS_ADDRV	BIT_ULL(58)  /* addr reg. valid */
+#define MCI_STATUS_PCC		BIT_ULL(57)  /* processor context corrupt */
+#define MCI_STATUS_S		BIT_ULL(56)  /* Signaled machine check */
+#define MCI_STATUS_AR		BIT_ULL(55)  /* Action required */
+#define MCI_STATUS_CEC_SHIFT	38           /* Corrected Error Count */
+#define MCI_STATUS_CEC_MASK	0x1fffc000000000ULL
+#define MCI_STATUS_CEC(c)	(((c) & MCI_STATUS_CEC_MASK) >> MCI_STATUS_CEC_SHIFT)

This is the wrong separation of changes: the *first* patch should contain the switch to use BIT_ULL() and the vertical realignment of all bits, i.e., cleanup, and the second should only add the new functionality, i.e., macros in this case.