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