From patchwork Tue Jun 16 15:34:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 188057 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp3768146ilo; Tue, 16 Jun 2020 08:48:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeMfqZ982ZzWfbxVBnt0Y4/gqzC0mnEx4UvE1gC+TC8oejtb0vXE6/geWlKChBL+zO4PRd X-Received: by 2002:a05:6402:1217:: with SMTP id c23mr3170141edw.270.1592322512914; Tue, 16 Jun 2020 08:48:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592322512; cv=none; d=google.com; s=arc-20160816; b=z7B+fNk0leHRkL6etjEQft19ibb3aYmuV+D9n03zL0kmcbrFsZadOtNexvJcBfnqF8 sd0AehCk81gBLVU1cSUT49d9rdbebHyqwRf+VMFstIFyWQkoQ3LwHroI2KM9AYuZXSbH kHeRlvlbGNTCjSOPC0GwZY9iA0VE12d+1/Wi6MlKpiLEQtEbjjXtHBAbeTBviBRqfI/Y rImHZOgRJ2OwmlXF1Ljdrbn4sfRsnB4JzjC1oVFSILp6XNIJMCIID0P9vO2282YUu0d+ E9ZAypoBQj671T+FNH+G57v8F+sLWzB0wjKqp7x33VFzo686t6qnLFpsn52B4pxhoCUI gf1w== 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=/e1w59/B3r/KJqZrpAfVdEboSiXPT8c7vW6GOZFixXc=; b=De+dJR5pohmWVekTiYbzkdJA/bl1xQD8awzuSk7F67G6uPja8PSLwJXtIG7kIbn/Pw TYAWxUkSpelGodha3GqaASK7RK/5o/lhFOzF8CrSawp4m4QuTYx+4qnnMTZGrp1SaYUb 9ear5LjQcceQbaf6uCWUEzKfg0tRCB3JA5/vs8F7idi58c6qZ0RPR4NnwuCKef93a231 1XYrka7ZEHcZmagoye6tfs7mEOk9nbTTA5qTappZ4Fp9t9oHETtZazHwVfT6IXx4eeuH yREOaxvlLOvDX1OnpfBExA+U5SueA0d736HwA6sfqxFKSB65A872ZQFQBP6BHZlcqJw2 UZzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qkcTaITR; 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 q6si10502868edr.270.2020.06.16.08.48.32; Tue, 16 Jun 2020 08:48:32 -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=qkcTaITR; 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 S1732134AbgFPPsb (ORCPT + 15 others); Tue, 16 Jun 2020 11:48:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:42874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732418AbgFPPs3 (ORCPT ); Tue, 16 Jun 2020 11:48:29 -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 7D6E52071A; Tue, 16 Jun 2020 15:48:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592322508; bh=n6hO7kTq18ACOseJ0u75cyXpKuEp5UjJeYvXIuP/QJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qkcTaITRgF17kp3HnVo4QRsK8ksCW1NTq7JN/SwK4uiCykwAeSiYLDI217cCqqHIy Y3GASzgx3CcnPXJ/kfQ1RNITPyYEwetLp+5mU2pc6swJy6/4Pq8HZ8s7EMa9FBhJ+4 N3RrCiArE0TZvToTuIw+CR5un3LHItWWwDliwMG8= 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.7 120/163] remoteproc: Fall back to using parent memory pool if no dedicated available Date: Tue, 16 Jun 2020 17:34:54 +0200 Message-Id: <20200616153112.558164310@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616153106.849127260@linuxfoundation.org> References: <20200616153106.849127260@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 @@ -376,6 +376,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 */