From patchwork Thu Aug 4 09:21:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 73249 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1289733qga; Thu, 4 Aug 2016 02:24:38 -0700 (PDT) X-Received: by 10.98.64.93 with SMTP id n90mr124964461pfa.29.1470302676743; Thu, 04 Aug 2016 02:24:36 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1si13787689pan.173.2016.08.04.02.24.35; Thu, 04 Aug 2016 02:24:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933184AbcHDJYb (ORCPT + 27 others); Thu, 4 Aug 2016 05:24:31 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:36002 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757493AbcHDJXt (ORCPT ); Thu, 4 Aug 2016 05:23:49 -0400 Received: by mail-wm0-f46.google.com with SMTP id q128so477412147wma.1 for ; Thu, 04 Aug 2016 02:22:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VYwgHG6wxLBm259T9ObJIvrUjcIKPzlMnFqO/Ki7C2I=; b=DbOzZmc4nN77lWi9G0OzoZSiL/C62GEoJiZE4XkCnzQLt062ihTX5AUOksT+FsmPng bRP+TkjxgwkuQW/3wdDS6uE5M/w9JRqfIiBcVdqEaHMfpFQGM6obedagJst5riXwf535 NOekprJzmG1iR0LoHJo17KRucu1GAvXjVoMok= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VYwgHG6wxLBm259T9ObJIvrUjcIKPzlMnFqO/Ki7C2I=; b=hW5NBD43NeaBQPIP7x4kE2u9BaZ8v+Ng8pNtzaNOuq5qrs6OQM1GX9jIYNDUhBlaG/ 7VDeVZZhqG4OGUftziw+RqZYXA2kmqHhpg7xc7mgaWtBA7Rp38KXbfUjVKMYb7PW3MuX IiEAwnSfB16D7P8hwAICLdVwfqovucubmURu4N5KFlHr2IDCDcIN+krlS8Cxpdv6+OFH EJOQLXLK+ZgrN8UYQ0/ifud9p046iVr6Wa9pZn3djX3aSJZwwQx9dKp0Xbf3pTIx2EF6 mIDWak9USxSam2eIjZ2JjTnmrEl9oxEhfxgRRoFxlAVhRJBaV7LCZzlSeBt9gYzj6qnz zuGg== X-Gm-Message-State: AEkoouu707leH9HQG8rxgJIDMmQT0X31pmCt4IbiB90WR1eDXVEy8lt2jBSKrQ3wC5y0VRhJ X-Received: by 10.194.79.161 with SMTP id k1mr12894156wjx.119.1470302561572; Thu, 04 Aug 2016 02:22:41 -0700 (PDT) Received: from localhost.localdomain (host86-185-202-8.range86-185.btcentralplus.com. [86.185.202.8]) by smtp.gmail.com with ESMTPSA id d64sm2615461wmc.22.2016.08.04.02.22.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Aug 2016 02:22:41 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: kernel@stlinux.com, patrice.chotard@st.com, ohad@wizery.com, bjorn.andersson@linaro.org, linux-remoteproc@vger.kernel.org, loic.pallardy@st.com, Lee Jones Subject: [PATCH 9/9] remoteproc: core: Support empty resource tables Date: Thu, 4 Aug 2016 10:21:53 +0100 Message-Id: <20160804092153.23032-10-lee.jones@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160804092153.23032-1-lee.jones@linaro.org> References: <20160804092153.23032-1-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/remoteproc/remoteproc_core.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) -- 2.9.0 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;