summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2017-06-20 02:43:55 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-06-20 12:23:33 -0400
commit50e2fdd306c253deae97a6bbf6be20f7502eba86 (patch)
tree7bf404b0f00d4bd4ff8c4f223316d0fcb1e3e27e /drivers/gpu/nvgpu/common
parent4d8895276003edf0183c94f3e2f5de378bf9d345 (diff)
gpu: nvgpu: fix double jiffies conversion
The gk20a_channel_wait() ioctl still considers a timeout value type to be jiffies, but NVGPU_COND_WAIT_INTERRUPTIBLE takes milliseconds. Pass the millisecond value from args directly to the cond wait. NVGPU_NO_TIMEOUT is the max unsigned value that fits in 32 bits, so it does not need to be tested explicitly. Jira NVGPU-83 Change-Id: If7979c015696b2d1e0bbe9612c546410a0f41f2e Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/1505422 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_channel.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
index a083cb81..08e483a3 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
@@ -401,7 +401,7 @@ int nvgpu_channel_ioctl_alloc_gpfifo(struct channel_gk20a *c,
401 401
402static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch, 402static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch,
403 ulong id, u32 offset, 403 ulong id, u32 offset,
404 u32 payload, long timeout) 404 u32 payload, u32 timeout)
405{ 405{
406 struct dma_buf *dmabuf; 406 struct dma_buf *dmabuf;
407 void *data; 407 void *data;
@@ -448,7 +448,6 @@ static int gk20a_channel_wait(struct channel_gk20a *ch,
448 u64 jiffies; 448 u64 jiffies;
449 ulong id; 449 ulong id;
450 u32 offset; 450 u32 offset;
451 unsigned long timeout;
452 int remain, ret = 0; 451 int remain, ret = 0;
453 u64 end; 452 u64 end;
454 453
@@ -457,11 +456,6 @@ static int gk20a_channel_wait(struct channel_gk20a *ch,
457 if (ch->has_timedout) 456 if (ch->has_timedout)
458 return -ETIMEDOUT; 457 return -ETIMEDOUT;
459 458
460 if (args->timeout == NVGPU_NO_TIMEOUT)
461 timeout = MAX_SCHEDULE_TIMEOUT;
462 else
463 timeout = (u32)msecs_to_jiffies(args->timeout);
464
465 switch (args->type) { 459 switch (args->type) {
466 case NVGPU_WAIT_TYPE_NOTIFIER: 460 case NVGPU_WAIT_TYPE_NOTIFIER:
467 id = args->condition.notifier.dmabuf_fd; 461 id = args->condition.notifier.dmabuf_fd;
@@ -494,7 +488,7 @@ static int gk20a_channel_wait(struct channel_gk20a *ch,
494 remain = NVGPU_COND_WAIT_INTERRUPTIBLE( 488 remain = NVGPU_COND_WAIT_INTERRUPTIBLE(
495 &ch->notifier_wq, 489 &ch->notifier_wq,
496 notif->status == 0 || ch->has_timedout, 490 notif->status == 0 || ch->has_timedout,
497 timeout); 491 args->timeout);
498 492
499 if (remain == 0 && notif->status != 0) { 493 if (remain == 0 && notif->status != 0) {
500 ret = -ETIMEDOUT; 494 ret = -ETIMEDOUT;
@@ -521,7 +515,7 @@ notif_clean_up:
521 args->condition.semaphore.dmabuf_fd, 515 args->condition.semaphore.dmabuf_fd,
522 args->condition.semaphore.offset, 516 args->condition.semaphore.offset,
523 args->condition.semaphore.payload, 517 args->condition.semaphore.payload,
524 timeout); 518 args->timeout);
525 519
526 break; 520 break;
527 521