Blame SOURCES/9acef39f13833f7d53ef96abc5a72e79384260f4.patch

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