xref: /linux/Documentation/userspace-api/dma-buf-heaps.rst (revision 260f6f4fda93c8485c8037865c941b42b9cba5d2)
12d38f5feSMaxime Ripard.. SPDX-License-Identifier: GPL-2.0
22d38f5feSMaxime Ripard
32d38f5feSMaxime Ripard==============================
42d38f5feSMaxime RipardAllocating dma-buf using heaps
52d38f5feSMaxime Ripard==============================
62d38f5feSMaxime Ripard
72d38f5feSMaxime RipardDma-buf Heaps are a way for userspace to allocate dma-buf objects. They are
82d38f5feSMaxime Ripardtypically used to allocate buffers from a specific allocation pool, or to share
92d38f5feSMaxime Ripardbuffers across frameworks.
102d38f5feSMaxime Ripard
112d38f5feSMaxime RipardHeaps
122d38f5feSMaxime Ripard=====
132d38f5feSMaxime Ripard
142d38f5feSMaxime RipardA heap represents a specific allocator. The Linux kernel currently supports the
152d38f5feSMaxime Ripardfollowing heaps:
162d38f5feSMaxime Ripard
172d38f5feSMaxime Ripard - The ``system`` heap allocates virtually contiguous, cacheable, buffers.
182d38f5feSMaxime Ripard
192d38f5feSMaxime Ripard - The ``cma`` heap allocates physically contiguous, cacheable,
202d38f5feSMaxime Ripard   buffers. Only present if a CMA region is present. Such a region is
212d38f5feSMaxime Ripard   usually created either through the kernel commandline through the
22c2d636dcSJared Kangas   ``cma`` parameter, a memory region Device-Tree node with the
23c2d636dcSJared Kangas   ``linux,cma-default`` property set, or through the ``CMA_SIZE_MBYTES`` or
24*854acbe7SJared Kangas   ``CMA_SIZE_PERCENTAGE`` Kconfig options. The heap's name in devtmpfs is
25*854acbe7SJared Kangas   ``default_cma_region``. For backwards compatibility, when the
26*854acbe7SJared Kangas   ``DMABUF_HEAPS_CMA_LEGACY`` Kconfig option is set, a duplicate node is
27*854acbe7SJared Kangas   created following legacy naming conventions; the legacy name might be
28*854acbe7SJared Kangas   ``reserved``, ``linux,cma``, or ``default-pool``.
29