diff mbox

[9/9] remoteproc: core: Support empty resource tables

Message ID 20160804092153.23032-10-lee.jones@linaro.org
State New
Headers show

Commit Message

Lee Jones Aug. 4, 2016, 9:21 a.m. UTC
Currently, when a remote processor does not require resources, the
platform-specific remoteproc driver has to create a fake resource
table in order to by-pass the strict checking.  But there is no hard
requirement for a remote processor so require or support shared
resources.  This patch removes the strict checking and skips
resource table related operations if one is not provided.

Signed-off-by: Lee Jones <lee.jones@linaro.org>

---
 drivers/remoteproc/remoteproc_core.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

-- 
2.9.0

Comments

Lee Jones Aug. 5, 2016, 7:38 a.m. UTC | #1
On Thu, 04 Aug 2016, Lee Jones wrote:

> Currently, when a remote processor does not require resources, the

> platform-specific remoteproc driver has to create a fake resource

> table in order to by-pass the strict checking.  But there is no hard

> requirement for a remote processor so require or support shared

> resources.  This patch removes the strict checking and skips

> resource table related operations if one is not provided.

> 

> Signed-off-by: Lee Jones <lee.jones@linaro.org>

> ---

>  drivers/remoteproc/remoteproc_core.c | 19 ++++++++++---------

>  1 file changed, 10 insertions(+), 9 deletions(-)


Due to the fact that a) this patch conflicts heavily with Bjorn's set
and b) it isn't fully tested with real resourceless firmware, I'm
pulling it from the set.  I will submit it as part of a subsequent set
-- please ignore.

[...]

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
diff mbox

Patch

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 9a077e4..366e197 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1104,9 +1104,6 @@  static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
 	struct resource_table *table, *loaded_table;
 	int ret, tablesz;
 
-	if (!rproc->table_ptr)
-		return -ENOMEM;
-
 	ret = rproc_fw_sanity_check(rproc, fw);
 	if (ret)
 		return ret;
@@ -1130,12 +1127,10 @@  static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
 	if (!list_empty(&rproc->override_resources))
 		goto skip_table_check;
 
-	/* look for the resource table */
+	/* Resource tables aren't compulsory. */
 	table = rproc_find_rsc_table(rproc, fw, &tablesz);
-	if (!table) {
-		dev_err(dev, "Failed to find resource table\n");
-		goto clean_up;
-	}
+	if (!table)
+		goto skip_resources;
 
 	/* Verify that resource table in loaded fw is unchanged */
 	if (rproc->table_csum != crc32(0, table, tablesz)) {
@@ -1152,6 +1147,8 @@  static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
 		goto clean_up;
 	}
 
+ skip_resources:
+
 	/* load the ELF segments to memory */
 	ret = rproc_load_segments(rproc, fw);
 	if (ret) {
@@ -1213,8 +1210,12 @@  static void rproc_fw_config_virtio(const struct firmware *fw, void *context)
 	if (rproc_fw_sanity_check(rproc, fw) < 0)
 		goto out;
 
-	/* look for the resource table */
 	table = rproc_find_rsc_table(rproc, fw,  &tablesz);
+	if (IS_ERR(table)) {
+		dev_err(&rproc->dev, "Resource table expected, but failed\n");
+		goto out;
+	}
+
 	if (!table)
 		goto out;