diff options
author | Ohad Ben-Cohen <ohad@wizery.com> | 2012-02-13 02:38:23 -0500 |
---|---|---|
committer | Ohad Ben-Cohen <ohad@wizery.com> | 2012-03-06 12:13:53 -0500 |
commit | 41a6ee09ee8dd7ac3a6ac12a24e26279b5d93385 (patch) | |
tree | 4bc89b62b0076ab23a848a5035bad0c4d524d816 /drivers/remoteproc | |
parent | 04a9016e82193cfbe2f9111b4c59de5628fbbe3b (diff) |
remoteproc: safer boot/shutdown order
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>
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r-- | 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 4f73e811bb80..78d8527a8fec 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) | |||
123 | struct virtqueue *vq, *n; | 123 | struct virtqueue *vq, *n; |
124 | struct rproc *rproc = vdev_to_rproc(vdev); | 124 | struct rproc *rproc = vdev_to_rproc(vdev); |
125 | 125 | ||
126 | /* power down the remote processor before deleting vqs */ | ||
127 | rproc_shutdown(rproc); | ||
128 | |||
126 | list_for_each_entry_safe(vq, n, &vdev->vqs, list) { | 129 | list_for_each_entry_safe(vq, n, &vdev->vqs, list) { |
127 | struct rproc_virtio_vq_info *rpvq = vq->priv; | 130 | struct rproc_virtio_vq_info *rpvq = vq->priv; |
128 | vring_del_virtqueue(vq); | 131 | vring_del_virtqueue(vq); |
129 | kfree(rpvq); | 132 | kfree(rpvq); |
130 | } | 133 | } |
131 | |||
132 | /* power down the remote processor */ | ||
133 | rproc_shutdown(rproc); | ||
134 | } | 134 | } |
135 | 135 | ||
136 | static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs, | 136 | 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, | |||
145 | if (nvqs != 2) | 145 | if (nvqs != 2) |
146 | return -EINVAL; | 146 | return -EINVAL; |
147 | 147 | ||
148 | /* boot the remote processor */ | ||
149 | ret = rproc_boot(rproc); | ||
150 | if (ret) { | ||
151 | dev_err(rproc->dev, "rproc_boot() failed %d\n", ret); | ||
152 | goto error; | ||
153 | } | ||
154 | |||
155 | for (i = 0; i < nvqs; ++i) { | 148 | for (i = 0; i < nvqs; ++i) { |
156 | vqs[i] = rp_find_vq(vdev, i, callbacks[i], names[i]); | 149 | vqs[i] = rp_find_vq(vdev, i, callbacks[i], names[i]); |
157 | if (IS_ERR(vqs[i])) { | 150 | if (IS_ERR(vqs[i])) { |
@@ -160,6 +153,13 @@ static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs, | |||
160 | } | 153 | } |
161 | } | 154 | } |
162 | 155 | ||
156 | /* now that the vqs are all set, boot the remote processor */ | ||
157 | ret = rproc_boot(rproc); | ||
158 | if (ret) { | ||
159 | dev_err(rproc->dev, "rproc_boot() failed %d\n", ret); | ||
160 | goto error; | ||
161 | } | ||
162 | |||
163 | return 0; | 163 | return 0; |
164 | 164 | ||
165 | error: | 165 | error: |