diff options
author | Sami Kiminki <skiminki@nvidia.com> | 2017-08-22 09:14:56 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-09-15 18:45:45 -0400 |
commit | 5d09c908b0679f060bc89ae70eef681a6783ebbc (patch) | |
tree | 244177eb4425e765b9a043e66533ca624f0d3cbd /drivers/gpu/nvgpu/common/linux/ioctl_as.c | |
parent | 2b7e8a2c2a5df041c9a434804d0f3f6d9df82737 (diff) |
gpu: nvgpu: Direct GMMU PTE kind control
Allow userspace to control directly the PTE kind for the mappings by
supplying NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL for MAP_BUFFER_EX.
In particular, in this mode, the userspace will tell the kernel
whether the kind is compressible, and if so, what is the
incompressible fallback kind. By supplying only the compressible kind,
the userspace can require that the map kind will not be demoted to the
incompressible fallback kind in case of comptag allocation failure.
Add also a GPU characteristics flag
NVGPU_GPU_FLAGS_SUPPORT_MAP_DIRECT_KIND_CTRL to signal whether direct
kind control is supported.
Fix indentation of nvgpu_as_map_buffer_ex_args header comment.
Bug 1705731
Change-Id: I317ab474ae53b78eb8fdd31bd6bca0541fcba9a4
Signed-off-by: Sami Kiminki <skiminki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1543462
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/ioctl_as.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_as.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_as.c b/drivers/gpu/nvgpu/common/linux/ioctl_as.c index d4242955..cfc4e7ef 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_as.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_as.c | |||
@@ -79,11 +79,22 @@ static int gk20a_as_ioctl_map_buffer_ex( | |||
79 | struct gk20a_as_share *as_share, | 79 | struct gk20a_as_share *as_share, |
80 | struct nvgpu_as_map_buffer_ex_args *args) | 80 | struct nvgpu_as_map_buffer_ex_args *args) |
81 | { | 81 | { |
82 | s16 compressible_kind; | ||
83 | s16 incompressible_kind; | ||
84 | |||
82 | gk20a_dbg_fn(""); | 85 | gk20a_dbg_fn(""); |
83 | 86 | ||
87 | if (args->flags & NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL) { | ||
88 | compressible_kind = args->compr_kind; | ||
89 | incompressible_kind = args->incompr_kind; | ||
90 | } else { | ||
91 | compressible_kind = args->kind; | ||
92 | incompressible_kind = NV_KIND_INVALID; | ||
93 | } | ||
94 | |||
84 | return nvgpu_vm_map_buffer(as_share->vm, args->dmabuf_fd, | 95 | return nvgpu_vm_map_buffer(as_share->vm, args->dmabuf_fd, |
85 | &args->offset, args->flags, | 96 | &args->offset, args->flags, |
86 | args->kind, | 97 | compressible_kind, incompressible_kind, |
87 | args->buffer_offset, | 98 | args->buffer_offset, |
88 | args->mapping_size, | 99 | args->mapping_size, |
89 | NULL); | 100 | NULL); |
@@ -97,6 +108,7 @@ static int gk20a_as_ioctl_map_buffer( | |||
97 | return nvgpu_vm_map_buffer(as_share->vm, args->dmabuf_fd, | 108 | return nvgpu_vm_map_buffer(as_share->vm, args->dmabuf_fd, |
98 | &args->o_a.offset, | 109 | &args->o_a.offset, |
99 | args->flags, NV_KIND_DEFAULT, | 110 | args->flags, NV_KIND_DEFAULT, |
111 | NV_KIND_DEFAULT, | ||
100 | 0, 0, NULL); | 112 | 0, 0, NULL); |
101 | /* args->o_a.offset will be set if !err */ | 113 | /* args->o_a.offset will be set if !err */ |
102 | } | 114 | } |
@@ -158,6 +170,9 @@ static int gk20a_as_ioctl_map_buffer_batch( | |||
158 | } | 170 | } |
159 | 171 | ||
160 | for (i = 0; i < args->num_maps; ++i) { | 172 | for (i = 0; i < args->num_maps; ++i) { |
173 | s16 compressible_kind; | ||
174 | s16 incompressible_kind; | ||
175 | |||
161 | struct nvgpu_as_map_buffer_ex_args map_args; | 176 | struct nvgpu_as_map_buffer_ex_args map_args; |
162 | memset(&map_args, 0, sizeof(map_args)); | 177 | memset(&map_args, 0, sizeof(map_args)); |
163 | 178 | ||
@@ -167,10 +182,19 @@ static int gk20a_as_ioctl_map_buffer_batch( | |||
167 | break; | 182 | break; |
168 | } | 183 | } |
169 | 184 | ||
185 | if (map_args.flags & | ||
186 | NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL) { | ||
187 | compressible_kind = map_args.compr_kind; | ||
188 | incompressible_kind = map_args.incompr_kind; | ||
189 | } else { | ||
190 | compressible_kind = map_args.kind; | ||
191 | incompressible_kind = NV_KIND_INVALID; | ||
192 | } | ||
193 | |||
170 | err = nvgpu_vm_map_buffer( | 194 | err = nvgpu_vm_map_buffer( |
171 | as_share->vm, map_args.dmabuf_fd, | 195 | as_share->vm, map_args.dmabuf_fd, |
172 | &map_args.offset, map_args.flags, | 196 | &map_args.offset, map_args.flags, |
173 | map_args.kind, | 197 | compressible_kind, incompressible_kind, |
174 | map_args.buffer_offset, | 198 | map_args.buffer_offset, |
175 | map_args.mapping_size, | 199 | map_args.mapping_size, |
176 | &batch); | 200 | &batch); |