From 1710bdb0783a85ce183a77d182fb18d7f98af66e Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Fri, 16 Dec 2016 15:36:10 +0530 Subject: 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 Reviewed-on: http://git-master/r/1269472 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Aingara Paramakuru Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gp10b/gr_gp10b.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/gp10b/gr_gp10b.c') diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c index 051e16a3..aa2e3b65 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c @@ -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; -- cgit v1.2.2