summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp106/gr_gp106.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/gp106/gr_gp106.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/gp106/gr_gp106.c')
-rw-r--r--drivers/gpu/nvgpu/gp106/gr_gp106.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/gpu/nvgpu/gp106/gr_gp106.c b/drivers/gpu/nvgpu/gp106/gr_gp106.c
index 1fb527d1..fea337e7 100644
--- a/drivers/gpu/nvgpu/gp106/gr_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/gr_gp106.c
@@ -141,23 +141,23 @@ int gr_gp106_set_ctxsw_preemption_mode(struct gk20a *g,
141 int err = 0; 141 int err = 0;
142 142
143 if (class == PASCAL_B && g->gr.t18x.ctx_vars.force_preemption_gfxp) 143 if (class == PASCAL_B && g->gr.t18x.ctx_vars.force_preemption_gfxp)
144 graphics_preempt_mode = NVGPU_GRAPHICS_PREEMPTION_MODE_GFXP; 144 graphics_preempt_mode = NVGPU_PREEMPTION_MODE_GRAPHICS_GFXP;
145 145
146 if (class == PASCAL_COMPUTE_B && 146 if (class == PASCAL_COMPUTE_B &&
147 g->gr.t18x.ctx_vars.force_preemption_cilp) 147 g->gr.t18x.ctx_vars.force_preemption_cilp)
148 compute_preempt_mode = NVGPU_COMPUTE_PREEMPTION_MODE_CILP; 148 compute_preempt_mode = NVGPU_PREEMPTION_MODE_COMPUTE_CILP;
149 149
150 /* check for invalid combinations */ 150 /* check for invalid combinations */
151 if ((graphics_preempt_mode == 0) && (compute_preempt_mode == 0)) 151 if ((graphics_preempt_mode == 0) && (compute_preempt_mode == 0))
152 return -EINVAL; 152 return -EINVAL;
153 153
154 if ((graphics_preempt_mode == NVGPU_GRAPHICS_PREEMPTION_MODE_GFXP) && 154 if ((graphics_preempt_mode == NVGPU_PREEMPTION_MODE_GRAPHICS_GFXP) &&
155 (compute_preempt_mode == NVGPU_COMPUTE_PREEMPTION_MODE_CILP)) 155 (compute_preempt_mode == NVGPU_PREEMPTION_MODE_COMPUTE_CILP))
156 return -EINVAL; 156 return -EINVAL;
157 157
158 /* set preemption modes */ 158 /* set preemption modes */
159 switch (graphics_preempt_mode) { 159 switch (graphics_preempt_mode) {
160 case NVGPU_GRAPHICS_PREEMPTION_MODE_GFXP: 160 case NVGPU_PREEMPTION_MODE_GRAPHICS_GFXP:
161 { 161 {
162 u32 spill_size = 162 u32 spill_size =
163 gr_gpc0_swdx_rm_spill_buffer_size_256b_default_v() * 163 gr_gpc0_swdx_rm_spill_buffer_size_256b_default_v() *
@@ -213,7 +213,7 @@ int gr_gp106_set_ctxsw_preemption_mode(struct gk20a *g,
213 break; 213 break;
214 } 214 }
215 215
216 case NVGPU_GRAPHICS_PREEMPTION_MODE_WFI: 216 case NVGPU_PREEMPTION_MODE_GRAPHICS_WFI:
217 gr_ctx->graphics_preempt_mode = graphics_preempt_mode; 217 gr_ctx->graphics_preempt_mode = graphics_preempt_mode;
218 break; 218 break;
219 219
@@ -223,9 +223,9 @@ int gr_gp106_set_ctxsw_preemption_mode(struct gk20a *g,
223 223
224 if (class == PASCAL_COMPUTE_B) { 224 if (class == PASCAL_COMPUTE_B) {
225 switch (compute_preempt_mode) { 225 switch (compute_preempt_mode) {
226 case NVGPU_COMPUTE_PREEMPTION_MODE_WFI: 226 case NVGPU_PREEMPTION_MODE_COMPUTE_WFI:
227 case NVGPU_COMPUTE_PREEMPTION_MODE_CTA: 227 case NVGPU_PREEMPTION_MODE_COMPUTE_CTA:
228 case NVGPU_COMPUTE_PREEMPTION_MODE_CILP: 228 case NVGPU_PREEMPTION_MODE_COMPUTE_CILP:
229 gr_ctx->compute_preempt_mode = compute_preempt_mode; 229 gr_ctx->compute_preempt_mode = compute_preempt_mode;
230 break; 230 break;
231 default: 231 default: