Skip to content

Commit 71c6cea

Browse files
committed
dma-buf: heaps: add Linaro secure dmabuf heap support
add Linaro secure heap bindings: linaro,secure-heap use genalloc to allocate/free buffer from buffer pool. buffer pool info is from dts. use sg_table instore the allocated memory info, the length of sg_table is 1. implement secure_heap_buf_ops to implement buffer share in difference device: 1. Userspace passes this fd to all drivers it wants this buffer to share with: First the filedescriptor is converted to a &dma_buf using dma_buf_get(). Then the buffer is attached to the device using dma_buf_attach(). 2. Once the buffer is attached to all devices userspace can initiate DMA access to the shared buffer. In the kernel this is done by calling dma_buf_map_attachment() 3. get sg_table with dma_buf_map_attachment in difference device. Signed-off-by: Olivier Masse <[email protected]>
1 parent 0600b28 commit 71c6cea

File tree

3 files changed

+608
-4
lines changed

3 files changed

+608
-4
lines changed

drivers/dma-buf/heaps/Kconfig

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
config DMABUF_HEAPS_DEFERRED_FREE
2-
tristate
1+
menuconfig DMABUF_HEAPS_DEFERRED_FREE
2+
bool "DMA-BUF heaps deferred-free library"
3+
help
4+
Choose this option to enable the DMA-BUF heaps deferred-free library.
35

4-
config DMABUF_HEAPS_PAGE_POOL
5-
tristate
6+
menuconfig DMABUF_HEAPS_PAGE_POOL
7+
bool "DMA-BUF heaps page-pool library"
8+
help
9+
Choose this option to enable the DMA-BUF heaps page-pool library.
610

711
config DMABUF_HEAPS_SYSTEM
812
bool "DMA-BUF System Heap"
@@ -18,3 +22,12 @@ config DMABUF_HEAPS_CMA
1822
Choose this option to enable dma-buf CMA heap. This heap is backed
1923
by the Contiguous Memory Allocator (CMA). If your system has these
2024
regions, you should say Y here.
25+
26+
config DMABUF_HEAPS_SECURE
27+
tristate "DMA-BUF Secure Heap"
28+
depends on DMABUF_HEAPS && DMABUF_HEAPS_DEFERRED_FREE
29+
help
30+
Choose this option to enable the secure dmabuf heap. The secure heap
31+
pools are defined according to the DT. Heaps are allocated
32+
in the pools using gen allocater.
33+
If in doubt, say Y.

drivers/dma-buf/heaps/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ obj-$(CONFIG_DMABUF_HEAPS_DEFERRED_FREE) += deferred-free-helper.o
33
obj-$(CONFIG_DMABUF_HEAPS_PAGE_POOL) += page_pool.o
44
obj-$(CONFIG_DMABUF_HEAPS_SYSTEM) += system_heap.o
55
obj-$(CONFIG_DMABUF_HEAPS_CMA) += cma_heap.o
6+
obj-$(CONFIG_DMABUF_HEAPS_SECURE) += secure_heap.o

0 commit comments

Comments
 (0)