dma-mapping-fast: Do not clobber existing atomic pool

The generic atomic pool is initialized at the postcore
initcall level. However, the same function is called to
initialize the atomic pool for fastmap at a later level,
and that function makes it so that the generic pool is
clobbered, and we start using the same atomic pool for
both fastmap and allocations outside of fastmap.

Fix this by adding support in the atomic pool framework
to create and utilize different atomic pools, and creating
a private atomic pool for fastmap.

Change-Id: I934774f44cc25ff66157be7920895618cf76b812
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
Isaac J. Manjarres
2019-12-10 01:21:22 -08:00
parent 2cfd894384
commit 3a1bd738ef
3 changed files with 97 additions and 32 deletions

View File

@@ -11,6 +11,7 @@
#include <linux/scatterlist.h>
#include <linux/bug.h>
#include <linux/mem_encrypt.h>
#include <linux/genalloc.h>
/**
* List of possible attributes associated with a DMA mapping. The semantics
@@ -675,9 +676,13 @@ void *dma_common_pages_remap(struct page **pages, size_t size,
pgprot_t prot, const void *caller);
void dma_common_free_remap(void *cpu_addr, size_t size);
int __init dma_atomic_pool_init(void);
struct gen_pool *__init __dma_atomic_pool_init(void);
bool __dma_in_atomic_pool(struct gen_pool *pool, void *start, size_t size);
bool dma_in_atomic_pool(void *start, size_t size);
void *__dma_alloc_from_pool(struct gen_pool *pool, size_t size,
struct page **ret_page, gfp_t flags);
void *dma_alloc_from_pool(size_t size, struct page **ret_page, gfp_t flags);
bool __dma_free_from_pool(struct gen_pool *pool, void *start, size_t size);
bool dma_free_from_pool(void *start, size_t size);
int