Received: by 10.192.165.148 with SMTP id m20csp543288imm; Wed, 9 May 2018 18:09:34 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr0g8ksdOT2Kgo9KaCqEnwLVgt7BRgZPTZYOe/NNRJZqoHuw8xAkmQFkaCrw0Lvm7M96Me4 X-Received: by 2002:a65:62c2:: with SMTP id m2-v6mr38003823pgv.164.1525914574842; Wed, 09 May 2018 18:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525914574; cv=none; d=google.com; s=arc-20160816; b=umlGXKQHG4RnnYUXoqs+GvzDTmGAjSbFdHYOCzXYX0vsEzodA5PhYUZgE/2fGkLPfq 4ng9EZRh/Wq5SijzYlDI2rsUMxinnkMo50krNoLsagL+88PpyDQeem6TCR6RdSJWEYzI HnKZXqGlPzpJPI9ObdZMdqd4Gpas4vv+D8mL9chm2eEKddqEo/vNGsowFxd2KEOBvcVF EwVGa+9k/EkBqGpeLjhFBLkzFpISUYVy5uRCIKXJOkPmaDo15Prkv2bgHkpFkQQ+hHea 3BK3694LlrVFiQJdA+bi50g2lvba0nRMyab6COJTahSTkNIscRqr0259y8k05yNIp0rK KcOg== 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=/Qain1xQyzXNDKem+knRm7B82XNsLXMuMH4+ZsgS7lI=; b=FTdIgben7vng//nSaBIgpucT9h+GXrSV+UgrCBdUmcx9BBY0gtYg4zxEjOv6HD1guc ft/LSxHZH9GrqtFtGIOM1A0fs8uMK3/6IeTbfrKEHQ0F9OwdyM60fV9bkcULFs+utsjZ 1iX7kdI90lqvtqIogmvWbQj2T5nZ1+VNAnGT2zEMUQt1iiTt2F8EFBSTSyoUm49ga8CH Uu6WOhcnu7kzKEUtdVtHXla1vj4mlCDJfBweEw0jXSFk/bHcnP/JYwf4tdIK+NfOa0WL YeM5/Z/wPOwQ5KMkHuCVGShh2KJD9y3WKaf1gXdZVbshV13e5hurMGsnIPMcUiIsJpKC 35IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z9Pz64mI; 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 r15-v6si22545079pgs.292.2018.05.09.18.09.18; Wed, 09 May 2018 18:09:34 -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=Z9Pz64mI; 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 S966079AbeEJBGG (ORCPT + 99 others); Wed, 9 May 2018 21:06:06 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:40259 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966013AbeEJBGE (ORCPT ); Wed, 9 May 2018 21:06:04 -0400 Received: by mail-pf0-f193.google.com with SMTP id f189-v6so221052pfa.7 for ; Wed, 09 May 2018 18:06:04 -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=/Qain1xQyzXNDKem+knRm7B82XNsLXMuMH4+ZsgS7lI=; b=Z9Pz64mIRZ3cnNTDR9n90V03b9kvQcjkcxyirneiVRla6ihL71s1+1IwLjFYS4AIqe xeRqQZyOXaAx8IKx35wBUJygmeq0dW0YoTERwAGxmPLQbQ97cbiyjE99rcDGecTz1n1b +diswXLTlRmXBFcZ156zu5xsmkzOOBciUQWx4= 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=/Qain1xQyzXNDKem+knRm7B82XNsLXMuMH4+ZsgS7lI=; b=JkvOMBoTKRBVRg+YBJsbpmLnNgP4RMFG7OzBF3c/+xgSaWqJdcJF/onRqOVbTyYX/P uJ8PEhu/jKMWkU2lajkWlB+vL7h18IihkdaOJcE4vZoeqJMPSgoeMUV7ZNZveKmNl6Yv FFKN2j8GTNAuoKtwaaboI2HsG12HVeiqklKziOQlNKcfWWuhf/JKIUHGlJi+wy8IGSR/ XppnLnEL/cD9BimDyX0939z+85G0wVsxFSPHu9ieKwhZ5cyII0wMJq3KoSv7AfKrFeXs YKZAZlTv0YIYabDHMwh81JMVeaS9ivNosUZA9dKapn7sPJ2vlOkHINFrTuPYUwbIvT9v m0TQ== X-Gm-Message-State: ALQs6tDDcXgfz09EYiuBemN2DeCybAb7wlP0vWWS2JGYqWSptybKrBbj IQhI6L4xXRezM/5kg8cAVQgEsg== X-Received: by 2002:a63:8dca:: with SMTP id z193-v6mr37172253pgd.418.1525914364229; Wed, 09 May 2018 18:06:04 -0700 (PDT) Received: from builder (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id w19-v6sm41027256pgv.59.2018.05.09.18.06.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 May 2018 18:06:03 -0700 (PDT) Date: Wed, 9 May 2018 18:06:01 -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 11/13] remoteproc: create vdev subdevice with specific dma memory pool Message-ID: <20180510010601.GJ29093@builder> References: <1519921440-21356-1-git-send-email-loic.pallardy@st.com> <1519921440-21356-12-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-12-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: > @@ -479,6 +481,41 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc, > goto unwind_vring_allocations; > } > > + /* Initialise vdev subdevice */ > + snprintf(name, sizeof(name), "vdev%dbuffer", rvdev->index); > + rvdev->dev.parent = rproc->dev.parent; > + dev_set_name(&rvdev->dev, "%s#%s", dev_name(rvdev->dev.parent), name); > + dev_set_drvdata(&rvdev->dev, rvdev); > + dma_set_coherent_mask(&rvdev->dev, DMA_BIT_MASK(32)); > + > + ret = device_register(&rvdev->dev); > + if (ret) > + goto unwind_vring_allocations; > + > + /* Try to find dedicated vdev buffer carveout */ > + carveout = rproc_find_carveout_by_name(rproc, name); > + > + if (carveout) { > + phys_addr_t pa; > + > + if (carveout->va) { > + dev_warn(dev, "vdev %d buffer carveout already mapped\n", > + rvdev->index); > + pa = rproc_va_to_pa(carveout->va); > + } else { > + /* Use dma address as carveout no memmapped yet */ > + pa = (phys_addr_t)carveout->dma; > + } > + > + /* Associate vdev buffer memory pool to vdev subdevice */ > + ret = dmam_declare_coherent_memory(&rvdev->dev, pa, > + carveout->da, > + carveout->len, > + DMA_MEMORY_EXCLUSIVE); > + if (ret < 0) > + goto unregister_device; > + } > + So with this there will be one more device between rproc->dev and the virtio dev, for the sake of memory management. So e.g. a rpmsg device will still need to allocate memory from dev->parent->parent; which now possibly has a specific dma_mem. Is it not possible to assign the memory to the vdev->dev and allow the virtio devices can allocate memory from their parent device? Regards, Bjorn