From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 23 Apr 2018 14:52:19 +0300 From: "Michael S. Tsirkin" Subject: Re: virtio remoteproc device Message-ID: <20180423144812-mutt-send-email-mst@kernel.org> References: <20180420194321-mutt-send-email-mst@kernel.org> <1d7df45a692b42bd9d70462e0af63ca9@SFHDAG7NODE2.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1d7df45a692b42bd9d70462e0af63ca9@SFHDAG7NODE2.st.com> To: Loic PALLARDY Cc: Anup Patel , "linux-remoteproc@vger.kernel.org" , Ohad Ben-Cohen , Bjorn Andersson , "virtualization@lists.linux-foundation.org" List-ID: On Mon, Apr 23, 2018 at 08:55:57AM +0000, Loic PALLARDY wrote: > > > > -----Original Message----- > > From: linux-remoteproc-owner@vger.kernel.org [mailto:linux-remoteproc- > > owner@vger.kernel.org] On Behalf Of Anup Patel > > Sent: Sunday, April 22, 2018 6:08 AM > > To: Michael S. Tsirkin > > Cc: linux-remoteproc@vger.kernel.org; Ohad Ben-Cohen > > ; Bjorn Andersson ; > > virtualization@lists.linux-foundation.org > > Subject: Re: virtio remoteproc device > > > > On Fri, Apr 20, 2018 at 10:23 PM, Michael S. Tsirkin > > wrote: > > > Hello! > > > I note the following in the serial console: > > > > > > if (is_rproc_serial(vdev)) { > > > /* > > > * Allocate DMA memory from ancestor. When a virtio > > > * device is created by remoteproc, the DMA memory is > > > * associated with the grandparent device: > > > * vdev => rproc => platform-dev. > > > */ > > > if (!vdev->dev.parent || !vdev->dev.parent->parent) > > > goto free_buf; > > > buf->dev = vdev->dev.parent->parent; > > > > > > /* Increase device refcnt to avoid freeing it */ > > > get_device(buf->dev); > > > buf->buf = dma_alloc_coherent(buf->dev, buf_size, &buf->dma, > > > GFP_KERNEL); > > > } > > > > > > Added here: > > > commit 1b6370463e88b0c1c317de16d7b962acc1dab4f2 > > > Author: Sjur Br�ndeland > > > Date: Fri Dec 14 14:40:51 2012 +1030 > > > > > > virtio_console: Add support for remoteproc serial > > > > > > > > > I am not familiar with rproc so I have a question: > > > why is it required to use coherent memory here, > > > and why through a grandparent device? > > > > I faced similar issue when I tried VirtIO RPMSG bus over > > VirtIO MMIO transport. > > > > Here's my fix for VirtIO RPMSG bus driver: > > https://patchwork.kernel.org/patch/10155145/ > > Hi Anup and Michael, > > I pushed a series to modify virtio device allocation in remoteproc. Please see [1]. > It allows to remove allocation based on "grand-parent" device in the case of virtio device allocated by remoteproc. > Virto_console patch missing, only virtio_rpmsg modification proposed. I can add it in next version. > > Regards, > Loic > > [1] https://lkml.org/lkml/2018/3/1/644 Thanks! Based on that patch, can remoteproc force VIRTIO_F_IOMMU_PLATFORM in features and then drop special-casing of dma completely? > > > > Regards, > > Anup > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: virtio remoteproc device Date: Mon, 23 Apr 2018 14:52:19 +0300 Message-ID: <20180423144812-mutt-send-email-mst@kernel.org> References: <20180420194321-mutt-send-email-mst@kernel.org> <1d7df45a692b42bd9d70462e0af63ca9@SFHDAG7NODE2.st.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <1d7df45a692b42bd9d70462e0af63ca9@SFHDAG7NODE2.st.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: Loic PALLARDY Cc: Ohad Ben-Cohen , Anup Patel , "virtualization@lists.linux-foundation.org" , "linux-remoteproc@vger.kernel.org" , Bjorn Andersson List-Id: virtualization@lists.linuxfoundation.org On Mon, Apr 23, 2018 at 08:55:57AM +0000, Loic PALLARDY wrote: > = > = > > -----Original Message----- > > From: linux-remoteproc-owner@vger.kernel.org [mailto:linux-remoteproc- > > owner@vger.kernel.org] On Behalf Of Anup Patel > > Sent: Sunday, April 22, 2018 6:08 AM > > To: Michael S. Tsirkin > > Cc: linux-remoteproc@vger.kernel.org; Ohad Ben-Cohen > > ; Bjorn Andersson ; > > virtualization@lists.linux-foundation.org > > Subject: Re: virtio remoteproc device > > = > > On Fri, Apr 20, 2018 at 10:23 PM, Michael S. Tsirkin > > wrote: > > > Hello! > > > I note the following in the serial console: > > > > > > if (is_rproc_serial(vdev)) { > > > /* > > > * Allocate DMA memory from ancestor. When a virtio > > > * device is created by remoteproc, the DMA memory is > > > * associated with the grandparent device: > > > * vdev =3D> rproc =3D> platform-dev. > > > */ > > > if (!vdev->dev.parent || !vdev->dev.parent->parent) > > > goto free_buf; > > > buf->dev =3D vdev->dev.parent->parent; > > > > > > /* Increase device refcnt to avoid freeing it */ > > > get_device(buf->dev); > > > buf->buf =3D dma_alloc_coherent(buf->dev, buf_size, &= buf->dma, > > > GFP_KERNEL); > > > } > > > > > > Added here: > > > commit 1b6370463e88b0c1c317de16d7b962acc1dab4f2 > > > Author: Sjur Br=E6ndeland > > > Date: Fri Dec 14 14:40:51 2012 +1030 > > > > > > virtio_console: Add support for remoteproc serial > > > > > > > > > I am not familiar with rproc so I have a question: > > > why is it required to use coherent memory here, > > > and why through a grandparent device? > > = > > I faced similar issue when I tried VirtIO RPMSG bus over > > VirtIO MMIO transport. > > = > > Here's my fix for VirtIO RPMSG bus driver: > > https://patchwork.kernel.org/patch/10155145/ > = > Hi Anup and Michael, > = > I pushed a series to modify virtio device allocation in remoteproc. Pleas= e see [1]. > It allows to remove allocation based on "grand-parent" device in the case= of virtio device allocated by remoteproc. > Virto_console patch missing, only virtio_rpmsg modification proposed. I c= an add it in next version. > = > Regards, > Loic > = > [1] https://lkml.org/lkml/2018/3/1/644 Thanks! Based on that patch, can remoteproc force VIRTIO_F_IOMMU_PLATFORM in features and then drop special-casing of dma completely? > > = > > Regards, > > Anup > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-remotep= roc" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html