Hi all, before sending this RFC to a larger audience I would like to get our opinion about it. Please feel very free to comment it, thanks !
The goal of this RFC is to understand if a common ioctl for specific memory regions allocations is needed/welcome.
Obviously it will not replace allocation done in linux kernel frameworks like v4l2 or dmr/kms, but offer an alternative when you don't want/need to use them for buffer allocation.
"Unix Device Memory Allocator" project [1] wants to create a userland library which may allow to select, depending of the devices constraint, the best back-end for allocation. With this RFC I would to propose to have common ioctl for a maximum of allocator to avoid to duplicated back-end for this library.
Since the beginning it is a problem to allocate contiguous memory (CMA) without using v4l2 or drm/kms so the first allocator available in this RFC use CMA memory.
An other question is: do we have others memory regions that could be interested by this new framework ? I have in mind that some title memory regions could use it or replace ION heaps (system, carveout etc...). Maybe it only solve CMA allocation issue, in this case no need to create a common ioctl, a custom should be enough.
Maybe the first thing to do is to change the name and the location of this module, suggestions are welcome.
[1] https://github.com/cubanismo/allocator
Benjamin Gaignard (2): Create Simple Allocator module add CMA simple allocator module
drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/simpleallocator/Kconfig | 17 +++ drivers/simpleallocator/Makefile | 2 + drivers/simpleallocator/simple-allocator-cma.c | 163 +++++++++++++++++++++++ drivers/simpleallocator/simple-allocator-priv.h | 27 ++++ drivers/simpleallocator/simple-allocator.c | 167 ++++++++++++++++++++++++ include/uapi/linux/simple-allocator.h | 35 +++++ 8 files changed, 414 insertions(+) create mode 100644 drivers/simpleallocator/Kconfig create mode 100644 drivers/simpleallocator/Makefile create mode 100644 drivers/simpleallocator/simple-allocator-cma.c create mode 100644 drivers/simpleallocator/simple-allocator-priv.h create mode 100644 drivers/simpleallocator/simple-allocator.c create mode 100644 include/uapi/linux/simple-allocator.h