Il 11/09/23 04:30, Yong Wu ha scritto:
Create a new mtk_svp_cma heap from the CMA reserved buffer.
When the first allocating buffer, use cma_alloc to prepare whole the
CMA range, then send its range to TEE to protect and manage.
For the later allocating, we just adds the cma_used_size.
When SVP done, cma_release will release the buffer, then kernel may
reuse it.
Signed-off-by: Yong Wu <yong.wu@xxxxxxxxxxxx>
---
drivers/dma-buf/heaps/Kconfig | 2 +-
drivers/dma-buf/heaps/mtk_secure_heap.c | 121 +++++++++++++++++++++++-
2 files changed, 119 insertions(+), 4 deletions(-)
diff --git a/drivers/dma-buf/heaps/Kconfig b/drivers/dma-buf/heaps/Kconfig
index 729c0cf3eb7c..e101f788ecbf 100644
--- a/drivers/dma-buf/heaps/Kconfig
+++ b/drivers/dma-buf/heaps/Kconfig
@@ -15,7 +15,7 @@ config DMABUF_HEAPS_CMA
config DMABUF_HEAPS_MTK_SECURE
bool "DMA-BUF MediaTek Secure Heap"
- depends on DMABUF_HEAPS && TEE
+ depends on DMABUF_HEAPS && TEE && CMA
help
Choose this option to enable dma-buf MediaTek secure heap for Secure
Video Path. This heap is backed by TEE client interfaces. If in
diff --git a/drivers/dma-buf/heaps/mtk_secure_heap.c b/drivers/dma-buf/heaps/mtk_secure_heap.c
index daf6cf2121a1..3f568fe6b569 100644
--- a/drivers/dma-buf/heaps/mtk_secure_heap.c
+++ b/drivers/dma-buf/heaps/mtk_secure_heap.c
..snip..
+}
+
+RESERVEDMEM_OF_DECLARE(mtk_secure_cma, "mediatek,secure_cma_chunkmem",
I'd suggest "mediatek,secure-heap" as compatible name.
+ mtk_secure_cma_init);
+
Regards,
Angelo