summaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc
diff options
context:
space:
mode:
authorLoic Pallardy <loic.pallardy@st.com>2018-07-27 15:14:46 +0200
committerBjorn Andersson <bjorn.andersson@linaro.org>2018-10-09 22:41:04 -0700
commitffa5f9c84810ea175226863f66a51bb2d4502f5b (patch)
treef3885db699034d04bbdb25fed447c458911898ca /drivers/remoteproc
parentc874bf59add0e6ed1d5d8c1753b9b66d51e3f640 (diff)
downloadlinux-stable-ffa5f9c84810ea175226863f66a51bb2d4502f5b.tar.gz
linux-stable-ffa5f9c84810ea175226863f66a51bb2d4502f5b.tar.bz2
linux-stable-ffa5f9c84810ea175226863f66a51bb2d4502f5b.zip
remoteproc: modify rproc_handle_carveout to support pre-registered region
In current version rproc_handle_carveout() function registers carveout for allocation. This patch extends rproc_handle_carveout() function to support pre-registered region. Match is done on region name, then requested device address and length are checked. If match found, pre-registered region is associated with resource table request. If no name match found, new carveout is registered for allocation. Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r--drivers/remoteproc/remoteproc_core.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index a0a5e32935bc..5abcd27a29f3 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -840,6 +840,29 @@ static int rproc_handle_carveout(struct rproc *rproc,
dev_dbg(dev, "carveout rsc: name: %s, da 0x%x, pa 0x%x, len 0x%x, flags 0x%x\n",
rsc->name, rsc->da, rsc->pa, rsc->len, rsc->flags);
+ /*
+ * Check carveout rsc already part of a registered carveout,
+ * Search by name, then check the da and length
+ */
+ carveout = rproc_find_carveout_by_name(rproc, rsc->name);
+
+ if (carveout) {
+ if (carveout->rsc_offset != FW_RSC_ADDR_ANY) {
+ dev_err(dev,
+ "Carveout already associated to resource table\n");
+ return -ENOMEM;
+ }
+
+ if (rproc_check_carveout_da(rproc, carveout, rsc->da, rsc->len))
+ return -ENOMEM;
+
+ /* Update memory carveout with resource table info */
+ carveout->rsc_offset = offset;
+ carveout->flags = rsc->flags;
+
+ return 0;
+ }
+
/* Register carveout in in list */
carveout = rproc_mem_entry_init(dev, 0, 0, rsc->len, rsc->da,
rproc_alloc_carveout,
@@ -1120,8 +1143,15 @@ static int rproc_alloc_registered_carveouts(struct rproc *rproc)
* In this case, the device address and the physical address
* are the same.
*/
+
+ /* Use va if defined else dma to generate pa */
if (entry->va)
rsc->pa = (u32)rproc_va_to_pa(entry->va);
+ else
+ rsc->pa = (u32)entry->dma;
+
+ rsc->da = entry->da;
+ rsc->len = entry->len;
}
}