diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-04-17 19:26:28 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-05-19 18:34:01 -0400 |
commit | d37e8f7dcf190f31f9c0c12583db2bb0c0d313c0 (patch) | |
tree | 4807c89bf40954c54804c3a8dd88c16849181f29 /drivers/gpu/nvgpu/common/linux/ioctl_as.c | |
parent | dcb744acfbbc11e66cac2d0a674a42e62d908b9d (diff) |
gpu: nvgpu: Split VM interface out
This patch begins the major rework of the GPU's virtual memory manager
(VMM). The VMM is the piece of code that handles the userspace interface
to buffers and their mappings into the GMMU. The core data structure is
the VM - for now still known as 'struct vm_gk20a'. Each one of these
structs represents one addres space to which channels or TSGs may bind
themselves to.
The VMM splits the interface up into two broad categories. First there's
the common, OS independent interfaces; and second there's the OS specific
interfaces.
OS independent
--------------
This is the code that manages the lifetime of VMs, the buffers inside
VMs (search, batch mapping) creation, destruction, etc.
OS Specific
-----------
This handles mapping of buffers represented as they are represented by
the OS (dma_buf's for example on Linux).
This patch is by no means complete. There's still Linux specific functions
scattered in ostensibly OS independent code. This is the first step. A
patch that rewrites everything in one go would simply be too big to
effectively review.
Instead the goal of this change is to simply separate out the basic
OS specific and OS agnostic interfaces into their own header files. The
next series of patches will start to pull the relevant implementations
into OS specific C files and common C files.
JIRA NVGPU-12
JIRA NVGPU-30
Change-Id: I242c7206047b6c769296226d855b7e44d5c4bfa8
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1464939
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/ioctl_as.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_as.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_as.c b/drivers/gpu/nvgpu/common/linux/ioctl_as.c index 4bbcedda..7a24a14f 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_as.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_as.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "gk20a/gk20a.h" | 28 | #include "gk20a/gk20a.h" |
29 | #include "gk20a/platform_gk20a.h" | 29 | #include "gk20a/platform_gk20a.h" |
30 | #include "ioctl_as.h" | 30 | #include "ioctl_as.h" |
31 | #include "vm_priv.h" | ||
31 | 32 | ||
32 | static int gk20a_as_ioctl_bind_channel( | 33 | static int gk20a_as_ioctl_bind_channel( |
33 | struct gk20a_as_share *as_share, | 34 | struct gk20a_as_share *as_share, |
@@ -72,7 +73,7 @@ static int gk20a_as_ioctl_map_buffer_ex( | |||
72 | { | 73 | { |
73 | gk20a_dbg_fn(""); | 74 | gk20a_dbg_fn(""); |
74 | 75 | ||
75 | return gk20a_vm_map_buffer(as_share->vm, args->dmabuf_fd, | 76 | return nvgpu_vm_map_buffer(as_share->vm, args->dmabuf_fd, |
76 | &args->offset, args->flags, | 77 | &args->offset, args->flags, |
77 | args->kind, | 78 | args->kind, |
78 | args->buffer_offset, | 79 | args->buffer_offset, |
@@ -85,7 +86,7 @@ static int gk20a_as_ioctl_map_buffer( | |||
85 | struct nvgpu_as_map_buffer_args *args) | 86 | struct nvgpu_as_map_buffer_args *args) |
86 | { | 87 | { |
87 | gk20a_dbg_fn(""); | 88 | gk20a_dbg_fn(""); |
88 | return gk20a_vm_map_buffer(as_share->vm, args->dmabuf_fd, | 89 | return nvgpu_vm_map_buffer(as_share->vm, args->dmabuf_fd, |
89 | &args->o_a.offset, | 90 | &args->o_a.offset, |
90 | args->flags, NV_KIND_DEFAULT, | 91 | args->flags, NV_KIND_DEFAULT, |
91 | 0, 0, NULL); | 92 | 0, 0, NULL); |
@@ -97,7 +98,7 @@ static int gk20a_as_ioctl_unmap_buffer( | |||
97 | struct nvgpu_as_unmap_buffer_args *args) | 98 | struct nvgpu_as_unmap_buffer_args *args) |
98 | { | 99 | { |
99 | gk20a_dbg_fn(""); | 100 | gk20a_dbg_fn(""); |
100 | return gk20a_vm_unmap_buffer(as_share->vm, args->offset, NULL); | 101 | return nvgpu_vm_unmap_buffer(as_share->vm, args->offset, NULL); |
101 | } | 102 | } |
102 | 103 | ||
103 | static int gk20a_as_ioctl_map_buffer_batch( | 104 | static int gk20a_as_ioctl_map_buffer_batch( |
@@ -123,7 +124,7 @@ static int gk20a_as_ioctl_map_buffer_batch( | |||
123 | args->num_maps > g->gpu_characteristics.map_buffer_batch_limit) | 124 | args->num_maps > g->gpu_characteristics.map_buffer_batch_limit) |
124 | return -EINVAL; | 125 | return -EINVAL; |
125 | 126 | ||
126 | gk20a_vm_mapping_batch_start(&batch); | 127 | nvgpu_vm_mapping_batch_start(&batch); |
127 | 128 | ||
128 | for (i = 0; i < args->num_unmaps; ++i) { | 129 | for (i = 0; i < args->num_unmaps; ++i) { |
129 | struct nvgpu_as_unmap_buffer_args unmap_args; | 130 | struct nvgpu_as_unmap_buffer_args unmap_args; |
@@ -134,14 +135,14 @@ static int gk20a_as_ioctl_map_buffer_batch( | |||
134 | break; | 135 | break; |
135 | } | 136 | } |
136 | 137 | ||
137 | err = gk20a_vm_unmap_buffer(as_share->vm, unmap_args.offset, | 138 | err = nvgpu_vm_unmap_buffer(as_share->vm, unmap_args.offset, |
138 | &batch); | 139 | &batch); |
139 | if (err) | 140 | if (err) |
140 | break; | 141 | break; |
141 | } | 142 | } |
142 | 143 | ||
143 | if (err) { | 144 | if (err) { |
144 | gk20a_vm_mapping_batch_finish(as_share->vm, &batch); | 145 | nvgpu_vm_mapping_batch_finish(as_share->vm, &batch); |
145 | 146 | ||
146 | args->num_unmaps = i; | 147 | args->num_unmaps = i; |
147 | args->num_maps = 0; | 148 | args->num_maps = 0; |
@@ -158,7 +159,7 @@ static int gk20a_as_ioctl_map_buffer_batch( | |||
158 | break; | 159 | break; |
159 | } | 160 | } |
160 | 161 | ||
161 | err = gk20a_vm_map_buffer( | 162 | err = nvgpu_vm_map_buffer( |
162 | as_share->vm, map_args.dmabuf_fd, | 163 | as_share->vm, map_args.dmabuf_fd, |
163 | &map_args.offset, map_args.flags, | 164 | &map_args.offset, map_args.flags, |
164 | map_args.kind, | 165 | map_args.kind, |
@@ -169,7 +170,7 @@ static int gk20a_as_ioctl_map_buffer_batch( | |||
169 | break; | 170 | break; |
170 | } | 171 | } |
171 | 172 | ||
172 | gk20a_vm_mapping_batch_finish(as_share->vm, &batch); | 173 | nvgpu_vm_mapping_batch_finish(as_share->vm, &batch); |
173 | 174 | ||
174 | if (err) | 175 | if (err) |
175 | args->num_maps = i; | 176 | args->num_maps = i; |
@@ -228,7 +229,7 @@ static int gk20a_as_ioctl_get_buffer_compbits_info( | |||
228 | struct nvgpu_as_get_buffer_compbits_info_args *args) | 229 | struct nvgpu_as_get_buffer_compbits_info_args *args) |
229 | { | 230 | { |
230 | gk20a_dbg_fn(""); | 231 | gk20a_dbg_fn(""); |
231 | return gk20a_vm_get_compbits_info(as_share->vm, | 232 | return nvgpu_vm_get_compbits_info(as_share->vm, |
232 | args->mapping_gva, | 233 | args->mapping_gva, |
233 | &args->compbits_win_size, | 234 | &args->compbits_win_size, |
234 | &args->compbits_win_ctagline, | 235 | &args->compbits_win_ctagline, |
@@ -241,7 +242,7 @@ static int gk20a_as_ioctl_map_buffer_compbits( | |||
241 | struct nvgpu_as_map_buffer_compbits_args *args) | 242 | struct nvgpu_as_map_buffer_compbits_args *args) |
242 | { | 243 | { |
243 | gk20a_dbg_fn(""); | 244 | gk20a_dbg_fn(""); |
244 | return gk20a_vm_map_compbits(as_share->vm, | 245 | return nvgpu_vm_map_compbits(as_share->vm, |
245 | args->mapping_gva, | 246 | args->mapping_gva, |
246 | &args->compbits_win_gva, | 247 | &args->compbits_win_gva, |
247 | &args->mapping_iova, | 248 | &args->mapping_iova, |