mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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 <[email protected]> Cc: Brian Swetland <[email protected]> Cc: Iliyan Malchev <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Grant Likely <[email protected]> Cc: Rusty Russell <[email protected]> Cc: Mark Grosen <[email protected]> Cc: John Williams <[email protected]> Cc: Michal Simek <[email protected]> Cc: Loic PALLARDY <[email protected]> Cc: Ludovic BARRE <[email protected]> Cc: Omar Ramirez Luna <[email protected]> Cc: Guzman Lugo Fernando <[email protected]> Cc: Anna Suman <[email protected]> Cc: Clark Rob <[email protected]> Cc: Stephen Boyd <[email protected]> Cc: Saravana Kannan <[email protected]> Cc: David Brown <[email protected]> Cc: Kieran Bingham <[email protected]> Cc: Tony Lindgren <[email protected]>
This commit is contained in:
parent
04a9016e82
commit
41a6ee09ee
1 changed files with 10 additions and 10 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue