Skip to content

Commit a54bace

Browse files
Oleksandr Tyshchenkodigetx
authored andcommitted
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: b5c9ed7 ("drm/virtio: Improve DMA API usage for shmem BOs") Signed-off-by: Oleksandr Tyshchenko <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 1b9b4f9 commit a54bace

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/virtio/virtgpu_vq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ void virtio_gpu_cmd_transfer_to_host_2d(struct virtio_gpu_device *vgdev,
597597
bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev);
598598

599599
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,
601601
bo->base.sgt, DMA_TO_DEVICE);
602602

603603
cmd_p = virtio_gpu_alloc_cmd(vgdev, &vbuf, sizeof(*cmd_p));
@@ -1019,7 +1019,7 @@ void virtio_gpu_cmd_transfer_to_host_3d(struct virtio_gpu_device *vgdev,
10191019
bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev);
10201020

10211021
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,
10231023
bo->base.sgt, DMA_TO_DEVICE);
10241024

10251025
cmd_p = virtio_gpu_alloc_cmd(vgdev, &vbuf, sizeof(*cmd_p));

0 commit comments

Comments
 (0)