From patchwork Thu Aug 11 21:52:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 73823 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp322987qga; Thu, 11 Aug 2016 14:53:40 -0700 (PDT) X-Received: by 10.98.61.24 with SMTP id k24mr21111997pfa.100.1470952420351; Thu, 11 Aug 2016 14:53:40 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k5si5048222pay.255.2016.08.11.14.53.34; Thu, 11 Aug 2016 14:53:40 -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 S932600AbcHKVxZ (ORCPT + 27 others); Thu, 11 Aug 2016 17:53:25 -0400 Received: from mail-pf0-f174.google.com ([209.85.192.174]:34618 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932407AbcHKVw5 (ORCPT ); Thu, 11 Aug 2016 17:52:57 -0400 Received: by mail-pf0-f174.google.com with SMTP id p64so2360411pfb.1 for ; Thu, 11 Aug 2016 14:52:57 -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=4XVQAi9TM+hTVGNxpwkOFE+I8QIHlyvrbsfvsGkJTfU=; b=BhA6H0efzWqtokOz83cOGUXsdSpDKTjI1qgkcJwBpTWK+m9EplVrrEDBZ7+5eiDpZG xTTMaFHUBQCgHrNlXLyc7G3fZjkvVhL2GSzqMvU+XpKtMJGzXJ8Y+ptSorgqJXO5h/6g ESdiN3+eUgkgwQXDhANn5jmqo2pooTiH73ZY0= 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=4XVQAi9TM+hTVGNxpwkOFE+I8QIHlyvrbsfvsGkJTfU=; b=EGQtLmaQqr8f+FYI0elxB/QD8OPe5Q6qG5JNS2yrEp6Z3GWffM8aX8IN+hfcMNrgsv sjIxJjeArXlSg9qHVSdZHh36d3X1iY79260NGYAo5AM8zmMmFzxOWkY1KF4dl9BlxLn6 6+IWgXxSsXUXaeAAVllohaLNit7MFrjxDZ31DbAUGF4umdWHnYMIOv8JCYYRpAdjVGpp zSsYbeTuLrqCgwZhpIr2MHhbjwsIlvcARVOTveHFnngZATFxnwlfREI6UuNHjM0P5XCJ 79mcpBmXWc7fEjx02PEq7uYqY5DTEXjSQeYet90itDb6kNZ+/zOiKrHYm2SyXLOzv+mg G3/w== X-Gm-Message-State: AEkoouvTUYMg2KoC4/G9IHAVcX98UaTQGwdHhp2ztKNCeTAfZiKx5BEcs+Xa2S+sQHLmnBgv X-Received: by 10.98.79.27 with SMTP id d27mr21039440pfb.127.1470952376871; Thu, 11 Aug 2016 14:52:56 -0700 (PDT) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id bx9sm7547908pab.17.2016.08.11.14.52.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Aug 2016 14:52:56 -0700 (PDT) From: Bjorn Andersson To: linux-remoteproc@vger.kernel.org Cc: Ohad Ben-Cohen , linux-kernel@vger.kernel.org, Suman Anna , Lee Jones , Loic Pallardy Subject: [PATCH v2 2/4] remoteproc: Calculate max_notifyid during load Date: Thu, 11 Aug 2016 14:52:51 -0700 Message-Id: <1470952373-4823-2-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1470952373-4823-1-git-send-email-bjorn.andersson@linaro.org> References: <1470952373-4823-1-git-send-email-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The calculation of max_notifyid must only be done before we call start() on the remoteproc drivers, so move the calculation to be part of the loading steps. Cc: Lee Jones Cc: Loic Pallardy Signed-off-by: Bjorn Andersson --- Changes since v1: - None drivers/remoteproc/remoteproc_core.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) -- 2.5.0 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 5ca98039e494..f484e04810f3 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -697,17 +697,13 @@ static rproc_handle_resource_t rproc_loading_handlers[RSC_LAST] = { [RSC_CARVEOUT] = (rproc_handle_resource_t)rproc_handle_carveout, [RSC_DEVMEM] = (rproc_handle_resource_t)rproc_handle_devmem, [RSC_TRACE] = (rproc_handle_resource_t)rproc_handle_trace, - [RSC_VDEV] = NULL, /* VDEVs were handled upon registrarion */ + [RSC_VDEV] = (rproc_handle_resource_t)rproc_count_vrings, }; static rproc_handle_resource_t rproc_vdev_handler[RSC_LAST] = { [RSC_VDEV] = (rproc_handle_resource_t)rproc_handle_vdev, }; -static rproc_handle_resource_t rproc_count_vrings_handler[RSC_LAST] = { - [RSC_VDEV] = (rproc_handle_resource_t)rproc_count_vrings, -}; - /* handle firmware resource entries before booting the remote processor */ static int rproc_handle_resources(struct rproc *rproc, int len, rproc_handle_resource_t handlers[RSC_LAST]) @@ -836,6 +832,9 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) goto clean_up; } + /* reset max_notifyid */ + rproc->max_notifyid = -1; + /* handle fw resources which are required to boot rproc */ ret = rproc_handle_resources(rproc, tablesz, rproc_loading_handlers); if (ret) { @@ -923,13 +922,6 @@ static void rproc_fw_config_virtio(const struct firmware *fw, void *context) rproc->table_ptr = rproc->cached_table; - /* count the number of notify-ids */ - rproc->max_notifyid = -1; - ret = rproc_handle_resources(rproc, tablesz, - rproc_count_vrings_handler); - if (ret) - goto out; - /* look for virtio devices and register them */ ret = rproc_handle_resources(rproc, tablesz, rproc_vdev_handler);