gpu: nvgpu: ignore set preempt mode to default

In native case, attempting to set graphics/compute preempt mode
to default is ignored if preemption mode has already been set
for the context. In virtualized case an error is currently
returned.
Align behaviour for native and virtualized case, by ignoring
such request.

Bug 200186530

Change-Id: Ieb3a37107bdbd3284804ee9fd392786409224082
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: http://git-master/r/1306506
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Aingara Paramakuru <aparamakuru@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Thomas Fleury
2017-02-16 15:39:02 -08:00
committed by mobile promotions
parent 45303a7de5
commit ac8cea9351

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -264,9 +264,17 @@ static int vgpu_gr_gp10b_set_preemption_mode(struct channel_gk20a *ch,
if (!class) if (!class)
return -EINVAL; return -EINVAL;
/* preemption already set ? */ /* skip setting anything if both modes are already set */
if (gr_ctx->graphics_preempt_mode || gr_ctx->compute_preempt_mode) if (graphics_preempt_mode &&
return -EINVAL; (graphics_preempt_mode == gr_ctx->graphics_preempt_mode))
graphics_preempt_mode = 0;
if (compute_preempt_mode &&
(compute_preempt_mode == gr_ctx->compute_preempt_mode))
compute_preempt_mode = 0;
if (graphics_preempt_mode == 0 && compute_preempt_mode == 0)
return 0;
if (gk20a_is_channel_marked_as_tsg(ch)) { if (gk20a_is_channel_marked_as_tsg(ch)) {
tsg = &g->fifo.tsg[ch->tsgid]; tsg = &g->fifo.tsg[ch->tsgid];