]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - rpmsg/rpmsg.git/commitdiff
Revert "remoteproc: Remove depricated crash completion"
authorSuman Anna <s-anna@ti.com>
Wed, 6 Mar 2019 20:16:38 +0000 (14:16 -0600)
committerSuman Anna <s-anna@ti.com>
Sun, 10 Mar 2019 21:33:15 +0000 (16:33 -0500)
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>
drivers/remoteproc/remoteproc_core.c
include/linux/remoteproc.h

index 89580b957d66239ecdbde266ea4996c670965a50..76fd36413c565e53c52dfb55f776793c67fe5f61 100644 (file)
@@ -1206,6 +1206,10 @@ static int rproc_stop(struct rproc *rproc, bool crashed)
 
        rproc_unprepare_subdevices(rproc);
 
+       /* if in crash state, unlock crash handler */
+       if (rproc->state == RPROC_CRASHED)
+               complete_all(&rproc->crash_comp);
+
        rproc->state = RPROC_OFFLINE;
 
        dev_info(dev, "stopped remote processor %s\n", rproc->name);
@@ -1339,6 +1343,8 @@ int rproc_trigger_recovery(struct rproc *rproc)
 
        dev_err(dev, "recovering %s\n", rproc->name);
 
+       init_completion(&rproc->crash_comp);
+
        ret = mutex_lock_interruptible(&rproc->lock);
        if (ret)
                return ret;
@@ -1350,6 +1356,9 @@ int rproc_trigger_recovery(struct rproc *rproc)
        /* generate coredump */
        rproc_coredump(rproc);
 
+       /* wait until there is no more rproc users */
+       wait_for_completion(&rproc->crash_comp);
+
        /* load firmware */
        ret = request_firmware(&firmware_p, rproc->firmware, dev);
        if (ret < 0) {
@@ -1786,6 +1795,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
        INIT_LIST_HEAD(&rproc->dump_segments);
 
        INIT_WORK(&rproc->crash_handler, rproc_crash_handler_work);
+       init_completion(&rproc->crash_comp);
 
        rproc->state = RPROC_OFFLINE;
 
index e0baae1659c2ac3a20753b7db9e652bad99f29bb..ed33b09ff0ce073649c7ef992e6308b0629c2005 100644 (file)
@@ -476,6 +476,7 @@ struct rproc_dump_segment {
  * @index: index of this rproc device
  * @crash_handler: workqueue for handling a crash
  * @crash_cnt: crash counter
+ * @crash_comp: completion used to sync crash handler and the rproc reload
  * @recovery_disabled: flag that state if recovery was disabled
  * @max_notifyid: largest allocated notify id.
  * @table_ptr: pointer to the resource table in effect
@@ -511,6 +512,7 @@ struct rproc {
        int index;
        struct work_struct crash_handler;
        unsigned int crash_cnt;
+       struct completion crash_comp;
        bool recovery_disabled;
        int max_notifyid;
        struct resource_table *table_ptr;