gpu: nvgpu: allow upgrading preemption modes

We currently do not allow resetting preemption
modes once set

Relax this check to allow upgrading preemption
modes. Downgrading of preemption modes is still
not allowed

Bug 200263471

Change-Id: Ie2dae910028929090899a661f4b8b9dd4d6d7ee7
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1269472
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Aingara Paramakuru <aparamakuru@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Deepak Nibade
2016-12-16 15:36:10 +05:30
parent be6e02a6d4
commit 1710bdb078

View File

@@ -877,6 +877,15 @@ static int gr_gp10b_set_ctxsw_preemption_mode(struct gk20a *g,
(compute_preempt_mode == NVGPU_COMPUTE_PREEMPTION_MODE_CILP))
return -EINVAL;
/* Do not allow lower preemption modes than current ones */
if (graphics_preempt_mode &&
(graphics_preempt_mode < gr_ctx->graphics_preempt_mode))
return -EINVAL;
if (compute_preempt_mode &&
(compute_preempt_mode < gr_ctx->compute_preempt_mode))
return -EINVAL;
/* set preemption modes */
switch (graphics_preempt_mode) {
case NVGPU_GRAPHICS_PREEMPTION_MODE_GFXP:
@@ -2064,10 +2073,6 @@ static int gr_gp10b_set_preemption_mode(struct channel_gk20a *ch,
if (!class)
return -EINVAL;
/* preemption already set ? */
if (gr_ctx->graphics_preempt_mode || gr_ctx->compute_preempt_mode)
return -EINVAL;
if (gk20a_is_channel_marked_as_tsg(ch)) {
tsg = &g->fifo.tsg[ch->tsgid];
vm = tsg->vm;