From patchwork Thu Nov 30 16:46:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Pallardy X-Patchwork-Id: 120240 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp21763qgn; Thu, 30 Nov 2017 08:47:30 -0800 (PST) X-Google-Smtp-Source: AGs4zMaMdLIvWBL1wcVVtsqb4OT1yKBs0Efrv0VdXNCngX/1616nAiskWxzQRjZFO51fifSf+Whj X-Received: by 10.98.245.68 with SMTP id n65mr7240437pfh.113.1512060450718; Thu, 30 Nov 2017 08:47:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512060450; cv=none; d=google.com; s=arc-20160816; b=BDKf4RxnIBPVboCf3nAkhgKbEk7x8OAt7TGuj5OkZk0Ht9c5UMywg67pLKDDzIf1Yq W5zDJMnsyLStmPPwAC/H3Y7/B8Bo8UeUV+r8ykXVY+tueKveeJAzwqR/46rx1x07JnNS pBDYFAShNSOcs93JrnIOKP8GT/cQ14cJDLfCcXsn/j0jLdt560bbpCfxJdpcsNeDQif5 OL47ZYzRHBeW6lk+35rz0xGEvm6ImUrs+x41loVaVQ1BEjxl5NWp0Z4SjAI3UsIomGSW Nl/0kpLoDUCZG6L6Fg7LfLWrGKngM+sHG0WA+oe4x9EzY+fPrQkoqxoB1G7OVf0/+aA1 w8bw== 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=QHFWNJgin0uiwINiDmNHkFBjm3eRIXF5q03YmYwazCg=; b=QCXJnqQGMMCGhelyXQjwbBTtqsHtudA7laGPuwaWXOSnO+pKB8IhfySCM+BNnxjgux N9dwXHpV05xkCyPVfulobFDUXxqKNdHWjMB71CHetDCi2iwp6O5cI+z0sJQOGlq2K8lY 1QTILxd6mxZJUXAYoCf9nAXLwB+V3QrQzig1BaBVDchbMUH1W+/r1ti7f0OzMQhK2ylY 5atG+8B0BQ/5hsYSOUf5lJSPl61cxVAPnKhVqg07dzBKaXgh2VK2fmO6/lGjmRqCyAL9 FMttBCe0AUb4+0N44Eq/Zf+5MDmCFCVCX+9reLBVfgWWYtZty0TFtA+kBJy9n6GMd+kP +yjg== 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 q14si3194300pgv.770.2017.11.30.08.47.30; Thu, 30 Nov 2017 08:47:30 -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 S1753826AbdK3Qr1 (ORCPT + 28 others); Thu, 30 Nov 2017 11:47:27 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:40996 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753774AbdK3QrV (ORCPT ); Thu, 30 Nov 2017 11:47:21 -0500 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 vAUGiJ7o017787; Thu, 30 Nov 2017 17:47:20 +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 2ef09hkt5d-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 30 Nov 2017 17:47:19 +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 690BB34; Thu, 30 Nov 2017 16:47:19 +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 51443537A; Thu, 30 Nov 2017 16:47:19 +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:18 +0100 From: Loic Pallardy To: , CC: , , , , Loic Pallardy Subject: [PATCH v2 11/16] remoteproc: introduce rproc_find_carveout_by_name function Date: Thu, 30 Nov 2017 17:46:46 +0100 Message-ID: <1512060411-729-12-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: SFHDAG7NODE2.st.com (10.75.127.20) 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 provides a new function to find a carveout according to a name. If match found, this function returns a point on the corresponding carveout. Signed-off-by: Loic Pallardy --- drivers/remoteproc/remoteproc_core.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) -- 1.9.1 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 2b7effb..8d990b1 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -367,6 +367,42 @@ void *rproc_find_carveout_by_da(struct rproc *rproc, u64 da, int len) return va; } +/** + * rproc_find_carveout_by_name() - lookup the carveout region by a name + * @rproc: handle of a remote processor + * @name: carveout name to find + * + * Platform driver has the capability to register some pre-allacoted carveout + * (physically contiguous memory regions) before rproc firmware loading and + * associated resource table analysis. These regions may be dedicated memory + * regions internal to the coprocessor or specified DDR region with specific + * attributes + * + * This function is a helper function with which we can go over the + * allocated carveouts and return associated region characteristics like + * coprocessor address, length or processor virtual address. + * + * The function returns a valid pointer on carveout entry on success or NULL on failure. + */ +struct rproc_mem_entry * +rproc_find_carveout_by_name(struct rproc *rproc, char *name) +{ + struct rproc_mem_entry *carveout, *mem = NULL; + + if (!name) + return NULL; + + list_for_each_entry(carveout, &rproc->carveouts, node) { + /* Compare carveout and requested names */ + if (!strcmp(carveout->name, name)) { + mem = carveout; + break; + } + } + + return mem; +} + int rproc_alloc_vring(struct rproc_vdev *rvdev, int i) { struct rproc *rproc = rvdev->rproc;