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: d5fe2fec6c40 ("EDAC: Add a driver for the AMD Versal NET DDR controller")
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20251023113108.3467132-1-shubhrajyoti.datta@amd.com

authored by Shubhrajyoti Datta and committed by Borislav Petkov (AMD) 2cf95b9b 79c0a2b7

+13 -11
+13 -11
drivers/edac/versalnet_edac.c
··· 605 605 length = result[MSG_ERR_LENGTH]; 606 606 offset = result[MSG_ERR_OFFSET]; 607 607 608 + /* 609 + * The data can come in two stretches. Construct the regs from two 610 + * messages. The offset indicates the offset from which the data is to 611 + * be taken. 612 + */ 613 + for (i = 0 ; i < length; i++) { 614 + k = offset + i; 615 + j = ERROR_DATA + i; 616 + mc_priv->regs[k] = result[j]; 617 + } 618 + 608 619 if (result[TOTAL_ERR_LENGTH] > length) { 609 620 if (!mc_priv->part_len) 610 621 mc_priv->part_len = length; 611 622 else 612 623 mc_priv->part_len += length; 613 - /* 614 - * The data can come in 2 stretches. Construct the regs from 2 615 - * messages the offset indicates the offset from which the data is to 616 - * be taken 617 - */ 618 - for (i = 0 ; i < length; i++) { 619 - k = offset + i; 620 - j = ERROR_DATA + i; 621 - mc_priv->regs[k] = result[j]; 622 - } 624 + 623 625 if (mc_priv->part_len < result[TOTAL_ERR_LENGTH]) 624 626 return 0; 625 627 mc_priv->part_len = 0; ··· 707 705 /* Convert to bytes */ 708 706 length = result[TOTAL_ERR_LENGTH] * 4; 709 707 log_non_standard_event(sec_type, &amd_versalnet_guid, mc_priv->message, 710 - sec_sev, (void *)&result[ERROR_DATA], length); 708 + sec_sev, (void *)&mc_priv->regs, length); 711 709 712 710 return 0; 713 711 }