Received: by 10.192.165.148 with SMTP id m20csp535231imm; Wed, 9 May 2018 17:59:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpXKwF75kbjRY2qTx3u7qfEpl87e3sghh4AoaRYqQ0f/MrVmwYpvlx90wtO3kRUHce387d3 X-Received: by 2002:a65:5504:: with SMTP id f4-v6mr22699596pgr.177.1525913987086; Wed, 09 May 2018 17:59:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525913987; cv=none; d=google.com; s=arc-20160816; b=TJf621z/Xa3nRKpx2Vah37unFanQjciXzb4yV0kv0S7n6wPidejdI0ck923Izu8Gh5 m5tElJf6V98q1F1Go5gJb2nNpug1FGKVPS3McLfQBxEdkla3wXgIchDHj5Ka03QffjTC DOa7OaBaEPhJ34SQwns/DIQBBKMTc1B1jDBSBeBiJF96CRb4xaHv6S9qkXav5ImfeLX0 vmIhIR0g5hGjClbAv2qicSGIn1T89lbRq5LajRkSlhrJp0pyhXBAT6uSYrpWBoj8QiCI zD1ZVQ+vHjCKk7CLURY1emcr1ew2WfqjsWSop57sAF7LuGpbHtwKGcjbGh8+olBVjY/r BFgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=HnZTY5ZaPl50gto9oniu3Uu0m8E400NHnjvymdGfAxY=; b=N1/YLJw4mLohCYGrbml/Ts0d6e3QL+3ot8zSRI9sMJ1VJ6KhINDmF47U0a1p7Ra61k O1ZZ40NpL0Gfn8aVJEXccbV46MrQPx+pjLktxT3KEajcuPp660hjoKyo8P1sv8/c04NI cTdD1pacu40JVIWynIyl/oIrecJCzMFOpeYv1DKkt1Bhb5pimtOwMQ1S6/gxKyeqlUzX mP1HCNnr1+dZA/aPw3N6R0SDkvUkg0Olc1ojUXv4vjPbJnQW9cKbRGXGcFpLuxfqkkob WL3BPB3J8NSey3i2CJCoxqRAqAY0ReFe0EO06ZbsqEbywextGlNZ1yxJ0z059p193n2M 0xwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CL4/najJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h62si27847485pfg.308.2018.05.09.17.59.32; Wed, 09 May 2018 17:59:47 -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; dkim=pass header.i=@linaro.org header.s=google header.b=CL4/najJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966067AbeEJA7X (ORCPT + 99 others); Wed, 9 May 2018 20:59:23 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:33443 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966023AbeEJA7V (ORCPT ); Wed, 9 May 2018 20:59:21 -0400 Received: by mail-pl0-f65.google.com with SMTP id n10-v6so270907plp.0 for ; Wed, 09 May 2018 17:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=HnZTY5ZaPl50gto9oniu3Uu0m8E400NHnjvymdGfAxY=; b=CL4/najJN+PkoRUoRGL3u6C7/DfMK37cz2U5UxmNAr8wqw+loHndoBfdPCCG25El6h I+p/TViZ1LVr5ffL/I/LDIhv/pMqCkOXRtc0imy5H7f4g2z/aAx6THTEch1958zuj0oC 2PcxvsijtOvziFcxp/hommmv8Ib+0Kt6WSWmQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=HnZTY5ZaPl50gto9oniu3Uu0m8E400NHnjvymdGfAxY=; b=HrrODkjifuNTnv9mVwwa8mfCKMcg1It0pOD9e9/xbi14R9/35D4GGAR6kUHZ3YK2rG 9lFJ38qKoyKsHJMrZYDfbOC2pAiUZLXWURm2t1MlkEps+AOjKmD3DzRkcY4ddUlUQWsT Q0yAldFVmPccLn/GFCFw63m3j601mIMiauUoeNI3OkzHzOXVqa2HqbUPyL4wMaOiaCsB g5Zk18+VfAT3bljc1Mxw4E1w9QVpOglIyyJmfXZe6nm21rpWA+mmB/KfDUhtOheqhjw9 IQ9At+i2VmY7CtrTAHoGZwsdDi4IFsUh1aMMDH3FyTtMHDgSLYIFkaalgGZvrzGPl79V gI3Q== X-Gm-Message-State: ALQs6tDbvD0Hz91GC5Vctixp8SivXuEF/cfkg4dT8GHdLMk2qw+2b2cP RjNP2Gx2pt6HHdzRrmBsOCWEnw== X-Received: by 2002:a17:902:680e:: with SMTP id h14-v6mr46117251plk.90.1525913961395; Wed, 09 May 2018 17:59:21 -0700 (PDT) Received: from builder (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id u14sm60773702pfa.101.2018.05.09.17.59.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 May 2018 17:59:20 -0700 (PDT) Date: Wed, 9 May 2018 17:59:18 -0700 From: Bjorn Andersson To: Loic Pallardy Cc: ohad@wizery.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, arnaud.pouliquen@st.com, benjamin.gaignard@linaro.org Subject: Re: [PATCH v3 10/13] remoteproc: modify vring allocation to support pre-registered region Message-ID: <20180510005918.GI29093@builder> References: <1519921440-21356-1-git-send-email-loic.pallardy@st.com> <1519921440-21356-11-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1519921440-21356-11-git-send-email-loic.pallardy@st.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Regards, Bjorn