summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-04-25 16:51:27 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-05-16 13:24:57 -0400
commit80a6291c9c5e373a3a534ba100b616b6789fb568 (patch)
tree20a5c5c3c1ea0933fa9db6af61a89c2ebd027ae0 /drivers/gpu
parent7bc97ca7d5e0cee265014ce5fd682858c3b63629 (diff)
gpu: nvgpu: Use nvgpu_cond in semaphore wq
Change semaphore wait queue to use nvgpu_cond instead of Linux wait queue. JIRA NVGPU-14 Change-Id: I3be5097ded168300b4480e986218d9f4fd6104b1 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1469852 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_channel.c4
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c7
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/gk20a/fence_gk20a.c6
-rw-r--r--drivers/gpu/nvgpu/gk20a/fence_gk20a.h6
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c2
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.c2
-rw-r--r--drivers/gpu/nvgpu/vgpu/fifo_vgpu.c2
-rw-r--r--drivers/gpu/nvgpu/vgpu/gr_vgpu.c2
9 files changed, 16 insertions, 17 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
index 79cea30c..8a87e4cb 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
@@ -413,8 +413,8 @@ static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch,
413 413
414 semaphore = data + (offset & ~PAGE_MASK); 414 semaphore = data + (offset & ~PAGE_MASK);
415 415
416 remain = wait_event_interruptible_timeout( 416 remain = NVGPU_COND_WAIT_INTERRUPTIBLE(
417 ch->semaphore_wq, 417 &ch->semaphore_wq,
418 *semaphore == payload || ch->has_timedout, 418 *semaphore == payload || ch->has_timedout,
419 timeout); 419 timeout);
420 420
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index 65dc1c72..536ca9f3 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -252,7 +252,7 @@ void gk20a_channel_abort_clean_up(struct channel_gk20a *ch)
252 nvgpu_mutex_release(&ch->joblist.cleanup_lock); 252 nvgpu_mutex_release(&ch->joblist.cleanup_lock);
253 253
254 if (released_job_semaphore) 254 if (released_job_semaphore)
255 wake_up_interruptible_all(&ch->semaphore_wq); 255 nvgpu_cond_broadcast_interruptible(&ch->semaphore_wq);
256 256
257 /* 257 /*
258 * When closing the channel, this scheduled update holds one ref which 258 * When closing the channel, this scheduled update holds one ref which
@@ -850,7 +850,7 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g,
850 * an address space bound and allocate a gpfifo and grctx. */ 850 * an address space bound and allocate a gpfifo and grctx. */
851 851
852 init_waitqueue_head(&ch->notifier_wq); 852 init_waitqueue_head(&ch->notifier_wq);
853 init_waitqueue_head(&ch->semaphore_wq); 853 nvgpu_cond_init(&ch->semaphore_wq);
854 854
855 ch->update_fn = NULL; 855 ch->update_fn = NULL;
856 ch->update_fn_data = NULL; 856 ch->update_fn_data = NULL;
@@ -2783,7 +2783,8 @@ void gk20a_channel_semaphore_wakeup(struct gk20a *g, bool post_events)
2783 struct channel_gk20a *c = g->fifo.channel+chid; 2783 struct channel_gk20a *c = g->fifo.channel+chid;
2784 if (gk20a_channel_get(c)) { 2784 if (gk20a_channel_get(c)) {
2785 if (atomic_read(&c->bound)) { 2785 if (atomic_read(&c->bound)) {
2786 wake_up_interruptible_all(&c->semaphore_wq); 2786 nvgpu_cond_broadcast_interruptible(
2787 &c->semaphore_wq);
2787 if (post_events) { 2788 if (post_events) {
2788 if (gk20a_is_channel_marked_as_tsg(c)) { 2789 if (gk20a_is_channel_marked_as_tsg(c)) {
2789 struct tsg_gk20a *tsg = 2790 struct tsg_gk20a *tsg =
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
index ea77985e..1cbf7689 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
@@ -218,7 +218,7 @@ struct channel_gk20a {
218 struct priv_cmd_queue priv_cmd_q; 218 struct priv_cmd_queue priv_cmd_q;
219 219
220 wait_queue_head_t notifier_wq; 220 wait_queue_head_t notifier_wq;
221 wait_queue_head_t semaphore_wq; 221 struct nvgpu_cond semaphore_wq;
222 222
223 u32 timeout_accumulated_ms; 223 u32 timeout_accumulated_ms;
224 u32 timeout_gpfifo_get; 224 u32 timeout_gpfifo_get;
diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
index 87c4f6be..3964c37d 100644
--- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
@@ -208,8 +208,8 @@ static int nvgpu_semaphore_fence_wait(struct gk20a_fence *f, long timeout)
208 if (!nvgpu_semaphore_is_acquired(f->semaphore)) 208 if (!nvgpu_semaphore_is_acquired(f->semaphore))
209 return 0; 209 return 0;
210 210
211 remain = wait_event_interruptible_timeout( 211 remain = NVGPU_COND_WAIT_INTERRUPTIBLE(
212 *f->semaphore_wq, 212 f->semaphore_wq,
213 !nvgpu_semaphore_is_acquired(f->semaphore), 213 !nvgpu_semaphore_is_acquired(f->semaphore),
214 timeout); 214 timeout);
215 if (remain == 0 && nvgpu_semaphore_is_acquired(f->semaphore)) 215 if (remain == 0 && nvgpu_semaphore_is_acquired(f->semaphore))
@@ -235,7 +235,7 @@ int gk20a_fence_from_semaphore(
235 struct gk20a_fence *fence_out, 235 struct gk20a_fence *fence_out,
236 struct sync_timeline *timeline, 236 struct sync_timeline *timeline,
237 struct nvgpu_semaphore *semaphore, 237 struct nvgpu_semaphore *semaphore,
238 wait_queue_head_t *semaphore_wq, 238 struct nvgpu_cond *semaphore_wq,
239 bool wfi, bool need_sync_fence) 239 bool wfi, bool need_sync_fence)
240{ 240{
241 struct gk20a_fence *f = fence_out; 241 struct gk20a_fence *f = fence_out;
diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.h b/drivers/gpu/nvgpu/gk20a/fence_gk20a.h
index 87fa9fdb..c479f359 100644
--- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.h
@@ -17,8 +17,6 @@
17#ifndef _GK20A_FENCE_H_ 17#ifndef _GK20A_FENCE_H_
18#define _GK20A_FENCE_H_ 18#define _GK20A_FENCE_H_
19 19
20#include <linux/wait.h>
21
22#include <nvgpu/kref.h> 20#include <nvgpu/kref.h>
23 21
24struct platform_device; 22struct platform_device;
@@ -42,7 +40,7 @@ struct gk20a_fence {
42 40
43 /* Valid for fences created from semaphores: */ 41 /* Valid for fences created from semaphores: */
44 struct nvgpu_semaphore *semaphore; 42 struct nvgpu_semaphore *semaphore;
45 wait_queue_head_t *semaphore_wq; 43 struct nvgpu_cond *semaphore_wq;
46 44
47 /* Valid for fences created from syncpoints: */ 45 /* Valid for fences created from syncpoints: */
48 struct platform_device *host1x_pdev; 46 struct platform_device *host1x_pdev;
@@ -59,7 +57,7 @@ int gk20a_fence_from_semaphore(
59 struct gk20a_fence *fence_out, 57 struct gk20a_fence *fence_out,
60 struct sync_timeline *timeline, 58 struct sync_timeline *timeline,
61 struct nvgpu_semaphore *semaphore, 59 struct nvgpu_semaphore *semaphore,
62 wait_queue_head_t *semaphore_wq, 60 struct nvgpu_cond *semaphore_wq,
63 bool wfi, bool need_sync_fence); 61 bool wfi, bool need_sync_fence);
64 62
65int gk20a_fence_from_syncpt( 63int gk20a_fence_from_syncpt(
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index edd98896..f212e55b 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -1338,7 +1338,7 @@ static void gk20a_fifo_set_has_timedout_and_wake_up_wqs(struct gk20a *g,
1338 refch->has_timedout = true; 1338 refch->has_timedout = true;
1339 wmb(); 1339 wmb();
1340 /* unblock pending waits */ 1340 /* unblock pending waits */
1341 wake_up(&refch->semaphore_wq); 1341 nvgpu_cond_broadcast_interruptible(&refch->semaphore_wq);
1342 wake_up(&refch->notifier_wq); 1342 wake_up(&refch->notifier_wq);
1343 } 1343 }
1344} 1344}
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
index e645a1a4..04d494fc 100644
--- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
@@ -5703,7 +5703,7 @@ static int gk20a_gr_handle_semaphore_pending(struct gk20a *g,
5703 NVGPU_IOCTL_CHANNEL_EVENT_ID_GR_SEMAPHORE_WRITE_AWAKEN); 5703 NVGPU_IOCTL_CHANNEL_EVENT_ID_GR_SEMAPHORE_WRITE_AWAKEN);
5704 } 5704 }
5705 5705
5706 wake_up_interruptible_all(&ch->semaphore_wq); 5706 nvgpu_cond_broadcast(&ch->semaphore_wq);
5707 5707
5708 return 0; 5708 return 0;
5709} 5709}
diff --git a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
index 9122e48b..5ea6a016 100644
--- a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
@@ -710,7 +710,7 @@ static void vgpu_fifo_set_ctx_mmu_error(struct gk20a *g,
710 ch->has_timedout = true; 710 ch->has_timedout = true;
711 wmb(); 711 wmb();
712 /* unblock pending waits */ 712 /* unblock pending waits */
713 wake_up(&ch->semaphore_wq); 713 nvgpu_cond_broadcast_interruptible(&ch->semaphore_wq);
714 wake_up(&ch->notifier_wq); 714 wake_up(&ch->notifier_wq);
715} 715}
716 716
diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
index 2a674feb..c7960c1f 100644
--- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
@@ -928,7 +928,7 @@ int vgpu_gr_isr(struct gk20a *g, struct tegra_vgpu_gr_intr_info *info)
928 wake_up(&ch->notifier_wq); 928 wake_up(&ch->notifier_wq);
929 break; 929 break;
930 case TEGRA_VGPU_GR_INTR_SEMAPHORE: 930 case TEGRA_VGPU_GR_INTR_SEMAPHORE:
931 wake_up_interruptible_all(&ch->semaphore_wq); 931 nvgpu_cond_broadcast_interruptible(&ch->semaphore_wq);
932 break; 932 break;
933 case TEGRA_VGPU_GR_INTR_SEMAPHORE_TIMEOUT: 933 case TEGRA_VGPU_GR_INTR_SEMAPHORE_TIMEOUT:
934 gk20a_set_error_notifier(ch, 934 gk20a_set_error_notifier(ch,