]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
EDAC/versalnet: Handle split messages for non-standard errors
authorShubhrajyoti Datta <shubhrajyoti.datta@amd.com>
Thu, 23 Oct 2025 11:31:08 +0000 (17:01 +0530)
committerBorislav Petkov (AMD) <bp@alien8.de>
Fri, 7 Nov 2025 19:15:14 +0000 (20:15 +0100)
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
drivers/edac/versalnet_edac.c

index 1ded4c3f02133444931528032000d3583cdc63e3..1a1092793092a82199175cfac464da5e33288492 100644 (file)
@@ -605,21 +605,23 @@ static int rpmsg_cb(struct rpmsg_device *rpdev, void *data,
        length = result[MSG_ERR_LENGTH];
        offset = result[MSG_ERR_OFFSET];
 
+       /*
+        * 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;
-               /*
-                * 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
-                */
-               for (i = 0 ; i < length; i++) {
-                       k = offset + i;
-                       j = ERROR_DATA + i;
-                       mc_priv->regs[k] = result[j];
-               }
+
                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;
 }