From patchwork Thu Oct 20 02:40:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 9385773 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 893F460487 for ; Thu, 20 Oct 2016 02:41:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BC8F29954 for ; Thu, 20 Oct 2016 02:41:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E652299AE; Thu, 20 Oct 2016 02:41:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4084F29954 for ; Thu, 20 Oct 2016 02:41:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933914AbcJTCkf (ORCPT ); Wed, 19 Oct 2016 22:40:35 -0400 Received: from mail-pf0-f175.google.com ([209.85.192.175]:35138 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933735AbcJTCka (ORCPT ); Wed, 19 Oct 2016 22:40:30 -0400 Received: by mail-pf0-f175.google.com with SMTP id s8so26525288pfj.2 for ; Wed, 19 Oct 2016 19:40:30 -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=anmFFEhfXuNE0JcHP21awQo+tFdRNNgvivG5BnJbFPU=; b=RRLA6bE8Vzr7EE0qWwoTw9VHeDP6cXoZJdTcZGjvo0h8s6Cy05BlpbqtdFcoY4i1Zw IcPhxBKh8N8DErkNJ9b85h1Xusw36KhChnYneaycniJwuU0iLiHeiEr8VTevrjFclWrD pUPNmPjDInbs0Uu/WZ2mBxx6vR3jrlJML4klU= 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=anmFFEhfXuNE0JcHP21awQo+tFdRNNgvivG5BnJbFPU=; b=CdBTy1b3Mpq13QAX4+FBB6TgVGsw2c6v8vDxxQHMZR/upXxFt+pRuZ8/dU8ycFOIhw j8PPiSHZVQbmwIINc8DssDhmVX2ZbqftScH665KPAmbvBSatWi+Cf1AldEdjCybNePBa Ah+Ki+AI3xDrMZolDriZ4u7KP6EAYwR2//UN8qDIByBWArfo09OmS+mYjhdj8GDQtvpb FT0Y0d3pGQ0oGyCfCqAoFuWSebOl4tMLSETkrkPTdOoJuv1Kydd/Xd5EqROiBeC8HUTP NLjPgtgLrD4yElReCMYIRfG2pOSsQd9Ty/XtFGh3K9hqxsnHm0oyV1D/aFddIHgBE7Cl qgbg== X-Gm-Message-State: AA6/9Rm1YlojuWtq/LkuNA9mq+BVAb9DVeSukiUu/oUeXm44je/H3YpBQStl4MBKQ9vNmwDx X-Received: by 10.98.13.20 with SMTP id v20mr17055007pfi.80.1476931230072; Wed, 19 Oct 2016 19:40:30 -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 s85sm66780616pfi.17.2016.10.19.19.40.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Oct 2016 19:40:29 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/11] remoteproc: Update max_notifyid as we allocate vrings Date: Wed, 19 Oct 2016 19:40:10 -0700 Message-Id: <1476931212-1806-10-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1476931212-1806-1-git-send-email-bjorn.andersson@linaro.org> References: <1476931212-1806-1-git-send-email-bjorn.andersson@linaro.org> Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Vrings are now allocated as we parse the resource table, before we boot the rproc or register any virtio devices, so it's safe to bump max_notifyid as part of this process. Signed-off-by: Bjorn Andersson --- drivers/remoteproc/remoteproc_core.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index c242ca016496..57f12421fdd2 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -236,6 +236,10 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i) } notifyid = ret; + /* Potentially bump max_notifyid */ + if (notifyid > rproc->max_notifyid) + rproc->max_notifyid = notifyid; + dev_dbg(dev, "vring%d: va %p dma %pad size 0x%x idr %d\n", i, va, &dma, size, notifyid); @@ -719,15 +723,6 @@ static int rproc_handle_carveout(struct rproc *rproc, return ret; } -static int rproc_count_vrings(struct rproc *rproc, struct fw_rsc_vdev *rsc, - int offset, int avail) -{ - /* Summarize the number of notification IDs */ - rproc->max_notifyid += rsc->num_of_vrings; - - return 0; -} - /* * A lookup table for resource handlers. The indices are defined in * enum fw_resource_type. @@ -736,7 +731,7 @@ 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] = (rproc_handle_resource_t)rproc_count_vrings, + [RSC_VDEV] = NULL, }; static rproc_handle_resource_t rproc_vdev_handler[RSC_LAST] = {