summaryrefslogtreecommitdiff
path: root/drivers/firmware/arm_scmi
diff options
context:
space:
mode:
authorLuke Parkin <luke.parkin@arm.com>2024-08-05 16:10:12 +0300
committerSudeep Holla <sudeep.holla@arm.com>2024-08-09 16:21:43 +0300
commitbd02b0737f3816073e7a37a667190dea3c195e4a (patch)
tree35b1190b350a24a3d839d762ed79fd456253bbde /drivers/firmware/arm_scmi
parentf6a905eaf6bfcf63d7b83d27bf3046e0e7a6f0a6 (diff)
downloadlinux-bd02b0737f3816073e7a37a667190dea3c195e4a.tar.xz
firmware: arm_scmi: Add support to reset the debug metrics
It is sometimes useful to reset all these SCMI communication debug metrics especially when we are interested in analysing these metrics during a particular workload or for a fixed time duration. Let us add the capability to reset all these metrics as once so that they can be counted during the period of interest. Signed-off-by: Luke Parkin <luke.parkin@arm.com> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Tested-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <20240805131013.587016-6-sudeep.holla@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Diffstat (limited to 'drivers/firmware/arm_scmi')
-rw-r--r--drivers/firmware/arm_scmi/driver.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index ade32a67ab63..ca910079d718 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -2864,6 +2864,24 @@ static const char * const dbg_counter_strs[] = {
"err_protocol",
};
+static ssize_t reset_all_on_write(struct file *filp, const char __user *buf,
+ size_t count, loff_t *ppos)
+{
+ struct scmi_debug_info *dbg = filp->private_data;
+
+ for (int i = 0; i < SCMI_DEBUG_COUNTERS_LAST; i++)
+ atomic_set(&dbg->counters[i], 0);
+
+ return count;
+}
+
+static const struct file_operations fops_reset_counts = {
+ .owner = THIS_MODULE,
+ .open = simple_open,
+ .llseek = no_llseek,
+ .write = reset_all_on_write,
+};
+
static void scmi_debugfs_counters_setup(struct scmi_debug_info *dbg,
struct dentry *trans)
{
@@ -2873,8 +2891,10 @@ static void scmi_debugfs_counters_setup(struct scmi_debug_info *dbg,
counters = debugfs_create_dir("counters", trans);
for (idx = 0; idx < SCMI_DEBUG_COUNTERS_LAST; idx++)
- debugfs_create_atomic_t(dbg_counter_strs[idx], 0400, counters,
+ debugfs_create_atomic_t(dbg_counter_strs[idx], 0600, counters,
&dbg->counters[idx]);
+
+ debugfs_create_file("reset", 0200, counters, dbg, &fops_reset_counts);
}
static void scmi_debugfs_common_cleanup(void *d)