Commit 2cf95b9b authored by Shubhrajyoti Datta's avatar Shubhrajyoti Datta Committed by Borislav Petkov (AMD)
Browse files

EDAC/versalnet: Handle split messages for non-standard errors



The current code assumes that only DDR errors have split messages.  Ensure
proper logging of non-standard event errors that may be split across multiple
messages too.

  [ bp: Massage, move comment too, fix it up. ]

Fixes: d5fe2fec ("EDAC: Add a driver for the AMD Versal NET DDR controller")
Signed-off-by: default avatarShubhrajyoti Datta <shubhrajyoti.datta@amd.com>
Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20251023113108.3467132-1-shubhrajyoti.datta@amd.com
parent 79c0a2b7
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -605,21 +605,23 @@ static int rpmsg_cb(struct rpmsg_device *rpdev, void *data,
	length = result[MSG_ERR_LENGTH];
	offset = result[MSG_ERR_OFFSET];

	if (result[TOTAL_ERR_LENGTH] > length) {
		if (!mc_priv->part_len)
			mc_priv->part_len = length;
		else
			mc_priv->part_len += length;
	/*
		 * The data can come in 2 stretches. Construct the regs from 2
		 * messages the offset indicates the offset from which the data is to
		 * be taken
	 * The data can come in two stretches. Construct the regs from two
	 * messages. The offset indicates the offset from which the data is to
	 * be taken.
	 */
	for (i = 0 ; i < length; i++) {
		k = offset + i;
		j = ERROR_DATA + i;
		mc_priv->regs[k] = result[j];
	}

	if (result[TOTAL_ERR_LENGTH] > length) {
		if (!mc_priv->part_len)
			mc_priv->part_len = length;
		else
			mc_priv->part_len += length;

		if (mc_priv->part_len < result[TOTAL_ERR_LENGTH])
			return 0;
		mc_priv->part_len = 0;
@@ -705,7 +707,7 @@ static int rpmsg_cb(struct rpmsg_device *rpdev, void *data,
	/* Convert to bytes */
	length = result[TOTAL_ERR_LENGTH] * 4;
	log_non_standard_event(sec_type, &amd_versalnet_guid, mc_priv->message,
			       sec_sev, (void *)&result[ERROR_DATA], length);
			       sec_sev, (void *)&mc_priv->regs, length);

	return 0;
}