From patchwork Tue Jun 16 15:34:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 188051 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp3761593ilo; Tue, 16 Jun 2020 08:40:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYss9sinwQlNgUYx9vkCmKxTdw/S8FWbY6i+NudkgvvnwzptEQz9g0AF5SUY0D2+q3KMQU X-Received: by 2002:a17:906:5243:: with SMTP id y3mr3552642ejm.193.1592322005138; Tue, 16 Jun 2020 08:40:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592322005; cv=none; d=google.com; s=arc-20160816; b=TbUhQJwcyuJ69bEeaSPlKUsPPfbJMYGEheQQkYbWoloqm4J2nH0gUpsL+qN5seqEXH 3qvuE3EfQaVPTCw+FPHmSWgtEQQOqOjNmid1cYKRVjddZ/LbRkr+ZaHrFdYJo2ammQ3I Ota94OoVuKoZjUtbRlLrBfNYZTz6oyz8TXPkBcNffV9M54Pw8KMD3lpq/FFsG63ltAfs XY2Llyaje3cZ3Utc/l2FeuEu8Mzty5PSyfGryRq4NT4eC38LhGibz/D46/RHjt6RcOZY JJvAc+A7+HntgROEQnkKxITSZdlgDyT131Mdh5USXe/tT1CveU4HbiJc5be4OOWKKkRc m/RQ== 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=S530TV2Uk8LruJluiGudU1MHVn8+GvvEH7jbWd5SGyYUgvb+C0XxeOkw/Kv+1OupOS hXyVIXv2lglmw4VCth2nmrjsEudvc1KGr9fln1jjh0Y5BrlpyiLWguV0bCPnwLKRw7/G GuSisShvsqU6QYYyPDHla3ZQ2xRK9fCycmVedfNND6F3sGAOTnRt7VLC9LiA+az6z21L KW8TffQihsf9CrI27u/zqbCwlTPR974NezsFAh3ZyTueFNvK/a83opef+kaNrBuyEjfa p5HBUDu4l8+k6wQq29ATHblW4rCDxXILSZw1KJhMt5qIZnyGpbPtr7jKCAdm+BFSyQ3Z dvZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mHCQOzof; 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 x15si10968071ejb.393.2020.06.16.08.40.04; Tue, 16 Jun 2020 08:40:05 -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=mHCQOzof; 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 S1730250AbgFPPkE (ORCPT + 15 others); Tue, 16 Jun 2020 11:40:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:54014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731069AbgFPPj6 (ORCPT ); Tue, 16 Jun 2020 11:39:58 -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 C53E821475; Tue, 16 Jun 2020 15:39:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592321998; bh=rslNjUeVlj97qpEPQRjAVmForQmuPgw5erM9aaqm87g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mHCQOzofcOskyBdKz1V9ZtPwOVJdSCbsS2wyXDO8Hgm5G2AHHzyVXi9JdGGbluDFJ ycit4+VHvKPvYTfLfGUnaCJH0XFg3GVrVpms3TWApFcv176KPnxyP4bNHcIf9jsZOh iycz8KkkwxWBmBk1LAUFFABpkxFp1qN2IP/VswFk= 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.4 096/134] remoteproc: Fall back to using parent memory pool if no dedicated available Date: Tue, 16 Jun 2020 17:34:40 +0200 Message-Id: <20200616153105.380956788@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616153100.633279950@linuxfoundation.org> References: <20200616153100.633279950@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 */