From 5855fe26cb401d6d139b930ab48bb1106301585f Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Fri, 14 Oct 2016 08:57:05 -0700 Subject: gpu: nvgpu: Do not post events to unbound channels Change-Id: Ia1157198aad248e12e94823eb9f273497c724b2c Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/1248366 Tested-by: Sachit Kadle Reviewed-by: David Martinez Nieto GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/vgpu/fifo_vgpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/vgpu/fifo_vgpu.c') diff --git a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c index 3d00e72c..efeeb8ee 100644 --- a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c @@ -36,7 +36,8 @@ static void vgpu_channel_bind(struct channel_gk20a *ch) err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); WARN_ON(err || msg.ret); - ch->bound = true; + wmb(); + atomic_set(&ch->bound, true); } static void vgpu_channel_unbind(struct channel_gk20a *ch) @@ -44,7 +45,7 @@ static void vgpu_channel_unbind(struct channel_gk20a *ch) gk20a_dbg_fn(""); - if (ch->bound) { + if (atomic_cmpxchg(&ch->bound, true, false)) { struct tegra_vgpu_cmd_msg msg; struct tegra_vgpu_channel_config_params *p = &msg.params.channel_config; @@ -57,7 +58,6 @@ static void vgpu_channel_unbind(struct channel_gk20a *ch) WARN_ON(err || msg.ret); } - ch->bound = false; } static int vgpu_channel_alloc_inst(struct gk20a *g, struct channel_gk20a *ch) -- cgit v1.2.2