[PATCH v3 14/14] remoteproc: Expose synchronisation flags via debugfs

From: Mathieu Poirier
Date: Fri Apr 24 2020 - 16:02:07 EST


Add a debugfs entry that reflects the value of the current
synchronisation flags used by the remoteproc core.

Signed-off-by: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
---
drivers/remoteproc/remoteproc_debugfs.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c
index 732770e92b99..3dde24e62cd8 100644
--- a/drivers/remoteproc/remoteproc_debugfs.c
+++ b/drivers/remoteproc/remoteproc_debugfs.c
@@ -291,6 +291,25 @@ static int rproc_carveouts_show(struct seq_file *seq, void *p)

DEFINE_SHOW_ATTRIBUTE(rproc_carveouts);

+ /* Expose synchronisation states via debugfs */
+static int rproc_sync_flags_show(struct seq_file *seq, void *p)
+{
+ struct rproc *rproc = seq->private;
+
+ seq_printf(seq, "Sync with rproc: %s\n",
+ rproc->sync_with_rproc ? "true" : "false");
+ seq_printf(seq, "On init: %s\n",
+ rproc->sync_flags.on_init ? "true" : "false");
+ seq_printf(seq, "After stop: %s\n",
+ rproc->sync_flags.after_stop ? "true" : "false");
+ seq_printf(seq, "After crash: %s\n",
+ rproc->sync_flags.after_crash ? "true" : "false");
+
+ return 0;
+}
+
+DEFINE_SHOW_ATTRIBUTE(rproc_sync_flags);
+
void rproc_remove_trace_file(struct dentry *tfile)
{
debugfs_remove(tfile);
@@ -337,6 +356,8 @@ void rproc_create_debug_dir(struct rproc *rproc)
rproc, &rproc_rsc_table_fops);
debugfs_create_file("carveout_memories", 0400, rproc->dbg_dir,
rproc, &rproc_carveouts_fops);
+ debugfs_create_file("sync_flags", 0400, rproc->dbg_dir,
+ rproc, &rproc_sync_flags_fops);
}

void __init rproc_init_debugfs(void)
--
2.20.1