Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4637051imm; Mon, 14 May 2018 10:19:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpaF0zmo3XEQ5WlZDmaV1M43SCejltQlscsTj9XXUGaZvNKdV1Z/y2zLXSEWF5GJg/E8+2u X-Received: by 2002:a63:3d0a:: with SMTP id k10-v6mr9367420pga.11.1526318398007; Mon, 14 May 2018 10:19:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526318397; cv=none; d=google.com; s=arc-20160816; b=kbTREOT4Qh7BbJ1I1RrDjbi/5zjSbIXZpvlqgTjPpujWcy/3Re2imiGfyotXPs+htg vMeP8H6SGNvmVb+/VPABqsCgUpWWFCpB55ycBK2JrCwGQOVnoG4MDYWPcGS0onI2RiGS RS1l1Hm4IMnmwI7oXE1rBFg1yyVLG2VxHs/2yfKO1kLT2RAbB8c+SqlwiELwAVGrOVDs 0CZ7sSHB+/N0NOGet/IwxMLU/oe59221I1waRSfIs5JChKqDk/vwoaCVOIS6NzsDvMhx 8tsZ+K/vomA14MAV9iwEW289H2Gjwi58JKUKwc8rOjQqkiDO2lU2vxLTAQcEzwxu/bbf +Pgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from :arc-authentication-results; bh=pC6JZe1HJx+DVoaenfYb2jJBfmD5CBApI3kAtC4swRw=; b=Cek3JVWrrJhvVdmIh8wwbbFXLRv/bMfzmL/JpH8ehh/9PRwOk3ZTbc9BpCqqqdwWL1 S0kF4h21Z/HgV2YlQBqA5B8VP9s07GdEGbgAW4iY7je9GZ8M1RA/dcR8T73ttytzSIWV zlNfGWmEywBmNGqSyG2ux97sB1MhGk1JYO04GjhGXP5eX5Tehq/n/ywtATe6DPP1ytUn sKDmnhqM5rxYXvpVTfvCRnZJfFQE2Vvm9kE21vpLpgqkVSLo1IHC8sA7DbZxFou5V76P A1eO/NetGLtjEYO6Yt4THTgGckJZi37ZPlOamqVTVITvaU1f2Q5xCEIMaeYD05PsUlRo tumw== 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 61-v6si6757629plf.63.2018.05.14.10.19.43; Mon, 14 May 2018 10:19:57 -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 S1753765AbeENPn2 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 14 May 2018 11:43:28 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:14925 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752089AbeENPn0 (ORCPT ); Mon, 14 May 2018 11:43:26 -0400 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w4EFYNAr024878; Mon, 14 May 2018 17:43:24 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2hwp1t32ya-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 14 May 2018 17:43:24 +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 0C07B34; Mon, 14 May 2018 15:43:24 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag3node2.st.com [10.75.127.8]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id DFFB759B2; Mon, 14 May 2018 15:43:23 +0000 (GMT) Received: from SFHDAG7NODE2.st.com (10.75.127.20) by SFHDAG3NODE2.st.com (10.75.127.8) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 14 May 2018 17:43:23 +0200 Received: from SFHDAG7NODE2.st.com ([fe80::d548:6a8f:2ca4:2090]) by SFHDAG7NODE2.st.com ([fe80::d548:6a8f:2ca4:2090%20]) with mapi id 15.00.1347.000; Mon, 14 May 2018 17:43:23 +0200 From: Loic PALLARDY To: Bjorn Andersson CC: "ohad@wizery.com" , "linux-remoteproc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Arnaud POULIQUEN , "benjamin.gaignard@linaro.org" Subject: RE: [PATCH v3 10/13] remoteproc: modify vring allocation to support pre-registered region Thread-Topic: [PATCH v3 10/13] remoteproc: modify vring allocation to support pre-registered region Thread-Index: AQHTsXm+ipVfNWWG40m907UTzmUTsqQob8QAgAdhtbA= Date: Mon, 14 May 2018 15:43:23 +0000 Message-ID: References: <1519921440-21356-1-git-send-email-loic.pallardy@st.com> <1519921440-21356-11-git-send-email-loic.pallardy@st.com> <20180510005918.GI29093@builder> In-Reply-To: <20180510005918.GI29093@builder> Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.75.127.51] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-14_04:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Bjorn Andersson [mailto:bjorn.andersson@linaro.org] > Sent: Thursday, May 10, 2018 2:59 AM > To: Loic PALLARDY > Cc: ohad@wizery.com; linux-remoteproc@vger.kernel.org; linux- > kernel@vger.kernel.org; Arnaud POULIQUEN ; > benjamin.gaignard@linaro.org > Subject: Re: [PATCH v3 10/13] remoteproc: modify vring allocation to support > pre-registered region > > On Thu 01 Mar 08:23 PST 2018, Loic Pallardy wrote: > [..] > > @@ -265,23 +269,45 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, > int i) > > struct device *dev = &rproc->dev; > > struct rproc_vring *rvring = &rvdev->vring[i]; > > struct fw_rsc_vdev *rsc; > > - dma_addr_t dma; > > - void *va; > > int ret, size, notifyid; > > + struct fw_rsc_carveout rsc_carveout; > > + struct rproc_mem_entry *mem; > > > > /* actual size of vring (in bytes) */ > > size = PAGE_ALIGN(vring_size(rvring->len, rvring->align)); > > > > - /* > > - * Allocate non-cacheable memory for the vring. In the future > > - * this call will also configure the IOMMU for us > > - */ > > - va = dma_alloc_coherent(dev->parent, size, &dma, GFP_KERNEL); > > - if (!va) { > > - dev_err(dev->parent, "dma_alloc_coherent failed\n"); > > + rsc = (void *)rproc->table_ptr + rvdev->rsc_offset; > > + > > + /* Create virtual firmware carveout resource */ > > + rsc_carveout.da = rsc->vring[i].da; > > + rsc_carveout.pa = FW_RSC_ADDR_ANY; > > + rsc_carveout.len = size; > > + rsc_carveout.flags = 0; > > + rsc_carveout.reserved = 0; > > + snprintf(rsc_carveout.name, sizeof(rsc_carveout.name), > "vdev%dvring%d", > > + rvdev->index, i); > [..] > > @@ -437,6 +460,7 @@ static int rproc_handle_vdev(struct rproc *rproc, > struct fw_rsc_vdev *rsc, > > > > rvdev->id = rsc->id; > > rvdev->rproc = rproc; > > + rvdev->index = index++; > > This index isn't deterministic over multiple remoteproc instances and > multiple restarts of the remoteproc. It probably needs to be based > generated based on the ordering in the resource table. Yes it was my intention, but static use make it wrong. I'll revisit this point Regards, Loic > > Regards, > Bjorn