From patchwork Fri Oct 27 12:44:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Pallardy X-Patchwork-Id: 117318 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp728191qgn; Fri, 27 Oct 2017 05:45:48 -0700 (PDT) X-Google-Smtp-Source: ABhQp+R6ytYS6rfmIz5OI/kuT4CBIG7xqMEoaMGuXFCP1sfd4Tzh26VPcFt1t7fgu5MI4289iJsK X-Received: by 10.99.150.2 with SMTP id c2mr203595pge.386.1509108348074; Fri, 27 Oct 2017 05:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509108348; cv=none; d=google.com; s=arc-20160816; b=k7hXroZFQvfj8c4f80LpJk9D4y5e4mCApFABB2U+uwf/6QRG+2sl3nOKCMqxRZn+pI 2fTp1t8WEmDc9GobhLv6h3FYrEpJUyktCpaO1dJOYlG875MuGdvFC8z5TYTkvhkHuC1Q DLcysMUPZkAIgaGNb+66aIClgqgCC1jzqcXMhwp5tTEnvlNW/hte9UAMEHuIiHsF29H5 8IpU8MF6iqlScTDG9mNMJHs5v9GQUYJ432Bq8+1Bpi01dQII5rIV6ECNpXPbthTrYblQ nykpc4j7aOVBJAud0nmWrGl/KAhDDgHHJ612c0OjFme/GqDWzbsI48VD55KM5p9uR2NK FWng== 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=vA3i7ZEs2Dz9wt0MQ1WcUiKG6MPbrOb+i90VEdpY9h+afjRhQsHpV+tXdBQu0t19Ri TYGI1jfMWmb71ZDQ08WgJQk8Yb2YUlE+f3oUPjpK6YA8G82N3a/4/Sxuf26JP1lKfikk LNgzFalV11r7STLCb/hgpmAMcTMW2hOcRyyRW/Q7xLfsuUFiHmx4wGsXQIbOBiN85EUt FC7XygbU/zvt2BrczoTrq3SMYtTWGBE7WK9eKkavqM/QqYeGzXbDCbzHX54b7XHW9lMu wGGkRDOyy+2GFjEe26slUuWSimVp+4UT27cgEgBSpHqtJ6G0bRRE87K6J8bNFp6xyG0E G2JQ== 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 m3si4460994plt.232.2017.10.27.05.45.47; Fri, 27 Oct 2017 05:45:48 -0700 (PDT) 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 S1752776AbdJ0Mpp (ORCPT + 27 others); Fri, 27 Oct 2017 08:45:45 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:33908 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752412AbdJ0Mof (ORCPT ); Fri, 27 Oct 2017 08:44:35 -0400 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9RChee6000593; Fri, 27 Oct 2017 14:44:33 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2duapy8939-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 27 Oct 2017 14:44:33 +0200 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 AF57534; Fri, 27 Oct 2017 12:44:32 +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 9795326E0; Fri, 27 Oct 2017 12:44:32 +0000 (GMT) Received: from localhost (10.75.127.46) by SFHDAG7NODE2.st.com (10.75.127.20) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 27 Oct 2017 14:44:32 +0200 From: Loic Pallardy To: , CC: , , , , Loic Pallardy Subject: [PATCH 3/7] remoteproc: introduce rproc_add_carveout function Date: Fri, 27 Oct 2017 14:44:10 +0200 Message-ID: <1509108254-22296-4-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509108254-22296-1-git-send-email-loic.pallardy@st.com> References: <1509108254-22296-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG1NODE1.st.com (10.75.127.1) To SFHDAG7NODE2.st.com (10.75.127.20) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-27_07:, , 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);