Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5090485ybv; Tue, 11 Feb 2020 09:01:22 -0800 (PST) X-Google-Smtp-Source: APXvYqwPEGxh0iWH1rMvaVaGJFP8cqJqXDh7X19hRe8jbWLYb8u6dzHeJINZIx+Cgl4RPz4jyso1 X-Received: by 2002:a9d:7498:: with SMTP id t24mr6118579otk.290.1581440481686; Tue, 11 Feb 2020 09:01:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581440481; cv=none; d=google.com; s=arc-20160816; b=lb+aSrkOZExoq5CPnZnj+ubUIaap6buCoQU/v0J+rREEOxBAxWIK3rN8hKfx5rs0Gi k91uM7LHZAKt0vsAOPinSECzTh0CBysmP5A/i4ByQS0zNwmOkb1UJ44nH0pwTHsc0n3k euW99IglToHpW1PP1EBRPCcLUEC3m7KSTkaQWa0YpTPpHvG2pLdakSjCa6E0I4Y1Xx+B E+/gHrQRIqOca1fOTqiwO6zCwREF1CXNtI/JnOXWoIAp+DzGxAFYfMcgJFHLsEfbDJLb GHF96co9WUbQ6AFso+horuJEsLVw+6kb5/xDVHHLJx4tc+754RJBKaQJCd+rFtYAd8Iq 16Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=hLpMhA/DQOSEGxT1JMEcmi7MPVEfve9uqOLxpyOK9iw=; b=obSN2h9E2HVY9SV3nSkZOawfvaX+16in02s4qKXu0pOjrTqWjG802cxrj1RwkZOCkJ GFMMztHxij9/+reeqDx2khbcgWOo6va+DuFlfqAedyrZIi7bgLuQHoi1JZwRVwKEUfmK WRl7Nvf/zgtJNFyMbwu01+G3ZN2atrsMaCuZpSDsUbUNT144V59IjkHPI/qdlgvgOT9p uPTMixhB4mFg8vAZKxl4SW+3bhqTwsHNCN/Y08vA20PXHZt+GrfYO2kHwOyAMqlHgSTu KLAwI7rVQa2IKDtTEwtvE9lJ6mya/ufNfy3mjIANBvghVb3AFLVAMP4KzsS7akQNAlsy ptHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=arJjL3en; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m7si2387572otk.73.2020.02.11.09.01.04; Tue, 11 Feb 2020 09:01:21 -0800 (PST) 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=@ti.com header.s=ti-com-17Q1 header.b=arJjL3en; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730511AbgBKPWc (ORCPT + 99 others); Tue, 11 Feb 2020 10:22:32 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:58030 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730407AbgBKPVz (ORCPT ); Tue, 11 Feb 2020 10:21:55 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 01BFLsj5022397; Tue, 11 Feb 2020 09:21:54 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1581434514; bh=hLpMhA/DQOSEGxT1JMEcmi7MPVEfve9uqOLxpyOK9iw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=arJjL3enOL/fC1Y+nmIZOmxNECLMIGX3X9lV1KmOC+De/eI1VxKV9/URgKCsfeaE/ s0VCoFSJpbxTG3SpMhozcx9OJh53qIRhWn0hdCeKbKaab2eLN0O8Sj+SXfEJDsfLeC SArKMD5sX6t505ud1qzQDF39ecjtfwV34cBL3wq0= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 01BFLs5i059335; Tue, 11 Feb 2020 09:21:54 -0600 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Tue, 11 Feb 2020 09:21:54 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Tue, 11 Feb 2020 09:21:54 -0600 Received: from sokoban.bb.dnainternet.fi (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 01BFLbki020993; Tue, 11 Feb 2020 09:21:52 -0600 From: Tero Kristo To: , , , CC: , , , Suman Anna , Tero Kristo Subject: [PATCHv6 06/14] remoteproc/omap: Initialize and assign reserved memory node Date: Tue, 11 Feb 2020 17:21:17 +0200 Message-ID: <20200211152125.23819-7-t-kristo@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200211152125.23819-1-t-kristo@ti.com> References: <20200211152125.23819-1-t-kristo@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suman Anna The reserved memory nodes are not assigned to platform devices by default in the driver core to avoid the lookup for every platform device and incur a penalty as the real users are expected to be only a few devices. OMAP remoteproc devices fall into the above category and the OMAP remoteproc driver _requires_ specific CMA pools to be assigned for each device at the moment to align on the location of the vrings and vring buffers in the RTOS-side firmware images. So, use the of_reserved_mem_device_init/release() API appropriately to assign the corresponding reserved memory region to the OMAP remoteproc device. Note that only one region per device is allowed by the framework. Signed-off-by: Suman Anna Signed-off-by: Tero Kristo --- v6: - made memory-regions optional - added multi-line warning if memory-regions are not provided drivers/remoteproc/omap_remoteproc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c index 0846839b2c97..a0711c1035d3 100644 --- a/drivers/remoteproc/omap_remoteproc.c +++ b/drivers/remoteproc/omap_remoteproc.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -480,14 +481,23 @@ static int omap_rproc_probe(struct platform_device *pdev) if (ret) goto free_rproc; + ret = of_reserved_mem_device_init(&pdev->dev); + if (ret) { + dev_warn(&pdev->dev, "device does not have specific CMA pool.\n"); + dev_warn(&pdev->dev, "Typically this should be provided,\n"); + dev_warn(&pdev->dev, "only omit if you know what you are doing.\n"); + } + platform_set_drvdata(pdev, rproc); ret = rproc_add(rproc); if (ret) - goto free_rproc; + goto release_mem; return 0; +release_mem: + of_reserved_mem_device_release(&pdev->dev); free_rproc: rproc_free(rproc); return ret; @@ -499,6 +509,7 @@ static int omap_rproc_remove(struct platform_device *pdev) rproc_del(rproc); rproc_free(rproc); + of_reserved_mem_device_release(&pdev->dev); return 0; } -- 2.17.1 -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki