diff options
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/linux/vm.h | 105 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/vm.h | 6 |
2 files changed, 107 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h b/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h new file mode 100644 index 00000000..91f0cf09 --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h | |||
@@ -0,0 +1,105 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #ifndef __COMMON_LINUX_VM_PRIV_H__ | ||
18 | #define __COMMON_LINUX_VM_PRIV_H__ | ||
19 | |||
20 | #include <nvgpu/types.h> | ||
21 | |||
22 | struct sg_table; | ||
23 | struct dma_buf; | ||
24 | |||
25 | struct vm_gk20a; | ||
26 | struct vm_gk20a_mapping_batch; | ||
27 | struct nvgpu_vm_area; | ||
28 | |||
29 | struct buffer_attrs { | ||
30 | struct sg_table *sgt; | ||
31 | u64 size; | ||
32 | u64 align; | ||
33 | u32 ctag_offset; | ||
34 | u32 ctag_lines; | ||
35 | u32 ctag_allocated_lines; | ||
36 | int pgsz_idx; | ||
37 | u8 kind_v; | ||
38 | bool use_kind_v; | ||
39 | u8 uc_kind_v; | ||
40 | bool use_uc_kind_v; | ||
41 | bool ctag_user_mappable; | ||
42 | }; | ||
43 | |||
44 | u64 nvgpu_vm_map_linux(struct vm_gk20a *vm, | ||
45 | struct dma_buf *dmabuf, | ||
46 | u64 offset_align, | ||
47 | u32 flags, | ||
48 | |||
49 | /* | ||
50 | * compressible kind if | ||
51 | * NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL is | ||
52 | * specified, otherwise just the kind | ||
53 | */ | ||
54 | s16 compr_kind, | ||
55 | |||
56 | /* | ||
57 | * incompressible kind if | ||
58 | * NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL is | ||
59 | * specified, otherwise ignored | ||
60 | */ | ||
61 | s16 incompr_kind, | ||
62 | |||
63 | bool user_mapped, | ||
64 | int rw_flag, | ||
65 | u64 buffer_offset, | ||
66 | u64 mapping_size, | ||
67 | struct vm_gk20a_mapping_batch *mapping_batch); | ||
68 | |||
69 | /* | ||
70 | * Notes: | ||
71 | * - Batch may be NULL if map op is not part of a batch. | ||
72 | * - If NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL is set, | ||
73 | * compr_kind and incompr_kind work as explained in nvgpu.h. | ||
74 | * - If NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL is NOT set, | ||
75 | * compr_kind holds the kind and kernel will figure out whether | ||
76 | * it is a compressible or incompressible kind. If compressible, kernel will | ||
77 | * also figure out the incompressible counterpart or return an error. | ||
78 | */ | ||
79 | int nvgpu_vm_map_buffer(struct vm_gk20a *vm, | ||
80 | int dmabuf_fd, | ||
81 | u64 *offset_align, | ||
82 | u32 flags, /* NVGPU_AS_MAP_BUFFER_FLAGS_ */ | ||
83 | s16 compr_kind, | ||
84 | s16 incompr_kind, | ||
85 | u64 buffer_offset, | ||
86 | u64 mapping_size, | ||
87 | struct vm_gk20a_mapping_batch *batch); | ||
88 | |||
89 | /* Note: batch may be NULL if unmap op is not part of a batch */ | ||
90 | int nvgpu_vm_unmap_buffer(struct vm_gk20a *vm, u64 offset, | ||
91 | struct vm_gk20a_mapping_batch *batch); | ||
92 | |||
93 | /* find buffer corresponding to va */ | ||
94 | int nvgpu_vm_find_buf(struct vm_gk20a *vm, u64 gpu_va, | ||
95 | struct dma_buf **dmabuf, | ||
96 | u64 *offset); | ||
97 | |||
98 | enum nvgpu_aperture gk20a_dmabuf_aperture(struct gk20a *g, | ||
99 | struct dma_buf *dmabuf); | ||
100 | int validate_fixed_buffer(struct vm_gk20a *vm, | ||
101 | struct buffer_attrs *bfr, | ||
102 | u64 map_offset, u64 map_size, | ||
103 | struct nvgpu_vm_area **pva_node); | ||
104 | |||
105 | #endif | ||
diff --git a/drivers/gpu/nvgpu/include/nvgpu/vm.h b/drivers/gpu/nvgpu/include/nvgpu/vm.h index 8c56461c..e529512b 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/vm.h +++ b/drivers/gpu/nvgpu/include/nvgpu/vm.h | |||
@@ -207,14 +207,12 @@ void nvgpu_vm_put_buffers(struct vm_gk20a *vm, | |||
207 | struct nvgpu_mapped_buf **mapped_buffers, | 207 | struct nvgpu_mapped_buf **mapped_buffers, |
208 | int num_buffers); | 208 | int num_buffers); |
209 | 209 | ||
210 | /* Note: batch may be NULL if unmap op is not part of a batch */ | ||
211 | int nvgpu_vm_unmap_buffer(struct vm_gk20a *vm, u64 offset, | ||
212 | struct vm_gk20a_mapping_batch *batch); | ||
213 | |||
214 | void nvgpu_vm_unmap_locked(struct nvgpu_mapped_buf *mapped_buffer, | 210 | void nvgpu_vm_unmap_locked(struct nvgpu_mapped_buf *mapped_buffer, |
215 | struct vm_gk20a_mapping_batch *batch); | 211 | struct vm_gk20a_mapping_batch *batch); |
216 | void nvgpu_vm_unmap_locked_ref(struct nvgpu_ref *ref); | 212 | void nvgpu_vm_unmap_locked_ref(struct nvgpu_ref *ref); |
217 | 213 | ||
214 | void nvgpu_vm_unmap(struct vm_gk20a *vm, u64 offset); | ||
215 | |||
218 | /* | 216 | /* |
219 | * These all require the VM update lock to be held. | 217 | * These all require the VM update lock to be held. |
220 | */ | 218 | */ |