Shrenuj Bansal | a419c79 | 2016-10-20 14:05:11 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2016, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | #ifndef __KGSL_POOL_H |
| 14 | #define __KGSL_POOL_H |
| 15 | |
| 16 | #include <linux/mm_types.h> |
| 17 | #include "kgsl_sharedmem.h" |
| 18 | |
| 19 | static inline unsigned int |
| 20 | kgsl_gfp_mask(unsigned int page_order) |
| 21 | { |
| 22 | unsigned int gfp_mask = __GFP_HIGHMEM; |
| 23 | |
| 24 | if (page_order > 0) { |
| 25 | gfp_mask |= __GFP_COMP | __GFP_NORETRY | __GFP_NOWARN; |
| 26 | gfp_mask &= ~__GFP_RECLAIM; |
| 27 | } else |
| 28 | gfp_mask |= GFP_KERNEL; |
| 29 | |
| 30 | if (kgsl_sharedmem_get_noretry() == true) |
| 31 | gfp_mask |= __GFP_NORETRY | __GFP_NOWARN; |
| 32 | |
| 33 | return gfp_mask; |
| 34 | } |
| 35 | |
| 36 | void kgsl_pool_free_sgt(struct sg_table *sgt); |
| 37 | void kgsl_pool_free_pages(struct page **pages, unsigned int page_count); |
| 38 | void kgsl_init_page_pools(struct platform_device *pdev); |
| 39 | void kgsl_exit_page_pools(void); |
| 40 | int kgsl_pool_alloc_page(int *page_size, struct page **pages, |
| 41 | unsigned int pages_len, unsigned int *align); |
| 42 | void kgsl_pool_free_page(struct page *p); |
| 43 | #endif /* __KGSL_POOL_H */ |
| 44 | |