1587ab
commit 8704a85d8dc3483423ec2934fee8132f85f8fdb6
1587ab
Author: Brian WoodsGhannam, Yazen <brian.woods@amd.comYazen.Ghannam@amd.com>
1587ab
Date:   Fri Nov 1 15:48:14 2019 +0100
1587ab
1587ab
    rasdaemon: add support for new AMD SMCA bank types
1587ab
    
1587ab
    Going forward, the Scalable Machine Check Architecture (SMCA) has some
1587ab
    updated and additional bank types which show up in Zen2.  The differing
1587ab
    bank types include: CS_V2, PSP_V2, SMU_V2, MP5, NBIO, and PCIE.  The V2
1587ab
    bank types replace the original bank types but have unique HWID/MCAtype
1587ab
    IDs from the originals so there's no conflicts between different
1587ab
    versions or other bank types.  All of the differing bank types have new
1587ab
    MCE descriptions which have been added as well.
1587ab
    
1587ab
    CC: "mchehab+samsung@kernel.org" <mchehab+samsung@kernel.org>, "Namburu, Chandu-babu" <chandu@amd.com> # Thread-Topic: [PATCH 2/2] rasdaemon: add support for new AMD SMCA bank types
1587ab
    Signed-off-by: Brian Woods <brian.woods@amd.com>
1587ab
    Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
1587ab
    Cc: Chandu-babu Namburu <chandu@amd.com>
1587ab
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1587ab
1587ab
diff --git a/mce-amd-smca.c b/mce-amd-smca.c
1587ab
index 6c3e8a5..114e786 100644
1587ab
--- a/mce-amd-smca.c
1587ab
+++ b/mce-amd-smca.c
1587ab
@@ -49,11 +49,17 @@ enum smca_bank_types {
1587ab
 	SMCA_FP,        /* Floating Point */
1587ab
 	SMCA_L3_CACHE,  /* L3 Cache */
1587ab
 	SMCA_CS,        /* Coherent Slave */
1587ab
+	SMCA_CS_V2,     /* Coherent Slave V2 */
1587ab
 	SMCA_PIE,       /* Power, Interrupts, etc. */
1587ab
 	SMCA_UMC,       /* Unified Memory Controller */
1587ab
 	SMCA_PB,        /* Parameter Block */
1587ab
 	SMCA_PSP,       /* Platform Security Processor */
1587ab
+	SMCA_PSP_V2,    /* Platform Security Processor V2 */
1587ab
 	SMCA_SMU,       /* System Management Unit */
1587ab
+	SMCA_SMU_V2,    /* System Management Unit V2 */
1587ab
+	SMCA_MP5,	/* Microprocessor 5 Unit */
1587ab
+	SMCA_NBIO,	/* Northbridge IO Unit */
1587ab
+	SMCA_PCIE,	/* PCI Express Unit */
1587ab
 	N_SMCA_BANK_TYPES
1587ab
 };
1587ab
 
1587ab
@@ -165,6 +171,23 @@ static const char * const smca_cs_mce_desc[] = {
1587ab
 	"Atomic request parity",
1587ab
 	"ECC error on probe filter access",
1587ab
 };
1587ab
+/* Coherent Slave Unit V2 */
1587ab
+static const char * const smca_cs2_mce_desc[] = {
1587ab
+	"Illegal Request",
1587ab
+	"Address Violation",
1587ab
+	"Security Violation",
1587ab
+	"Illegal Response",
1587ab
+	"Unexpected Response",
1587ab
+	"Request or Probe Parity Error",
1587ab
+	"Read Response Parity Error",
1587ab
+	"Atomic Request Parity Error",
1587ab
+	"SDP read response had no match in the CS queue",
1587ab
+	"Probe Filter Protocol Error",
1587ab
+	"Probe Filter ECC Error",
1587ab
+	"SDP read response had an unexpected RETRY error",
1587ab
+	"Counter overflow error",
1587ab
+	"Counter underflow error",
1587ab
+};
1587ab
 /* Power, Interrupt, etc.. */
