diff options
author | Joerg Roedel <jroedel@suse.de> | 2019-02-07 12:59:15 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2019-03-06 11:19:11 -0500 |
commit | 133d624b1cee16906134e92d5befb843b58bcf31 (patch) | |
tree | b5d5d7d1ce51dca0a90402227028eee5ded9ba6b /kernel/dma/mapping.c | |
parent | 492366f7b4237257ef50ca9c431a6a0d50225aca (diff) | |
download | linux-133d624b1cee16906134e92d5befb843b58bcf31.tar.gz linux-133d624b1cee16906134e92d5befb843b58bcf31.tar.bz2 linux-133d624b1cee16906134e92d5befb843b58bcf31.zip |
dma: Introduce dma_max_mapping_size()
The function returns the maximum size that can be mapped
using DMA-API functions. The patch also adds the
implementation for direct DMA and a new dma_map_ops pointer
so that other implementations can expose their limit.
Cc: stable@vger.kernel.org
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'kernel/dma/mapping.c')
-rw-r--r-- | kernel/dma/mapping.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c index a11006b6d8e8..5753008ab286 100644 --- a/kernel/dma/mapping.c +++ b/kernel/dma/mapping.c @@ -357,3 +357,17 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size, ops->cache_sync(dev, vaddr, size, dir); } EXPORT_SYMBOL(dma_cache_sync); + +size_t dma_max_mapping_size(struct device *dev) +{ + const struct dma_map_ops *ops = get_dma_ops(dev); + size_t size = SIZE_MAX; + + if (dma_is_direct(ops)) + size = dma_direct_max_mapping_size(dev); + else if (ops && ops->max_mapping_size) + size = ops->max_mapping_size(dev); + + return size; +} +EXPORT_SYMBOL_GPL(dma_max_mapping_size); |