From: Ohad Ben-Cohen <ohad@wizery.com>
To: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: Ohad Ben-Cohen <ohad@wizery.com>,
Brian Swetland <swetland@google.com>,
Iliyan Malchev <malchev@google.com>,
Arnd Bergmann <arnd@arndb.de>,
Grant Likely <grant.likely@secretlab.ca>,
Rusty Russell <rusty@rustcorp.com.au>,
Mark Grosen <mgrosen@ti.com>,
John Williams <john.williams@petalogix.com>,
Michal Simek <monstr@monstr.eu>,
Loic PALLARDY <loic.pallardy@stericsson.com>,
Ludovic BARRE <ludovic.barre@stericsson.com>,
Omar Ramirez Luna <omar.luna@linaro.org>,
Guzman Lugo Fernando <fernando.lugo@ti.com>,
Anna Suman <s-anna@ti.com>, Clark Rob <rob@ti.com>,
Stephen Boyd <sboyd@codeaurora.org>,
Saravana Kannan <skannan@codeaurora.org>,
David Brown <davidb@codeaurora.org>,
Kieran Bingham <kieranbingham@gmail.com>,
Tony Lindgren <tony@atomide.com>
Subject: [PATCH 3/7] remoteproc: safer boot/shutdown order
Date: Thu, 1 Mar 2012 10:11:33 +0200 [thread overview]
Message-ID: <1330589497-4139-4-git-send-email-ohad@wizery.com> (raw)
In-Reply-To: <1330589497-4139-1-git-send-email-ohad@wizery.com>
Boot the remote processor only after setting up the virtqueues,
and shut it down before deleting them.
Remote processors should obey virtio status changes, and
therefore not manipulate/trigger the virtqueues while the virtio
driver isn't ready, but it's just safer not to rely on that
(plus a vq access might already be inflight while a vdev
status is changed).
We also don't have yet status change notifications, but that's
a temporary limitation.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Iliyan Malchev <malchev@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Mark Grosen <mgrosen@ti.com>
Cc: John Williams <john.williams@petalogix.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
Cc: Omar Ramirez Luna <omar.luna@linaro.org>
Cc: Guzman Lugo Fernando <fernando.lugo@ti.com>
Cc: Anna Suman <s-anna@ti.com>
Cc: Clark Rob <rob@ti.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Saravana Kannan <skannan@codeaurora.org>
Cc: David Brown <davidb@codeaurora.org>
Cc: Kieran Bingham <kieranbingham@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>
---
drivers/remoteproc/remoteproc_virtio.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
index 4f73e81..78d8527 100644
--- a/drivers/remoteproc/remoteproc_virtio.c
+++ b/drivers/remoteproc/remoteproc_virtio.c
@@ -123,14 +123,14 @@ static void rproc_virtio_del_vqs(struct virtio_device *vdev)
struct virtqueue *vq, *n;
struct rproc *rproc = vdev_to_rproc(vdev);
+ /* power down the remote processor before deleting vqs */
+ rproc_shutdown(rproc);
+
list_for_each_entry_safe(vq, n, &vdev->vqs, list) {
struct rproc_virtio_vq_info *rpvq = vq->priv;
vring_del_virtqueue(vq);
kfree(rpvq);
}
-
- /* power down the remote processor */
- rproc_shutdown(rproc);
}
static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs,
@@ -145,13 +145,6 @@ static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs,
if (nvqs != 2)
return -EINVAL;
- /* boot the remote processor */
- ret = rproc_boot(rproc);
- if (ret) {
- dev_err(rproc->dev, "rproc_boot() failed %d\n", ret);
- goto error;
- }
-
for (i = 0; i < nvqs; ++i) {
vqs[i] = rp_find_vq(vdev, i, callbacks[i], names[i]);
if (IS_ERR(vqs[i])) {
@@ -160,6 +153,13 @@ static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs,
}
}
+ /* now that the vqs are all set, boot the remote processor */
+ ret = rproc_boot(rproc);
+ if (ret) {
+ dev_err(rproc->dev, "rproc_boot() failed %d\n", ret);
+ goto error;
+ }
+
return 0;
error:
--
1.7.5.4
next prev parent reply other threads:[~2012-03-01 8:11 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-01 8:11 [PATCH 0/7] remoteproc: additional virtio support Ohad Ben-Cohen
2012-03-01 8:11 ` [PATCH 1/7] remoteproc: resource table overhaul Ohad Ben-Cohen
2012-03-16 14:57 ` Michal Simek
2012-03-17 6:39 ` Ohad Ben-Cohen
2012-03-19 7:07 ` Michal Simek
2012-05-17 18:45 ` Ohad Ben-Cohen
2012-05-21 13:02 ` Michal Simek
2012-05-21 14:00 ` Ohad Ben-Cohen
2012-05-22 5:51 ` Michal Simek
2012-05-22 8:02 ` Ohad Ben-Cohen
2012-05-22 8:18 ` Michal Simek
2012-05-22 9:14 ` frq09524
2012-05-22 9:22 ` Ohad Ben-Cohen
2012-05-22 12:51 ` frq09524
2012-05-23 12:41 ` Ohad Ben-Cohen
2012-03-01 8:11 ` [PATCH 2/7] remoteproc: remoteproc_rpmsg -> remoteproc_virtio Ohad Ben-Cohen
2012-03-01 8:11 ` Ohad Ben-Cohen [this message]
2012-03-01 8:11 ` [PATCH 4/7] remoteproc: remove the single rpmsg vdev limitation Ohad Ben-Cohen
2012-03-01 8:11 ` [PATCH 5/7] remoteproc/omap: remove the mbox_callback limitation Ohad Ben-Cohen
2012-03-01 8:11 ` [PATCH 6/7] remoteproc: remove the hardcoded vring alignment Ohad Ben-Cohen
2012-03-01 8:11 ` [PATCH 7/7] remoteproc: cleanup resource table parsing paths Ohad Ben-Cohen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330589497-4139-4-git-send-email-ohad@wizery.com \
--to=ohad@wizery.com \
--cc=arnd@arndb.de \
--cc=davidb@codeaurora.org \
--cc=fernando.lugo@ti.com \
--cc=grant.likely@secretlab.ca \
--cc=john.williams@petalogix.com \
--cc=kieranbingham@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=loic.pallardy@stericsson.com \
--cc=ludovic.barre@stericsson.com \
--cc=malchev@google.com \
--cc=mgrosen@ti.com \
--cc=monstr@monstr.eu \
--cc=omar.luna@linaro.org \
--cc=rob@ti.com \
--cc=rusty@rustcorp.com.au \
--cc=s-anna@ti.com \
--cc=sboyd@codeaurora.org \
--cc=skannan@codeaurora.org \
--cc=swetland@google.com \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).