summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-11-10 08:02:37 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-14 07:58:39 -0500
commit90aeab9dee07a63e4bac6d92646dfd80e65d2edd (patch)
treea175a1724590dc14c599db9c23f04d79a8f3ac79 /drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
parentfd2cac59f3491cb5b4f5d1f3fc97df94734bd682 (diff)
gpu: nvgpu: define preemption modes in common code
We use linux specific graphics/compute preemption modes defined in uapi header (and of below form) in all over common code NVGPU_GRAPHICS_PREEMPTION_MODE_* NVGPU_COMPUTE_PREEMPTION_MODE_* Since common code should be independent of linux specific code, define new modes of the form in common code and used them everywhere NVGPU_PREEMPTION_MODE_GRAPHICS_* NVGPU_PREEMPTION_MODE_COMPUTE_* Add required parser functions to convert both the modes into each other For linux IOCTL NVGPU_IOCTL_CHANNEL_SET_PREEMPTION_MODE, we need to convert linux specific modes into common modes first before passing them to common code And to pass gpu characteristics to user space we need to first convert common modes into linux specific modes and then pass them to user space Jira NVGPU-392 Change-Id: I8c62c6859bdc1baa5b44eb31c7020e42d2462c8c Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1596930 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_ctrl.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
index b77855f4..58178ac3 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
@@ -194,6 +194,28 @@ static u64 nvgpu_ctrl_ioctl_gpu_characteristics_flags(struct gk20a *g)
194 return ioctl_flags; 194 return ioctl_flags;
195} 195}
196 196
197static void nvgpu_set_preemption_mode_flags(struct gk20a *g,
198 struct nvgpu_gpu_characteristics *gpu)
199{
200 struct nvgpu_preemption_modes_rec preemption_mode_rec;
201
202 g->ops.gr.get_preemption_mode_flags(g, &preemption_mode_rec);
203
204 gpu->graphics_preemption_mode_flags =
205 nvgpu_get_ioctl_graphics_preempt_mode_flags(
206 preemption_mode_rec.graphics_preemption_mode_flags);
207 gpu->compute_preemption_mode_flags =
208 nvgpu_get_ioctl_compute_preempt_mode_flags(
209 preemption_mode_rec.compute_preemption_mode_flags);
210
211 gpu->default_graphics_preempt_mode =
212 nvgpu_get_ioctl_graphics_preempt_mode(
213 preemption_mode_rec.default_graphics_preempt_mode);
214 gpu->default_compute_preempt_mode =
215 nvgpu_get_ioctl_compute_preempt_mode(
216 preemption_mode_rec.default_compute_preempt_mode);
217}
218
197static long 219static long
198gk20a_ctrl_ioctl_gpu_characteristics( 220gk20a_ctrl_ioctl_gpu_characteristics(
199 struct gk20a *g, 221 struct gk20a *g,
@@ -235,6 +257,8 @@ gk20a_ctrl_ioctl_gpu_characteristics(
235 257
236 pgpu->max_css_buffer_size = g->gr.max_css_buffer_size; 258 pgpu->max_css_buffer_size = g->gr.max_css_buffer_size;
237 259
260 nvgpu_set_preemption_mode_flags(g, pgpu);
261
238 if (request->gpu_characteristics_buf_size > 0) { 262 if (request->gpu_characteristics_buf_size > 0) {
239 size_t write_size = sizeof(*pgpu); 263 size_t write_size = sizeof(*pgpu);
240 264