Blame SOURCES/9acef39f13833f7d53ef96abc5a72e79384260f4.patch

81d547
commit 9acef39f13833f7d53ef96abc5a72e79384260f4
81d547
Author: Naveen Krishna Chatradhi <nchatrad@amd.com>
81d547
Date:   Tue Jun 1 11:01:17 2021 +0530
81d547
81d547
    rasdaemon: Add new SMCA bank types with error decoding
81d547
    
81d547
    Upcoming systems with Scalable Machine Check Architecture (SMCA) have
81d547
    new MCA banks added.
81d547
    
81d547
    This patch adds the (HWID, MCATYPE) tuple, name and error decoding for
81d547
    those new SMCA banks.
81d547
    While at it, optimize the string names in smca_bank_name[].
81d547
    
81d547
    Signed-off-by: Muralidhara M K <muralimk@amd.com>
81d547
    Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com>
81d547
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
81d547
81d547
diff --git a/mce-amd-smca.c b/mce-amd-smca.c
81d547
index 7c619fd..e0cf512 100644
81d547
--- a/mce-amd-smca.c
81d547
+++ b/mce-amd-smca.c
81d547
@@ -47,7 +47,7 @@
81d547
 /* These may be used by multiple smca_hwid_mcatypes */
81d547
 enum smca_bank_types {
81d547
 	SMCA_LS = 0,    /* Load Store */
81d547
-	SMCA_LS_V2,	/* Load Store */
81d547
+	SMCA_LS_V2,
81d547
 	SMCA_IF,        /* Instruction Fetch */
81d547
 	SMCA_L2_CACHE,  /* L2 Cache */
81d547
 	SMCA_DE,        /* Decoder Unit */
81d547
@@ -56,17 +56,22 @@ enum smca_bank_types {
81d547
 	SMCA_FP,        /* Floating Point */
81d547
 	SMCA_L3_CACHE,  /* L3 Cache */
81d547
 	SMCA_CS,        /* Coherent Slave */
81d547
-	SMCA_CS_V2,     /* Coherent Slave V2 */
81d547
+	SMCA_CS_V2,
81d547
 	SMCA_PIE,       /* Power, Interrupts, etc. */
81d547
 	SMCA_UMC,       /* Unified Memory Controller */
81d547
+	SMCA_UMC_V2,
81d547
 	SMCA_PB,        /* Parameter Block */
81d547
 	SMCA_PSP,       /* Platform Security Processor */
81d547
-	SMCA_PSP_V2,    /* Platform Security Processor V2 */
81d547
+	SMCA_PSP_V2,
81d547
 	SMCA_SMU,       /* System Management Unit */
81d547
-	SMCA_SMU_V2,    /* System Management Unit V2 */
81d547
+	SMCA_SMU_V2,
81d547
 	SMCA_MP5,	/* Microprocessor 5 Unit */
81d547
 	SMCA_NBIO,	/* Northbridge IO Unit */
81d547
 	SMCA_PCIE,	/* PCI Express Unit */
81d547
+	SMCA_PCIE_V2,
81d547
+	SMCA_XGMI_PCS,	/* xGMI PCS Unit */
81d547
+	SMCA_XGMI_PHY,	/* xGMI PHY Unit */
81d547
+	SMCA_WAFL_PHY,	/* WAFL PHY Unit */
81d547
 	N_SMCA_BANK_TYPES
81d547
 };
81d547
 
81d547
@@ -237,6 +242,22 @@ static const char * const smca_umc_mce_desc[] = {
81d547
 	"Command/address parity error",
81d547
 	"Write data CRC error",
81d547
 };
81d547
+
81d547
+static const char * const smca_umc2_mce_desc[] = {
81d547
+	"DRAM ECC error",
81d547
+	"Data poison error",
81d547
+	"SDP parity error",
81d547
+	"Reserved",
81d547
+	"Address/Command parity error",
81d547
+	"Write data parity error",
81d547
+	"DCQ SRAM ECC error",
81d547
+	"Reserved",
81d547
+	"Read data parity error",
81d547
+	"Rdb SRAM ECC error",
81d547
+	"RdRsp SRAM ECC error",
81d547
+	"LM32 MP errors",
81d547
+};
81d547
+
81d547
 /* Parameter Block */
81d547
 static const char * const smca_pb_mce_desc[] = {
81d547
 	"Parameter Block RAM ECC error",
81d547
@@ -314,6 +335,55 @@ static const char * const smca_pcie_mce_desc[] = {
81d547
 	"CCIX Non-okay write response with data error",
81d547
 };
81d547
 
81d547
+static const char * const smca_pcie2_mce_desc[] = {
81d547
+	"SDP Parity Error logging",
81d547
+};
81d547
+
81d547
+static const char * const smca_xgmipcs_mce_desc[] = {
81d547
+	"Data Loss Error",
81d547
+	"Training Error",
81d547
+	"Flow Control Acknowledge Error",
81d547
+	"Rx Fifo Underflow Error",
81d547
+	"Rx Fifo Overflow Error",
81d547
+	"CRC Error",
81d547
+	"BER Exceeded Error",
81d547
+	"Tx Vcid Data Error",
81d547
+	"Replay Buffer Parity Error",
81d547
+	"Data Parity Error",
81d547
+	"Replay Fifo Overflow Error",
81d547
+	"Replay Fifo Underflow Error",
81d547
+	"Elastic Fifo Overflow Error",
81d547
+	"Deskew Error",
81d547
+	"Flow Control CRC Error",
81d547
+	"Data Startup Limit Error",
81d547
+	"FC Init Timeout Error",
81d547
+	"Recovery Timeout Error",
81d547
+	"Ready Serial Timeout Error",
81d547
+	"Ready Serial Attempt Error",
81d547
+	"Recovery Attempt Error",
81d547
+	"Recovery Relock Attempt Error",
81d547
+	"Replay Attempt Error",
81d547
+	"Sync Header Error",
81d547
+	"Tx Replay Timeout Error",
81d547
+	"Rx Replay Timeout Error",
81d547
+	"LinkSub Tx Timeout Error",
81d547
+	"LinkSub Rx Timeout Error",
81d547
+	"Rx CMD Pocket Error",
81d547
+};
81d547
+
81d547
+static const char * const smca_xgmiphy_mce_desc[] = {
81d547
+	"RAM ECC Error",
81d547
+	"ARC instruction buffer parity error",
81d547
+	"ARC data buffer parity error",
81d547
+	"PHY APB error",
81d547
+};
81d547
+
81d547
+static const char * const smca_waflphy_mce_desc[] = {
81d547
+	"RAM ECC Error",
81d547
+	"ARC instruction buffer parity error",
81d547
+	"ARC data buffer parity error",
81d547
+	"PHY APB error",
81d547
+};
81d547
 
81d547
 struct smca_mce_desc {
81d547
 	const char * const *descs;
81d547
@@ -333,6 +403,7 @@ static struct smca_mce_desc smca_mce_descs[] = {
81d547
 	[SMCA_CS_V2]    = { smca_cs2_mce_desc,  ARRAY_SIZE(smca_cs2_mce_desc) },
81d547
 	[SMCA_PIE]      = { smca_pie_mce_desc,  ARRAY_SIZE(smca_pie_mce_desc) },
81d547
 	[SMCA_UMC]      = { smca_umc_mce_desc,  ARRAY_SIZE(smca_umc_mce_desc) },
81d547
+	[SMCA_UMC_V2]	= { smca_umc2_mce_desc,	ARRAY_SIZE(smca_umc2_mce_desc)	},
81d547
 	[SMCA_PB]       = { smca_pb_mce_desc,   ARRAY_SIZE(smca_pb_mce_desc)  },
81d547
 	[SMCA_PSP]      = { smca_psp_mce_desc,  ARRAY_SIZE(smca_psp_mce_desc) },
81d547
 	[SMCA_PSP_V2]   = { smca_psp2_mce_desc, ARRAY_SIZE(smca_psp2_mce_desc)},
81d547
@@ -341,6 +412,10 @@ static struct smca_mce_desc smca_mce_descs[] = {
81d547
 	[SMCA_MP5]      = { smca_mp5_mce_desc,  ARRAY_SIZE(smca_mp5_mce_desc) },
81d547
 	[SMCA_NBIO]     = { smca_nbio_mce_desc, ARRAY_SIZE(smca_nbio_mce_desc)},
81d547
 	[SMCA_PCIE]     = { smca_pcie_mce_desc, ARRAY_SIZE(smca_pcie_mce_desc)},
81d547
+	[SMCA_PCIE_V2]	= { smca_pcie2_mce_desc,   ARRAY_SIZE(smca_pcie2_mce_desc)	},
81d547
+	[SMCA_XGMI_PCS]	= { smca_xgmipcs_mce_desc, ARRAY_SIZE(smca_xgmipcs_mce_desc)	},
81d547
+	[SMCA_XGMI_PHY]	= { smca_xgmiphy_mce_desc, ARRAY_SIZE(smca_xgmiphy_mce_desc)	},
81d547
+	[SMCA_WAFL_PHY]	= { smca_waflphy_mce_desc, ARRAY_SIZE(smca_waflphy_mce_desc)	},
81d547
 };
81d547
 
81d547
 struct smca_hwid {
81d547
@@ -369,6 +444,8 @@ static struct smca_hwid smca_hwid_mcatypes[] = {
81d547
 
81d547
 	/* Unified Memory Controller MCA type */
81d547
 	{ SMCA_UMC,      0x00000096 },
81d547
+	/* Heterogeneous systems may have both UMC and UMC_v2 types on the same node. */
81d547
+	{ SMCA_UMC_V2,   0x00010096 },
81d547
 
81d547
 	/* Parameter Block MCA type */
81d547
 	{ SMCA_PB,       0x00000005 },
81d547
@@ -389,6 +466,16 @@ static struct smca_hwid smca_hwid_mcatypes[] = {
81d547
 
81d547
 	/* PCI Express Unit MCA type */
81d547
 	{ SMCA_PCIE,     0x00000046 },
81d547
+	{ SMCA_PCIE_V2,  0x00010046 },
81d547
+
81d547
+	/* Ext Global Memory Interconnect PCS MCA type */
81d547
+	{ SMCA_XGMI_PCS, 0x00000050 },
81d547
+
81d547
+	/* Ext Global Memory Interconnect PHY MCA type */
81d547
+	{ SMCA_XGMI_PHY, 0x00000259 },
81d547
+
81d547
+	/* WAFL PHY MCA type */
81d547
+	{ SMCA_WAFL_PHY, 0x00000267 },
81d547
 };
81d547
 
81d547
 struct smca_bank_name {
81d547
@@ -396,27 +483,28 @@ struct smca_bank_name {
81d547
 };
81d547
 
81d547
 static struct smca_bank_name smca_names[] = {
81d547
-	[SMCA_LS]       = { "Load Store Unit" },
81d547
-	[SMCA_LS_V2]    = { "Load Store Unit" },
81d547
-	[SMCA_IF]       = { "Instruction Fetch Unit" },
81d547
-	[SMCA_L2_CACHE] = { "L2 Cache" },
81d547
-	[SMCA_DE]       = { "Decode Unit" },
81d547
-	[SMCA_RESERVED] = { "Reserved" },
81d547
-	[SMCA_EX]       = { "Execution Unit" },
81d547
-	[SMCA_FP]       = { "Floating Point Unit" },
81d547
-	[SMCA_L3_CACHE] = { "L3 Cache" },
81d547
-	[SMCA_CS]       = { "Coherent Slave" },
81d547
-	[SMCA_CS_V2]    = { "Coherent Slave" },
81d547
-	[SMCA_PIE]      = { "Power, Interrupts, etc." },
81d547
-	[SMCA_UMC]      = { "Unified Memory Controller" },
81d547
-	[SMCA_PB]       = { "Parameter Block" },
81d547
-	[SMCA_PSP]      = { "Platform Security Processor" },
81d547
-	[SMCA_PSP_V2]   = { "Platform Security Processor" },
81d547
-	[SMCA_SMU]      = { "System Management Unit" },
81d547
-	[SMCA_SMU_V2]   = { "System Management Unit" },
81d547
-	[SMCA_MP5]	= { "Microprocessor 5 Unit" },
81d547
-	[SMCA_NBIO]     = { "Northbridge IO Unit" },
81d547
-	[SMCA_PCIE]     = { "PCI Express Unit" },
81d547
+	[SMCA_LS ... SMCA_LS_V2]	= { "Load Store Unit" },
81d547
+	[SMCA_IF]			= { "Instruction Fetch Unit" },
81d547
+	[SMCA_L2_CACHE]			= { "L2 Cache" },
81d547
+	[SMCA_DE]			= { "Decode Unit" },
81d547
+	[SMCA_RESERVED]			= { "Reserved" },
81d547
+	[SMCA_EX]			= { "Execution Unit" },
81d547
+	[SMCA_FP]			= { "Floating Point Unit" },
81d547
+	[SMCA_L3_CACHE]			= { "L3 Cache" },
81d547
+	[SMCA_CS ... SMCA_CS_V2]	= { "Coherent Slave" },
81d547
+	[SMCA_PIE]			= { "Power, Interrupts, etc." },
81d547
+	[SMCA_UMC]			= { "Unified Memory Controller" },
81d547
+	[SMCA_UMC_V2]			= { "Unified Memory Controller V2" },
81d547
+	[SMCA_PB]			= { "Parameter Block" },
81d547
+	[SMCA_PSP ... SMCA_PSP_V2]	= { "Platform Security Processor" },
81d547
+	[SMCA_SMU ... SMCA_SMU_V2]	= { "System Management Unit" },
81d547
+	[SMCA_MP5]			= { "Microprocessor 5 Unit" },
81d547
+	[SMCA_NBIO]			= { "Northbridge IO Unit" },
81d547
+	[SMCA_PCIE ... SMCA_PCIE_V2]	= { "PCI Express Unit" },
81d547
+	[SMCA_XGMI_PCS]			= { "Ext Global Memory Interconnect PCS Unit" },
81d547
+	[SMCA_XGMI_PHY]			= { "Ext Global Memory Interconnect PHY Unit" },
81d547
+	[SMCA_WAFL_PHY]			= { "WAFL PHY Unit" },
81d547
+
81d547
 };
81d547
 
81d547
 static void amd_decode_errcode(struct mce_event *e)