From patchwork Wed Feb 15 20:18:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Pallardy X-Patchwork-Id: 94037 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2196918qgi; Wed, 15 Feb 2017 12:22:20 -0800 (PST) X-Received: by 10.99.139.68 with SMTP id j65mr41107935pge.64.1487190140139; Wed, 15 Feb 2017 12:22:20 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o24si4704682pgc.285.2017.02.15.12.22.19; Wed, 15 Feb 2017 12:22:20 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751926AbdBOUUC (ORCPT + 25 others); Wed, 15 Feb 2017 15:20:02 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:52878 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751831AbdBOUTP (ORCPT ); Wed, 15 Feb 2017 15:19:15 -0500 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by m0046037.ppops.net (8.16.0.11/8.16.0.11) with SMTP id v1FK9jp0023375; Wed, 15 Feb 2017 21:19:13 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-.pphosted.com with ESMTP id 28hs8wrg71-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 15 Feb 2017 21:19:13 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 516B14D; Wed, 15 Feb 2017 20:19:12 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas2.st.com [10.75.90.16]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2F41045E8; Wed, 15 Feb 2017 20:19:12 +0000 (GMT) Received: from localhost (10.129.5.225) by webmail-eu.st.com (10.75.90.13) with Microsoft SMTP Server (TLS) id 8.3.444.0; Wed, 15 Feb 2017 21:19:11 +0100 From: Loic Pallardy To: , , CC: , , , , , , Subject: [PATCH v4 2/2] remoteproc: core: don't allocate carveout if pa is defined Date: Wed, 15 Feb 2017 21:18:49 +0100 Message-ID: <1487189929-24196-3-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1487189929-24196-1-git-send-email-loic.pallardy@st.com> References: <1487189929-24196-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-15_10:, , signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remoteproc doesn't check if firmware requests fixed addresses for carveout regions. Current assumption is that platform specific driver is in charge of coprocessor specific memory region allocation and remoteproc core doesn't have to handle them. If a pa is specified in firmware resource table, remoteproc core doesn't have to perform any allocation. Access to carveout will be done thanks to rproc_da_to_pa function, which will provide virtual address on carveout region allocated by platform specific driver. Signed-off-by: Loic Pallardy Acked-by: Hugues Fruchet Tested-by: Hugues Fruchet --- Changes from V3: - Fix Bjorn's remark: Don't check if da is already specified in resource table. Because this doesn't mean buffer has been allocated, but that a specific da is requested for IOMMU configuration. - Rebase on rproc-next branch --- drivers/remoteproc/remoteproc_core.c | 5 +++++ 1 file changed, 5 insertions(+) -- 1.9.1 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 3dabb20..74ad2d0 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -622,6 +622,11 @@ static int rproc_handle_carveout(struct rproc *rproc, dev_dbg(dev, "carveout rsc: name: %s, da 0x%x, pa 0x%x, len 0x%x, flags 0x%x\n", rsc->name, rsc->da, rsc->pa, rsc->len, rsc->flags); + if (rsc->pa != FW_RSC_ADDR_ANY) { + dev_dbg(dev, "carveout already allocated by low level driver\n"); + return 0; + } + carveout = kzalloc(sizeof(*carveout), GFP_KERNEL); if (!carveout) return -ENOMEM;