[PATCH V2 1/6] dma-mapping: add DMA_ATTR_LOW_ADDRESS attribute
Ajay Kumar
ajaykumar.rs at samsung.com
Wed May 11 05:15:39 PDT 2022
From: Marek Szyprowski <m.szyprowski at samsung.com>
Some devices require to allocate a special buffer (usually for the
firmware) just at the beginning of the address space to ensure that all
further allocations can be expressed as a positive offset from that
special buffer. When IOMMU is used for managing the DMA address space,
such requirement can be easily fulfilled, simply by enforcing the
'first-fit' IOVA allocation algorithm.
This patch adds a DMA attribute for such case.
Signed-off-by: Marek Szyprowski <m.szyprowski at samsung.com>
Signed-off-by: Ajay Kumar <ajaykumar.rs at samsung.com>
---
include/linux/dma-mapping.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index dca2b1355bb1..3cbdf857edd1 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -60,6 +60,12 @@
* at least read-only at lesser-privileged levels).
*/
#define DMA_ATTR_PRIVILEGED (1UL << 9)
+/*
+ * DMA_ATTR_LOW_ADDRESS: used to indicate that the buffer should be allocated
+ * at the lowest possible DMA address, usually just at the beginning of the
+ * DMA/IOVA address space ('first-fit' allocation algorithm).
+ */
+#define DMA_ATTR_LOW_ADDRESS (1UL << 10)
/*
* A dma_addr_t can hold any valid DMA or bus address for the platform. It can
--
2.17.1
More information about the linux-arm-kernel
mailing list