summaryrefslogtreecommitdiffstats
path: root/kernel/dma
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-03-15 17:56:43 +0100
committerChristoph Hellwig <hch@lst.de>2019-09-04 11:13:17 +0200
commit14451467014b4c8aff6570b44b6d0ee68cd49bc0 (patch)
tree66eec34dfcf1db31d85ebc9b1387e4ec43fe8a58 /kernel/dma
parent392e879a445008e8e96b872dabaaf5b1eca58729 (diff)
downloadlinux-14451467014b4c8aff6570b44b6d0ee68cd49bc0.tar.gz
linux-14451467014b4c8aff6570b44b6d0ee68cd49bc0.tar.bz2
linux-14451467014b4c8aff6570b44b6d0ee68cd49bc0.zip
dma-mapping: move the dma_get_sgtable API comments from arm to common code
The comments are spot on and should be near the central API, not just near a single implementation. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'kernel/dma')
-rw-r--r--kernel/dma/mapping.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c
index 72c825c1788e..a136932b8e6d 100644
--- a/kernel/dma/mapping.c
+++ b/kernel/dma/mapping.c
@@ -136,6 +136,17 @@ int dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
return ret;
}
+/*
+ * The whole dma_get_sgtable() idea is fundamentally unsafe - it seems
+ * that the intention is to allow exporting memory allocated via the
+ * coherent DMA APIs through the dma_buf API, which only accepts a
+ * scattertable. This presents a couple of problems:
+ * 1. Not all memory allocated via the coherent DMA APIs is backed by
+ * a struct page
+ * 2. Passing coherent DMA memory into the streaming APIs is not allowed
+ * as we will try to flush the memory through a different alias to that
+ * actually being used (and the flushes are redundant.)
+ */
int dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt,
void *cpu_addr, dma_addr_t dma_addr, size_t size,
unsigned long attrs)