From patchwork Thu Nov 30 16:46:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Pallardy X-Patchwork-Id: 120245 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp23256qgn; Thu, 30 Nov 2017 08:48:53 -0800 (PST) X-Google-Smtp-Source: AGs4zMZV7nDoTkpCTmlbCvCfCq7CyyRCeVyl/6Edsx5PaSm5j5xmF+0kMTAAiZivsWc2og/dLfcA X-Received: by 10.101.81.69 with SMTP id g5mr2974979pgq.324.1512060533002; Thu, 30 Nov 2017 08:48:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512060532; cv=none; d=google.com; s=arc-20160816; b=OIy/eAOrYtQoVFTfZ5/PKGqM2nbg47M+LAQkUZ5366+KdB+GXfozMiH8H3Q71dHKV/ eNod5gwpvLPsTZZAFeIIG0H5bQxAkXlFG2Pn9SK+vDXhHJpV2BjnoBp0c4czu4XFoAYg E0J3ZyX/JWCr2EfGl7dKV8o1DUex/v1LtPuT4IhGe40OSsfiRJlQnF16UDJpR/jVffFX 2MZLSkLHGAdAOSi7VeJ3ZTH6Z2B5Wc1vkCm8BZhEzq8xBTuFfXXT9Ugbwlsqfx3u4mLs UkUriN++7ajFNlw0J+9HlwBlBTvkVayZVdM89nk4wcXuo5Q0SlPX06E0NnTTom5DIW4o NwDg== 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=nbeu/AlQf1VF9MZsHCHaGduLHMlJzfI974Qqm8AZHNE=; b=VrVxcC3OE4zB6xyIVx4SbkiO579vgd9P3q1qpSKFjKOMHZ4EMV+L21fDUE/k5cXUxH kwAz5OkvAkHV+CiqHV+W1ZPGo4ofOgv1CECA4bYpw+gnW3B5OIEWDGEx8QOIzt83FSr0 kLGOVMGIo0eaIu3Ay0PXMm3kclQmt6xsaBX4o9VJQpd61F+oToj1grErpFE5aKga6ySr yFXvG5RLFKFx3mTCQdds65t9M42gdQeQIqRNwme687VzraFprWQBIHKc3m1XKDs7VP1z SxdrTk71E3ATep76U1Et9UoJqF16xs2hthjcxw+60M6b+YObDh/yBiH3OFENYCFYpNPp b9Fw== 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 k14si3228247pgp.518.2017.11.30.08.48.52; Thu, 30 Nov 2017 08:48:52 -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 S1753638AbdK3Qsu (ORCPT + 28 others); Thu, 30 Nov 2017 11:48:50 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:41004 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753416AbdK3QrX (ORCPT ); Thu, 30 Nov 2017 11:47:23 -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 vAUGicPV017825; Thu, 30 Nov 2017 17:47:21 +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 2ef09hkt5q-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 30 Nov 2017 17:47:21 +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 0B85131; Thu, 30 Nov 2017 16:47:21 +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 E72B05379; Thu, 30 Nov 2017 16:47:20 +0000 (GMT) Received: from localhost (10.75.127.45) by SFHDAG7NODE2.st.com (10.75.127.20) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 30 Nov 2017 17:47:20 +0100 From: Loic Pallardy To: , CC: , , , , Loic Pallardy Subject: [PATCH v2 13/16] remoteproc: look-up memory-device for virtio device allocation Date: Thu, 30 Nov 2017 17:46:48 +0100 Message-ID: <1512060411-729-14-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.45] X-ClientProxiedBy: SFHDAG5NODE3.st.com (10.75.127.15) 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 parse existing carveout list to find a memory area matching on "vdevbuffer" name. If found, memory device will be used as parent for vdev creation, else rproc platform device will be used as today. Signed-off-by: Loic Pallardy --- drivers/remoteproc/remoteproc_core.c | 13 +++++++++++++ drivers/remoteproc/remoteproc_virtio.c | 2 +- include/linux/remoteproc.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) -- 1.9.1 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 6b5e2b2..9c12319 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -583,8 +583,11 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc, { struct device *dev = &rproc->dev; struct rproc_vdev *rvdev; + struct device *memdev = dev->parent; + struct rproc_mem_entry *carveout; int i, ret; static int index; + char name[16]; /* make sure resource isn't truncated */ if (sizeof(*rsc) + rsc->num_of_vrings * sizeof(struct fw_rsc_vdev_vring) @@ -637,6 +640,16 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc, list_add_tail(&rvdev->node, &rproc->rvdevs); + /* Find associated registered carveout. */ + /* Try dedicated vdev buffer pool. */ + snprintf(name, sizeof(name), "vdev%dbuffer", rvdev->index); + carveout = rproc_find_carveout_by_name(rproc, name); + + if (carveout && carveout->memdev) + memdev = &carveout->memdev->dev; + + rvdev->dev = memdev; + rproc_add_subdev(rproc, &rvdev->subdev, rproc_vdev_do_probe, rproc_vdev_do_remove); diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c index 2946348..1f7a444 100644 --- a/drivers/remoteproc/remoteproc_virtio.c +++ b/drivers/remoteproc/remoteproc_virtio.c @@ -303,7 +303,7 @@ static void rproc_virtio_dev_release(struct device *dev) int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id) { struct rproc *rproc = rvdev->rproc; - struct device *dev = &rproc->dev; + struct device *dev = rvdev->dev; struct virtio_device *vdev = &rvdev->vdev; int ret; diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index fb293d3..b3d6656 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -506,6 +506,7 @@ struct rproc_vdev { struct kref refcount; struct rproc_subdev subdev; + struct device *dev; unsigned int id; unsigned int index;