Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/virtio: Pass correct device to dma_sync_sgtable_for_device()

The "vdev->dev.parent" should be used instead of "vdev->dev" as a device
for which to perform the DMA operation in both
virtio_gpu_cmd_transfer_to_host_2d(3d).

Because the virtio-gpu device "vdev->dev" doesn't really have DMA OPS
assigned to it, but parent (virtio-pci or virtio-mmio) device
"vdev->dev.parent" has. The more, the sgtable in question the code is
trying to sync here was mapped for the parent device (by using its DMA OPS)
previously at:
virtio_gpu_object_shmem_init()->drm_gem_shmem_get_pages_sgt()->
dma_map_sgtable(), so should be synced here for the same parent device.

Fixes: b5c9ed70d1a9 ("drm/virtio: Improve DMA API usage for shmem BOs")
Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230224153450.526222-1-olekstysh@gmail.com

authored by

Oleksandr Tyshchenko and committed by
Dmitry Osipenko
a54bace0 1b9b4f92

+2 -2
+2 -2
drivers/gpu/drm/virtio/virtgpu_vq.c
··· 597 597 bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev); 598 598 599 599 if (virtio_gpu_is_shmem(bo) && use_dma_api) 600 - dma_sync_sgtable_for_device(&vgdev->vdev->dev, 600 + dma_sync_sgtable_for_device(vgdev->vdev->dev.parent, 601 601 bo->base.sgt, DMA_TO_DEVICE); 602 602 603 603 cmd_p = virtio_gpu_alloc_cmd(vgdev, &vbuf, sizeof(*cmd_p)); ··· 1019 1019 bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev); 1020 1020 1021 1021 if (virtio_gpu_is_shmem(bo) && use_dma_api) 1022 - dma_sync_sgtable_for_device(&vgdev->vdev->dev, 1022 + dma_sync_sgtable_for_device(vgdev->vdev->dev.parent, 1023 1023 bo->base.sgt, DMA_TO_DEVICE); 1024 1024 1025 1025 cmd_p = virtio_gpu_alloc_cmd(vgdev, &vbuf, sizeof(*cmd_p));