diff options
author | Iliyan Malchev <malchev@google.com> | 2011-09-23 11:08:32 -0700 |
---|---|---|
committer | Iliyan Malchev <malchev@google.com> | 2011-09-23 14:44:50 -0700 |
commit | ddbb0c5faf3eed37d1d6a578d01a770d2586fe54 (patch) | |
tree | 1e8beba2f3d4f2253f835f9941b0a8e6521fcbf4 /drivers/remoteproc/remoteproc.c | |
parent | b5f168f9a7631f913209fd785e8f6a010d69960b (diff) | |
download | kernel_samsung_tuna-ddbb0c5faf3eed37d1d6a578d01a770d2586fe54.zip kernel_samsung_tuna-ddbb0c5faf3eed37d1d6a578d01a770d2586fe54.tar.gz kernel_samsung_tuna-ddbb0c5faf3eed37d1d6a578d01a770d2586fe54.tar.bz2 |
remoteproc: add halt_on_crash flag
Add a flag to struct rproc that tells us whether to pause crash recovery (when
true), or to recover from the crash immediately (when false--the default),
usually by resetting the remoteproc.
Signed-off-by: Iliyan Malchev <malchev@google.com>
Diffstat (limited to 'drivers/remoteproc/remoteproc.c')
-rw-r--r-- | drivers/remoteproc/remoteproc.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/drivers/remoteproc/remoteproc.c b/drivers/remoteproc/remoteproc.c index 5163acb..17543eb 100644 --- a/drivers/remoteproc/remoteproc.c +++ b/drivers/remoteproc/remoteproc.c @@ -48,6 +48,8 @@ static DEFINE_SPINLOCK(rprocs_lock); /* debugfs parent dir */ static struct dentry *rproc_dbg; +static void complete_remoteproc_crash(struct rproc *rproc); + static ssize_t rproc_format_trace_buf(char __user *userbuf, size_t count, loff_t *ppos, const void *src, int size) { @@ -529,6 +531,20 @@ static int rproc_watchdog_isr(struct rproc *rproc) return 0; } +static void complete_remoteproc_crash(struct rproc *rproc) +{ + /* reset the ducati */ + if (rproc->trace_buf0 && rproc->last_trace_buf0) + memcpy(rproc->last_trace_buf0, rproc->trace_buf0, + rproc->last_trace_len0); + if (rproc->trace_buf1 && rproc->last_trace_buf1) + memcpy(rproc->last_trace_buf1, rproc->trace_buf1, + rproc->last_trace_len1); + pr_info("remoteproc: resetting %s...\n", rproc->name); + (void)blocking_notifier_call_chain(&rproc->nb_error, + RPROC_ERROR, NULL); +} + static int _event_notify(struct rproc *rproc, int type, void *data) { struct blocking_notifier_head *nh; @@ -540,12 +556,12 @@ static int _event_notify(struct rproc *rproc, int type, void *data) init_completion(&rproc->error_comp); rproc->state = RPROC_CRASHED; mutex_unlock(&rproc->lock); - if (rproc->trace_buf0 && rproc->last_trace_buf0) - memcpy(rproc->last_trace_buf0, rproc->trace_buf0, - rproc->last_trace_len0); - if (rproc->trace_buf1 && rproc->last_trace_buf1) - memcpy(rproc->last_trace_buf1, rproc->trace_buf1, - rproc->last_trace_len1); + if (!rproc->halt_on_crash) + complete_remoteproc_crash(rproc); + else + pr_info("remoteproc %s: halt-on-crash enabled: " \ + "deferring crash recovery\n", + rproc->name); #ifdef CONFIG_REMOTE_PROC_AUTOSUSPEND pm_runtime_dont_use_autosuspend(rproc->dev); #endif |