habanalabs: unified memory manager infrastructure
authorYuri Nudelman <ynudelman@habana.ai>
Sun, 20 Mar 2022 14:08:12 +0000 (16:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 May 2022 18:57:36 +0000 (20:57 +0200)
commitbabe8e7c04b5d3b7298b77acdd1de922c97442bc
tree0616ba944461746713800f4daef5d94dac736cfe
parentb75cce27d0bc18b69471469fddf06fc9ac00bb8f
habanalabs: unified memory manager infrastructure

This is a part of overall refactoring attempt to separate nic and the
core drivers.
Currently, there are 4 different flows, that contain very similar code.
These are the ts, nic, hwblocks and cb alloc/map flows. The similar
aspect of all these flows is that they all contain a central store, with
memory buffers inside, supporting the following set of operations:

- Allocate buffer and return handle
- Get buffer from the store with handle
- Put the buffer (last put releases the buffer)
- Map the buffer to the user

This patch contains a generic data structure used to implement the above
memory buffer store interface. Conversion of the existing code to use
the new data structure will follow.

Signed-off-by: Yuri Nudelman <ynudelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/habanalabs/common/Makefile
drivers/misc/habanalabs/common/habanalabs.h
drivers/misc/habanalabs/common/memory_mgr.c [new file with mode: 0644]