From patchwork Thu Aug 4 09:21:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 73256 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1291112qga; Thu, 4 Aug 2016 02:27:56 -0700 (PDT) X-Received: by 10.98.1.137 with SMTP id 131mr123595792pfb.165.1470302876906; Thu, 04 Aug 2016 02:27:56 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id um11si13794352pab.133.2016.08.04.02.27.55; Thu, 04 Aug 2016 02:27:56 -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 S1757484AbcHDJZj (ORCPT + 27 others); Thu, 4 Aug 2016 05:25:39 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:33633 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757458AbcHDJXt (ORCPT ); Thu, 4 Aug 2016 05:23:49 -0400 Received: by mail-wm0-f46.google.com with SMTP id p129so1517504wmp.0 for ; Thu, 04 Aug 2016 02:22:41 -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=qp77Mn2jclfg47EVjtcaGjbmOrbbqQeH5ywunpKJPzU=; b=ZCbf3X0cej2a9A4HMs106lJ53T070OhSiPyX/Y16RPsfLbHLw13INZt8sctto1OEfn 8MS2NwewpLHq8frcuTYLbPwYM1niUg65JWM8gXUDWwWzVnTRpxQ2svSkzNmuPzBN94Ah gMB7yNbZiB4nlcr9ANpRL30gPCjvpYencYfVY= 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=qp77Mn2jclfg47EVjtcaGjbmOrbbqQeH5ywunpKJPzU=; b=KVtdnJnyGMs/pA0K1TRnwkcMs1tc4U3uk+odVtimeBRwCuFyk2PGLF79if7T+AvWFr KySjhbGkxjfZNmhScv7x4HgZIFUGeW+Lcj1r0OPnN/j0P5N3orgFVRWpz3iz2cqRllvr y+Xox9ztXaJgH7dnyNsWW99yMEgd+vFNsul5JfHmUhva5A1s/R5t1AqF130btQdkb9bC xYLpvk4UGDIzQDa5iMLTsRTirijacZwv8ps43n9xUMJY0tYyRvnBZfkYQo8GGQiFMHlH Vy7aTK165hjAVtWfIzMhnawdRnYR93G606UcWQtTv1IXttEOosyYrVg7U+k6Q/7tmhcJ wdUw== X-Gm-Message-State: AEkoouvsGFziygzIHTEaAbJaNgueYBucEIxKcBsUBM3fC+mtqP4x3HN8+TOtayUw6rY81Kbq X-Received: by 10.194.85.232 with SMTP id k8mr65141348wjz.147.1470302560703; Thu, 04 Aug 2016 02:22:40 -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.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Aug 2016 02:22:40 -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 8/9] remoteproc: core: Skip resource table integrity checks if there are amendments Date: Thu, 4 Aug 2016 10:21:52 +0100 Message-Id: <20160804092153.23032-9-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 There is little point wasting CPU cycles completing integrity checking (i.e. ensuring nothing has changed) on the resource table if we *know* that it will be changed (by us). In this patch we skip resource table integrity checks if a platform-specific remoteproc driver has requested an amendment or an appended entry. Signed-off-by: Lee Jones --- drivers/remoteproc/remoteproc_core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 2.9.0 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 6b4e29a..9a077e4 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1126,6 +1126,10 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) rproc->bootaddr = rproc_get_boot_addr(rproc, fw); ret = -EINVAL; + /* If we've overridden the resource table, we know it's changed. */ + if (!list_empty(&rproc->override_resources)) + goto skip_table_check; + /* look for the resource table */ table = rproc_find_rsc_table(rproc, fw, &tablesz); if (!table) { @@ -1139,6 +1143,8 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) goto clean_up; } + skip_table_check: + /* handle fw resources which are required to boot rproc */ ret = rproc_handle_resources(rproc, tablesz, rproc_loading_handlers); if (ret) { @@ -1216,10 +1222,15 @@ static void rproc_fw_config_virtio(const struct firmware *fw, void *context) table = rproc_apply_resource_overrides(rproc, &table, &tablesz); if (IS_ERR(table)) goto out; + + /* No point checking table if we know it *has* changed */ + goto skip_table_check; } rproc->table_csum = crc32(0, table, tablesz); + skip_table_check: + /* * Create a copy of the resource table. When a virtio device starts * and calls vring_new_virtqueue() the address of the allocated vring