Commit 1b18d429 authored by Luke Parkin's avatar Luke Parkin Committed by Sudeep Holla

firmware: arm_scmi: Add support for debug metrics at the interface

Since SCMI involves interaction with the entity(software, firmware and/or
hardware) providing services or features, it is quite useful to track
certain metrics(for pure debugging purposes) like how many messages were
sent or received, were there any failures, what kind of failures, ..etc.

Add a new optional config option for the above purpose and the initial
support for counting such key debug metrics.
Signed-off-by: default avatarLuke Parkin <luke.parkin@arm.com>
Reviewed-by: default avatarCristian Marussi <cristian.marussi@arm.com>
Tested-by: default avatarCristian Marussi <cristian.marussi@arm.com>
Message-Id: <20240805131013.587016-3-sudeep.holla@arm.com>
Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
parent 20c9234d
...@@ -55,6 +55,20 @@ config ARM_SCMI_RAW_MODE_SUPPORT_COEX ...@@ -55,6 +55,20 @@ config ARM_SCMI_RAW_MODE_SUPPORT_COEX
operate normally, thing which could make an SCMI test suite using the operate normally, thing which could make an SCMI test suite using the
SCMI Raw mode support unreliable. If unsure, say N. SCMI Raw mode support unreliable. If unsure, say N.
config ARM_SCMI_DEBUG_COUNTERS
bool "Enable SCMI communication debug metrics tracking"
select ARM_SCMI_NEED_DEBUGFS
depends on DEBUG_FS
default n
help
Enables tracking of some key communication metrics for debug
purposes. It may track metrics like how many messages were sent
or received, were there any failures, what kind of failures, ..etc.
Enable this option to create a new debugfs directory which contains
such useful debug counters. This can be helpful for debugging and
SCMI monitoring.
config ARM_SCMI_HAVE_TRANSPORT config ARM_SCMI_HAVE_TRANSPORT
bool bool
help help
......
...@@ -301,6 +301,16 @@ extern const struct scmi_desc scmi_optee_desc; ...@@ -301,6 +301,16 @@ extern const struct scmi_desc scmi_optee_desc;
void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, void *priv); void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, void *priv);
enum debug_counters {
SCMI_DEBUG_COUNTERS_LAST
};
static inline void scmi_inc_count(atomic_t *arr, int stat)
{
if (IS_ENABLED(CONFIG_ARM_SCMI_DEBUG_COUNTERS))
atomic_inc(&arr[stat]);
}
enum scmi_bad_msg { enum scmi_bad_msg {
MSG_UNEXPECTED = -1, MSG_UNEXPECTED = -1,
MSG_INVALID = -2, MSG_INVALID = -2,
......
...@@ -117,12 +117,14 @@ struct scmi_protocol_instance { ...@@ -117,12 +117,14 @@ struct scmi_protocol_instance {
* @name: Name of this SCMI instance * @name: Name of this SCMI instance
* @type: Type of this SCMI instance * @type: Type of this SCMI instance
* @is_atomic: Flag to state if the transport of this instance is atomic * @is_atomic: Flag to state if the transport of this instance is atomic
* @counters: An array of atomic_c's used for tracking statistics (if enabled)
*/ */
struct scmi_debug_info { struct scmi_debug_info {
struct dentry *top_dentry; struct dentry *top_dentry;
const char *name; const char *name;
const char *type; const char *type;
bool is_atomic; bool is_atomic;
atomic_t counters[SCMI_DEBUG_COUNTERS_LAST];
}; };
/** /**
......
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