Commit 5076ab66 authored by Cristian Marussi's avatar Cristian Marussi Committed by Sudeep Holla

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: default avatarCristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20240325204620.1437237-4-cristian.marussi@arm.comSigned-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
parent 5dc0e0b1
...@@ -861,6 +861,9 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo, u32 msg_hdr) ...@@ -861,6 +861,9 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo, u32 msg_hdr)
"Message for %d type %d is not expected!\n", "Message for %d type %d is not expected!\n",
xfer_id, msg_type); xfer_id, msg_type);
spin_unlock_irqrestore(&minfo->xfer_lock, flags); spin_unlock_irqrestore(&minfo->xfer_lock, flags);
scmi_bad_message_trace(cinfo, msg_hdr, MSG_UNEXPECTED);
return xfer; return xfer;
} }
refcount_inc(&xfer->users); refcount_inc(&xfer->users);
...@@ -885,6 +888,9 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo, u32 msg_hdr) ...@@ -885,6 +888,9 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo, u32 msg_hdr)
dev_err(cinfo->dev, dev_err(cinfo->dev,
"Invalid message type:%d for %d - HDR:0x%X state:%d\n", "Invalid message type:%d for %d - HDR:0x%X state:%d\n",
msg_type, xfer_id, msg_hdr, xfer->state); msg_type, xfer_id, msg_hdr, xfer->state);
scmi_bad_message_trace(cinfo, msg_hdr, MSG_INVALID);
/* On error the refcount incremented above has to be dropped */ /* On error the refcount incremented above has to be dropped */
__scmi_xfer_put(minfo, xfer); __scmi_xfer_put(minfo, xfer);
xfer = ERR_PTR(-EINVAL); xfer = ERR_PTR(-EINVAL);
...@@ -921,6 +927,9 @@ static void scmi_handle_notification(struct scmi_chan_info *cinfo, ...@@ -921,6 +927,9 @@ static void scmi_handle_notification(struct scmi_chan_info *cinfo,
if (IS_ERR(xfer)) { if (IS_ERR(xfer)) {
dev_err(dev, "failed to get free message slot (%ld)\n", dev_err(dev, "failed to get free message slot (%ld)\n",
PTR_ERR(xfer)); PTR_ERR(xfer));
scmi_bad_message_trace(cinfo, msg_hdr, MSG_NOMEM);
scmi_clear_channel(info, cinfo); scmi_clear_channel(info, cinfo);
return; return;
} }
...@@ -1040,6 +1049,7 @@ void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, void *priv) ...@@ -1040,6 +1049,7 @@ void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, void *priv)
break; break;
default: default:
WARN_ONCE(1, "received unknown msg_type:%d\n", msg_type); WARN_ONCE(1, "received unknown msg_type:%d\n", msg_type);
scmi_bad_message_trace(cinfo, msg_hdr, MSG_UNKNOWN);
break; break;
} }
} }
......
...@@ -56,6 +56,9 @@ static void rx_callback(struct mbox_client *cl, void *m) ...@@ -56,6 +56,9 @@ static void rx_callback(struct mbox_client *cl, void *m)
*/ */
if (cl->knows_txdone && !shmem_channel_free(smbox->shmem)) { if (cl->knows_txdone && !shmem_channel_free(smbox->shmem)) {
dev_warn(smbox->cinfo->dev, "Ignoring spurious A2P IRQ !\n"); dev_warn(smbox->cinfo->dev, "Ignoring spurious A2P IRQ !\n");
scmi_bad_message_trace(smbox->cinfo,
shmem_read_header(smbox->shmem),
MSG_MBOX_SPURIOUS);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment