From patchwork Thu Nov 30 16:46:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic PALLARDY X-Patchwork-Id: 10085355 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 5639B60234 for ; Thu, 30 Nov 2017 16:51:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BFE22A0F7 for ; Thu, 30 Nov 2017 16:51:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4106C2A201; Thu, 30 Nov 2017 16:51:32 +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=unavailable 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 C687A2A0F7 for ; Thu, 30 Nov 2017 16:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753188AbdK3Quw (ORCPT ); Thu, 30 Nov 2017 11:50:52 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:59150 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753522AbdK3QrP (ORCPT ); Thu, 30 Nov 2017 11:47:15 -0500 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vAUGiIDx001572; Thu, 30 Nov 2017 17:47:13 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2eexh9v2r9-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 30 Nov 2017 17:47: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 09B1534; Thu, 30 Nov 2017 16:47:13 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag7node2.st.com [10.75.127.20]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id DD4A9537C; Thu, 30 Nov 2017 16:47:12 +0000 (GMT) Received: from localhost (10.75.127.49) by SFHDAG7NODE2.st.com (10.75.127.20) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 30 Nov 2017 17:47:12 +0100 From: Loic Pallardy To: , CC: , , , , Loic Pallardy Subject: [PATCH v2 03/16] remoteproc: introduce rproc_add_carveout function Date: Thu, 30 Nov 2017 17:46:38 +0100 Message-ID: <1512060411-729-4-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1512060411-729-1-git-send-email-loic.pallardy@st.com> References: <1512060411-729-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG8NODE1.st.com (10.75.127.22) To SFHDAG7NODE2.st.com (10.75.127.20) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-11-30_05:, , 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 This patch introduces a new API to allow platform driver to register platform specific carveout regions. Signed-off-by: Loic Pallardy --- drivers/remoteproc/remoteproc_core.c | 22 ++++++++++++++++++++++ drivers/remoteproc/remoteproc_internal.h | 7 +++++++ include/linux/remoteproc.h | 2 ++ 3 files changed, 31 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index f23daf9..279320a 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -737,6 +737,7 @@ static int rproc_handle_carveout(struct rproc *rproc, carveout->dma = dma; carveout->da = rsc->da; carveout->release = rproc_release_carveout; + carveout->priv = (void *)CARVEOUT_RSC_ALLOCATED; list_add_tail(&carveout->node, &rproc->carveouts); @@ -751,6 +752,27 @@ static int rproc_handle_carveout(struct rproc *rproc, return ret; } +/** + * rproc_add_carveout() - register an allocated carveout region + * @rproc: rproc handle + * @mem: memory entry to register + * + * This function registers specified memory entry in @rproc carveouts list. + * Specified carveout should have been allocated before registering. + */ +int rproc_add_carveout(struct rproc *rproc, struct rproc_mem_entry *mem) +{ + if (!rproc || !mem) + return -EINVAL; + + mem->priv = (void *)CARVEOUT_EXTERNAL; + + list_add_tail(&mem->node, &rproc->carveouts); + + return 0; +} +EXPORT_SYMBOL(rproc_add_carveout); + /* * A lookup table for resource handlers. The indices are defined in * enum fw_resource_type. diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index c1077be..69b22ac 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -23,6 +23,13 @@ #include #include +/* Indicate carveout origin */ +enum carveout_src { + CARVEOUT_RSC = 0, + CARVEOUT_RSC_ALLOCATED = 1, + CARVEOUT_EXTERNAL = 2, +}; + struct rproc; /** diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 8780f2e..5bd5175 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -522,6 +522,8 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, int rproc_del(struct rproc *rproc); void rproc_free(struct rproc *rproc); +int rproc_add_carveout(struct rproc *rproc, struct rproc_mem_entry *mem); + int rproc_boot(struct rproc *rproc); void rproc_shutdown(struct rproc *rproc); void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type);