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

This commit is contained in:
qctecmdr 2021-05-14 09:51:37 -07:00 committed by Gerrit - the friendly Code Review server
commit 43ef4d9e99
5 changed files with 29 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)

View File

@ -407,6 +407,7 @@ config ARM_SMMU_V3_SVA
config QCOM_LAZY_MAPPING
tristate "Reference counted iommu-mapping support"
depends on QCOM_DMABUF_HEAPS
depends on IOMMU_API
help
DMA-BUFs may be shared between several software clients.