RemoteAlloc allocates memory and provides it to the tui carveout heap.
Other clients may suballocate from this heap. Both of these uses are
represented via a fd. Clearly, we cannot free the memory from RemoteAlloc,
until all clients of the tui carveout heap have closed their fd.
Previously, we assumed that the client would simply place these calls in
the proper order - release dma_buf fds first, followed by RemoteAlloc fds.
However, there are situations where this does not occur. One example is
a process crash, where fds are closed in no particular order. Another
example is when a kthread calls fput(). In this case the actual file
release callback is defered onto a workqueue.
To solve these issues, modify the carveout heap to increase the refcount
of the RemoteAlloc fd when carveout_alloc() is called.
Change-Id: I878d4883ec17bccf5c6c08711ba7150d9ea76597
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
Bring over the prefetch and drain implementation from
drivers/staging/android/ion/heaps/ion_system_secure_heap.c from
msm-5.4, as of commit 48a845e5f683 ("ion: Use a freezable unbound
workqueue for the memory prefetch work items"), which is used for
asynchronously pre-loading the pools for clients who want the pools
filled with a certain amount of memory in advance of their use case
starting.
Change-Id: I5a2df4b75d86eb917cd0848107e7f920fb735434
Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
Allow this symbols to be used by kernel modules, specifically
mem-buf for its usecase which allows SVM to request memory from
the PVM, and add it to a SVM carveout heap.
Change-Id: I9f285f890285f320d2237b03441d6b8c66ef539a
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
Make the needed changes in the secure memory handling code to support
TZ and modem use cases.
Change-Id: I3905f7d6eed50c0f511f19dba1776d85b82b2396
Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
Add a VMID field so that clients who currently use DMA-BUF get flags
can continue to check the security status of a buffer.
Change-Id: If012f01f521cb30d817529194561183187c3f227
Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
Add the carveout heap, which is to be used for devices requiring
contiguous memory on other VMs.
Change-Id: I54154f94f1c315ce2bc5ef5a5b7ac1918464a073
Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
Add the base file for our DMA-BUF heap module, which will create all
of our DMA-BUF heaps. Add the needed utilities and constants to
support the DMA-BUF Heap DT file, which will be used for the CMA and
carveout heap on our device.
Change-Id: I079587aedab385f4fac3c7d46ebdd72eb0aa5a20
Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
Rename our kernel-internal DMA-BUF Heap headers. Remove header define
our version of the heap helper buffer, which will not longer be used.
Change-Id: Ib1c7f1c00aa922ef81b45f23306e91faab32be92
Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>