Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9d516aa

Browse files
solbjorngregkh
authored andcommitted
virtio: virtio_console: fix DMA memory allocation for rproc serial
Since commit086d087 ("remoteproc: create vdev subdevice withspecific dma memory pool"), every remoteproc has a DMA subdevice("remoteprocX#vdevYbuffer") for each virtio device, which inheritsDMA capabilities from the corresponding platform device. This allowedto associate different DMA pools with each vdev, and required fromvirtio drivers to perform DMA operations with the parent device(vdev->dev.parent) instead of grandparent (vdev->dev.parent->parent).virtio_rpmsg_bus was already changed in the same merge cycle withcommitd999b62 ("rpmsg: virtio: allocate buffer from parent"),but virtio_console did not. In fact, operations using the grandparentworked fine while the grandparent was the platform device, but sincecommitc774ad0 ("remoteproc: Fix and restore the parentinghierarchy for vdev") this was changed, and now the grandparent deviceis the remoteproc device without any DMA capabilities.So, starting v5.8-rc1 the following warning is observed:[ 2.483925] ------------[ cut here ]------------[ 2.489148] WARNING: CPU: 3 PID: 101 at kernel/dma/mapping.c:427 0x80e7eee8[ 2.489152] Modules linked in: virtio_console(+)[ 2.503737] virtio_rpmsg_bus rpmsg_core[ 2.508903][ 2.528898] <Other modules, stack and call trace here>[ 2.913043][ 2.914907] ---[ end trace 93ac8746beab612c ]---[ 2.920102] virtio-ports vport1p0: Error allocating inbufskernel/dma/mapping.c:427 is:WARN_ON_ONCE(!dev->coherent_dma_mask);obviously because the grandparent now is remoteproc dev without anyDMA caps:[ 3.104943] Parent: remoteproc0#vdev1buffer, grandparent: remoteproc0Fix this the same way as it was for virtio_rpmsg_bus, using just theparent device (vdev->dev.parent, "remoteprocX#vdevYbuffer") for DMAoperations.This also allows now to reserve DMA pools/buffers for rproc serialvia Device Tree.Fixes:c774ad0 ("remoteproc: Fix and restore the parenting hierarchy for vdev")Cc: stable@vger.kernel.org # 5.1+Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>Acked-by: Jason Wang <jasowang@redhat.com>Signed-off-by: Alexander Lobakin <alobakin@pm.me>Date: Thu, 5 Nov 2020 11:10:24 +0800Link:https://lore.kernel.org/r/AOKowLclCbOCKxyiJ71WeNyuAAj2q8EUtxrXbyky5E@cp7-web-042.plabs.chSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parenta864362 commit9d516aa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎drivers/char/virtio_console.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,12 +435,12 @@ static struct port_buffer *alloc_buf(struct virtio_device *vdev, size_t buf_size
435435
/*
436436
* Allocate DMA memory from ancestor. When a virtio
437437
* device is created by remoteproc, the DMA memory is
438-
* associated with thegrandparent device:
439-
*vdev =>rproc => platform-dev.
438+
* associated with theparent device:
439+
*virtioY =>remoteprocX#vdevYbuffer.
440440
*/
441-
if (!vdev->dev.parent|| !vdev->dev.parent->parent)
441+
buf->dev=vdev->dev.parent;
442+
if (!buf->dev)
442443
gotofree_buf;
443-
buf->dev=vdev->dev.parent->parent;
444444

445445
/* Increase device refcnt to avoid freeing it */
446446
get_device(buf->dev);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp