linux/drivers/remoteproc/remoteproc_debugfs.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Remote Processor Framework
 *
 * Copyright (C) 2011 Texas Instruments, Inc.
 * Copyright (C) 2011 Google, Inc.
 *
 * Ohad Ben-Cohen <[email protected]>
 * Mark Grosen <[email protected]>
 * Brian Swetland <[email protected]>
 * Fernando Guzman Lugo <[email protected]>
 * Suman Anna <[email protected]>
 * Robert Tivy <[email protected]>
 * Armando Uribe De Leon <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/kernel.h>
#include <linux/debugfs.h>
#include <linux/remoteproc.h>
#include <linux/device.h>
#include <linux/uaccess.h>

#include "remoteproc_internal.h"

/* remoteproc debugfs parent dir */
static struct dentry *rproc_dbg;

/*
 * A coredump-configuration-to-string lookup table, for exposing a
 * human readable configuration via debugfs. Always keep in sync with
 * enum rproc_coredump_mechanism
 */
static const char * const rproc_coredump_str[] =;

/* Expose the current coredump configuration via debugfs */
static ssize_t rproc_coredump_read(struct file *filp, char __user *userbuf,
				   size_t count, loff_t *ppos)
{}

/*
 * By writing to the 'coredump' debugfs entry, we control the behavior of the
 * coredump mechanism dynamically. The default value of this entry is "disabled".
 *
 * The 'coredump' debugfs entry supports these commands:
 *
 * disabled:	By default coredump collection is disabled. Recovery will
 *		proceed without collecting any dump.
 *
 * enabled:	When the remoteproc crashes the entire coredump will be copied
 *		to a separate buffer and exposed to userspace.
 *
 * inline:	The coredump will not be copied to a separate buffer and the
 *		recovery process will have to wait until data is read by
 *		userspace. But this avoid usage of extra memory.
 */
static ssize_t rproc_coredump_write(struct file *filp,
				    const char __user *user_buf, size_t count,
				    loff_t *ppos)
{}

static const struct file_operations rproc_coredump_fops =;

/*
 * Some remote processors may support dumping trace logs into a shared
 * memory buffer. We expose this trace buffer using debugfs, so users
 * can easily tell what's going on remotely.
 *
 * We will most probably improve the rproc tracing facilities later on,
 * but this kind of lightweight and simple mechanism is always good to have,
 * as it provides very early tracing with little to no dependencies at all.
 */
static ssize_t rproc_trace_read(struct file *filp, char __user *userbuf,
				size_t count, loff_t *ppos)
{}

static const struct file_operations trace_rproc_ops =;

/* expose the name of the remote processor via debugfs */
static ssize_t rproc_name_read(struct file *filp, char __user *userbuf,
			       size_t count, loff_t *ppos)
{}

static const struct file_operations rproc_name_ops =;

/* expose recovery flag via debugfs */
static ssize_t rproc_recovery_read(struct file *filp, char __user *userbuf,
				   size_t count, loff_t *ppos)
{}

/*
 * By writing to the 'recovery' debugfs entry, we control the behavior of the
 * recovery mechanism dynamically. The default value of this entry is "enabled".
 *
 * The 'recovery' debugfs entry supports these commands:
 *
 * enabled:	When enabled, the remote processor will be automatically
 *		recovered whenever it crashes. Moreover, if the remote
 *		processor crashes while recovery is disabled, it will
 *		be automatically recovered too as soon as recovery is enabled.
 *
 * disabled:	When disabled, a remote processor will remain in a crashed
 *		state if it crashes. This is useful for debugging purposes;
 *		without it, debugging a crash is substantially harder.
 *
 * recover:	This function will trigger an immediate recovery if the
 *		remote processor is in a crashed state, without changing
 *		or checking the recovery state (enabled/disabled).
 *		This is useful during debugging sessions, when one expects
 *		additional crashes to happen after enabling recovery. In this
 *		case, enabling recovery will make it hard to debug subsequent
 *		crashes, so it's recommended to keep recovery disabled, and
 *		instead use the "recover" command as needed.
 */
static ssize_t
rproc_recovery_write(struct file *filp, const char __user *user_buf,
		     size_t count, loff_t *ppos)
{}

static const struct file_operations rproc_recovery_ops =;

/* expose the crash trigger via debugfs */
static ssize_t
rproc_crash_write(struct file *filp, const char __user *user_buf,
		  size_t count, loff_t *ppos)
{}

static const struct file_operations rproc_crash_ops =;

/* Expose resource table content via debugfs */
static int rproc_rsc_table_show(struct seq_file *seq, void *p)
{}

DEFINE_SHOW_ATTRIBUTE();

/* Expose carveout content via debugfs */
static int rproc_carveouts_show(struct seq_file *seq, void *p)
{}

DEFINE_SHOW_ATTRIBUTE();

void rproc_remove_trace_file(struct dentry *tfile)
{}

struct dentry *rproc_create_trace_file(const char *name, struct rproc *rproc,
				       struct rproc_debug_trace *trace)
{}

void rproc_delete_debug_dir(struct rproc *rproc)
{}

void rproc_create_debug_dir(struct rproc *rproc)
{}

void __init rproc_init_debugfs(void)
{}

void __exit rproc_exit_debugfs(void)
{}