[PATCH v12 1/5] dma-buf: Add dma-buf heaps framework

Brian Starkey Brian.Starkey at arm.com
Fri Oct 18 11:18:33 UTC 2019

Hi John,

On Fri, Oct 18, 2019 at 05:23:19AM +0000, John Stultz wrote:
> From: "Andrew F. Davis" <afd at ti.com>
> This framework allows a unified userspace interface for dma-buf
> exporters, allowing userland to allocate specific types of memory
> for use in dma-buf sharing.
> Each heap is given its own device node, which a user can allocate
> a dma-buf fd from using the DMA_HEAP_IOC_ALLOC.
> This code is an evoluiton of the Android ION implementation,
> and a big thanks is due to its authors/maintainers over time
> for their effort:
>   Rebecca Schultz Zavin, Colin Cross, Benjamin Gaignard,
>   Laura Abbott, and many other contributors!
> Cc: Laura Abbott <labbott at redhat.com>
> Cc: Benjamin Gaignard <benjamin.gaignard at linaro.org>
> Cc: Sumit Semwal <sumit.semwal at linaro.org>
> Cc: Liam Mark <lmark at codeaurora.org>
> Cc: Pratik Patel <pratikp at codeaurora.org>
> Cc: Brian Starkey <Brian.Starkey at arm.com>
> Cc: Vincent Donnefort <Vincent.Donnefort at arm.com>
> Cc: Sudipto Paul <Sudipto.Paul at arm.com>
> Cc: Andrew F. Davis <afd at ti.com>
> Cc: Christoph Hellwig <hch at infradead.org>
> Cc: Chenbo Feng <fengc at google.com>
> Cc: Alistair Strachan <astrachan at google.com>
> Cc: Hridya Valsaraju <hridya at google.com>
> Cc: Hillf Danton <hdanton at sina.com>
> Cc: dri-devel at lists.freedesktop.org
> Reviewed-by: Benjamin Gaignard <benjamin.gaignard at linaro.org>
> Reviewed-by: Brian Starkey <brian.starkey at arm.com>
> Acked-by: Laura Abbott <labbott at redhat.com>
> Tested-by: Ayan Kumar Halder <ayan.halder at arm.com>
> Signed-off-by: Andrew F. Davis <afd at ti.com>
> Signed-off-by: John Stultz <john.stultz at linaro.org>
> ---
> v2:
> * Folded down fixes I had previously shared in implementing
>   heaps
> * Make flags a u64 (Suggested by Laura)
> * Add PAGE_ALIGN() fix to the core alloc funciton
> * IOCTL fixups suggested by Brian
> * Added fixes suggested by Benjamin
> * Removed core stats mgmt, as that should be implemented by
>   per-heap code
> * Changed alloc to return a dma-buf fd, rather than a buffer
>   (as it simplifies error handling)
> v3:
> * Removed scare-quotes in MAINTAINERS email address
> * Get rid of .release function as it didn't do anything (from
>   Christoph)
> * Renamed filp to file (suggested by Christoph)
> * Split out ioctl handling to separate function (suggested by
>   Christoph)
> * Add comment documenting PAGE_ALIGN usage (suggested by Brian)
> * Switch from idr to Xarray (suggested by Brian)
> * Fixup cdev creation (suggested by Brian)
> * Avoid EXPORT_SYMBOL until we finalize modules (suggested by
>   Brian)
> * Make struct dma_heap internal only (folded in from Andrew)
> * Small cleanups suggested by GregKH
> * Provide class->devnode callback to get consistent /dev/
>   subdirectory naming (Suggested by Bjorn)
> v4:
> * Folded down dma-heap.h change that was in a following patch
> * Added fd_flags entry to allocation structure and pass it
>   through to heap code for use on dma-buf fd creation (suggested
>   by Benjamin)
> v5:
> * Minor cleanups
> v6:
> * Improved error path handling, minor whitespace fixes, both
>   suggested by Brian
> v7:
> * Longer Kconfig description to quiet checkpatch warnings
> * Re-add compat_ioctl bits (Hridya noticed 32bit userland wasn't
>   working)
> v8:
> * Make struct dma_heap_ops consts (Suggested by Christoph)
> * Checkpatch whitespace fixups
> v9:
> * Minor cleanups suggested by Brian Starkey
> * Rename dma_heap_get_data->dma_heap_get_drvdata suggested
>   by Hilf Danton
> v11:
> * Kconfig text improvements suggested by Randy Dunlap
> v12:
> * Add logic to prevent duplicately named heaps being added
> * Add symbol exports for heaps as modules

As in v3:

 * Avoid EXPORT_SYMBOL until we finalize modules (suggested by

Did something change in that regard? I still think letting modules
register heaps without a way to remove them is a recipe for issues.


More information about the dri-devel mailing list