mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
ANDROID: dma-buf: system_heap: allocate from dma32_pool for dma32* heap
The system_dma32 heap should allocate pages with GFP_DMA32, from
dma32_pool.
Fixes: 8880c05e5a ("ANDROID: dma-buf: system_heap: support to allocate pages with GFP_DMA32")
Change-Id: I3e9f123b653cd50873cd8dd40d31c46968ad4a43
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
This commit is contained in:
@@ -519,18 +519,22 @@ static const struct dma_buf_ops system_heap_buf_ops = {
|
||||
.release = system_heap_dma_buf_release,
|
||||
};
|
||||
|
||||
static struct page *alloc_largest_available(unsigned long size,
|
||||
unsigned int max_order)
|
||||
static struct page *system_heap_alloc_largest_available(struct dma_heap *heap,
|
||||
unsigned long size,
|
||||
unsigned int max_order)
|
||||
{
|
||||
struct page *page;
|
||||
int i;
|
||||
const char *name = dma_heap_get_name(heap);
|
||||
struct dmabuf_page_pool **pool;
|
||||
|
||||
pool = strstr(name, "dma32") ? dma32_pools : pools;
|
||||
for (i = 0; i < NUM_ORDERS; i++) {
|
||||
if (size < (PAGE_SIZE << orders[i]))
|
||||
continue;
|
||||
if (max_order < orders[i])
|
||||
continue;
|
||||
page = dmabuf_page_pool_alloc(pools[i]);
|
||||
page = dmabuf_page_pool_alloc(pool[i]);
|
||||
if (!page)
|
||||
continue;
|
||||
return page;
|
||||
@@ -583,7 +587,7 @@ static struct dma_buf *system_heap_do_allocate(struct dma_heap *heap,
|
||||
if (fatal_signal_pending(current))
|
||||
goto free_buffer;
|
||||
|
||||
page = alloc_largest_available(size_remaining, max_order);
|
||||
page = system_heap_alloc_largest_available(heap, size_remaining, max_order);
|
||||
if (!page)
|
||||
goto free_buffer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user