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>
This commit is contained in:
Deepak Nibade
2017-11-10 05:02:37 -08:00
committed by mobile promotions
parent fd2cac59f3
commit 90aeab9dee
9 changed files with 223 additions and 86 deletions

View File

@@ -468,16 +468,6 @@ int gk20a_init_gpu_characteristics(struct gk20a *g)
if (g->ops.clk.get_maxrate)
gpu->max_freq = g->ops.clk.get_maxrate(&g->clk);
g->ops.gr.get_preemption_mode_flags(g, &g->gr.preemption_mode_rec);
gpu->graphics_preemption_mode_flags =
g->gr.preemption_mode_rec.graphics_preemption_mode_flags;
gpu->compute_preemption_mode_flags =
g->gr.preemption_mode_rec.compute_preemption_mode_flags;
gpu->default_graphics_preempt_mode =
g->gr.preemption_mode_rec.default_graphics_preempt_mode;
gpu->default_compute_preempt_mode =
g->gr.preemption_mode_rec.default_compute_preempt_mode;
gpu->local_video_memory_size = g->mm.vidmem.size;
gpu->pci_vendor_id = g->pci_vendor_id;