Blame SOURCES/9acef39f13833f7d53ef96abc5a72e79384260f4.patch

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