From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: ohad@wizery.com, bjorn.andersson@linaro.org
Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v5 8/9] remoteproc: Refactor function rproc_free_vring()
Date: Tue, 7 Jul 2020 15:00:13 -0600 [thread overview]
Message-ID: <20200707210014.927691-9-mathieu.poirier@linaro.org> (raw)
In-Reply-To: <20200707210014.927691-1-mathieu.poirier@linaro.org>
When function rproc_free_vring() clears the virtio device section
it does so on the cached resource table rather than the one
installed in the remote processor memory. When a remote processor
has been booted by another entity there is no need to use a cached
table and as such, no need to clear the virtio device section in
it.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
drivers/remoteproc/remoteproc_core.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 08de81828e4e..6b6e4ec8cf3a 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -410,10 +410,22 @@ void rproc_free_vring(struct rproc_vring *rvring)
idr_remove(&rproc->notifyids, rvring->notifyid);
- /* reset resource entry info */
- rsc = (void *)rproc->table_ptr + rvring->rvdev->rsc_offset;
- rsc->vring[idx].da = 0;
- rsc->vring[idx].notifyid = -1;
+ /*
+ * At this point rproc_stop() has been called and the installed resource
+ * table in the remote processor memory may no longer be accessible. As
+ * such and as per rproc_stop(), rproc->table_ptr points to the cached
+ * resource table (rproc->cached_table). The cached resource table is
+ * only available when a remote processor has been booted by the
+ * remoteproc core, otherwise it is NULL.
+ *
+ * Based on the above, reset the virtio device section in the cached
+ * resource table only if there is one to work with.
+ */
+ if (rproc->table_ptr) {
+ rsc = (void *)rproc->table_ptr + rvring->rvdev->rsc_offset;
+ rsc->vring[idx].da = 0;
+ rsc->vring[idx].notifyid = -1;
+ }
}
static int rproc_vdev_do_start(struct rproc_subdev *subdev)
--
2.25.1
next prev parent reply other threads:[~2020-07-07 21:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 21:00 [PATCH v5 0/9] remoteproc: Add support for attaching with rproc Mathieu Poirier
2020-07-07 21:00 ` [PATCH v5 1/9] remoteproc: Add new RPROC_DETACHED state Mathieu Poirier
2020-07-07 21:00 ` [PATCH v5 2/9] remoteproc: Add new attach() remoteproc operation Mathieu Poirier
2020-07-07 21:00 ` [PATCH v5 3/9] remoteproc: Introducing function rproc_attach() Mathieu Poirier
2020-07-07 21:00 ` [PATCH v5 4/9] remoteproc: Introducing function rproc_actuate() Mathieu Poirier
2020-07-09 8:29 ` Arnaud POULIQUEN
2020-07-07 21:00 ` [PATCH v5 5/9] remoteproc: Introducing function rproc_validate() Mathieu Poirier
2020-07-09 8:32 ` Arnaud POULIQUEN
2020-07-07 21:00 ` [PATCH v5 6/9] remoteproc: Refactor function rproc_boot() Mathieu Poirier
2020-07-07 21:00 ` [PATCH v5 7/9] remoteproc: Refactor function rproc_trigger_auto_boot() Mathieu Poirier
2020-07-07 21:00 ` Mathieu Poirier [this message]
2020-07-07 21:00 ` [PATCH v5 9/9] remoteproc: Properly handle firmware name when attaching Mathieu Poirier
2020-07-09 8:58 ` Arnaud POULIQUEN
2020-07-09 16:23 ` [PATCH v5 0/9] remoteproc: Add support for attaching with rproc Arnaud POULIQUEN
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=20200707210014.927691-9-mathieu.poirier@linaro.org \
--to=mathieu.poirier@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=ohad@wizery.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).