mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
FROMLIST: virtio_ring: Fix querying of maximum DMA mapping size for virtio device
virtio_max_dma_size() returns the maximum DMA mapping size of the virtio device by querying dma_max_mapping_size() for the device when the DMA API is in use for the vring. Unfortunately, the device passed is initialised by register_virtio_device() and does not inherit the DMA configuration from its parent, resulting in SWIOTLB errors when bouncing is enabled and the default 256K mapping limit (IO_TLB_SEGSIZE) is not respected: | virtio-pci 0000:00:01.0: swiotlb buffer is full (sz: 294912 bytes), total 1024 (slots), used 725 (slots) Follow the pattern used elsewhere in the virtio_ring code when calling into the DMA layer and pass the parent device to dma_max_mapping_size() instead. Cc: Marc Zyngier <maz@kernel.org> Cc: Quentin Perret <qperret@google.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Jason Wang <jasowang@redhat.com> Signed-off-by: Will Deacon <will@kernel.org> Acked-by: Jason Wang <jasowang@redhat.com> Tested-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20211201112018.25276-1-will@kernel.org Bug: 209580772 Change-Id: I3389270b4df2b0e0d3813ff8be61bdb594c1b0bd Signed-off-by: Quentin Perret <qperret@google.com>
This commit is contained in:
committed by
Quentin Perret
parent
03761cf7c7
commit
25b14230af
@@ -268,7 +268,7 @@ size_t virtio_max_dma_size(struct virtio_device *vdev)
|
||||
size_t max_segment_size = SIZE_MAX;
|
||||
|
||||
if (vring_use_dma_api(vdev))
|
||||
max_segment_size = dma_max_mapping_size(&vdev->dev);
|
||||
max_segment_size = dma_max_mapping_size(vdev->dev.parent);
|
||||
|
||||
return max_segment_size;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user