Skip to content

dma-buf: heaps: Use constant name for CMA heap

Jared Kangas dri-devel linux-media lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 2 repliesIn review
  2. v33 patches 3 repliesSuperseded
  3. v22 patches 13 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches0 repliesSuperseded

Changes in v4 from the cover letter

- Fix ERR_PTR() usage for negative return value.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3Documentation: dma-buf: heaps: Fix code markupDocumentation/userspace-api/dma-buf-heaps.rst+3 -30 replies
2/3dma-buf: heaps: Parameterize heap name in __add_cma_heap()drivers/dma-buf/heaps/cma_heap.c+11 -70 replies
3/3dma-buf: heaps: Give default CMA heap a fixed nameDocumentation/userspace-api/dma-buf-heaps.rst drivers/dma-buf/heaps/Kconfig drivers/dma-buf/heaps/cma_heap.c+34 -30 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchMaxime Ripard
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/3] dma-buf: heaps: Use constant name for CMA heap

Hi all,

This patch series is based on a previous discussion around CMA heap naming. [1] The heap's name depends on the device name, which is generally "reserved", "linux,cma", or "default-pool", but could be any arbitrary name given to the default CMA area in the devicetree. For a consistent userspace interface, the series introduces a constant name for the CMA heap, and for backwards compatibility, an additional Kconfig that controls the creation of a legacy-named heap with the same CMA backing.

The ideas to handle backwards compatibility in [1] are to either use a symlink or add a heap node with a duplicate minor. However, I assume that we don't want to create symlinks in /dev from module initcalls, and attempting to duplicate minors would cause device_create() to fail. Because of these drawbacks, after brainstorming with Maxime Ripard, I went with creating a new node in devtmpfs with its own minor. This admittedly makes it a little unclear that the old and new nodes are backed by the same heap when both are present. The only approach that I think would provide total clarity on this in userspace is symlinking, which seemed like a fairly involved solution for devtmpfs, but if I'm wrong on this, please let me know.

Changelog:

v4:
- Fix ERR_PTR() usage for negative return value.

v3:
- Extract documentation markup fix to separate patch.
- Adjust DEFAULT_CMA_NAME per discussion in [2].
- Warn if the legacy heap name and the default heap name are the same.
- Fix DMABUF_HEAPS_CMA_LEGACY prompt.
- Touch up commit log wording.

v2:
- Use tabs instead of spaces for large vertical alignment.

[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/CANDhNCroe6ZBtN_o=c71kzFFaWK-fF5rCdnr9P5h1sgPOWSGSw@mail.gmail.com/

Jared Kangas (3):
Documentation: dma-buf: heaps: Fix code markup
dma-buf: heaps: Parameterize heap name in __add_cma_heap()
dma-buf: heaps: Give default CMA heap a fixed name

 Documentation/userspace-api/dma-buf-heaps.rst | 11 +++---
 drivers/dma-buf/heaps/Kconfig                 | 10 ++++++
 drivers/dma-buf/heaps/cma_heap.c              | 36 +++++++++++++++----
 3 files changed, 46 insertions(+), 11 deletions(-)
Signature · 1 line
2.49.0