rk: ion: resolve build err
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / t6xx / kbase / src / linux / mali_kbase_mem_linux.h
1 /*
2  *
3  * (C) COPYRIGHT ARM Limited. All rights reserved.
4  *
5  * This program is free software and is provided to you under the terms of the
6  * GNU General Public License version 2 as published by the Free Software
7  * Foundation, and any use by you of this program is subject to the terms
8  * of such GNU licence.
9  *
10  * A copy of the licence is included with the program, and can also be obtained
11  * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
12  * Boston, MA  02110-1301, USA.
13  *
14  */
15
16
17
18
19
20 /**
21  * @file mali_kbase_mem_linux.h
22  * Base kernel memory APIs, Linux implementation.
23  */
24
25 #ifndef _KBASE_MEM_LINUX_H_
26 #define _KBASE_MEM_LINUX_H_
27
28 /* This define is used by the gator kernel module compile to select which DDK
29  * API calling convention to use. If not defined (legacy DDK) gator assumes
30  * version 1. The version to DDK release mapping is:
31  *     Version 1 API: DDK versions r1px, r2px
32  *     Version 2 API: DDK versions r3px and newer
33  **/
34 #define MALI_DDK_GATOR_API_VERSION 2
35
36 /** A HWC dump mapping */
37 typedef struct kbase_hwc_dma_mapping {
38         void       *cpu_va;
39         dma_addr_t  dma_pa;
40         size_t      size;
41 } kbase_hwc_dma_mapping;
42
43 struct kbase_va_region * kbase_mem_alloc(kbase_context * kctx, u64 va_pages, u64 commit_pages, u64 extent, u64 * flags, u64 * gpu_va, u16 * va_alignment);
44 mali_error kbase_mem_query(kbase_context *kctx, mali_addr64 gpu_addr, int query, u64 * const pages);
45 int kbase_mem_import(kbase_context *kctx, base_mem_import_type type, int handle, mali_addr64 * gpu_va, u64 * va_pages, u64 * flags);
46 mali_error kbase_mem_flags_change(kbase_context *kctx, mali_addr64 gpu_addr, unsigned int flags, unsigned int mask);
47 int kbase_mem_commit(kbase_context * kctx, mali_addr64 gpu_addr, u64 new_pages, base_backing_threshold_status * failure_reason);
48 int kbase_mmap(struct file *file, struct vm_area_struct *vma);
49
50 /** @brief Allocate memory from kernel space and map it onto the GPU
51  *
52  * @param kctx   The context used for the allocation/mapping
53  * @param size   The size of the allocation in bytes
54  * @param handle An opaque structure used to contain the state needed to free the memory
55  * @return the VA for kernel space and GPU MMU
56  */
57 void *kbase_va_alloc(kbase_context *kctx, u32 size, kbase_hwc_dma_mapping *handle);
58
59 /** @brief Free/unmap memory allocated by kbase_va_alloc
60  *
61  * @param kctx   The context used for the allocation/mapping
62  * @param handle An opaque structure returned by the kbase_va_alloc function.
63  */
64 void kbase_va_free(kbase_context *kctx, kbase_hwc_dma_mapping *handle);
65
66 #endif                          /* _KBASE_MEM_LINUX_H_ */