Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4639426imm; Mon, 14 May 2018 10:22:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrmLAh2+2H7I/W+hISPAke+YFQH6AyP7gequNGPrsUr4dltVKEbUVtA14ul36qx//eCqt1g X-Received: by 2002:a65:590e:: with SMTP id f14-v6mr9205996pgu.282.1526318523658; Mon, 14 May 2018 10:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526318523; cv=none; d=google.com; s=arc-20160816; b=xe2RccHdAK+4L7lVnq3ylmUROYkFoXhdEw9KsMGZkcU76wXExx1beek9LDtA4B/eUG nwS7K/WNmyFi5U5J7wLLpabRO4OEVD5c2pgDxc8su6TNyZzDOT/lyMTqTplaBTtXdy6P LQkW+KexOwy+H5hcpqgF0Ke9zUASVsqG9T/VRrtLVSgxgPln+clJ+2vI9VaH9kxQwm2+ ofnt7ClvthbDQbr5L1cflE89fh8kcz5K8g/nS1OF1Bv9HpMQsjSjMvLFEt00w1RqA4kQ H1G4EfOTFzmL8uyojizD889Yn1JPVCySTcthyHP7iEuCWkJ54Q7jYP8qu7oST7X4rmvC SMRA== 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=Icx4erN1Tn1GCew/kej71tCV/FMDk/NQRH3YcyLQcsw=; b=T82l9dkKC5UQ52PBA6GP+64j8VhxqQNkTF9Sq13+LULmjffvM1lIcUc7wQKJaVHYoH Svv+0y1OrHAS9yJ76ppvCGhO7bGUkIgNXY/UqdilYwTHipPLlmNLJfx7dxFV9qqGRwv9 YwEFg+5VLlyb+48sLBr4T4YtuuGGtwVMtkGGh6QWW/rwp6YXLsBtGsbYlicHX1urXneI wHdhGW8/hOEiewiHYrVY1MtvIEYtOQu64XMF6yZQYBi/ZlqNT867+sos7I/eGam5AHkd 3ZL/UooazqUQ3trMyVgyO0WJLqKd5m/wM3C7gLi41+yuCdJXlnFlNJb4r63KNqavB59b 1F4Q== 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 t14-v6si7866202pgn.521.2018.05.14.10.21.49; Mon, 14 May 2018 10:22:03 -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 S1754805AbeENP5Q convert rfc822-to-8bit (ORCPT + 99 others); Mon, 14 May 2018 11:57:16 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:31002 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752973AbeENP5N (ORCPT ); Mon, 14 May 2018 11:57:13 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w4EFsZRh015208; Mon, 14 May 2018 17:57:12 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2hwnd6kdmf-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 14 May 2018 17:57:12 +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 6B3BE3A; Mon, 14 May 2018 15:57:09 +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 41FD95AEA; Mon, 14 May 2018 15:57:09 +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:57:08 +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:57:08 +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 11/13] remoteproc: create vdev subdevice with specific dma memory pool Thread-Topic: [PATCH v3 11/13] remoteproc: create vdev subdevice with specific dma memory pool Thread-Index: AQHTsXm/k4UVGYSNwU6IBCvhmFj8G6QocaSAgAdg7BA= Date: Mon, 14 May 2018 15:57:08 +0000 Message-ID: <1964b4422c324eb9a7d712ad1d278b55@SFHDAG7NODE2.st.com> References: <1519921440-21356-1-git-send-email-loic.pallardy@st.com> <1519921440-21356-12-git-send-email-loic.pallardy@st.com> <20180510010601.GJ29093@builder> In-Reply-To: <20180510010601.GJ29093@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 3:06 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 11/13] remoteproc: create vdev subdevice with > specific dma memory pool > > 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. Yes it is a new sub device between virtio dev and rproc dev, but this device owns memory region dedicated to this vdev So, rpmsg device will allocate from dev->parent, not from dev->parent->parent. > > Is it not possible to assign the memory to the vdev->dev and allow the > virtio devices can allocate memory from their parent device? No sure to catch your point. Who should be the parent device? Rproc dev itself? Doesn't fit well if you want to handle 2 different vdev with specific memory region for each of them. Regards, Loic > > Regards, > Bjorn