diff options
author | Debarshi Dutta <ddutta@nvidia.com> | 2017-10-10 01:15:54 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-10-16 16:35:04 -0400 |
commit | 61b263d83222cd5d2ff3d2d5d699b07ebdf44288 (patch) | |
tree | 07ef35fb427dc2f93741ed9193673b6da2872bb7 /drivers/gpu/nvgpu/common/linux | |
parent | 30b9cbe35a2a0adc4e3a65b033dc0f61046783ea (diff) |
gpu: nvgpu: replace wait_queue_head_t with nvgpu_cond
Replace existing usages of wait_queue_head_t with struct nvgpu_cond and
using the corresponding APIs in order to reduce Linux dependencies in NVGPU.
JIRA NVGPU-205
Change-Id: I85850369c3c47d3e1704e4171b1d172361842423
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1575778
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/driver_common.c | 12 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/intr.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_channel.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_tsg.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/os_linux.h | 4 |
5 files changed, 15 insertions, 15 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c index 295297b6..e4a65692 100644 --- a/drivers/gpu/nvgpu/common/linux/driver_common.c +++ b/drivers/gpu/nvgpu/common/linux/driver_common.c | |||
@@ -39,8 +39,8 @@ static void nvgpu_init_vars(struct gk20a *g) | |||
39 | struct device *dev = dev_from_gk20a(g); | 39 | struct device *dev = dev_from_gk20a(g); |
40 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 40 | struct gk20a_platform *platform = dev_get_drvdata(dev); |
41 | 41 | ||
42 | init_waitqueue_head(&l->sw_irq_stall_last_handled_wq); | 42 | nvgpu_cond_init(&l->sw_irq_stall_last_handled_wq); |
43 | init_waitqueue_head(&l->sw_irq_nonstall_last_handled_wq); | 43 | nvgpu_cond_init(&l->sw_irq_nonstall_last_handled_wq); |
44 | gk20a_init_gr(g); | 44 | gk20a_init_gr(g); |
45 | 45 | ||
46 | init_rwsem(&l->busy_lock); | 46 | init_rwsem(&l->busy_lock); |
@@ -261,14 +261,14 @@ void nvgpu_wait_for_deferred_interrupts(struct gk20a *g) | |||
261 | int nonstall_irq_threshold = atomic_read(&l->hw_irq_nonstall_count); | 261 | int nonstall_irq_threshold = atomic_read(&l->hw_irq_nonstall_count); |
262 | 262 | ||
263 | /* wait until all stalling irqs are handled */ | 263 | /* wait until all stalling irqs are handled */ |
264 | wait_event(l->sw_irq_stall_last_handled_wq, | 264 | NVGPU_COND_WAIT(&l->sw_irq_stall_last_handled_wq, |
265 | cyclic_delta(stall_irq_threshold, | 265 | cyclic_delta(stall_irq_threshold, |
266 | atomic_read(&l->sw_irq_stall_last_handled)) | 266 | atomic_read(&l->sw_irq_stall_last_handled)) |
267 | <= 0); | 267 | <= 0, 0); |
268 | 268 | ||
269 | /* wait until all non-stalling irqs are handled */ | 269 | /* wait until all non-stalling irqs are handled */ |
270 | wait_event(l->sw_irq_nonstall_last_handled_wq, | 270 | NVGPU_COND_WAIT(&l->sw_irq_nonstall_last_handled_wq, |
271 | cyclic_delta(nonstall_irq_threshold, | 271 | cyclic_delta(nonstall_irq_threshold, |
272 | atomic_read(&l->sw_irq_nonstall_last_handled)) | 272 | atomic_read(&l->sw_irq_nonstall_last_handled)) |
273 | <= 0); | 273 | <= 0, 0); |
274 | } | 274 | } |
diff --git a/drivers/gpu/nvgpu/common/linux/intr.c b/drivers/gpu/nvgpu/common/linux/intr.c index da177b55..d1b6ef36 100644 --- a/drivers/gpu/nvgpu/common/linux/intr.c +++ b/drivers/gpu/nvgpu/common/linux/intr.c | |||
@@ -59,7 +59,7 @@ irqreturn_t nvgpu_intr_thread_stall(struct gk20a *g) | |||
59 | /* sync handled irq counter before re-enabling interrupts */ | 59 | /* sync handled irq counter before re-enabling interrupts */ |
60 | atomic_set(&l->sw_irq_stall_last_handled, hw_irq_count); | 60 | atomic_set(&l->sw_irq_stall_last_handled, hw_irq_count); |
61 | 61 | ||
62 | wake_up_all(&l->sw_irq_stall_last_handled_wq); | 62 | nvgpu_cond_broadcast(&l->sw_irq_stall_last_handled_wq); |
63 | 63 | ||
64 | trace_mc_gk20a_intr_thread_stall_done(g->name); | 64 | trace_mc_gk20a_intr_thread_stall_done(g->name); |
65 | 65 | ||
@@ -128,7 +128,7 @@ irqreturn_t nvgpu_intr_nonstall(struct gk20a *g) | |||
128 | 128 | ||
129 | g->ops.mc.intr_nonstall_resume(g); | 129 | g->ops.mc.intr_nonstall_resume(g); |
130 | 130 | ||
131 | wake_up_all(&l->sw_irq_nonstall_last_handled_wq); | 131 | nvgpu_cond_broadcast(&l->sw_irq_nonstall_last_handled_wq); |
132 | 132 | ||
133 | return IRQ_HANDLED; | 133 | return IRQ_HANDLED; |
134 | } | 134 | } |
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c index 6c66eca0..3ea07eed 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c | |||
@@ -575,7 +575,7 @@ static unsigned int gk20a_event_id_poll(struct file *filep, poll_table *wait) | |||
575 | 575 | ||
576 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_info, ""); | 576 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_info, ""); |
577 | 577 | ||
578 | poll_wait(filep, &event_id_data->event_id_wq, wait); | 578 | poll_wait(filep, &event_id_data->event_id_wq.wq, wait); |
579 | 579 | ||
580 | nvgpu_mutex_acquire(&event_id_data->lock); | 580 | nvgpu_mutex_acquire(&event_id_data->lock); |
581 | 581 | ||
@@ -683,7 +683,7 @@ void gk20a_channel_event_id_post_event(struct channel_gk20a *ch, | |||
683 | event_id, ch->chid); | 683 | event_id, ch->chid); |
684 | event_id_data->event_posted = true; | 684 | event_id_data->event_posted = true; |
685 | 685 | ||
686 | wake_up_interruptible_all(&event_id_data->event_id_wq); | 686 | nvgpu_cond_broadcast_interruptible(&event_id_data->event_id_wq); |
687 | 687 | ||
688 | nvgpu_mutex_release(&event_id_data->lock); | 688 | nvgpu_mutex_release(&event_id_data->lock); |
689 | } | 689 | } |
@@ -735,7 +735,7 @@ static int gk20a_channel_event_id_enable(struct channel_gk20a *ch, | |||
735 | event_id_data->is_tsg = false; | 735 | event_id_data->is_tsg = false; |
736 | event_id_data->event_id = event_id; | 736 | event_id_data->event_id = event_id; |
737 | 737 | ||
738 | init_waitqueue_head(&event_id_data->event_id_wq); | 738 | nvgpu_cond_init(&event_id_data->event_id_wq); |
739 | err = nvgpu_mutex_init(&event_id_data->lock); | 739 | err = nvgpu_mutex_init(&event_id_data->lock); |
740 | if (err) | 740 | if (err) |
741 | goto clean_up_free; | 741 | goto clean_up_free; |
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c index 10379633..6d0439f3 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c | |||
@@ -97,7 +97,7 @@ void gk20a_tsg_event_id_post_event(struct tsg_gk20a *tsg, | |||
97 | event_id, tsg->tsgid); | 97 | event_id, tsg->tsgid); |
98 | event_id_data->event_posted = true; | 98 | event_id_data->event_posted = true; |
99 | 99 | ||
100 | wake_up_interruptible_all(&event_id_data->event_id_wq); | 100 | nvgpu_cond_broadcast_interruptible(&event_id_data->event_id_wq); |
101 | 101 | ||
102 | nvgpu_mutex_release(&event_id_data->lock); | 102 | nvgpu_mutex_release(&event_id_data->lock); |
103 | } | 103 | } |
@@ -150,7 +150,7 @@ static int gk20a_tsg_event_id_enable(struct tsg_gk20a *tsg, | |||
150 | event_id_data->is_tsg = true; | 150 | event_id_data->is_tsg = true; |
151 | event_id_data->event_id = event_id; | 151 | event_id_data->event_id = event_id; |
152 | 152 | ||
153 | init_waitqueue_head(&event_id_data->event_id_wq); | 153 | nvgpu_cond_init(&event_id_data->event_id_wq); |
154 | err = nvgpu_mutex_init(&event_id_data->lock); | 154 | err = nvgpu_mutex_init(&event_id_data->lock); |
155 | if (err) | 155 | if (err) |
156 | goto clean_up_free; | 156 | goto clean_up_free; |
diff --git a/drivers/gpu/nvgpu/common/linux/os_linux.h b/drivers/gpu/nvgpu/common/linux/os_linux.h index 4a3128c3..c67cbbcc 100644 --- a/drivers/gpu/nvgpu/common/linux/os_linux.h +++ b/drivers/gpu/nvgpu/common/linux/os_linux.h | |||
@@ -77,12 +77,12 @@ struct nvgpu_os_linux { | |||
77 | atomic_t hw_irq_stall_count; | 77 | atomic_t hw_irq_stall_count; |
78 | atomic_t hw_irq_nonstall_count; | 78 | atomic_t hw_irq_nonstall_count; |
79 | 79 | ||
80 | wait_queue_head_t sw_irq_stall_last_handled_wq; | 80 | struct nvgpu_cond sw_irq_stall_last_handled_wq; |
81 | atomic_t sw_irq_stall_last_handled; | 81 | atomic_t sw_irq_stall_last_handled; |
82 | 82 | ||
83 | atomic_t nonstall_ops; | 83 | atomic_t nonstall_ops; |
84 | 84 | ||
85 | wait_queue_head_t sw_irq_nonstall_last_handled_wq; | 85 | struct nvgpu_cond sw_irq_nonstall_last_handled_wq; |
86 | atomic_t sw_irq_nonstall_last_handled; | 86 | atomic_t sw_irq_nonstall_last_handled; |
87 | 87 | ||
88 | struct work_struct nonstall_fn_work; | 88 | struct work_struct nonstall_fn_work; |