From patchwork Wed Dec 7 20:33:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic PALLARDY X-Patchwork-Id: 9465197 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 27BD06074E for ; Wed, 7 Dec 2016 20:34:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2929528427 for ; Wed, 7 Dec 2016 20:34:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DD2E28560; Wed, 7 Dec 2016 20:34:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92CFB284D0 for ; Wed, 7 Dec 2016 20:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932513AbcLGUe5 (ORCPT ); Wed, 7 Dec 2016 15:34:57 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:52189 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753246AbcLGUe5 (ORCPT ); Wed, 7 Dec 2016 15:34:57 -0500 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id uB7KYZ67026369; Wed, 7 Dec 2016 21:34:35 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-.pphosted.com with ESMTP id 2756tnbu3m-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 07 Dec 2016 21:34:35 +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 57DFD31; Wed, 7 Dec 2016 20:34:34 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3BED34E98; Wed, 7 Dec 2016 20:34:34 +0000 (GMT) Received: from localhost (10.129.5.76) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.294.0; Wed, 7 Dec 2016 21:34:33 +0100 From: Loic Pallardy To: , , , CC: , , Subject: [PATCH v1 3/3] remoteproc: core: don't allocate carveout if pa or da are defined Date: Wed, 7 Dec 2016 21:33:46 +0100 Message-ID: <1481142826-15528-4-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1481142826-15528-1-git-send-email-loic.pallardy@st.com> References: <1481142826-15528-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 X-Originating-IP: [10.129.5.76] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-12-07_06:, , signatures=0 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 da or 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 --- drivers/remoteproc/remoteproc_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index f0f6ec1..022f9a6 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -625,6 +625,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 || rsc->da != 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;