dma-heap: qcom: Implement pool-size getters for our system heaps

Implement our callbacks for .get_pool_size for the system and secure
system heaps.

Change-Id: Ic52ae76cb1bf10005a6bc6445b22e1d241daad92
Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
This commit is contained in:
Chris Goldsworthy 2021-05-09 18:47:23 -07:00
parent 510a21f3a0
commit 26ae9d5098
4 changed files with 28 additions and 1 deletions

View File

@ -70,7 +70,7 @@ void dynamic_page_pool_free(struct dynamic_page_pool *pool, struct page *page)
dynamic_page_pool_add(pool, page);
}
static int dynamic_page_pool_total(struct dynamic_page_pool *pool, bool high)
int dynamic_page_pool_total(struct dynamic_page_pool *pool, bool high)
{
int count = pool->low_count;

View File

@ -98,6 +98,7 @@ void dynamic_page_pool_free(struct dynamic_page_pool *pool, struct page *page);
int dynamic_page_pool_init_shrinker(void);
void dynamic_page_pool_shrink_high_and_low(struct dynamic_page_pool **pools_list,
int num_pools, int nr_to_scan);
int dynamic_page_pool_total(struct dynamic_page_pool *pool, bool high);
struct page *dynamic_page_pool_remove(struct dynamic_page_pool *pool, bool high);
void dynamic_page_pool_add(struct dynamic_page_pool *pool, struct page *page);

View File

@ -609,8 +609,21 @@ static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
return ERR_PTR(ret);
}
static long get_pool_size_bytes(struct dma_heap *heap)
{
long total_size = 0;
int i;
struct qcom_secure_system_heap *sys_heap = dma_heap_get_drvdata(heap);
for (i = 0; i < NUM_ORDERS; i++)
total_size += dynamic_page_pool_total(sys_heap->pool_list[i], true);
return total_size << PAGE_SHIFT;
}
static const struct dma_heap_ops system_heap_ops = {
.allocate = system_heap_allocate,
.get_pool_size = get_pool_size_bytes,
};
static int create_prefetch_workqueue(void)

View File

@ -381,8 +381,21 @@ static int system_heap_refill_worker(void *data)
return 0;
}
static long get_pool_size_bytes(struct dma_heap *heap)
{
long total_size = 0;
int i;
struct qcom_system_heap *sys_heap = dma_heap_get_drvdata(heap);
for (i = 0; i < NUM_ORDERS; i++)
total_size += dynamic_page_pool_total(sys_heap->pool_list[i], true);
return total_size << PAGE_SHIFT;
}
static const struct dma_heap_ops system_heap_ops = {
.allocate = system_heap_allocate,
.get_pool_size = get_pool_size_bytes,
};
int qcom_system_heap_create(char *name, bool uncached)