summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-05-16 16:59:31 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-05-24 15:14:03 -0400
commitee25b33ca4aafbbab6e9b7cd963f9011a59037cd (patch)
tree80f10d0027de77ea23a5c6b71c46b7da61c61102 /drivers/gpu/nvgpu/common
parent9db45cf0376c6de8d71cc8087d0ec76dff72c00b (diff)
gpu: nvgpu: Proper timeout for NVGPU_COND_WAIT
The timeout parameter to NVGPU_COND_WAIT() was passed directly to wait_event_timeout(), which takes jiffies. Also allows zero timeout to disable timeout. The return value of NVGPU_COND_WAIT() was defined in a way specific to how Linux wait_event_() calls work. Replace that with proper error reporting and change the callers to check against error codes. JIRA NVGPU-14 Change-Id: Idbd2c8fbbef7589c3ca4f4c5732852bc71217515 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1484927 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_channel.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
index 4d4d1690..c7adb76c 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
@@ -392,7 +392,6 @@ static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch,
392 void *data; 392 void *data;
393 u32 *semaphore; 393 u32 *semaphore;
394 int ret = 0; 394 int ret = 0;
395 long remain;
396 395
397 /* do not wait if channel has timed out */ 396 /* do not wait if channel has timed out */
398 if (ch->has_timedout) 397 if (ch->has_timedout)
@@ -413,16 +412,11 @@ static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch,
413 412
414 semaphore = data + (offset & ~PAGE_MASK); 413 semaphore = data + (offset & ~PAGE_MASK);
415 414
416 remain = NVGPU_COND_WAIT_INTERRUPTIBLE( 415 ret = NVGPU_COND_WAIT_INTERRUPTIBLE(
417 &ch->semaphore_wq, 416 &ch->semaphore_wq,
418 *semaphore == payload || ch->has_timedout, 417 *semaphore == payload || ch->has_timedout,
419 timeout); 418 timeout);
420 419
421 if (remain == 0 && *semaphore != payload)
422 ret = -ETIMEDOUT;
423 else if (remain < 0)
424 ret = remain;
425
426 dma_buf_kunmap(dmabuf, offset >> PAGE_SHIFT, data); 420 dma_buf_kunmap(dmabuf, offset >> PAGE_SHIFT, data);
427cleanup_put: 421cleanup_put:
428 dma_buf_put(dmabuf); 422 dma_buf_put(dmabuf);