1587ab
 static const char * const smca_pie_mce_desc[] = {
1587ab
 	"HW assert",
1587ab
@@ -189,10 +212,75 @@ static const char * const smca_pb_mce_desc[] = {
1587ab
 static const char * const smca_psp_mce_desc[] = {
1587ab
 	"PSP RAM ECC or parity error",
1587ab
 };
1587ab
+/* Platform Security Processor V2 */
1587ab
+static const char * const smca_psp2_mce_desc[] = {
1587ab
+	"High SRAM ECC or parity error",
1587ab
+	"Low SRAM ECC or parity error",
1587ab
+	"Instruction Cache Bank 0 ECC or parity error",
1587ab
+	"Instruction Cache Bank 1 ECC or parity error",
1587ab
+	"Instruction Tag Ram 0 parity error",
1587ab
+	"Instruction Tag Ram 1 parity error",
1587ab
+	"Data Cache Bank 0 ECC or parity error",
1587ab
+	"Data Cache Bank 1 ECC or parity error",
1587ab
+	"Data Cache Bank 2 ECC or parity error",
1587ab
+	"Data Cache Bank 3 ECC or parity error",
1587ab
+	"Data Tag Bank 0 parity error",
1587ab
+	"Data Tag Bank 1 parity error",
1587ab
+	"Data Tag Bank 2 parity error",
1587ab
+	"Data Tag Bank 3 parity error",
1587ab
+	"Dirty Data Ram parity error",
1587ab
+	"TLB Bank 0 parity error",
1587ab
+	"TLB Bank 1 parity error",
1587ab
+	"System Hub Read Buffer ECC or parity error",
1587ab
+};
1587ab
 /* System Management Unit */
1587ab
 static const char * const smca_smu_mce_desc[] = {
1587ab
 	"SMU RAM ECC or parity error",
1587ab
 };
1587ab
+/* System Management Unit V2 */
1587ab
+static const char * const smca_smu2_mce_desc[] = {
1587ab
+	"High SRAM ECC or parity error",
1587ab
+	"Low SRAM ECC or parity error",
1587ab
+	"Data Cache Bank A ECC or parity error",
1587ab
+	"Data Cache Bank B ECC or parity error",
1587ab
+	"Data Tag Cache Bank A ECC or parity error",
1587ab
+	"Data Tag Cache Bank B ECC or parity error",
1587ab
+	"Instruction Cache Bank A ECC or parity error",
1587ab
+	"Instruction Cache Bank B ECC or parity error",
1587ab
+	"Instruction Tag Cache Bank A ECC or parity error",
1587ab
+	"Instruction Tag Cache Bank B ECC or parity error",
1587ab
+	"System Hub Read Buffer ECC or parity error",
1587ab
+};
1587ab
+/* Microprocessor 5 Unit */
1587ab
+static const char * const smca_mp5_mce_desc[] = {
1587ab
+	"High SRAM ECC or parity error",
1587ab
+	"Low SRAM ECC or parity error",
1587ab
+	"Data Cache Bank A ECC or parity error",
1587ab
+	"Data Cache Bank B ECC or parity error",
1587ab
+	"Data Tag Cache Bank A ECC or parity error",
1587ab
+	"Data Tag Cache Bank B ECC or parity error",
1587ab
+	"Instruction Cache Bank A ECC or parity error",
1587ab
+	"Instruction Cache Bank B ECC or parity error",
1587ab
+	"Instruction Tag Cache Bank A ECC or parity error",
1587ab
+	"Instruction Tag Cache Bank B ECC or parity error",
1587ab
+};
1587ab
+/* Northbridge IO Unit */
1587ab
+static const char * const smca_nbio_mce_desc[] = {
1587ab
+	"ECC or Parity error",
1587ab
+	"PCIE error",
1587ab
+	"SDP ErrEvent error",
1587ab
+	"SDP Egress Poison Error",
1587ab
+	"IOHC Internal Poison Error",
1587ab
+};
1587ab
+/* PCI Express Unit */
1587ab
+static const char * const smca_pcie_mce_desc[] = {
1587ab
+	"CCIX PER Message logging",
1587ab
+	"CCIX Read Response with Status: Non-Data Error",
1587ab
+	"CCIX Write Response with Status: Non-Data Error",
1587ab
+	"CCIX Read Response with Status: Data Error",
1587ab
+	"CCIX Non-okay write response with data error",
1587ab
+};
1587ab
+
1587ab
 
1587ab
 struct smca_mce_desc {
1587ab
 	const char * const *descs;
1587ab
@@ -208,11 +296,17 @@ static struct smca_mce_desc smca_mce_descs[] = {
1587ab
 	[SMCA_FP]       = { smca_fp_mce_desc,   ARRAY_SIZE(smca_fp_mce_desc)  },
1587ab
 	[SMCA_L3_CACHE] = { smca_l3_mce_desc,   ARRAY_SIZE(smca_l3_mce_desc)  },
1587ab
 	[SMCA_CS]       = { smca_cs_mce_desc,   ARRAY_SIZE(smca_cs_mce_desc)  },
1587ab
+	[SMCA_CS_V2]    = { smca_cs2_mce_desc,  ARRAY_SIZE(smca_cs2_mce_desc) },
1587ab
 	[SMCA_PIE]      = { smca_pie_mce_desc,  ARRAY_SIZE(smca_pie_mce_desc) },
1587ab
 	[SMCA_UMC]      = { smca_umc_mce_desc,  ARRAY_SIZE(smca_umc_mce_desc) },
1587ab
 	[SMCA_PB]       = { smca_pb_mce_desc,   ARRAY_SIZE(smca_pb_mce_desc)  },
1587ab
 	[SMCA_PSP]      = { smca_psp_mce_desc,  ARRAY_SIZE(smca_psp_mce_desc) },
1587ab
+	[SMCA_PSP_V2]   = { smca_psp2_mce_desc, ARRAY_SIZE(smca_psp2_mce_desc)},
1587ab
 	[SMCA_SMU]      = { smca_smu_mce_desc,  ARRAY_SIZE(smca_smu_mce_desc) },
1587ab
+	[SMCA_SMU_V2]   = { smca_smu2_mce_desc, ARRAY_SIZE(smca_smu2_mce_desc)},
1587ab
+	[SMCA_MP5]      = { smca_mp5_mce_desc,  ARRAY_SIZE(smca_mp5_mce_desc) },
1587ab
+	[SMCA_NBIO]     = { smca_nbio_mce_desc, ARRAY_SIZE(smca_nbio_mce_desc)},
1587ab
+	[SMCA_PCIE]     = { smca_pcie_mce_desc, ARRAY_SIZE(smca_pcie_mce_desc)},
1587ab
 };
1587ab
 
1587ab
 struct smca_hwid {
1587ab
@@ -235,6 +329,7 @@ static struct smca_hwid smca_hwid_mcatypes[] = {
1587ab
 
1587ab
 	/* Data Fabric MCA types */
1587ab
 	{ SMCA_CS,       0x0000002E },
1587ab
+	{ SMCA_CS_V2,    0x0002002E },
1587ab
 	{ SMCA_PIE,      0x0001002E },
1587ab
 
1587ab
 	/* Unified Memory Controller MCA type */
1587ab
@@ -245,9 +340,20 @@ static struct smca_hwid smca_hwid_mcatypes[] = {
1587ab
 
1587ab
 	/* Platform Security Processor MCA type */
1587ab
 	{ SMCA_PSP,      0x000000FF },
1587ab
+	{ SMCA_PSP_V2,   0x000100FF },
1587ab
 
1587ab
 	/* System Management Unit MCA type */
1587ab
 	{ SMCA_SMU,      0x00000001 },
1587ab
+	{ SMCA_SMU_V2,   0x00010001 },
1587ab
+
1587ab
+	/* Microprocessor 5 Unit MCA type */
1587ab
+	{ SMCA_MP5,      0x00020001 },
1587ab
+
1587ab
+	/* Northbridge IO Unit MCA type */
1587ab
+	{ SMCA_NBIO,     0x00000018 },
1587ab
+
1587ab
+	/* PCI Express Unit MCA type */
1587ab
+	{ SMCA_PCIE,     0x00000046 },
1587ab
 };
1587ab
 
1587ab
 struct smca_bank_name {
1587ab
@@ -264,11 +370,17 @@ static struct smca_bank_name smca_names[] = {
1587ab
 	[SMCA_FP]       = { "Floating Point Unit" },
1587ab
 	[SMCA_L3_CACHE] = { "L3 Cache" },
1587ab
 	[SMCA_CS]       = { "Coherent Slave" },
1587ab
+	[SMCA_CS_V2]    = { "Coherent Slave" },
1587ab
 	[SMCA_PIE]      = { "Power, Interrupts, etc." },
1587ab
 	[SMCA_UMC]      = { "Unified Memory Controller" },
1587ab
 	[SMCA_PB]       = { "Parameter Block" },
1587ab
 	[SMCA_PSP]      = { "Platform Security Processor" },
1587ab
+	[SMCA_PSP_V2]   = { "Platform Security Processor" },
1587ab
 	[SMCA_SMU]      = { "System Management Unit" },
1587ab
+	[SMCA_SMU_V2]   = { "System Management Unit" },
1587ab
+	[SMCA_MP5]	= { "Microprocessor 5 Unit" },
1587ab
+	[SMCA_NBIO]     = { "Northbridge IO Unit" },
1587ab
+	[SMCA_PCIE]     = { "PCI Express Unit" },
1587ab
 };
1587ab
 
1587ab
 static void amd_decode_errcode(struct mce_event *e)