1587ab
commit cc2ce5c65ed5a42eaa97aa3659854add6d808da5
1587ab
Author: Muralidhara M K <muralidhara.mk@amd.com>
1587ab
Date:   Mon Jan 13 19:12:06 2020 +0530
1587ab
1587ab
    rasdaemon: Add error decoding for new SMCA Load Store bank type
1587ab
    
1587ab
    Future Scalable Machine Check Architecture (SMCA) systems will have a
1587ab
    new Load Store bank type.
1587ab
    
1587ab
    Add the new type's (HWID, McaType) ID and error decoding.
1587ab
    
1587ab
    Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com>
1587ab
    [ Adjust commit message. ]
1587ab
    Signed-off-by: Yazen Ghannam <yazen.ghannam@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 114e786..d0b6cb6 100644
1587ab
--- a/mce-amd-smca.c
1587ab
+++ b/mce-amd-smca.c
1587ab
@@ -38,9 +38,16 @@
1587ab
  * 03: EC[3], 02: EC[2], 01: EC[1], 00: EC[0]
1587ab
  */
1587ab
 
1587ab
+/* MCA_STATUS REGISTER FOR FAMILY 19H
1587ab
+ * The bits 24 ~ 29 contains AddressLsb
1587ab
+ * 29: ADDRLS[5], 28: ADDRLS[4], 27: ADDRLS[3],
1587ab
+ * 26: ADDRLS[2], 25: ADDRLS[1], 24: ADDRLS[0]
1587ab
+ */
1587ab
+
1587ab
 /* These may be used by multiple smca_hwid_mcatypes */
1587ab
 enum smca_bank_types {
1587ab
 	SMCA_LS = 0,    /* Load Store */
1587ab
+	SMCA_LS_V2,	/* Load Store */
1587ab
 	SMCA_IF,        /* Instruction Fetch */
1587ab
 	SMCA_L2_CACHE,  /* L2 Cache */
1587ab
 	SMCA_DE,        /* Decoder Unit */
1587ab
@@ -88,6 +95,32 @@ static const char * const smca_ls_mce_desc[] = {
1587ab
 	"DC tag error type 5",
1587ab
 	"L2 fill data error",
1587ab
 };
1587ab
+static const char * const smca_ls2_mce_desc[] = {
1587ab
+	"An ECC error was detected on a data cache read by a probe or victimization",
1587ab
+	"An ECC error or L2 poison was detected on a data cache read by a load",
1587ab
+	"An ECC error was detected on a data cache read-modify-write by a store",
1587ab
+	"An ECC error or poison bit mismatch was detected on a tag read by a probe or victimization",
1587ab
+	"An ECC error or poison bit mismatch was detected on a tag read by a load",
1587ab
+	"An ECC error or poison bit mismatch was detected on a tag read by a store",
1587ab
+	"An ECC error was detected on an EMEM read by a load",
1587ab
+	"An ECC error was detected on an EMEM read-modify-write by a store",
1587ab
+	"A parity error was detected in an L1 TLB entry by any access",
1587ab
+	"A parity error was detected in an L2 TLB entry by any access",
1587ab
+	"A parity error was detected in a PWC entry by any access",
1587ab
+	"A parity error was detected in an STQ entry by any access",
1587ab
+	"A parity error was detected in an LDQ entry by any access",
1587ab
+	"A parity error was detected in a MAB entry by any access",
1587ab
+	"A parity error was detected in an SCB entry state field by any access",
1587ab
+	"A parity error was detected in an SCB entry address field by any access",
1587ab
+	"A parity error was detected in an SCB entry data field by any access",
1587ab
+	"A parity error was detected in a WCB entry by any access",
1587ab
+	"A poisoned line was detected in an SCB entry by any access",
1587ab
+	"A SystemReadDataError error was reported on read data returned from L2 for a load",
1587ab
+	"A SystemReadDataError error was reported on read data returned from L2 for an SCB store",
1587ab
+	"A SystemReadDataError error was reported on read data returned from L2 for a WCB store",
1587ab
+	"A hardware assertion error was reported",
1587ab
+	"A parity error was detected in an STLF, SCB EMEM entry or SRB store data by any access",
1587ab
+};
1587ab
 /* Instruction Fetch */
1587ab
 static const char * const smca_if_mce_desc[] = {
1587ab
 	"microtag probe port parity error",
1587ab
@@ -289,6 +322,7 @@ struct smca_mce_desc {
1587ab
 
1587ab
 static struct smca_mce_desc smca_mce_descs[] = {
1587ab
 	[SMCA_LS]       = { smca_ls_mce_desc,   ARRAY_SIZE(smca_ls_mce_desc)  },
1587ab
+	[SMCA_LS_V2]	= { smca_ls2_mce_desc,	ARRAY_SIZE(smca_ls2_mce_desc) },
1587ab
 	[SMCA_IF]       = { smca_if_mce_desc,   ARRAY_SIZE(smca_if_mce_desc)  },
1587ab
 	[SMCA_L2_CACHE] = { smca_l2_mce_desc,   ARRAY_SIZE(smca_l2_mce_desc)  },
1587ab
 	[SMCA_DE]       = { smca_de_mce_desc,   ARRAY_SIZE(smca_de_mce_desc)  },
1587ab
@@ -319,6 +353,7 @@ static struct smca_hwid smca_hwid_mcatypes[] = {
1587ab
 
1587ab
 	/* ZN Core (HWID=0xB0) MCA types */
1587ab
 	{ SMCA_LS,       0x000000B0 },
1587ab
+	{ SMCA_LS_V2,    0x001000B0 },
1587ab
 	{ SMCA_IF,       0x000100B0 },
1587ab
 	{ SMCA_L2_CACHE, 0x000200B0 },
1587ab
 	{ SMCA_DE,       0x000300B0 },
1587ab
@@ -362,6 +397,7 @@ struct smca_bank_name {
1587ab
 
1587ab
 static struct smca_bank_name smca_names[] = {
1587ab
 	[SMCA_LS]       = { "Load Store Unit" },
1587ab
+	[SMCA_LS_V2]    = { "Load Store Unit" },
1587ab
 	[SMCA_IF]       = { "Instruction Fetch Unit" },
1587ab
 	[SMCA_L2_CACHE] = { "L2 Cache" },
1587ab
 	[SMCA_DE]       = { "Decode Unit" },