include: trace: Add platform and channel instance references
authorCristian Marussi <cristian.marussi@arm.com>
Wed, 18 Jan 2023 12:14:17 +0000 (12:14 +0000)
committerSudeep Holla <sudeep.holla@arm.com>
Fri, 20 Jan 2023 11:40:57 +0000 (11:40 +0000)
Add the channel and platform instance indentifier to SCMI message dump
traces in order to easily associate message flows to specific transport
channels.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20230118121426.492864-9-cristian.marussi@arm.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/driver.c
include/trace/events/scmi.h

index af34324e923bc98d9aafae07695e882bbefcd816..c765d0c51dc57c4a6e47b366c6d2e0796ad52a39 100644 (file)
@@ -860,9 +860,9 @@ static void scmi_handle_notification(struct scmi_chan_info *cinfo,
        info->desc->ops->fetch_notification(cinfo, info->desc->max_msg_size,
                                            xfer);
 
-       trace_scmi_msg_dump(xfer->hdr.protocol_id, xfer->hdr.id, "NOTI",
-                           xfer->hdr.seq, xfer->hdr.status,
-                           xfer->rx.buf, xfer->rx.len);
+       trace_scmi_msg_dump(info->id, cinfo->id, xfer->hdr.protocol_id,
+                           xfer->hdr.id, "NOTI", xfer->hdr.seq,
+                           xfer->hdr.status, xfer->rx.buf, xfer->rx.len);
 
        scmi_notify(cinfo->handle, xfer->hdr.protocol_id,
                    xfer->hdr.id, xfer->rx.buf, xfer->rx.len, ts);
@@ -898,7 +898,8 @@ static void scmi_handle_response(struct scmi_chan_info *cinfo,
                smp_store_mb(xfer->priv, priv);
        info->desc->ops->fetch_response(cinfo, xfer);
 
-       trace_scmi_msg_dump(xfer->hdr.protocol_id, xfer->hdr.id,
+       trace_scmi_msg_dump(info->id, cinfo->id, xfer->hdr.protocol_id,
+                           xfer->hdr.id,
                            xfer->hdr.type == MSG_TYPE_DELAYED_RESP ?
                            "DLYD" : "RESP",
                            xfer->hdr.seq, xfer->hdr.status,
@@ -1008,6 +1009,8 @@ static int scmi_wait_for_reply(struct device *dev, const struct scmi_desc *desc,
 
                if (!ret) {
                        unsigned long flags;
+                       struct scmi_info *info =
+                               handle_to_scmi_info(cinfo->handle);
 
                        /*
                         * Do not fetch_response if an out-of-order delayed
@@ -1021,7 +1024,8 @@ static int scmi_wait_for_reply(struct device *dev, const struct scmi_desc *desc,
                        spin_unlock_irqrestore(&xfer->lock, flags);
 
                        /* Trace polled replies. */
-                       trace_scmi_msg_dump(xfer->hdr.protocol_id, xfer->hdr.id,
+                       trace_scmi_msg_dump(info->id, cinfo->id,
+                                           xfer->hdr.protocol_id, xfer->hdr.id,
                                            "RESP",
                                            xfer->hdr.seq, xfer->hdr.status,
                                            xfer->rx.buf, xfer->rx.len);
@@ -1157,9 +1161,9 @@ static int do_xfer(const struct scmi_protocol_handle *ph,
                return ret;
        }
 
-       trace_scmi_msg_dump(xfer->hdr.protocol_id, xfer->hdr.id, "CMND",
-                           xfer->hdr.seq, xfer->hdr.status,
-                           xfer->tx.buf, xfer->tx.len);
+       trace_scmi_msg_dump(info->id, cinfo->id, xfer->hdr.protocol_id,
+                           xfer->hdr.id, "CMND", xfer->hdr.seq,
+                           xfer->hdr.status, xfer->tx.buf, xfer->tx.len);
 
        ret = scmi_wait_for_message_response(cinfo, xfer);
        if (!ret && xfer->hdr.status)
index f160d68f961d2685204eaaa95f55061d3471c0c5..422c1ad9484dc89d93c2712a04dc70e56bcd7137 100644 (file)
@@ -139,11 +139,15 @@ TRACE_EVENT(scmi_rx_done,
 );
 
 TRACE_EVENT(scmi_msg_dump,
-       TP_PROTO(u8 protocol_id, u8 msg_id, unsigned char *tag, u16 seq,
-                int status, void *buf, size_t len),
-       TP_ARGS(protocol_id, msg_id, tag, seq, status, buf, len),
+       TP_PROTO(int id, u8 channel_id, u8 protocol_id, u8 msg_id,
+                unsigned char *tag, u16 seq, int status,
+                void *buf, size_t len),
+       TP_ARGS(id, channel_id, protocol_id, msg_id, tag, seq, status,
+               buf, len),
 
        TP_STRUCT__entry(
+               __field(int, id)
+               __field(u8, channel_id)
                __field(u8, protocol_id)
                __field(u8, msg_id)
                __array(char, tag, 5)
@@ -154,6 +158,8 @@ TRACE_EVENT(scmi_msg_dump,
        ),
 
        TP_fast_assign(
+               __entry->id = id;
+               __entry->channel_id = channel_id;
                __entry->protocol_id = protocol_id;
                __entry->msg_id = msg_id;
                strscpy(__entry->tag, tag, 5);
@@ -163,9 +169,9 @@ TRACE_EVENT(scmi_msg_dump,
                memcpy(__get_dynamic_array(cmd), buf, __entry->len);
        ),
 
-       TP_printk("pt=%02X t=%s msg_id=%02X seq=%04X s=%d pyld=%s",
-                 __entry->protocol_id, __entry->tag, __entry->msg_id,
-                 __entry->seq, __entry->status,
+       TP_printk("id=%d ch=%02X pt=%02X t=%s msg_id=%02X seq=%04X s=%d pyld=%s",
+                 __entry->id, __entry->channel_id, __entry->protocol_id,
+                 __entry->tag, __entry->msg_id, __entry->seq, __entry->status,
                __print_hex_str(__get_dynamic_array(cmd), __entry->len))
 );
 #endif /* _TRACE_SCMI_H */