diff mbox series

[1/3] rasdaemon: Decode bank_type based on InstanceIdHi in MCA_IPID.

Message ID 20230704105823.3516889-2-muralimk@amd.com (mailing list archive)
State New, archived
Headers show
Series Update rasdaemon decoding for AMD systems | expand

Commit Message

M K, Muralidhara July 4, 2023, 10:58 a.m. UTC
From: Muralidhara M K <muralidhara.mk@amd.com>

On some AMD systems, InstanceIdHi bits b'47:44 of MCA_IPID register
are Reserved, but the same bits are defined on viz. Genoa. So bank type
is erroneously decoded.

Incorrect bank_type which is socket_id value is observed from the
register InstanceIdHi field.
Handle these bit fields appropriately to get correct bank_type.

Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com>
Tested-by: Gupta Akshay <akshay.gupta@amd.com>
---
 mce-amd-smca.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/mce-amd-smca.c b/mce-amd-smca.c
index f69b555..4a2e645 100644
--- a/mce-amd-smca.c
+++ b/mce-amd-smca.c
@@ -790,6 +790,10 @@  static void decode_smca_error(struct mce_event *e, struct mce_priv* m)
 	const struct smca_hwid *s_hwid;
 	uint32_t mcatype_hwid = EXTRACT(e->ipid, 32, 63);
 	uint8_t mcatype_instancehi = EXTRACT(e->ipid, 44, 47);
+	/* MCA_IPID[43:32] HardwareID of IP associated with MCA bank */
+	uint16_t ipid_hwid = EXTRACT(e->ipid, 32, 43);
+	/* MCA_IPID[63:48] McaType of the MCA bank within the IP */
+	uint16_t ipid_mcatype = EXTRACT(e->ipid, 48, 63);
 	unsigned int csrow = -1, channel = -1;
 	unsigned int i;
 
@@ -800,6 +804,11 @@  static void decode_smca_error(struct mce_event *e, struct mce_priv* m)
 		if (mcatype_hwid == s_hwid->mcatype_hwid) {
 			bank_type = s_hwid->bank_type;
 			break;
+		} else if ((mcatype_instancehi == e->socketid) &&
+			(ipid_hwid == EXTRACT(s_hwid->mcatype_hwid, 0, 11)) &&
+			(ipid_mcatype == EXTRACT(s_hwid->mcatype_hwid, 16, 31))) {
+			bank_type = s_hwid->bank_type;
+			break;
 		}
 		if (mcatype_instancehi >= NONCPU_NODE_INDEX)
 			bank_type = SMCA_UMC_V2;