mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
virtio: Introduce virtio_max_dma_size()
This function returns the maximum segment size for a single dma transaction of a virtio device. The possible limit comes from the SWIOTLB implementation in the Linux kernel, that has an upper limit of (currently) 256kb of contiguous memory it can map. Other DMA-API implementations might also have limits. Use the new dma_max_mapping_size() function to determine the maximum mapping size when DMA-API is in use for virtio. Cc: [email protected] Reviewed-by: Konrad Rzeszutek Wilk <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Joerg Roedel <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
This commit is contained in:
parent
133d624b1c
commit
e6d6dd6c87
2 changed files with 13 additions and 0 deletions
|
|
@ -271,6 +271,17 @@ static bool vring_use_dma_api(struct virtio_device *vdev)
|
|||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
return max_segment_size;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(virtio_max_dma_size);
|
||||
|
||||
static void *vring_alloc_queue(struct virtio_device *vdev, size_t size,
|
||||
dma_addr_t *dma_handle, gfp_t flag)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue