summaryrefstree
path: root/kernel/drivers/gpu/msm/kgsl_pool.h
blob: e8a0e9f3806eea8098fdb1415034f4536f587512 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2016-2017,2019 The Linux Foundation. All rights reserved.
 */
#ifndef __KGSL_POOL_H
#define __KGSL_POOL_H

void kgsl_pool_free_sgt(struct sg_table *sgt);

/**
 * kgsl_pool_alloc_pages - Allocate an array of pages from the pool
 * @size: Size of the allocation
 * @pages: Pointer to an array of pages
 * @dev: A &struct device pointer
 *
 * Allocate a list of pages and store it in the pointer pointed to by @pages.
 * @dev specifies a &struct device that is used to call dma_sync_sg_for_device
 * to synchronize the caches. If @dev isn't specified, no cache maintenance
 * will be performed.
 *
 * Return: The number of entries in the array pointed to by @page or negative
 * on error.
 */
int kgsl_pool_alloc_pages(u64 size, struct page ***pages, struct device *dev);

/**
 * kgsl_pool_free_pages - Free pages in an pages array
 * @pages: pointer to an array of page structs
 * @page_count: Number of entries in @pages
 *
 * Free the pages by collapsing any physical adjacent pages.
 * Pages are added back to the pool, if pool has sufficient space
 * otherwise they are given back to system.
 */
void kgsl_pool_free_pages(struct page **pages, unsigned int page_count);

/**
 * kgsl_probe_page_pools - Initialize the memory pools pools
 */
void kgsl_probe_page_pools(void);

/**
 * kgsl_exit_page_pools - Free outstanding pooled memory
 */
void kgsl_exit_page_pools(void);
#endif /* __KGSL_POOL_H */