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: 120254 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp25372qgn; Thu, 30 Nov 2017 08:50:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMbnMxud6yOPMGVwiFLt3S3clvPng4cmcVFVXJsRhUa2jy30CVSU74wa4vq87LhSZYpHrvDL X-Received: by 10.99.109.2 with SMTP id i2mr2986780pgc.269.1512060654977; Thu, 30 Nov 2017 08:50:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512060654; cv=none; d=google.com; s=arc-20160816; b=R21UTK9qMwdEa2w4vlxB9CcGFhxXEe/nYj4DUoLiiDMqXHyztFnYs0sBozqr3Z2xkr mrtz7ul4jFF5Ms1juZRJAZIlbcN43Zu5qj7z1O2PzIXbxVYca/llmbmLkRX71Tkgg0Tm AroJyresCFuWF2mvuglTpMLuKXdHhhPts68hhou10QtcuehVJhlHSXQK7IJg0VCHB2YN 4TSgCIJ3XGU388XvhYf5BRWSMQ/e4ekPZkYLRs4NjB3paDPzwoynctnQMj7tWWLVVxEc Vt0HYTa64c8uf1Hmf3DAiDYdFesmmLJ8KnLxYKeRYB41zHB3j1t0PycUJhbD2nlOGxgC krHg== 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:arc-authentication-results; bh=OGnuf/AzXk/2L6bJeDbKcupxE894ltzj74HbVsI9fig=; b=H0R4FZdWk+vKKHDWYhvKz4S4NKMN6uveH7xpScpMv8cZdiYtGtZFcg88GDmf4yj9Bm 4NY3aUmdMrkAOIPTlbWQgoUP1HShquS+ohwN8uorKwdHpWKhMJZUCAg32/l2dErE//Uo Xp2lt14dzo7TORku+3lfTfYtKVy5qL1pxB2NgqcguNepfmRJAsR6l9iMq1zw/2a4FTyS oFV13ZOO3UZ04mLxmeRI53XTCPrSwYFc9tAq9DEr0G5QiscK3lVOHZ7feaTO8HBrtw7i Dv6GUEVuc2VyJEIKI40sTIh+tDJRUwXh7rTOZ7mSr43v/YT0sAFiwLBvRvJsHJmcwxmJ 3Fgw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i11si3512549pfk.351.2017.11.30.08.50.54; Thu, 30 Nov 2017 08:50:54 -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 S1753552AbdK3Qux (ORCPT + 28 others); Thu, 30 Nov 2017 11:50:53 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- 1.9.1 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);