summaryrefslogtreecommitdiffstats
path: root/lib/dma-direct.c
diff options
context:
space:
mode:
authorChristoph Hellwig2018-04-16 15:24:51 +0200
committerChristoph Hellwig2018-05-19 08:46:12 +0200
commit782e6769c0df744e773dc2acff71c974b3bba4e9 (patch)
tree4b7f513da50a3bce1cca7a28949258642e9c8ab7 /lib/dma-direct.c
parentdma-mapping: simplify Kconfig dependencies (diff)
downloadkernel-qcow2-linux-782e6769c0df744e773dc2acff71c974b3bba4e9.tar.gz
kernel-qcow2-linux-782e6769c0df744e773dc2acff71c974b3bba4e9.tar.xz
kernel-qcow2-linux-782e6769c0df744e773dc2acff71c974b3bba4e9.zip
dma-mapping: provide a generic dma-noncoherent implementation
Add a new dma_map_ops implementation that uses dma-direct for the address mapping of streaming mappings, and which requires arch-specific implemenations of coherent allocate/free. Architectures have to provide flushing helpers to ownership trasnfers to the device and/or CPU, and can provide optional implementations of the coherent mmap functionality, and the cache_flush routines for non-coherent long term allocations. Signed-off-by: Christoph Hellwig <hch@lst.de> Tested-by: Alexey Brodkin <abrodkin@synopsys.com> Acked-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'lib/dma-direct.c')
-rw-r--r--lib/dma-direct.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/dma-direct.c b/lib/dma-direct.c
index df9e726e0712..b824eb218782 100644
--- a/lib/dma-direct.c
+++ b/lib/dma-direct.c
@@ -128,7 +128,7 @@ void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
free_pages((unsigned long)cpu_addr, page_order);
}
-static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size, enum dma_data_direction dir,
unsigned long attrs)
{
@@ -139,8 +139,8 @@ static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
return dma_addr;
}
-static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
- int nents, enum dma_data_direction dir, unsigned long attrs)
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+ enum dma_data_direction dir, unsigned long attrs)
{
int i;
struct scatterlist *sg;
@@ -175,7 +175,7 @@ int dma_direct_supported(struct device *dev, u64 mask)
return 1;
}
-static int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
return dma_addr == DIRECT_MAPPING_ERROR;
}