aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuman Anna2019-03-06 14:16:38 -0600
committerSuman Anna2019-03-10 16:33:15 -0500
commit7517114b4facdc9ca80e27c30dfc6ef8a1f165f4 (patch)
treefa4ed4dd4c5981600b334b3520770fbc333869c4
parentcb6320f7002078445ba5cebb5cdefca75136e052 (diff)
downloadremoteproc-7517114b4facdc9ca80e27c30dfc6ef8a1f165f4.tar.gz
remoteproc-7517114b4facdc9ca80e27c30dfc6ef8a1f165f4.tar.xz
remoteproc-7517114b4facdc9ca80e27c30dfc6ef8a1f165f4.zip
Revert "remoteproc: Remove depricated crash completion"
This reverts commit b26210cda63564a7478486faaea713f6ea965633. The commit b26210cda635 ("remoteproc: Remove depricated crash completion") has dropped the crash_comp completion variable as it was not needed after the rproc_trigger_recovery() function was modified to leverage rproc_stop() and rproc_start() functions in commit 7e83cab824a8 ("remoteproc: Modify recovery path to use rproc_{start,stop}()"). These new functions execute only a portion of the previous functions, and break the error recovery on OMAP remoteproc devices. Reintroduce the crash completion variable by reverting the above commit in preparation for reverting the error recovery logic to not use the rproc_start() and rproc_stop() functions. Signed-off-by: Suman Anna <s-anna@ti.com>
-rw-r--r--drivers/remoteproc/remoteproc_core.c10
-rw-r--r--include/linux/remoteproc.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 89580b957d66..76fd36413c56 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1206,6 +1206,10 @@ static int rproc_stop(struct rproc *rproc, bool crashed)
1206 1206
1207 rproc_unprepare_subdevices(rproc); 1207 rproc_unprepare_subdevices(rproc);
1208 1208
1209 /* if in crash state, unlock crash handler */
1210 if (rproc->state == RPROC_CRASHED)
1211 complete_all(&rproc->crash_comp);
1212
1209 rproc->state = RPROC_OFFLINE; 1213 rproc->state = RPROC_OFFLINE;
1210 1214
1211 dev_info(dev, "stopped remote processor %s\n", rproc->name); 1215 dev_info(dev, "stopped remote processor %s\n", rproc->name);
@@ -1339,6 +1343,8 @@ int rproc_trigger_recovery(struct rproc *rproc)
1339 1343
1340 dev_err(dev, "recovering %s\n", rproc->name); 1344 dev_err(dev, "recovering %s\n", rproc->name);
1341 1345
1346 init_completion(&rproc->crash_comp);
1347
1342 ret = mutex_lock_interruptible(&rproc->lock); 1348 ret = mutex_lock_interruptible(&rproc->lock);
1343 if (ret) 1349 if (ret)
1344 return ret; 1350 return ret;
@@ -1350,6 +1356,9 @@ int rproc_trigger_recovery(struct rproc *rproc)
1350 /* generate coredump */ 1356 /* generate coredump */
1351 rproc_coredump(rproc); 1357 rproc_coredump(rproc);
1352 1358
1359 /* wait until there is no more rproc users */
1360 wait_for_completion(&rproc->crash_comp);
1361
1353 /* load firmware */ 1362 /* load firmware */
1354 ret = request_firmware(&firmware_p, rproc->firmware, dev); 1363 ret = request_firmware(&firmware_p, rproc->firmware, dev);
1355 if (ret < 0) { 1364 if (ret < 0) {
@@ -1786,6 +1795,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
1786 INIT_LIST_HEAD(&rproc->dump_segments); 1795 INIT_LIST_HEAD(&rproc->dump_segments);
1787 1796
1788 INIT_WORK(&rproc->crash_handler, rproc_crash_handler_work); 1797 INIT_WORK(&rproc->crash_handler, rproc_crash_handler_work);
1798 init_completion(&rproc->crash_comp);
1789 1799
1790 rproc->state = RPROC_OFFLINE; 1800 rproc->state = RPROC_OFFLINE;
1791 1801
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index e0baae1659c2..ed33b09ff0ce 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -476,6 +476,7 @@ struct rproc_dump_segment {
476 * @index: index of this rproc device 476 * @index: index of this rproc device
477 * @crash_handler: workqueue for handling a crash 477 * @crash_handler: workqueue for handling a crash
478 * @crash_cnt: crash counter 478 * @crash_cnt: crash counter
479 * @crash_comp: completion used to sync crash handler and the rproc reload
479 * @recovery_disabled: flag that state if recovery was disabled 480 * @recovery_disabled: flag that state if recovery was disabled
480 * @max_notifyid: largest allocated notify id. 481 * @max_notifyid: largest allocated notify id.
481 * @table_ptr: pointer to the resource table in effect 482 * @table_ptr: pointer to the resource table in effect
@@ -511,6 +512,7 @@ struct rproc {
511 int index; 512 int index;
512 struct work_struct crash_handler; 513 struct work_struct crash_handler;
513 unsigned int crash_cnt; 514 unsigned int crash_cnt;
515 struct completion crash_comp;
514 bool recovery_disabled; 516 bool recovery_disabled;
515 int max_notifyid; 517 int max_notifyid;
516 struct resource_table *table_ptr; 518 struct resource_table *table_ptr;