diff options
| author | Maxime Ripard <mripard@kernel.org> | 2025-07-28 10:21:23 +0200 |
|---|---|---|
| committer | Sumit Semwal <sumit.semwal@linaro.org> | 2025-10-06 22:14:11 +0530 |
| commit | 507211e3c7a110c3f48cd8c731ddc748fe215ec8 (patch) | |
| tree | 7547095828680170b212a33d6c7f6aedfbfee533 /Documentation/userspace-api | |
| parent | 78b4d6463e9e69e5103f98b367f8984ad12cdc6f (diff) | |
| download | linux-507211e3c7a110c3f48cd8c731ddc748fe215ec8.tar.gz linux-507211e3c7a110c3f48cd8c731ddc748fe215ec8.tar.bz2 linux-507211e3c7a110c3f48cd8c731ddc748fe215ec8.zip | |
Documentation: dma-buf: heaps: Add naming guidelines
We've discussed a number of times of how some heap names are bad, but
not really what makes a good heap name.
Let's document what we expect the heap names to look like.
Reviewed-by: Andrew Davis <afd@ti.com>
Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/all/20250728-dma-buf-heap-names-doc-v4-1-f73f71cf0dfd@kernel.org/
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Diffstat (limited to 'Documentation/userspace-api')
| -rw-r--r-- | Documentation/userspace-api/dma-buf-heaps.rst | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Documentation/userspace-api/dma-buf-heaps.rst b/Documentation/userspace-api/dma-buf-heaps.rst index 1dfe5e7acd5a..a0979440d2a4 100644 --- a/Documentation/userspace-api/dma-buf-heaps.rst +++ b/Documentation/userspace-api/dma-buf-heaps.rst @@ -26,3 +26,37 @@ following heaps: ``DMABUF_HEAPS_CMA_LEGACY`` Kconfig option is set, a duplicate node is created following legacy naming conventions; the legacy name might be ``reserved``, ``linux,cma``, or ``default-pool``. +Naming Convention +================= + +``dma-buf`` heaps name should meet a number of constraints: + +- The name must be stable, and must not change from one version to the other. + Userspace identifies heaps by their name, so if the names ever change, we + would be likely to introduce regressions. + +- The name must describe the memory region the heap will allocate from, and + must uniquely identify it in a given platform. Since userspace applications + use the heap name as the discriminant, it must be able to tell which heap it + wants to use reliably if there's multiple heaps. + +- The name must not mention implementation details, such as the allocator. The + heap driver will change over time, and implementation details when it was + introduced might not be relevant in the future. + +- The name should describe properties of the buffers that would be allocated. + Doing so will make heap identification easier for userspace. Such properties + are: + + - ``contiguous`` for physically contiguous buffers; + + - ``protected`` for encrypted buffers not accessible the OS; + +- The name may describe intended usage. Doing so will make heap identification + easier for userspace applications and users. + +For example, assuming a platform with a reserved memory region located +at the RAM address 0x42000000, intended to allocate video framebuffers, +physically contiguous, and backed by the CMA kernel allocator, good +names would be ``memory@42000000-contiguous`` or ``video@42000000``, but +``cma-video`` wouldn't. |
