Skip to content

Commit 5076ab6

Browse files
cris-masudeep-holla
authored andcommitted
firmware: arm_scmi: Add message dump traces for bad and unexpected replies
It is useful to have message dump traces for any invalid/bad/unexpected replies. Let us add traces for the same as well as late-timed-out, out-of-order and unexpected/spurious messages. Signed-off-by: Cristian Marussi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sudeep Holla <[email protected]>
1 parent 5dc0e0b commit 5076ab6

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

drivers/firmware/arm_scmi/driver.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,9 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo, u32 msg_hdr)
861861
"Message for %d type %d is not expected!\n",
862862
xfer_id, msg_type);
863863
spin_unlock_irqrestore(&minfo->xfer_lock, flags);
864+
865+
scmi_bad_message_trace(cinfo, msg_hdr, MSG_UNEXPECTED);
866+
864867
return xfer;
865868
}
866869
refcount_inc(&xfer->users);
@@ -885,6 +888,9 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo, u32 msg_hdr)
885888
dev_err(cinfo->dev,
886889
"Invalid message type:%d for %d - HDR:0x%X state:%d\n",
887890
msg_type, xfer_id, msg_hdr, xfer->state);
891+
892+
scmi_bad_message_trace(cinfo, msg_hdr, MSG_INVALID);
893+
888894
/* On error the refcount incremented above has to be dropped */
889895
__scmi_xfer_put(minfo, xfer);
890896
xfer = ERR_PTR(-EINVAL);
@@ -921,6 +927,9 @@ static void scmi_handle_notification(struct scmi_chan_info *cinfo,
921927
if (IS_ERR(xfer)) {
922928
dev_err(dev, "failed to get free message slot (%ld)\n",
923929
PTR_ERR(xfer));
930+
931+
scmi_bad_message_trace(cinfo, msg_hdr, MSG_NOMEM);
932+
924933
scmi_clear_channel(info, cinfo);
925934
return;
926935
}
@@ -1040,6 +1049,7 @@ void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, void *priv)
10401049
break;
10411050
default:
10421051
WARN_ONCE(1, "received unknown msg_type:%d\n", msg_type);
1052+
scmi_bad_message_trace(cinfo, msg_hdr, MSG_UNKNOWN);
10431053
break;
10441054
}
10451055
}

drivers/firmware/arm_scmi/mailbox.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ static void rx_callback(struct mbox_client *cl, void *m)
5656
*/
5757
if (cl->knows_txdone && !shmem_channel_free(smbox->shmem)) {
5858
dev_warn(smbox->cinfo->dev, "Ignoring spurious A2P IRQ !\n");
59+
scmi_bad_message_trace(smbox->cinfo,
60+
shmem_read_header(smbox->shmem),
61+
MSG_MBOX_SPURIOUS);
5962
return;
6063
}
6164

0 commit comments

Comments
 (0)