All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remoteproc: block premature rproc booting
@ 2012-05-22 11:51 ` Ohad Ben-Cohen
  0 siblings, 0 replies; 27+ messages in thread
From: Ohad Ben-Cohen @ 2012-05-22 11:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-omap, linux-arm-kernel, Ohad Ben-Cohen

When an rproc instance is registered, remoteproc asynchronously
loads its firmware in order to tell which vdevs it supports.

Later on those vdevs are registered, and when probed, their drivers
usually trigger powering on of the remote processor.

OTOH, non-standard scenarios might involve early invocation of
rproc_boot even before the asynchronous fw loading has completed.

We're not sure we really want to support those scenarios, but right
now we do (e.g. via rproc_get_by_name), so let's simply fix this race
by blocking those premature rproc_boot() flows until the async fw
loading is completed.

Reported-and-tested-by: Sjur Brandeland <sjur.brandeland@stericsson.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
---
 drivers/remoteproc/remoteproc_core.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 40e2b2d..464ea4f 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1141,6 +1141,18 @@ int rproc_boot(struct rproc *rproc)
 
 	dev = rproc->dev;
 
+	/*
+	 * if asynchronoush fw loading is underway, wait up to 65 secs
+	 * (just a bit more than the firmware request's timeout)
+	 */
+	ret = wait_for_completion_interruptible_timeout(
+					&rproc->firmware_loading_complete,
+					msecs_to_jiffies(65000));
+	if (ret <= 0) {
+		dev_err(dev, "async fw loading isn't complete: %d\n", ret);
+		return ret ? ret : -ETIMEDOUT;
+	}
+
 	ret = mutex_lock_interruptible(&rproc->lock);
 	if (ret) {
 		dev_err(dev, "can't lock rproc %s: %d\n", rproc->name, ret);
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 27+ messages in thread
[parent not found: <81C3A93C17462B4BBD7E272753C10579232F86B623@EXDCVYMBSTM005.EQ1STM.local>]

end of thread, other threads:[~2012-07-02 21:10 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-22 11:51 [PATCH] remoteproc: block premature rproc booting Ohad Ben-Cohen
2012-05-22 11:51 ` Ohad Ben-Cohen
2012-05-22 11:51 ` Ohad Ben-Cohen
2012-05-24  9:15 ` Stephen Boyd
2012-05-24  9:15   ` Stephen Boyd
2012-05-24 20:11   ` Ohad Ben-Cohen
2012-05-24 20:11     ` Ohad Ben-Cohen
2012-06-04 21:23     ` Stephen Boyd
2012-06-04 21:23       ` Stephen Boyd
2012-06-05 10:57       ` Ohad Ben-Cohen
2012-06-05 10:57         ` Ohad Ben-Cohen
2012-06-06  3:25         ` Stephen Boyd
2012-06-06  3:25           ` Stephen Boyd
2012-06-06  5:44           ` Ohad Ben-Cohen
2012-06-06  5:44             ` Ohad Ben-Cohen
2012-06-06  5:44             ` Ohad Ben-Cohen
2012-07-02 12:25         ` Ohad Ben-Cohen
2012-07-02 12:25           ` Ohad Ben-Cohen
2012-07-02 15:15           ` Sjur BRENDELAND
2012-07-02 15:15             ` Sjur BRENDELAND
2012-07-02 15:15             ` Sjur BRENDELAND
2012-07-02 15:19             ` Ohad Ben-Cohen
2012-07-02 15:19               ` Ohad Ben-Cohen
2012-07-02 15:19               ` Ohad Ben-Cohen
     [not found] <81C3A93C17462B4BBD7E272753C10579232F86B623@EXDCVYMBSTM005.EQ1STM.local>
2012-06-29 14:56 ` Ohad Ben-Cohen
2012-07-02  6:08   ` Preetham-rao K
2012-07-02 21:10     ` Guzman Lugo, Fernando

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.