From patchwork Tue Jun 16 15:35:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 188062 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp3771948ilo; Tue, 16 Jun 2020 08:53:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPLR3Te4Upi4vaXLuW+H+BwZnTCK03CZu3sJtOTxCQBSBW5DLBw7uzn6mQSqZhP8r+qJdT X-Received: by 2002:a50:ee18:: with SMTP id g24mr3274848eds.370.1592322831122; Tue, 16 Jun 2020 08:53:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592322831; cv=none; d=google.com; s=arc-20160816; b=rWBE2INk+qRGx0OZiE011IEA6a9Fn84Y1aAjAMAGjaNX9CyEbOiOyt6GlsTWpRz6YA MRUJ7Pk9+0BThKyTH+GcP0y54/o/zQRledB6o0ib2LuXP9oSvk0rvPNk+d211U71FlUB fzwD26NUQPMdJtvQeo/5TaoFfJZKA/DVWtNbdsSd8+1uKw0sSWXWg2yDIqra0Gp4ZLWJ PCtIPw2x+J7Ha5WPoM6RB2A0aYmuA54RBTbJfsP8ERgtNgIg/HS5+elgGc+vWt5Y8Hku 8fi9LBcI9ipucw8pHwH+Zjk1Qzm3LeRsq3SuGtnjoW29rppnabYQbnm9fdCQpPga1xXh O99w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qQ8c1ob7w4qfUL+8h3lcbtkwNTESNwiXCbezmAvwZQc=; b=XgBPQYlBCyRIhtkvuejw5jb1+pEHBjt5nCq2gRfva5wWMn0gKizP98M6uUdYMToMf5 Ei/T3g0JqyGFQK4IlNhUIKJb6q20VnoowPRYLN23K9kXF6Y5OSTs0DzkvaMdlUJDxxa7 dDnN+Fb0AosGTmycWIm12h3YhFVXQiOKIoCk5Qi7i2YuW7K1gaC5J5jsejPnW+xPQNXS QF/JZu8ykhqe7KBCWuzHmnjWUt1vSbcGn2Svt4CssFVCN57dgVuscOkeB337yVrah2lk BxDZxO4offeq/5QdLSqHEydBaTrAle7FT/Un6elNPsg3PAXbJvzYCS8Y0cI2segbhw1Y 0vAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pK36BmY8; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si11476002ejp.589.2020.06.16.08.53.50; Tue, 16 Jun 2020 08:53:51 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pK36BmY8; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732904AbgFPPxt (ORCPT + 15 others); Tue, 16 Jun 2020 11:53:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:52302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732897AbgFPPxq (ORCPT ); Tue, 16 Jun 2020 11:53:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6226F207C4; Tue, 16 Jun 2020 15:53:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592322826; bh=rslNjUeVlj97qpEPQRjAVmForQmuPgw5erM9aaqm87g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pK36BmY8WfYriMzImQPN2oR6k/FU0Lib45A2F2u5FG855OtV8qUtiUygVU2Uu3pnA bT3FYOeMkgAPYnZLmG7kz+JWl4jkMpkzg1ec5YLtg4++Xy94Bu9Z+J914y4lnbcz+T xZ6KBtuYDYSCW/h1DqNjYml645Uul5DWOGILil4U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Poirier , Arnaud Pouliquen , Tero Kristo , Suman Anna , Bjorn Andersson Subject: [PATCH 5.6 118/161] remoteproc: Fall back to using parent memory pool if no dedicated available Date: Tue, 16 Jun 2020 17:35:08 +0200 Message-Id: <20200616153111.977789330@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616153106.402291280@linuxfoundation.org> References: <20200616153106.402291280@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tero Kristo commit db9178a4f8c4e523f824892cb8bab00961b07385 upstream. In some cases, like with OMAP remoteproc, we are not creating dedicated memory pool for the virtio device. Instead, we use the same memory pool for all shared memories. The current virtio memory pool handling forces a split between these two, as a separate device is created for it, causing memory to be allocated from bad location if the dedicated pool is not available. Fix this by falling back to using the parent device memory pool if dedicated is not available. Cc: stable@vger.kernel.org Reviewed-by: Mathieu Poirier Acked-by: Arnaud Pouliquen Fixes: 086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool") Signed-off-by: Tero Kristo Signed-off-by: Suman Anna Link: https://lore.kernel.org/r/20200420160600.10467-2-s-anna@ti.com Signed-off-by: Bjorn Andersson Signed-off-by: Greg Kroah-Hartman --- drivers/remoteproc/remoteproc_virtio.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/remoteproc/remoteproc_virtio.c +++ b/drivers/remoteproc/remoteproc_virtio.c @@ -375,6 +375,18 @@ int rproc_add_virtio_dev(struct rproc_vd goto out; } } + } else { + struct device_node *np = rproc->dev.parent->of_node; + + /* + * If we don't have dedicated buffer, just attempt to re-assign + * the reserved memory from our parent. A default memory-region + * at index 0 from the parent's memory-regions is assigned for + * the rvdev dev to allocate from. Failure is non-critical and + * the allocations will fall back to global pools, so don't + * check return value either. + */ + of_reserved_mem_device_init_by_idx(dev, np, 0); } /* Allocate virtio device */